*** Settings ***
Documentation Test Suite for Neutron Security Group
-Suite Setup BuiltIn.Run Keywords SetupUtils.Setup_Utils_For_Setup_And_Teardown
-... AND DevstackUtils.Devstack Suite Setup
-Suite Teardown SSHLibrary.Close All Connections
+Suite Setup OpenStackOperations.OpenStack Suite Setup
+Suite Teardown OpenStackOperations.OpenStack Suite Teardown
Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
Test Teardown OpenStackOperations.Get Test Teardown Debugs
Library SSHLibrary
Library RequestsLibrary
Library json
Resource ../../../libraries/DevstackUtils.robot
+Resource ../../../libraries/OpenStackOperations.robot
Resource ../../../libraries/SetupUtils.robot
Resource ../../../variables/Variables.robot
[Tags] Regression
${sg_id} = BuiltIn.Run Keyword Create Security Group and Validate ${SGS[0]}
Create Security Rule and Validate ${SGS[0]} direction=${ADD_PARAMS[0]} ethertype=${ADD_PARAMS[1]} port_range_max=${ADD_PARAMS[3]} port_range_min=${ADD_PARAMS[2]} protocol=${ADD_PARAMS[4]}
- Get Flows ${OS_COMPUTE_1_IP} ${OS_COMPUTE_2_IP}
Neutron Setup Creation ${NETWORKS[0]} ${SUBNETS[0]} ${IP_SUBNETS[0]} ${PORTS[0]} ${PORTS[1]} ${SECURITY_GROUPS}
... ${sg_id}
Security group verification on Neutron port ${PORTS[0]} ${sg_id}
[Documentation] This test case validates the security group and rule creation with optional parameters Create Security Rule with port_range_min greater than port_range_max
[Tags] Regression
Create Security Group and Validate ${SGS[1]}
- Get Flows ${OS_COMPUTE_1_IP} ${OS_COMPUTE_2_IP}
Neutron Rule Creation With Invalid Parameters ${SGS[1]} ${ADD_ARG_SSH5} ${PORT_RANGE_ERROR}
TC03_Create Security Rule with port_range_min = -1
[Documentation] This test case validates the security group and rule creation with optional parameters, Create Security Rule with port_range_min = -1
[Tags] Regression
Create Security Group and Validate ${SGS[2]}
- Get Flows ${OS_COMPUTE_1_IP} ${OS_COMPUTE_2_IP}
Neutron Rule Creation With Invalid Parameters ${SGS[2]} ${ADD_ARG_SSH6} ${INVALID_PORT_RANGE_MIN}
TC04_Create Security Rule with port_range_max = -1
[Documentation] This test case validates the security group and rule creation with optional parameters, Create Security Rule with port_range_max = -1
[Tags] Regression
Create Security Group and Validate ${SGS[3]}
- Get Flows ${OS_COMPUTE_1_IP} ${OS_COMPUTE_2_IP}
Neutron Rule Creation With Invalid Parameters ${SGS[3]} ${ADD_ARG_SSH7} ${INVALID_PORT_RANGE_MIN}
-Cleanup
- @{vms} = BuiltIn.Create List
- @{sgs} = BuiltIn.Create List ${SG_UPDATED} @{SGS}
- OpenStackOperations.Neutron Cleanup ${vms} ${NETWORKS} ${SUBNETS} ${PORTS} ${sgs}
-
*** Keywords ***
-Get Flows
- [Arguments] ${OS_COMPUTE_1_IP} ${OS_COMPUTE_2_IP}
- [Documentation] Get the Flows from DPN1 and DPN2
- ${resp} = Utils.Run Command On Remote System And Log ${OS_COMPUTE_1_IP} sudo ovs-ofctl dump-flows br-int -O OpenFlow13
- ${resp} = Utils.Run Command On Remote System And Log ${OS_COMPUTE_1_IP} sudo ovs-ofctl dump-groups br-int -OOpenflow13
- ${resp} = Utils.Run Command On Remote System And Log ${OS_COMPUTE_2_IP} sudo ovs-ofctl dump-flows br-int -O OpenFlow13
- ${resp} = Utils.Run Command On Remote System And Log ${OS_COMPUTE_2_IP} sudo ovs-ofctl dump-groups br-int -OOpenflow13
-
Create Security Group and Validate
[Arguments] ${sg_ssh}
${output} ${sg_id} = OpenStackOperations.Neutron Security Group Create ${sg_ssh}
${rc} ${output} = OperatingSystem.Run And Return Rc And Output neutron security-group-rule-create ${sg_name} ${additional_args}
BuiltIn.Log ${output}
BuiltIn.Should Contain ${output} ${expected_error}
- SSHLibrary.Close Connection