From fd2a5066ec0a3f13fb52b6d0bb2fb84e52dc31a8 Mon Sep 17 00:00:00 2001 From: Denis Kasanic Date: Wed, 4 Dec 2019 13:40:07 +0100 Subject: Add robot config at onap install Change onap network cidr to /16 due to robot hardcoded config. Adding onap network id to configuration at installation part. Adding optional connection to demo usecases network at deploy step Update patch scripts for specify network and kubernetes namespace Enable config_drive parameter at openstack instances deploying to get openstack metadata Issue-ID: OOM-1996 Signed-off-by: Denis Kasanic Change-Id: I4403e8ca0f385060ac815372ffd91eda60026ddb --- tools/cicdansible/group_vars/all.yml | 4 +++- tools/cicdansible/heat/installer.yaml | 16 ++++++++++++++++ tools/cicdansible/heat/instance.yaml | 17 ++++++++++++++++- tools/cicdansible/heat/node.yaml | 4 ++++ tools/cicdansible/roles/install/tasks/install.yml | 11 +++++++++++ .../tasks/deploy/heat.yml | 1 + 6 files changed, 51 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/cicdansible/group_vars/all.yml b/tools/cicdansible/group_vars/all.yml index f886b628..3165e374 100644 --- a/tools/cicdansible/group_vars/all.yml +++ b/tools/cicdansible/group_vars/all.yml @@ -30,7 +30,7 @@ image_name: "" #True by default, most openstack providers offer ssd volumes probably. use_volume_for_nfs: true #Cidr of private subnet where instances are connected. -subnet_cidr: "10.1.0.0/24" +subnet_cidr: "10.1.0.0/16" #Start of dhcp allocation range for subnet. subnet_range_start: "10.1.0.4" #Subnet allocation range end. @@ -64,3 +64,5 @@ install_app: true # You can use it to override any variable in offline installer except those # supported directly by cicdansible. application_config: '' +# Id of the network for demo usecases +demo_network_id: "" diff --git a/tools/cicdansible/heat/installer.yaml b/tools/cicdansible/heat/installer.yaml index 7b3f10c0..1f65f73f 100644 --- a/tools/cicdansible/heat/installer.yaml +++ b/tools/cicdansible/heat/installer.yaml @@ -94,6 +94,11 @@ parameters: type: boolean label: "use volume for nfs storage" description: "Indicates whether a cinder volume should be used for nfs storage or not. If not checked, the nfs would be stored in the root disk" + demo_network: + label: "demo net id" + type: string + description: "specifies id of network used for demo usecases" + default: "" conditions: #Condition for nfs volume usage. use_volume_for_nfs: { get_param: use_volume_for_nfs } @@ -201,6 +206,7 @@ resources: flavor_name: { get_param: node_flavor_name } notify_command: { get_attr: ["instance_wait_handle", "curl_cli"] } security_group: { get_resource: secgroup } + demo_network: { get_param: demo_network } scheduler_hints: group: { get_resource: anti_affinity_group } depends_on: [routercon, instance_wait_handle] @@ -243,6 +249,7 @@ resources: notify_command: { get_attr: ["instance_wait_handle", "curl_cli"] } security_group: { get_resource: secgroup } scheduler_hints: {} + demo_network: { get_param: demo_network } depends_on: [instance_wait_handle] #Volume attachment for infra node. resources_storage_attachment: @@ -309,6 +316,15 @@ resources: - [] #Output values outputs: + network_name: + value: {get_attr: [privnet, name] } + description: "Name of private network" + network_id: + value: { get_resource: privnet } + description: "ID of private network" + subnet_id: + value: { get_resource: privsubnet } + description: "ID of private subnet" installer_ip: value: { get_attr: [installer, ip] } description: "Internal ip of installer instance" diff --git a/tools/cicdansible/heat/instance.yaml b/tools/cicdansible/heat/instance.yaml index 5429eb6e..7d9715f7 100644 --- a/tools/cicdansible/heat/instance.yaml +++ b/tools/cicdansible/heat/instance.yaml @@ -21,6 +21,16 @@ parameters: scheduler_hints: type: json default: {} + demo_network: + type: string + default: "" +conditions: + #Condition for demo network connection + connect_demo_net: + not: + equals: + - get_param: demo_network + - "" #Resources. resources: #This is the network port to attach instance to. @@ -48,8 +58,13 @@ resources: image: { get_param: image_name } flavor: { get_param: flavor_name } key_name: { get_param: key_name } + config_drive: true networks: - - port: { get_resource: port } + if: + - "connect_demo_net" + - - port: { get_resource: port } + - network: { get_param: demo_network } + - - port: { get_resource: port } user_data_format: SOFTWARE_CONFIG user_data: { get_resource: config } scheduler_hints: { get_param: scheduler_hints } diff --git a/tools/cicdansible/heat/node.yaml b/tools/cicdansible/heat/node.yaml index cd628eec..12097770 100644 --- a/tools/cicdansible/heat/node.yaml +++ b/tools/cicdansible/heat/node.yaml @@ -22,6 +22,9 @@ parameters: type: string scheduler_hints: type: json + demo_network: + type: string + default: "" resources: #Volume for storing /var/lib/docker for node. docker_storage: @@ -45,6 +48,7 @@ resources: notify_command: { get_param: notify_command } security_group: { get_param: security_group } scheduler_hints: { get_param: scheduler_hints } + demo_network: { get_param: demo_network } #Attachment of docker volume to node. docker_storage_attachment: type: OS::Cinder::VolumeAttachment diff --git a/tools/cicdansible/roles/install/tasks/install.yml b/tools/cicdansible/roles/install/tasks/install.yml index 141ea7ae..529e2acf 100644 --- a/tools/cicdansible/roles/install/tasks/install.yml +++ b/tools/cicdansible/roles/install/tasks/install.yml @@ -23,6 +23,17 @@ copy: content: "{{ application_config | b64decode }}" dest: "{{ installer_deploy_path }}/ansible/application/application_overrides.yml" + # add onap network configuration to overrides +- name: "inject onap network information to config overrides" + replace: + path: "{{ installer_deploy_path }}/ansible/application/application_overrides.yml" + regexp: '({{ item.key }}:)\s?.*' + replace: '\1 {{ item.value }}' + loop: "{{ lines|dict2items }}" + vars: + lines: + openStackPrivateNetId: "{{ (hostvars['localhost'].heat_stack.stack.outputs | selectattr('output_key', 'equalto', 'network_id') | list).0.output_value }}" + openStackPrivateSubnetId: "{{ (hostvars['localhost'].heat_stack.stack.outputs | selectattr('output_key', 'equalto', 'subnet_id') | list).0.output_value }}" # This generates a file with locations of resource files in resource host, we # do it only to allow manually running offline installer without # typing them by hand. We cannot use diff --git a/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/deploy/heat.yml b/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/deploy/heat.yml index 5f9bc4f6..25e7ac79 100644 --- a/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/deploy/heat.yml +++ b/tools/cicdansible/roles/setup_openstack_infrastructure/tasks/deploy/heat.yml @@ -33,5 +33,6 @@ infra_ip: "{{ floating_ips_by_address[infra_ip].id }}" installer_ip: "{{ floating_ips_by_address[installer_ip].id }}" use_volume_for_nfs: "{{ use_volume_for_nfs }}" + demo_network: "{{ demo_network_id }}" wait: true register: heat_stack -- cgit 1.2.3-korg