From 24420ea33deb876a4ea1e17e478594c2d5c84ff1 Mon Sep 17 00:00:00 2001 From: Jamo Luhrsen Date: Thu, 17 Aug 2017 16:28:21 -0700 Subject: [PATCH] Fix openstack netvirt sfc suite typo in instance creation s/groups/group migrate some neutron cli to the openstack cli also, since I was here, I moved all of the cleanup steps out of their own individual test cases and into a suite teardown keyword. This lets robot run through every step regardless if any previous step had failed. If left in a test case, robot bails on the test case and wont run any other steps in that test case if any single step fails. Change-Id: Iea009efbe2c7633bc83898002b2a6decd08f24aa Signed-off-by: Jamo Luhrsen --- csit/libraries/OpenStackOperations.robot | 34 ++++++++++------------ csit/suites/openstack/extensions/sfc.robot | 24 ++++++--------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/csit/libraries/OpenStackOperations.robot b/csit/libraries/OpenStackOperations.robot index 46d881a67e..19fc4be34c 100644 --- a/csit/libraries/OpenStackOperations.robot +++ b/csit/libraries/OpenStackOperations.robot @@ -267,7 +267,7 @@ Create Vm Instance With Port [Documentation] Create One VM instance using given ${port_name} and for given ${compute_node} ${image} Set Variable If "${image}"=="${EMPTY}" ${CIRROS_${OPENSTACK_BRANCH}} ${image} ${port_id}= Get Port Id ${port_name} ${devstack_conn_id} - ${rc} ${output}= Run And Return Rc And Output openstack server create --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg} + ${rc} ${output}= Run And Return Rc And Output openstack server create --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-group ${sg} Log ${output} Create Vm Instance With Ports @@ -983,12 +983,12 @@ Remove Security Group From VM Create SFC Flow Classifier [Arguments] ${name} ${src_ip} ${dest_ip} ${protocol} ${dest_port} ${neutron_src_port} [Documentation] Create a flow classifier for SFC - ${cmd}= Set Variable neutron flow-classifier-create --ethertype IPv4 --source-ip-prefix ${src_ip}/32 --destination-ip-prefix ${dest_ip}/32 --protocol ${protocol} --destination-port ${dest_port}:${dest_port} --logical-source-port ${neutron_src_port} ${name} + ${cmd}= Set Variable openstack sfc flow classifier create --ethertype IPv4 --source-ip-prefix ${src_ip}/32 --destination-ip-prefix ${dest_ip}/32 --protocol ${protocol} --destination-port ${dest_port}:${dest_port} --logical-source-port ${neutron_src_port} ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Created a new flow_classifier + Should Contain ${output} ${name} [Return] ${output} Delete SFC Flow Classifier @@ -996,12 +996,11 @@ Delete SFC Flow Classifier [Documentation] Delete a SFC flow classifier ${devstack_conn_id}= Get ControlNode Connection Switch Connection ${devstack_conn_id} - ${cmd}= Set Variable neutron flow-classifier-delete ${name} + ${cmd}= Set Variable openstack sfc flow classifier delete ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Deleted flow_classifier [Return] ${output} Create SFC Port Pair @@ -1009,79 +1008,76 @@ Create SFC Port Pair [Documentation] Creates a neutron port pair for SFC ${devstack_conn_id}= Get ControlNode Connection Switch Connection ${devstack_conn_id} - ${cmd}= Set Variable neutron port-pair-create --ingress=${port_in} --egress=${port_out} ${name} + ${cmd}= Set Variable openstack sfc port pair create --ingress=${port_in} --egress=${port_out} ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Created a new port_pair + Should Contain ${output} ${name} [Return] ${output} Delete SFC Port Pair [Arguments] ${name} [Documentation] Delete a SFC port pair - ${cmd}= Set Variable neutron port-pair-delete ${name} + ${cmd}= Set Variable openstack sfc port pair delete ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Deleted port_pair [Return] ${output} Create SFC Port Pair Group [Arguments] ${name} ${port_pair} [Documentation] Creates a port pair group with a single port pair for SFC - ${cmd}= Set Variable neutron port-pair-group-create --port-pair ${port_pair} ${name} + ${cmd}= Set Variable openstack sfc port pair group create --port-pair ${port_pair} ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Created a new port_pair_group + Should Contain ${output} ${name} [Return] ${output} Create SFC Port Pair Group With Two Pairs [Arguments] ${name} ${port_pair1} ${port_pair2} [Documentation] Creates a port pair group with two port pairs for SFC - ${cmd}= Set Variable neutron port-pair-group-create --port-pair ${port_pair1} --port-pair ${port_pair2} ${name} + ${cmd}= Set Variable openstack sfc port pair group create --port-pair ${port_pair1} --port-pair ${port_pair2} ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Created a new port_pair_group + Should Contain ${output} ${name} [Return] ${output} Delete SFC Port Pair Group [Arguments] ${name} [Documentation] Delete a SFC port pair group ${devstack_conn_id}= Get ControlNode Connection - ${cmd}= Set Variable neutron port-pair-group-delete ${name} + ${cmd}= Set Variable openstack sfc port pair group delete ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Deleted port_pair_group [Return] ${output} Create SFC Port Chain [Arguments] ${name} ${pg1} ${pg2} ${fc} [Documentation] Creates a port pair chain with two port groups and a singel classifier. - ${cmd}= Set Variable neutron port-chain-create --port-pair-group ${pg1} --port-pair-group ${pg2} --flow-classifier ${fc} ${name} + ${cmd}= Set Variable openstack sfc port chain create --port-pair-group ${pg1} --port-pair-group ${pg2} --flow-classifier ${fc} ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Created a new port_chain + Should Contain ${output} ${name} [Return] ${output} Delete SFC Port Chain [Arguments] ${name} [Documentation] Delete a SFC port chain - ${cmd}= Set Variable neutron port-chain-delete ${name} + ${cmd}= Set Variable openstack sfc port chain delete ${name} Log ${cmd} ${rc} ${output}= Run And Return Rc And Output ${cmd} Log ${output} Should Not Be True ${rc} - Should Contain ${output} Deleted port_chain [Return] ${output} Reboot Nova VM diff --git a/csit/suites/openstack/extensions/sfc.robot b/csit/suites/openstack/extensions/sfc.robot index 27eb9d5f72..f796d90e73 100644 --- a/csit/suites/openstack/extensions/sfc.robot +++ b/csit/suites/openstack/extensions/sfc.robot @@ -2,7 +2,8 @@ Documentation Test suite to verify SFC configuration and packet flows. Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown ... AND DevstackUtils.Devstack Suite Setup -Suite Teardown Close All Connections +Suite Teardown BuiltIn.Run Keywords Delete Configurations +... AND Close All Connections Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing Test Teardown Get Test Teardown Debugs Library SSHLibrary @@ -112,13 +113,15 @@ Connectivity Tests From Vm Instance1 In network_1 Test Operations From Vm Instance network_1 @{NET1_VM_IPS}[3] ${DEST_VM_LIST} Execute Command on VM Instance @{NETWORKS_NAME}[0] @{NET1_VM_IPS}[3] curl http://@{NET1_VM_IPS}[4] -Delete Vm Instances In network_1 - [Documentation] Delete Vm instances using instance names in network_1. +*** Keywords *** +Delete Configurations + [Documentation] Delete all elements that were created in the test case section. These are done + ... in a local keyword so this can be called as part of the Suite Teardown. When called as part + ... of the Suite Teardown, all steps will be attempted. This prevents robot framework from bailing + ... on the rest of a test case if one step intermittently has trouble and fails. The goal is to attempt + ... to leave the test environment as clean as possible upon completion of this suite. : FOR ${VmElement} IN @{VM_INSTANCES} \ Delete Vm Instance ${VmElement} - -Delete All SFC Objects - [Documentation] Delete all previously created SFC objects Delete SFC Port Chain PC1 Delete SFC Port Pair Group PG1 Delete SFC Port Pair Group PG2 @@ -126,17 +129,8 @@ Delete All SFC Objects Delete SFC Port Pair PP2 Delete SFC Port Pair PP3 Delete SFC Flow Classifier FC_http - -Delete Neutron Ports - [Documentation] Delete neutron ports that were used for SFC VMs : FOR ${port} IN @{PORTS} \ Delete Port ${port} - -Delete Sub Networks In network_1 - [Documentation] Delete Sub Nets for the Networks with neutron request. Delete SubNet l2_subnet_1 - -Delete Networks - [Documentation] Delete Networks with neutron request. : FOR ${NetworkElement} IN @{NETWORKS_NAME} \ Delete Network ${NetworkElement} -- 2.36.6