From: Aswin Suryanarayanan Date: Mon, 19 Jun 2017 12:21:37 +0000 (+0530) Subject: Test cases added for BUG 8553 and Bug 8398 X-Git-Tag: release/nitrogen~105 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=75a14cf6c374221546f7ce31a21ef71058bbc1c6;p=integration%2Ftest.git Test cases added for BUG 8553 and Bug 8398 Change-Id: I52261a9d8fe6873376baf00417f69d583e70aef6 Signed-off-by: Aswin Suryanarayanan --- diff --git a/csit/libraries/OpenStackOperations.robot b/csit/libraries/OpenStackOperations.robot index 5ad5c84a12..4e41713293 100644 --- a/csit/libraries/OpenStackOperations.robot +++ b/csit/libraries/OpenStackOperations.robot @@ -935,6 +935,15 @@ Add Security Group To VM Log ${output} Should Not Be True ${rc} +Remove Security Group From VM + [Arguments] ${vm} ${sg} + [Documentation] Remove the security group provided to the given VM. + ${devstack_conn_id}= Get ControlNode Connection + Switch Connection ${devstack_conn_id} + ${output}= Write Commands Until Prompt openstack server remove security group ${vm} ${sg} + Log ${output} + Close Connection + Create SFC Flow Classifier [Arguments] ${name} ${src_ip} ${dest_ip} ${protocol} ${dest_port} ${neutron_src_port} [Documentation] Create a flow classifier for SFC diff --git a/csit/suites/openstack/connectivity/04_security_group_tests.robot b/csit/suites/openstack/connectivity/04_security_group_tests.robot index e35feec820..a6fe1b2c8d 100644 --- a/csit/suites/openstack/connectivity/04_security_group_tests.robot +++ b/csit/suites/openstack/connectivity/04_security_group_tests.robot @@ -19,10 +19,11 @@ Resource ../../../libraries/Utils.robot Resource ../../../libraries/KarafKeywords.robot *** Variables *** -@{NETWORKS_NAME} network_1 -@{SUBNETS_NAME} l2_subnet_1 +@{NETWORKS_NAME} network_1 network_2 +@{SUBNETS_NAME} l2_subnet_1 l2_subnet_2 @{NET_1_VM_INSTANCES} MyFirstInstance_1 MySecondInstance_1 -@{SUBNETS_RANGE} 30.0.0.0/24 +@{NET_2_VM_INSTANCES} MyThirdInstance_3 +@{SUBNETS_RANGE} 30.0.0.0/24 40.0.0.0/24 *** Test Cases *** Create VXLAN Network (network_1) @@ -33,6 +34,14 @@ Create Subnets For network_1 [Documentation] Create Sub Nets for the Networks with neutron request. Create SubNet @{NETWORKS_NAME}[0] @{SUBNETS_NAME}[0] @{SUBNETS_RANGE}[0] +Create VXLAN Network (network_2) + [Documentation] Create Network with neutron request. + Create Network @{NETWORKS_NAME}[1] + +Create Subnets For network_2 + [Documentation] Create Sub Nets for the Networks with neutron request. + Create SubNet @{NETWORKS_NAME}[1] @{SUBNETS_NAME}[1] @{SUBNETS_RANGE}[1] + Add TCP Allow Rules [Documentation] Allow only TCP packets for this suite Security Group Create Without Default Security Rules csit-remote-sgs @@ -44,6 +53,10 @@ Create Vm Instances For network_1 [Documentation] Create VM instances using flavor and image names for a network. Create Vm Instances network_1 ${NET_1_VM_INSTANCES} sg=csit-remote-sgs +Create Vm Instances For network_2 + [Documentation] Create VM instances using flavor and image names for a network. + Create Vm Instances network_2 ${NET_2_VM_INSTANCES} sg=csit-remote-sgs + Check Vm Instances Have Ip Address [Documentation] Test case to verify that all created VMs are ready and have received their ip addresses. ... We are polling first and longest on the last VM created assuming that if it's received it's address @@ -55,6 +68,7 @@ Check Vm Instances Have Ip Address ${status} ${message} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 5s Collect VM IP Addresses ... true @{NET_1_VM_INSTANCES} ${NET1_VM_IPS} ${NET1_DHCP_IP} Collect VM IP Addresses false @{NET_1_VM_INSTANCES} + ${NET2_VM_IPS} ${NET2_DHCP_IP} Collect VM IP Addresses false @{NET_2_VM_INSTANCES} ${VM_INSTANCES}= Collections.Combine Lists ${NET_1_VM_INSTANCES} ${VM_IPS}= Collections.Combine Lists ${NET1_VM_IPS} ${LOOP_COUNT} Get Length ${VM_INSTANCES} @@ -65,6 +79,10 @@ Check Vm Instances Have Ip Address Set Suite Variable ${NET1_DHCP_IP} Should Not Contain ${NET1_VM_IPS} None Should Not Contain ${NET1_DHCP_IP} None + Set Suite Variable ${NET2_VM_IPS} + Set Suite Variable ${NET2_DHCP_IP} + Should Not Contain ${NET2_VM_IPS} None + Should Not Contain ${NET2_DHCP_IP} None [Teardown] Run Keywords Show Debugs @{NET_1_VM_INSTANCES} ... AND Get Test Teardown Debugs @@ -113,6 +131,30 @@ Ping From Vm Instance2 To Vm Instance1 ${VM1_LIST} Create List @{NET1_VM_IPS}[0] Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} +Create Router + [Documentation] Create Router and Add Interface to the subnets. + OpenStackOperations.Create Router router1 + +Add Interfaces To Router + [Documentation] Add Interfaces + : FOR ${interface} IN @{SUBNETS_NAME} + \ OpenStackOperations.Add Router Interface router1 ${interface} + +Ping From Vm Instance1 To Vm Instance3 + [Documentation] Login to the vm instance and test some operations + ${VM3_LIST} Create List @{NET2_VM_IPS}[0] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM3_LIST} + +Repeat Ping From Vm Instance1 To Vm Instance2 With a Router + [Documentation] Login to the vm instance and test some operations + ${VM2_LIST} Create List @{NET1_VM_IPS}[1] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM2_LIST} + +Repeat Ping From Vm Instance2 To Vm Instance1 With a Router + [Documentation] Login to the vm instance and test operations + ${VM1_LIST} Create List @{NET1_VM_IPS}[0] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} + Add Additional Security Group To VMs [Documentation] Add an additional security group to the VMs - this is done to test a different logic put in place for ports with multiple SGs Security Group Create Without Default Security Rules additional-sg @@ -130,12 +172,82 @@ Ping From DHCP To Vm Instance2 [Documentation] Check reachability of vm instances by pinging to them from DHCP. Ping Vm From DHCP Namespace network_1 @{NET1_VM_IPS}[1] -Repeat Ping From Vm Instance1 To Vm Instance2 +Repeat Ping From Vm Instance1 To Vm Instance2 With additional SG [Documentation] Login to the vm instance and test some operations ${VM2_LIST} Create List @{NET1_VM_IPS}[1] Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM2_LIST} -Repeat Ping From Vm Instance2 To Vm Instance1 +Repeat Ping From Vm Instance2 To Vm Instance1 With additional SG + [Documentation] Login to the vm instance and test operations + ${VM1_LIST} Create List @{NET1_VM_IPS}[0] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} + +Remove The Rules From Additional Security Group + Delete All Security Group Rules additional-sg + +No Ping From DHCP To Vm Instance1 With Additional Security Group Rules Removed + [Documentation] Check non-reachability of vm instances by pinging to them. + Ping From DHCP Should Not Succeed network_1 @{NET1_VM_IPS}[0] + +No Ping From DHCP To Vm Instance2 With Additional Security Group Rules Removed + [Documentation] Check non-reachability of vm instances by pinging to them. + Ping From DHCP Should Not Succeed network_1 @{NET1_VM_IPS}[1] + +Add The Rules To Additional Security Group Again + Neutron Security Group Rule Create Legacy Cli additional-sg direction=ingress protocol=icmp remote_ip_prefix=@{NET1_DHCP_IP}[0]/32 + +Ping From DHCP To Vm Instance1 After Rules Are Added Again + [Documentation] Check reachability of vm instances by pinging to them from DHCP. + Ping Vm From DHCP Namespace network_1 @{NET1_VM_IPS}[0] + +Ping From DHCP To Vm Instance2 After Rules Are Added Again + [Documentation] Check reachability of vm instances by pinging to them from DHCP. + Ping Vm From DHCP Namespace network_1 @{NET1_VM_IPS}[1] + +Remove the additional Security Group from First Vm + [Documentation] Remove the additional Security group + Remove Security Group From VM @{NET_1_VM_INSTANCES}[0] additional-sg + +Repeat Ping From Vm Instance1 To Vm Instance2 With Additional SG Removed From Vm1 + [Documentation] Login to the vm instance and test some operations + ${VM2_LIST} Create List @{NET1_VM_IPS}[1] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM2_LIST} + +Repeat Ping From Vm Instance2 To Vm Instance1 With Additional SG Removed From Vm1 + [Documentation] Login to the vm instance and test operations + ${VM1_LIST} Create List @{NET1_VM_IPS}[0] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} + +Remove Router Interfaces + [Documentation] Delete the Router Interfaces + : FOR ${interface} IN @{SUBNETS_NAME} + \ Remove Interface router1 ${interface} + +Delete Router + [Documentation] Delete the Router + Delete Router router1 + +Repeat Ping From Vm Instance1 To Vm Instance2 With Router Removed + [Documentation] Login to the vm instance and test some operations + ${VM2_LIST} Create List @{NET1_VM_IPS}[1] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM2_LIST} + +Repeat Ping From Vm Instance2 To Vm Instance1 With Router Removed + [Documentation] Login to the vm instance and test operations + ${VM1_LIST} Create List @{NET1_VM_IPS}[0] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} + +Delete Vm Instances In network_2 + [Documentation] Delete Vm instances using instance names in network_2. + : FOR ${VmElement} IN @{NET_2_VM_INSTANCES} + \ Delete Vm Instance ${VmElement} + +Repeat Ping From Vm Instance1 To Vm Instance2 With network_2 VM Deleted + [Documentation] Login to the vm instance and test some operations + ${VM2_LIST} Create List @{NET1_VM_IPS}[1] + Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[0] ${VM2_LIST} + +Repeat Ping From Vm Instance2 To Vm Instance1 With network_2 VM Deleted [Documentation] Login to the vm instance and test operations ${VM1_LIST} Create List @{NET1_VM_IPS}[0] Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[1] ${VM1_LIST} @@ -145,6 +257,11 @@ Delete Vm Instances In network_1 : FOR ${VmElement} IN @{NET_1_VM_INSTANCES} \ Delete Vm Instance ${VmElement} +Delete SecurityGroups + [Documentation] Delete Security group + Delete SecurityGroup additional-sg + Delete SecurityGroup csit-remote-sgs + Delete Sub Networks In network_1 [Documentation] Delete Sub Nets for the Networks with neutron request. Delete SubNet l2_subnet_1