From 16779011030dbbd914da40beb4ae6f234a9bcb04 Mon Sep 17 00:00:00 2001 From: Sam Hague Date: Mon, 20 Nov 2017 18:09:37 -0500 Subject: [PATCH 1/1] Use consistent naming in external suite Change-Id: I9ff856d16eae5ec4e43425f27bc8a268ab96ecf5 Signed-off-by: Sam Hague --- .../connectivity/external_network.robot | 143 +++++++++--------- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/csit/suites/openstack/connectivity/external_network.robot b/csit/suites/openstack/connectivity/external_network.robot index 018aabba23..3485bfdafd 100644 --- a/csit/suites/openstack/connectivity/external_network.robot +++ b/csit/suites/openstack/connectivity/external_network.robot @@ -4,7 +4,7 @@ Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_T ... AND DevstackUtils.Devstack Suite Setup Suite Teardown Close All Connections Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing -Test Teardown Get Test Teardown Debugs +Test Teardown OpenStackOperations.Get Test Teardown Debugs Library SSHLibrary Library OperatingSystem Library RequestsLibrary @@ -15,20 +15,21 @@ Resource ../../../libraries/SetupUtils.robot Resource ../../../libraries/Utils.robot *** Variables *** -${SECURITY_GROUP} sg-connectivity -@{NETWORKS_NAME} l3_net -@{SUBNETS_NAME} l3_subnet -@{VM_INSTANCES_FLOATING} VmInstanceFloating1 VmInstanceFloating2 -@{VM_INSTANCES_SNAT} VmInstanceSnat3 VmInstanceSnat4 -@{SUBNETS_RANGE} 90.0.0.0/24 +${SECURITY_GROUP} l3_ext_sg +@{NETWORKS_NAME} l3_ext_net +@{SUBNETS_NAME} l3_ext_sub +${ROUTER_NAME} l3_ext_router +@{FIP_VM_INSTANCES} fip_vm_1 fip_vm_2 +@{SNAT_VM_INSTANCES} snat_vm_1 snat_vm_2 +@{SUBNETS_RANGE} 41.0.0.0/24 # Parameter values below are based on releng/builder - changing them requires updates in releng/builder as well -${external_gateway} 10.10.10.250 -${external_pnf} 10.10.10.253 -${external_subnet} 10.10.10.0/24 -${external_subnet_allocation_pool} start=10.10.10.2,end=10.10.10.249 -${external_internet_addr} 10.9.9.9 -${external_net_name} external-net -${external_subnet_name} external-subnet +${EXTERNAL_GATEWAY} 10.10.10.250 +${EXTERNAL_PNF} 10.10.10.253 +${EXTERNAL_SUBNET} 10.10.10.0/24 +${EXTERNAL_SUBNET_ALLOCATION_POOL} start=10.10.10.2,end=10.10.10.249 +${EXTERNAL_INTERNET_ADDR} 10.9.9.9 +${EXTERNAL_NET_NAME} external-net +${EXTERNAL_SUBNET_NAME} external-subnet *** Test Cases *** Create All Controller Sessions @@ -37,11 +38,11 @@ Create All Controller Sessions Create Private Network [Documentation] Create Network with neutron request. - : FOR ${NetworkElement} IN @{NETWORKS_NAME} - \ OpenStackOperations.Create Network ${NetworkElement} + : FOR ${network} IN @{NETWORKS_NAME} + \ OpenStackOperations.Create Network ${network} Create Subnet For Private Network - [Documentation] Create Sub Nets for the Networks with neutron request. + [Documentation] Create Sub Net for the Network with neutron request. OpenStackOperations.Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0] Add Ssh Allow Rule @@ -50,126 +51,126 @@ Add Ssh Allow Rule Create Vm Instances [Documentation] Create VM instances using flavor and image names for a network. - OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${VM_INSTANCES_FLOATING} sg=${SECURITY_GROUP} - OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${VM_INSTANCES_SNAT} sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${FIP_VM_INSTANCES} sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instances @{NETWORKS_NAME}[0] ${SNAT_VM_INSTANCES} sg=${SECURITY_GROUP} Check Vm Instances Have Ip Address - @{FLOATING_VM_IPS} ${FLOATING_DHCP_IP} = Get VM IPs @{VM_INSTANCES_FLOATING} - @{SNAT_VM_IPS} ${SNAT_DHCP_IP} = Get VM IPs @{VM_INSTANCES_SNAT} - Set Suite Variable @{FLOATING_VM_IPS} - Set Suite Variable @{SNAT_VM_IPS} - Should Not Contain ${FLOATING_VM_IPS} None - Should Not Contain ${SNAT_VM_IPS} None - Should Not Contain ${FLOATING_DHCP_IP} None - Should Not Contain ${SNAT_DHCP_IP} None - [Teardown] Run Keywords Show Debugs @{VM_INSTANCES_FLOATING} @{VM_INSTANCES_SNAT} - ... AND Get Test Teardown Debugs + @{FIP_VM_IPS} ${FLOATING_DHCP_IP} = OpenStackOperations.Get VM IPs @{FIP_VM_INSTANCES} + @{SNAT_VM_IPS} ${SNAT_DHCP_IP} = OpenStackOperations.Get VM IPs @{SNAT_VM_INSTANCES} + BuiltIn.Set Suite Variable @{FIP_VM_IPS} + BuiltIn.Set Suite Variable @{SNAT_VM_IPS} + BuiltIn.Should Not Contain ${FIP_VM_IPS} None + BuiltIn.Should Not Contain ${SNAT_VM_IPS} None + BuiltIn.Should Not Contain ${FLOATING_DHCP_IP} None + BuiltIn.Should Not Contain ${SNAT_DHCP_IP} None + [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VM_INSTANCES} @{SNAT_VM_INSTANCES} + ... AND OpenStackOperations.Get Test Teardown Debugs Create External Network And Subnet - Create Network ${external_net_name} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} - Update Network ${external_net_name} --external - Create Subnet ${external_net_name} ${external_subnet_name} ${external_subnet} --gateway ${external_gateway} --allocation-pool ${external_subnet_allocation_pool} + OpenStackOperations.Create Network ${EXTERNAL_NET_NAME} --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} + OpenStackOperations.Update Network ${EXTERNAL_NET_NAME} --external + OpenStackOperations.Create Subnet ${EXTERNAL_NET_NAME} ${EXTERNAL_SUBNET_NAME} ${EXTERNAL_SUBNET} --gateway ${EXTERNAL_GATEWAY} --allocation-pool ${EXTERNAL_SUBNET_ALLOCATION_POOL} Create Router [Documentation] Create Router and Add Interface to the subnets. - OpenStackOperations.Create Router router1 + OpenStackOperations.Create Router ${ROUTER_NAME} Add Interfaces To Router [Documentation] Add Interfaces : FOR ${interface} IN @{SUBNETS_NAME} - \ OpenStackOperations.Add Router Interface router1 ${interface} + \ OpenStackOperations.Add Router Interface ${ROUTER_NAME} ${interface} Add Router Gateway To Router - [Documentation] Add Router Gateway - OpenStackOperations.Add Router Gateway router1 ${external_net_name} + [Documentation] OpenStackOperations.Add Router Gateway + OpenStackOperations.Add Router Gateway ${ROUTER_NAME} ${EXTERNAL_NET_NAME} -Verify Created Routers +Verify Created Router [Documentation] Check created routers using northbound rest calls ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API} - Log ${data} - Should Contain ${data} router1 + BuiltIn.Log ${data} + Should Contain ${data} ${ROUTER_NAME} Create And Associate Floating IPs for VMs [Documentation] Create and associate a floating IP for the VM - ${VM_FLOATING_IPS} OpenStackOperations.Create And Associate Floating IPs ${external_net_name} @{VM_INSTANCES_FLOATING} - Set Suite Variable ${VM_FLOATING_IPS} - [Teardown] Run Keywords Show Debugs @{VM_INSTANCES_FLOATING} - ... AND Get Test Teardown Debugs + ${VM_FLOATING_IPS} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NET_NAME} @{FIP_VM_INSTANCES} + BuiltIn.Set Suite Variable ${VM_FLOATING_IPS} + [Teardown] BuiltIn.Run Keywords OpenStackOperations.Show Debugs @{FIP_VM_INSTANCES} + ... AND OpenStackOperations.Get Test Teardown Debugs Ping External Gateway From Control Node [Documentation] Check reachability of external gateway by pinging it from the control node. - OpenStackOperations.Ping Vm From Control Node ${external_gateway} additional_args=-I ${external_internet_addr} + OpenStackOperations.Ping Vm From Control Node ${EXTERNAL_GATEWAY} additional_args=-I ${EXTERNAL_INTERNET_ADDR} Ping Vm Instance1 Floating IP From Control Node [Documentation] Check reachability of VM instance through floating IP by pinging them. - OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${external_internet_addr} + OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[0] additional_args=-I ${EXTERNAL_INTERNET_ADDR} Ping Vm Instance2 Floating IP From Control Node [Documentation] Check reachability of VM instance through floating IP by pinging them. - OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${external_internet_addr} + OpenStackOperations.Ping Vm From Control Node @{VM_FLOATING_IPS}[1] additional_args=-I ${EXTERNAL_INTERNET_ADDR} Ping Vm Instance2 Floating IP From Vm Instance1 With Floating IP (Hairpinning) [Documentation] Check reachability of VM instance floating IP from another VM instance with FIP (with ttl=1 to make sure no router hops) - ${dst_ip}= Create List @{VM_FLOATING_IPS}[1] - OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FLOATING_VM_IPS}[0] ${dst_ip} ttl=1 + ${dst_ip}= BuiltIn.Create List @{VM_FLOATING_IPS}[1] + OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1 Ping External Network PNF from Vm Instance 1 [Documentation] Check reachability of External Network PNF from VM instance (with ttl=1 to make sure no router hops) - ${dst_ip}= Create List ${external_pnf} - OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FLOATING_VM_IPS}[0] ${dst_ip} ttl=1 + ${dst_ip}= BuiltIn.Create List ${EXTERNAL_PNF} + OpenStackOperations.Test Operations From Vm Instance @{NETWORKS_NAME}[0] @{FIP_VM_IPS}[0] ${dst_ip} ttl=1 SNAT - TCP connection to External Gateway From SNAT VM Instance1 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT - Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${external_gateway} + OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} SNAT - UDP connection to External Gateway From SNAT VM Instance1 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT - Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${external_gateway} -u + OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[0] ${EXTERNAL_GATEWAY} -u SNAT - TCP connection to External Gateway From SNAT VM Instance2 [Documentation] Login to the VM instance and test TCP connection to the controller via SNAT - Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${external_gateway} + OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} SNAT - UDP connection to External Gateway From SNAT VM Instance2 [Documentation] Login to the VM instance and test UDP connection to the controller via SNAT - Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${external_gateway} -u + OpenStackOperations.Test Netcat Operations From Vm Instance @{NETWORKS_NAME}[0] @{SNAT_VM_IPS}[1] ${EXTERNAL_GATEWAY} -u Delete Vm Instances [Documentation] Delete Vm instances using instance names. - : FOR ${VmElement} IN @{VM_INSTANCES_FLOATING} - \ OpenStackOperations.Delete Vm Instance ${VmElement} - : FOR ${VmElement} IN @{VM_INSTANCES_SNAT} - \ OpenStackOperations.Delete Vm Instance ${VmElement} + : FOR ${vm} IN @{FIP_VM_INSTANCES} + \ OpenStackOperations.Delete Vm Instance ${vm} + : FOR ${vm} IN @{SNAT_VM_INSTANCES} + \ OpenStackOperations.Delete Vm Instance ${vm} Delete Router Interfaces [Documentation] Remove Interface to the subnets. : FOR ${interface} IN @{SUBNETS_NAME} - \ OpenStackOperations.Remove Interface router1 ${interface} + \ OpenStackOperations.Remove Interface ${ROUTER_NAME} ${interface} Delete Routers [Documentation] Delete Router and Interface to the subnets. - OpenStackOperations.Delete Router router1 + OpenStackOperations.Delete Router ${ROUTER_NAME} -Verify Deleted Routers - [Documentation] Check deleted routers using northbound rest calls +Verify Deleted Router + [Documentation] Check deleted router using northbound rest call ${data} Utils.Get Data From URI 1 ${NEUTRON_ROUTERS_API} - Log ${data} - Should Not Contain ${data} router1 + BuiltIn.Log ${data} + BuiltIn.Should Not Contain ${data} ${ROUTER_NAME} -Delete Sub Networks - [Documentation] Delete Sub Nets for the Networks with neutron request. +Delete Sub Network + [Documentation] Delete Sub Net for the Network with neutron request. OpenStackOperations.Delete SubNet @{SUBNETS_NAME}[0] Delete Networks [Documentation] Delete Networks with neutron request. - : FOR ${NetworkElement} IN @{NETWORKS_NAME} - \ OpenStackOperations.Delete Network ${NetworkElement} - OpenStackOperations.Delete Network ${external_net_name} + : FOR ${network} IN @{NETWORKS_NAME} + \ OpenStackOperations.Delete Network ${network} + OpenStackOperations.Delete Network ${EXTERNAL_NET_NAME} Delete Security Group [Documentation] Delete security groups with neutron request - Delete SecurityGroup ${SECURITY_GROUP} + OpenStackOperations.Delete SecurityGroup ${SECURITY_GROUP} Verify Flows Cleanup [Documentation] Verify that flows have been cleaned up properly after removing all neutron configurations - Verify Flows Are Cleaned Up On All OpenStack Nodes + DataModels.Verify Flows Are Cleaned Up On All OpenStack Nodes -- 2.36.6