Use openstack cli instead of neutron 38/78238/9
authorJamo Luhrsen <jluhrsen@redhat.com>
Wed, 28 Nov 2018 01:23:03 +0000 (17:23 -0800)
committerJamo Luhrsen <jluhrsen@redhat.com>
Thu, 29 Nov 2018 21:02:53 +0000 (21:02 +0000)
neutron cli is deprecated and we don't install that client
in our apex job (yet) and would prefer not to keep maintaining
the deprecated cli.

Change-Id: I119dd160b04fcd1570d48c5849a999b77bbe6d92
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
csit/suites/openstack/securitygroup/neutron_security_group.robot

index 876b2a44a7421aba6bd7a27c46835ff5c75b7ce6..3e0678a44cadc6f583052ff196bafb90aa831135 100644 (file)
@@ -31,12 +31,13 @@ ${ADD_ARG_SSH}    --direction ingress --ethertype IPv4 --port_range_max 22 --por
 ${SECURITY_GROUPS}    --security-group
 @{SGS}            sgs_sg_1    sgs_sg_2    sgs_sg_3    sgs_sg_4
 ${SG_UPDATED}     SSH_UPDATED
-${ADD_ARG_SSH5}    --direction ingress --ethertype IPv4 --port_range_max 20 --port_range_min 25 --protocol tcp
+${ADD_ARG_SSH5}    --ingress --ethertype IPv4 --dst-port 25:20 --protocol tcp
 @{ADD_PARAMS}     ingression    IPv4    20    25    tcp
-${ADD_ARG_SSH6}    --direction ingress --ethertype IPv4 --port_range_max 25 --port_range_min -1 --protocol tcp
-${ADD_ARG_SSH7}    --direction ingress --ethertype IPv4 --port_range_max -1 --port_range_min 20 --protocol tcp
-${PORT_RANGE_ERROR}    For TCP/UDP protocols, port_range_min must be <= port_range_max
-${INVALID_PORT_RANGE_MIN}    Invalid value for port
+${ADD_ARG_SSH6}    --ingress --ethertype IPv4 --dst-port -1:25 --protocol tcp
+${ADD_ARG_SSH7}    --ingress --ethertype IPv4 --dst-port 20:-1 --protocol tcp
+${PORT_RANGE_ERROR}    argument --dst-port: Invalid range, 25 is not less than 20
+${INVALID_MIN_PORT}    argument --dst-port: expected one argument
+${INVALID_MAX_PORT}    argument --dst-port: Invalid range, 20 is not less than -1
 
 *** Testcases ***
 TC01_Update Security Group description and Name
@@ -44,30 +45,29 @@ TC01_Update Security Group description and Name
     [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]}
-    Neutron Setup Creation    ${NETWORKS[0]}    ${SUBNETS[0]}    ${IP_SUBNETS[0]}    ${PORTS[0]}    ${PORTS[1]}    ${SECURITY_GROUPS}
-    ...    ${sg_id}
+    Neutron Setup Creation    ${NETWORKS[0]}    ${SUBNETS[0]}    ${IP_SUBNETS[0]}    ${PORTS[0]}    ${PORTS[1]}    ${sg_id}
     Security group verification on Neutron port    ${PORTS[0]}    ${sg_id}
     Security group verification on Neutron port    ${PORTS[1]}    ${sg_id}
     Update Security Group Description and Verification    ${sg_id}    ${DESCRIPTION}    ${VERIFY_DESCRIPTION}
     Update Security Group Name and Verification    ${sg_id}    ${NAME_UPDATE}    ${VERIFY_NAME}
 
 TC02_Create Security Rule with port_range_min > port_range_max
-    [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
+    [Documentation]    Create Security Rule with port_range_min greater than port_range_max
     [Tags]    Regression
     Create Security Group and Validate    ${SGS[1]}
     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
+    [Documentation]    Create Security Rule with port_range_min = -1
     [Tags]    Regression
     Create Security Group and Validate    ${SGS[2]}
-    Neutron Rule Creation With Invalid Parameters    ${SGS[2]}    ${ADD_ARG_SSH6}    ${INVALID_PORT_RANGE_MIN}
+    Neutron Rule Creation With Invalid Parameters    ${SGS[2]}    ${ADD_ARG_SSH6}    ${INVALID_MIN_PORT}
 
 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
+    [Documentation]    Create Security Rule with port_range_max = -1
     [Tags]    Regression
     Create Security Group and Validate    ${SGS[3]}
-    Neutron Rule Creation With Invalid Parameters    ${SGS[3]}    ${ADD_ARG_SSH7}    ${INVALID_PORT_RANGE_MIN}
+    Neutron Rule Creation With Invalid Parameters    ${SGS[3]}    ${ADD_ARG_SSH7}    ${INVALID_MAX_PORT}
 
 *** Keywords ***
 Create Security Group and Validate
@@ -84,13 +84,11 @@ Create Security Rule and Validate
     BuiltIn.Wait Until Keyword Succeeds    10s    2s    Utils.Check For Elements At URI    ${SEC_RULE_API}    ${rule_ids}
 
 Neutron Setup Creation
-    [Arguments]    ${network}    ${subnet}    ${ip_subnet}    ${port1}    ${port2}    ${sg_groups}
-    ...    ${sg_id}
+    [Arguments]    ${network}    ${subnet}    ${ip_subnet}    ${port1}    ${port2}    ${sg_id}
     ${net_id} =    OpenStackOperations.Create Network    ${network}
     ${subnet_id} =    OpenStackOperations.Create SubNet    ${network}    ${subnet}    ${ip_subnet}
-    ${add_args} =    BuiltIn.Set Variable    ${sg_groups} ${sg_id}
-    ${port_id}    OpenStackOperations.Create Neutron Port With Additional Params    ${network}    ${port1}    ${add_args}
-    ${port_id}    OpenStackOperations.Create Neutron Port With Additional Params    ${network}    ${port2}    ${add_args}
+    ${port_id} =    OpenStackOperations.Create Port    ${network}    ${port1}    ${sg_id}
+    ${port_id} =    OpenStackOperations.Create Port    ${network}    ${port2}    ${sg_id}
 
 Security group verification on Neutron port
     [Arguments]    ${port}    ${sg_id}
@@ -115,6 +113,6 @@ Update Security Group Name and Verification
 
 Neutron Rule Creation With Invalid Parameters
     [Arguments]    ${sg_name}    ${additional_args}    ${expected_error}
-    ${rc}    ${output} =    OperatingSystem.Run And Return Rc And Output    neutron security-group-rule-create ${sg_name} ${additional_args}
+    ${rc}    ${output} =    Run And Return Rc And Output    openstack security group rule create ${additional_args} ${sg_name}
     BuiltIn.Log    ${output}
     BuiltIn.Should Contain    ${output}    ${expected_error}