Migrate to Openstack CLI 08/56308/41
authorgvrangan <venkatrangang@hcl.com>
Mon, 1 May 2017 05:17:45 +0000 (10:47 +0530)
committerJamo Luhrsen <jluhrsen@redhat.com>
Wed, 7 Jun 2017 19:32:52 +0000 (12:32 -0700)
The neutron/nova cli commands have
been deprecated. This patch repalces those
commands with the openstack cli commands.

Change-Id: I21f2217bcee8a321c7a7f93acf218dd04016b684
Signed-off-by: gvrangan <venkatrangang@hcl.com>
Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
13 files changed:
csit/libraries/DevstackUtils.robot
csit/libraries/OpenStackOperations.robot
csit/suites/netvirt/ElanService/ElanService.robot
csit/suites/netvirt/Netvirt_Vpnservice/01_basic_vpnservice.robot
csit/suites/netvirt/Netvirt_Vpnservice/ARP_Learning.robot
csit/suites/netvirt/Netvirt_Vpnservice/BFD_Monitoring.robot
csit/suites/openstack/connectivity/01_l2_tests.robot
csit/suites/openstack/connectivity/02_l3_tests.robot
csit/suites/openstack/connectivity/03_external_network_tests.robot
csit/suites/openstack/connectivity/04_security_group_tests.robot
csit/suites/openstack/extensions/sfc.robot
csit/suites/openstack/tempest/tempest.robot
csit/variables/Variables.robot

index 8e2b8a6e941564f3a34bdb3ecc84bf8b3bb69bf2..24bb1a344b432677c72c74dcc9678b378b650e51 100644 (file)
@@ -63,6 +63,6 @@ Write Commands Until Prompt
     Log    ${cmd}
     SSHLibrary.Set Client Configuration    timeout=${timeout}
     SSHLibrary.Read
-    SSHLibrary.Write    ${cmd}
+    SSHLibrary.Write    ${cmd};echo Command Returns $?
     ${output}=    SSHLibrary.Read Until Prompt
     [Return]    ${output}
index 105d9702e6b6f0f76d47ab6e571363784af5aae7..d6dec4a78a464744d1d48ff2e5059c02eb41a3ff 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
 Documentation     Openstack library. This library is useful for tests to create network, subnet, router and vm instances
+Library           Collections
 Library           SSHLibrary
 Resource          DataModels.robot
 Resource          Utils.robot
@@ -17,7 +18,7 @@ Get Tenant ID From Security Group
     [Documentation]    Returns tenant ID by reading it from existing default security-group.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron security-group-show default | grep "| tenant_id" | awk '{print $4}'
+    ${output}=    Write Commands Until Prompt    openstack security group show default | grep "| tenant_id" | awk '{print $4}'
     Log    ${output}
     [Return]    ${output}
 
@@ -33,9 +34,9 @@ Create Network
     [Documentation]    Create Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${command}    Set Variable If    "${verbose}" == "TRUE"    neutron -v net-create ${network_name} ${additional_args}    neutron net-create ${network_name} ${additional_args} | grep -w id | awk '{print $4}'
-    ${output}=    Write Commands Until Prompt    ${command}    30s
+    ${output}=    Write Commands Until Prompt    openstack network create ${network_name} ${additional_args}    30s
     Log    ${output}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
     [Return]    ${output}
 
 Update Network
@@ -43,7 +44,8 @@ Update Network
     [Documentation]    Update Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v net-update ${network_name} ${additional_args}    30s
+    ${cmd}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton'    neutron -v net-update ${network_name} ${additional_args}    openstack network set ${network_name} ${additional_args}
+    ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
@@ -53,7 +55,7 @@ Show Network
     [Documentation]    Show Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v net-show ${network_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack network show ${network_name}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
@@ -62,7 +64,7 @@ List Networks
     [Documentation]    List networks and return output with neutron client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron net-list    30s
+    ${output}=    Write Commands Until Prompt    openstack network list    30s
     Close Connection
     Log    ${output}
     [Return]    ${output}
@@ -71,7 +73,7 @@ List Subnets
     [Documentation]    List subnets and return output with neutron client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron subnet-list    30s
+    ${output}=    Write Commands Until Prompt    openstack subnet list    30s
     Close Connection
     Log    ${output}
     [Return]    ${output}
@@ -81,27 +83,28 @@ Delete Network
     [Documentation]    Delete Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v net-delete ${network_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack network delete ${network_name}    30s
     Close Connection
     Log    ${output}
-    Should Match Regexp    ${output}    Deleted network: ${network_name}|Deleted network\\(s\\): ${network_name}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Create SubNet
     [Arguments]    ${network_name}    ${subnet}    ${range_ip}    ${additional_args}=${EMPTY}
     [Documentation]    Create SubNet for the Network with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} ${additional_args}    30s
+    ${output}=    Write Commands Until Prompt    openstack subnet create --network ${network_name} --subnet-range ${range_ip} ${subnet} ${additional_args}    30s
     Close Connection
     Log    ${output}
-    Should Contain    ${output}    Created a new subnet
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Update SubNet
     [Arguments]    ${subnet_name}    ${additional_args}=${EMPTY}
     [Documentation]    Update subnet with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v subnet-update ${subnet_name} ${additional_args}    30s
+    ${cmd}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton'    neutron -v subnet-update ${subnet_name} ${additional_args}    openstack subnet set ${subnet_name} ${additional_args}
+    ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
@@ -111,27 +114,34 @@ Show SubNet
     [Documentation]    Show subnet with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v subnet-show ${subnet_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack subnet show ${subnet_name}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
 
 Create Port
-    [Arguments]    ${network_name}    ${port_name}    ${sg}=default    ${additional_args}=${EMPTY}
+    [Arguments]    ${network_name}    ${port_name}    ${sg}=default    ${additional_args}=${EMPTY}    ${allowed_address_pairs}=${EMPTY}
     [Documentation]    Create Port with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v port-create ${network_name} --name ${port_name} --security-group ${sg} ${additional_args}    30s
+    # if allowed_address_pairs is not empty we need to create the arguments to pass to the port create command. They are
+    # in a different format with the neutron vs openstack cli.
+    ${address_pair_length}=    Get Length    ${allowed_address_pairs}
+    ${allowed_pairs_argv}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton' and '${address_pair_length}'=='2'    --allowed-address-pairs type=dict list=true ip_address=@{allowed_address_pairs}[0] ip_address=@{allowed_address_pairs}[1]
+    ${allowed_pairs_argv}=    Set Variable If    '${OPENSTACK_BRANCH}'!='stable/newton' and '${address_pair_length}'=='2'    --allowed-address ip-address=@{allowed_address_pairs}[0] --allowed-address ip-address=@{allowed_address_pairs}[1]    ${allowed_pairs_argv}
+    ${allowed_pairs_argv}=    Set Variable If    '${address_pair_length}'=='0'    ${EMPTY}    ${allowed_pairs_argv}
+    ${cmd}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton'    neutron -v port-create ${network_name} --name ${port_name} --security-group ${sg} ${additional_args} ${allowed_pairs_argv}    openstack port create --network ${network_name} ${port_name} --security-group ${sg} ${additional_args} ${allowed_pairs_argv}
+    ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Close Connection
     Log    ${output}
-    Should Contain    ${output}    Created a new port
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Update Port
     [Arguments]    ${port_name}    ${additional_args}=${EMPTY}
     [Documentation]    Update port with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v port-update ${port_name} ${additional_args}    30s
+    ${output}=    Write Commands Until Prompt    openstack port set ${port_name} ${additional_args}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
@@ -141,7 +151,7 @@ Show Port
     [Documentation]    Show port with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v port-show ${port_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack port show ${port_name}    30s
     Log    ${output}
     Close Connection
     [Return]    ${output}
@@ -151,16 +161,16 @@ Delete Port
     [Documentation]    Delete Port with neutron request.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v port-delete ${port_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack port delete ${port_name}    30s
     Close Connection
     Log    ${output}
-    Should Match Regexp    ${output}    Deleted port: ${port_name}|Deleted port\\(s\\): ${port_name}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 List Ports
     [Documentation]    List ports and return output with neutron client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron port-list    30s
+    ${output}=    Write Commands Until Prompt    openstack port list    30s
     Close Connection
     Log    ${output}
     [Return]    ${output}
@@ -169,6 +179,7 @@ List Nova VMs
     [Documentation]    List VMs and return output with nova client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
+    #TODO Change to Openstak CLI once the problem with Ocata is solved
     ${output}=    Write Commands Until Prompt    nova list    30s
     Close Connection
     Log    ${output}
@@ -181,13 +192,13 @@ Create And Associate Floating IPs
     Switch Connection    ${devstack_conn_id}
     ${ip_list}=    Create List    @{EMPTY}
     : FOR    ${vm}    IN    @{vm_list}
-    \    ${output}=    Write Commands Until Prompt    neutron floatingip-create ${external_net}    30s
+    \    ${output}=    Write Commands Until Prompt    openstack floating ip create ${external_net}    30s
     \    Log    ${output}
     \    @{ip}    Get Regexp Matches    ${output}    [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
     \    ${ip_length}    Get Length    ${ip}
     \    Run Keyword If    ${ip_length}>0    Append To List    ${ip_list}    @{ip}[0]
     \    ...    ELSE    Append To List    ${ip_list}    None
-    \    ${output}=    Write Commands Until Prompt    nova floating-ip-associate ${vm} @{ip}[0]    30s
+    \    ${output}=    Write Commands Until Prompt    openstack server add floating ip ${vm} @{ip}[0]    30s
     \    Log    ${output}
     [Return]    ${ip_list}
 
@@ -218,10 +229,10 @@ Delete SubNet
     Log    ${subnet}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v subnet-delete ${subnet}
+    ${output}=    Write Commands Until Prompt    openstack subnet delete ${subnet}
     Close Connection
     Log    ${output}
-    Should Match Regexp    ${output}    Deleted subnet: ${subnet}|Deleted subnet\\(s\\): ${subnet}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Verify No Gateway Ips
     [Documentation]    Verifies the Gateway Ips removed with dump flow.
@@ -235,14 +246,14 @@ Delete Vm Instance
     [Documentation]    Delete Vm instances using instance names.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova force-delete ${vm_name}    40s
+    ${output}=    Write Commands Until Prompt    openstack server delete ${vm_name}    40s
     Close Connection
 
 Get Net Id
     [Arguments]    ${network_name}    ${devstack_conn_id}
     [Documentation]    Retrieve the net id for the given network name to create specific vm instance
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron net-list | grep "${network_name}" | awk '{print $2}'    30s
+    ${output}=    Write Commands Until Prompt    openstack network list | grep "${network_name}" | awk '{print $2}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${net_id}=    Get from List    ${splitted_output}    0
@@ -253,7 +264,7 @@ Get Subnet Id
     [Arguments]    ${subnet_name}    ${devstack_conn_id}
     [Documentation]    Retrieve the subnet id for the given subnet name
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron subnet-list | grep "${subnet_name}" | awk '{print $2}'    30s
+    ${output}=    Write Commands Until Prompt    openstack subnet show "${subnet_name}" | grep " id " | awk '{print $4}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${subnet_id}=    Get from List    ${splitted_output}    0
@@ -264,7 +275,7 @@ Get Port Id
     [Arguments]    ${port_name}    ${devstack_conn_id}
     [Documentation]    Retrieve the port id for the given port name to attach specific vm instance to a particular port
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $2}'    30s
+    ${output}=    Write Commands Until Prompt    openstack port list | grep "${port_name}" | awk '{print $2}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${port_id}=    Get from List    ${splitted_output}    0
@@ -275,7 +286,7 @@ Get Router Id
     [Arguments]    ${router1}    ${devstack_conn_id}
     [Documentation]    Retrieve the router id for the given router name
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron router-list | grep "${router1}" | awk '{print $2}'    30s
+    ${output}=    Write Commands Until Prompt    openstack router list | grep "${router1}" | awk '{print $2}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${router_id}=    Get from List    ${splitted_output}    0
@@ -289,7 +300,7 @@ Create Vm Instances
     Switch Connection    ${devstack_conn_id}
     ${net_id}=    Get Net Id    ${net_name}    ${devstack_conn_id}
     : FOR    ${VmElement}    IN    @{vm_instance_names}
-    \    ${output}=    Write Commands Until Prompt    nova boot --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-groups ${sg}    30s
+    \    ${output}=    Write Commands Until Prompt    openstack server create --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${VmElement} --security-group ${sg}    30s
     \    Log    ${output}
 
 Create Vm Instance With Port
@@ -298,7 +309,7 @@ Create Vm Instance With Port
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
     ${port_id}=    Get Port Id    ${port_name}    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg}    30s
+    ${output}=    Write Commands Until Prompt    openstack server create --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg}    30s
     Log    ${output}
 
 Create Vm Instance With Ports
@@ -308,7 +319,7 @@ Create Vm Instance With Ports
     Switch Connection    ${devstack_conn_id}
     ${port_id}=    Get Port Id    ${port_name}    ${devstack_conn_id}
     ${port2_id}=    Get Port Id    ${port2_name}    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} --nic port-id=${port2_id} ${vm_instance_name} --security-groups ${sg}    30s
+    ${output}=    Write Commands Until Prompt    openstack server create --image ${image} --flavor ${flavor} --nic port-id=${port_id} --nic port-id=${port2_id} ${vm_instance_name} --security-group ${sg}    30s
     Log    ${output}
 
 Create Vm Instance With Port On Compute Node
@@ -318,7 +329,7 @@ Create Vm Instance With Port On Compute Node
     Switch Connection    ${devstack_conn_id}
     ${port_id}=    Get Port Id    ${port_name}    ${devstack_conn_id}
     ${hostname_compute_node}=    Run Command On Remote System    ${compute_node}    hostname
-    ${output}=    Write Commands Until Prompt    nova boot --image ${image} --flavor ${flavor} --nic port-id=${port_id} ${vm_instance_name} --security-groups ${sg} --availability-zone nova:${hostname_compute_node}    30s
+    ${output}=    Write Commands Until Prompt    openstack server create --image ${image} --flavor ${flavor} --nic port-id=${port_id} --security-group ${sg} --availability-zone nova:${hostname_compute_node} ${vm_instance_name}    30s
     Log    ${output}
 
 Verify VM Is ACTIVE
@@ -326,6 +337,7 @@ Verify VM Is ACTIVE
     [Documentation]    Run these commands to check whether the created vm instance is active or not.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
+    #TODO Change to Openstack CLI Command once the Ocata Issue is resolved
     ${output}=    Write Commands Until Prompt    nova show ${vm_name} | grep OS-EXT-STS:vm_state    30s
     Log    ${output}
     Should Contain    ${output}    active
@@ -340,13 +352,13 @@ Collect VM IP Addresses
     Switch Connection    ${devstack_conn_id}
     ${ip_list}    Create List    @{EMPTY}
     : FOR    ${vm}    IN    @{vm_list}
-    \    ${vm_ip_line}=    Write Commands Until Prompt    nova console-log ${vm} | grep -i "obtained"    30s
+    \    ${vm_ip_line}=    Write Commands Until Prompt    openstack console log show ${vm} | grep -i "obtained"    30s
     \    Log    ${vm_ip_line}
     \    @{vm_ip}    Get Regexp Matches    ${vm_ip_line}    [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
     \    ${vm_ip_length}    Get Length    ${vm_ip}
     \    Run Keyword If    ${vm_ip_length}>0    Append To List    ${ip_list}    @{vm_ip}[0]
     \    ...    ELSE    Append To List    ${ip_list}    None
-    \    ${dhcp_ip_line}=    Write Commands Until Prompt    nova console-log ${vm} | grep "^nameserver"    30s
+    \    ${dhcp_ip_line}=    Write Commands Until Prompt    openstack console log show ${vm} | grep "^nameserver"    30s
     \    Log    ${dhcp_ip_line}
     \    ${dhcp_ip}    Get Regexp Matches    ${dhcp_ip_line}    [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
     \    ${dhcp_ip_length}    Get Length    ${dhcp_ip}
@@ -385,7 +397,7 @@ View Vm Console
     : FOR    ${VmElement}    IN    @{vm_instance_names}
     \    ${output}=    Write Commands Until Prompt    nova show ${VmElement}
     \    Log    ${output}
-    \    ${output}=    Write Commands Until Prompt    nova console-log ${VmElement}
+    \    ${output}=    Write Commands Until Prompt    openstack console log show ${VmElement}
     \    Log    ${output}
 
 Ping Vm From DHCP Namespace
@@ -551,15 +563,15 @@ Create Router
     [Documentation]    Create Router and Add Interface to the subnets.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v router-create ${router_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack router create ${router_name}    30s
     Close Connection
-    Should Contain    ${output}    Created a new router
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 List Router
     [Documentation]    List Router and return output with neutron client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron router-list    30s
+    ${output}=    Write Commands Until Prompt    openstack router list    30s
     Close Connection
     Log    ${output}
     [Return]    ${output}
@@ -568,52 +580,53 @@ Add Router Interface
     [Arguments]    ${router_name}    ${interface_name}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v router-interface-add ${router_name} ${interface_name}
+    ${output}=    Write Commands Until Prompt    openstack router add subnet ${router_name} ${interface_name}
     Close Connection
-    Should Contain    ${output}    Added interface
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Show Router Interface
     [Arguments]    ${router_name}
     [Documentation]    List Router interface associated with given Router and return output with neutron client.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron router-port-list ${router_name} -f csv    30s
+    ${output}=    Write Commands Until Prompt    openstack port list --router ${router_name}    30s
     Close Connection
     Log    ${output}
     [Return]    ${output}
 
 Add Router Gateway
-    [Arguments]    ${router_name}    ${network_name}
+    [Arguments]    ${router_name}    ${external_network_name}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v router-gateway-set ${router_name} ${network_name}
+    ${cmd}=    Set Variable If    '${OPENSTACK_BRANCH}'=='stable/newton'    neutron -v router-gateway-set ${router_name} ${external_network_name}    openstack router set ${router_name} --external-gateway ${external_network_name}
+    ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Close Connection
-    Should Contain    ${output}    Set gateway
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Remove Interface
     [Arguments]    ${router_name}    ${interface_name}
     [Documentation]    Remove Interface to the subnets.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v router-interface-delete ${router_name} ${interface_name}
+    ${output}=    Write Commands Until Prompt    openstack router remove subnet ${router_name} ${interface_name}
     Close Connection
-    Should Contain    ${output}    Removed interface from router
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Update Router
     [Arguments]    ${router_name}    ${cmd}
     [Documentation]    Update the router with the command. Router name and command should be passed as argument.
     ${devstack_conn_id} =    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output} =    Write Commands Until Prompt    neutron router-update ${router_name} ${cmd}    30s
+    ${output} =    Write Commands Until Prompt    openstack router set ${router_name} ${cmd}    30s
     Close Connection
-    Should Contain    ${output}    Updated
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Show Router
     [Arguments]    ${router_name}    ${options}
     [Documentation]    Show information of a given router. Router name and optional fields should be sent as arguments.
     ${devstack_conn_id} =    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output} =    Write Commands Until Prompt    neutron router-show ${router_name} ${options}    30s
+    ${output} =    Write Commands Until Prompt    openstack router show ${router_name}    30s
     Log    ${output}
     Close Connection
 
@@ -622,9 +635,9 @@ Delete Router
     [Documentation]    Delete Router and Interface to the subnets.
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron -v router-delete ${router_name}    60s
+    ${output}=    Write Commands Until Prompt    openstack router delete ${router_name}    60s
     Close Connection
-    Should Match Regexp    ${output}    Deleted router: ${router_name}|Deleted router\\(s\\): ${router_name}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
 
 Get DumpFlows And Ovsconfig
     [Arguments]    ${openstack_node_ip}
@@ -714,22 +727,22 @@ Create Security Group
     [Arguments]    ${sg_name}    ${desc}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova secgroup-create ${sg_name} ${desc}    40s
+    ${output}=    Write Commands Until Prompt    openstack security group create ${sg_name} --description ${desc}    40s
     Close Connection
 
 Create Security Rule
     [Arguments]    ${direction}    ${protocol}    ${min_port}    ${max_port}    ${remote_ip}    ${sg_name}
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron security-group-rule-create --direction ${direction} --protocol ${protocol} --port-range-min ${min_port} --port-range-max ${max_port} --remote-ip-prefix ${remote_ip} ${sg_name}
+    ${output}=    Write Commands Until Prompt    openstack security group rule create --${direction} --protocol ${protocol} --dst-port ${min_port}:${max_port} --remote-ip ${remote_ip} ${sg_name}
     Close Connection
 
 Neutron Security Group Show
-    [Arguments]    ${SecurityGroupRuleName}    ${additional_args}=${EMPTY}
+    [Arguments]    ${SecurityGroupRuleName}
     [Documentation]    Displays the neutron security group configurations that belongs to a given neutron security group name
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${cmd}=    Set Variable    neutron security-group-show ${SecurityGroupRuleName} ${additional_args}
+    ${cmd}=    Set Variable    openstack security group show ${SecurityGroupRuleName}
     Log    ${cmd}
     ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
@@ -737,11 +750,11 @@ Neutron Security Group Show
     [Return]    ${output}
 
 Neutron Port Show
-    [Arguments]    ${PortName}    ${additional_args}=${EMPTY}
+    [Arguments]    ${PortName}
     [Documentation]    Display the port configuration that belong to a given neutron port
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${cmd}=    Set Variable    neutron port-show ${PortName} ${additional_args}
+    ${cmd}=    Set Variable    openstack port show ${PortName}
     Log    ${cmd}
     ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
@@ -753,11 +766,11 @@ Neutron Security Group Create
     [Documentation]    Create a security group with specified name ,description & protocol value according to security group template
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${cmd}=    Set Variable    neutron security-group-create ${SecurityGroupName} ${additional_args}
+    ${cmd}=    Set Variable    openstack security group create ${SecurityGroupName} ${additional_args}
     Log    ${cmd}
     ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
-    Should Contain    ${output}    Created a new security_group
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
     ${sgp_id}=    Should Match Regexp    ${output}    [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
     Log    ${sgp_id}
     Close Connection
@@ -768,7 +781,7 @@ Neutron Security Group Update
     [Documentation]    Updating security groups
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${cmd}=    Set Variable    neutron security-group-update ${SecurityGroupName} ${additional_args}
+    ${cmd}=    Set Variable    openstack security group set ${SecurityGroupName} ${additional_args}
     Log    ${cmd}
     ${output}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${output}
@@ -780,12 +793,50 @@ Delete SecurityGroup
     [Documentation]    Delete Security group
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    neutron security-group-delete ${sg_name}    40s
+    ${output}=    Write Commands Until Prompt    openstack security group delete ${sg_name}    40s
     Log    ${output}
-    Should Match Regexp    ${output}    Deleted security_group: ${sg_name}|Deleted security_group\\(s\\): ${sg_name}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
     Close Connection
 
 Neutron Security Group Rule Create
+    [Arguments]    ${Security_group_name}    &{Kwargs}
+    [Documentation]    Creates neutron security rule with Openstack CLI with or without optional params, here security group name is mandatory args, rule with optional params can be created by passing the optional args values ex: direction=${INGRESS_EGRESS}, Then these optional params are catenated with mandatory args, example of usage: "Neutron Security Group Rule Create ${SGP_SSH} direction=${RULE_PARAMS[0]} ethertype=${RULE_PARAMS[1]} ..."
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    Run Keyword If    ${Kwargs}    Log    ${Kwargs}
+    ${description}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    description    default=${None}
+    ${direction}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    direction    default=${None}
+    ${ethertype}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    ethertype    default=${None}
+    ${port_range_max}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    port_range_max    default=${None}
+    ${port_range_min}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    port_range_min    default=${None}
+    ${protocol}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    protocol    default=${None}
+    ${remote_group_id}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    remote_group_id    default=${None}
+    ${remote_ip_prefix}    Run Keyword If    ${Kwargs}    Pop From Dictionary    ${Kwargs}    remote_ip_prefix    default=${None}
+    ${cmd}=    Set Variable    openstack security group rule create ${Security_group_name}
+    ${cmd}=    Run Keyword If    '${description}'!='None'    Catenate    ${cmd}    --description ${description}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${direction}'!='None'    Catenate    ${cmd}    --${direction}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${ethertype}'!='None'    Catenate    ${cmd}    --ethertype ${ethertype}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${port_range_min}'!='None' and '${port_range_max}'!='None'    Catenate    ${cmd}    --dst-port ${port_range_min}:${port_range_max}
+    ...    ELSE IF    '${port_range_max}'!='None'    Catenate    ${cmd}    --dst-port ${port_range_max}
+    ...    ELSE IF    '${port_range_min}'!='None'    Catenate    ${cmd}    --dst-port ${port_range_min}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${protocol}'!='None'    Catenate    ${cmd}    --protocol ${protocol}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${remote_group_id}'!='None'    Catenate    ${cmd}    --remote-group ${remote_group_id}
+    ...    ELSE    Catenate    ${cmd}
+    ${cmd}=    Run Keyword If    '${remote_ip_prefix}'!='None'    Catenate    ${cmd}    --remote-ip ${remote_ip_prefix}
+    ...    ELSE    Catenate    ${cmd}
+    ${output}=    Write Commands Until Prompt    ${cmd}    30s
+    ${rule_id}=    Should Match Regexp    ${output}    [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
+    Log    ${rule_id}
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
+    Close Connection
+    [Return]    ${output}    ${rule_id}
+
+Neutron Security Group Rule Create Legacy Cli
     [Arguments]    ${Security_group_name}    &{Kwargs}
     [Documentation]    Creates neutron security rule with neutron request with or without optional params, here security group name is mandatory args, rule with optional params can be created by passing the optional args values ex: direction=${INGRESS_EGRESS}, Then these optional params are catenated with mandatory args, example of usage: "Neutron Security Group Rule Create ${SGP_SSH} direction=${RULE_PARAMS[0]} ethertype=${RULE_PARAMS[1]} ..."
     ${devstack_conn_id}=    Get ControlNode Connection
@@ -851,7 +902,7 @@ Create Neutron Port With Additional Params
     Log    ${cmd}
     ${OUTPUT}=    Write Commands Until Prompt    ${cmd}    30s
     Log    ${OUTPUT}
-    Should Contain    ${output}    Created a new port
+    Should Contain    ${output}    ${OS_CMD_SUCCESS}
     ${port_id}=    Should Match Regexp    ${OUTPUT}    [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
     Log    ${port_id}
     Close Connection
@@ -883,7 +934,7 @@ Get Port Mac
     [Arguments]    ${port_name}    ${conn_id}=${devstack_conn_id}
     [Documentation]    Keyword would return the MAC ID of the ${port_name} received.
     Switch Connection    ${conn_id}
-    ${output}=    Write Commands Until Prompt    neutron port-list | grep "${port_name}" | awk '{print $6}'    30s
+    ${output}=    Write Commands Until Prompt    openstack port show ${port_name} | grep mac_address | awk '{print $4}'    30s
     Log    ${output}
     ${splitted_output}=    Split String    ${output}    ${EMPTY}
     ${port_mac}=    Get from List    ${splitted_output}    0
@@ -1115,7 +1166,7 @@ Reboot Nova VM
     [Documentation]    Reboot NOVA VM
     ${devstack_conn_id}=    Get ControlNode Connection
     Switch Connection    ${devstack_conn_id}
-    ${output}=    Write Commands Until Prompt    nova reboot --poll ${vm_name}    30s
+    ${output}=    Write Commands Until Prompt    openstack server reboot --wait ${vm_name}    30s
     Log    ${output}
     Wait Until Keyword Succeeds    35s    10s    Verify VM Is ACTIVE    ${vm_name}
     Close Connection
index 8f9065cdc6a3dfc175bd3d827a290d85840f939b..4dd85ea968fb9440b761adaccfcd1a7508639d11 100644 (file)
@@ -257,9 +257,9 @@ Create SecurityGroup
     [Arguments]    ${sg_name}
     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
     Neutron Security Group Create    ${sg_name}
-    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${sg_name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${sg_name}    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${sg_name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${sg_name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    ${sg_name}    direction=egress    protocol=icmp
+    Neutron Security Group Rule Create    ${sg_name}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    ${sg_name}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
index d9484ff15b92dc3e1965c2a61f648d1b63a1b39b..7006c1a95dc0d79a55e3065961df596d64e30018 100644 (file)
@@ -35,8 +35,8 @@ Resource          ../../../variables/netvirt/Variables.robot
 @{EXTRA_NW_SUBNET}    40.1.1.0/24    50.1.1.0/24
 ${SECURITY_GROUP}    sg-vpnservice
 # Values passed for extra routes
-${RT_OPTIONS}     --routes type=dict list=true
-${RT_CLEAR}       --routes action=clear
+${RT_OPTIONS}     --route
+${RT_CLEAR}       --no-route
 ${ARP_RESPONSE_REGEX}    arp,arp_op=2 actions=CONTROLLER:65535,resubmit\\(,${DISPATCHER_TABLE}\\)
 ${ARP_REQUEST_REGEX}    arp,arp_op=1 actions=group:\\d+
 ${ARP_REQUEST_GROUP_REGEX}    actions=CONTROLLER:65535,bucket=actions=resubmit\\(,${DISPATCHER_TABLE}\\),bucket=actions=resubmit\\(,${ARP_RESPONSE_TABLE}\\)
@@ -76,26 +76,30 @@ Create Neutron Subnets
 Add Ssh Allow Rule
     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
     Neutron Security Group Create    ${SECURITY_GROUP}
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    protocol=icmp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
 
 Create Neutron Ports
     [Documentation]    Create four ports under previously created subnets
-    ${allowed_address_pairs_args}=    Set Variable    --allowed-address-pairs type=dict list=true ip_address=${EXTRA_NW_SUBNET[0]} ip_address=${EXTRA_NW_SUBNET[1]}
-    Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    ${allowed_address_pairs_args}=    Set Variable    --allowed-address ip_address=${EXTRA_NW_SUBNET[0]} --allowed-address ip_address=${EXTRA_NW_SUBNET[1]}
+    ${allowed_address_pairs_os_cli}=    Set Variable    --allowed-address ip-address=${EXTRA_NW_SUBNET[0]} --allowed-address ip-address=${EXTRA_NW_SUBNET[1]}
+    Run Keyword If    '${OPENSTACK_BRANCH}'=='stable/newton'    Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    ...    ELSE    Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_os_cli}
+    Run Keyword If    '${OPENSTACK_BRANCH}'=='stable/newton'    Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    ...    ELSE    Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_os_cli}
+    Run Keyword If    '${OPENSTACK_BRANCH}'=='stable/newton'    Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    ...    ELSE    Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_os_cli}
+    Run Keyword If    '${OPENSTACK_BRANCH}'=='stable/newton'    Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    ...    ELSE    Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_os_cli}
     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${CONFIG_API}/neutron:neutron/ports/    ${PORT_LIST}
     ${PORTS_MACADDR} =    Get Ports MacAddr    ${PORT_LIST}
     Set Suite Variable    ${PORTS_MACADDR}
     Update Port    ${PORT_LIST[0]}    additional_args=--description ${UPDATE_PORT}
     ${output} =    Show Port    ${PORT_LIST[0]}
-    Should Contain    ${output}    ${UPDATE_PORT}
 
 Create Nova VMs
     [Documentation]    Create Vm instances on compute node with port
@@ -151,9 +155,6 @@ Add Interfaces To Router
     : FOR    ${INTERFACE}    IN    @{SUBNETS}
     \    Add Router Interface    ${ROUTERS[0]}    ${INTERFACE}
     ${interface_output} =    Show Router Interface    ${ROUTERS[0]}
-    : FOR    ${INTERFACE}    IN    @{SUBNETS}
-    \    ${subnet_id} =    Get Subnet Id    ${INTERFACE}    ${devstack_conn_id}
-    \    Should Contain    ${interface_output}    ${subnet_id}
     ${GWMAC_ADDRS}    ${GWIP_ADDRS} =    Get Gateway MAC And IP Address    ${ROUTERS[0]}
     Log    ${GWMAC_ADDRS}
     Set Suite Variable    ${GWMAC_ADDRS}
@@ -191,9 +192,9 @@ Add Multiple Extra Routes And Check Datapath Before L3VPN Creation
     ${CONFIG_EXTRA_ROUTE_IP2} =    Catenate    sudo ifconfig eth0:2 @{EXTRA_NW_IP}[1] netmask 255.255.255.0 up
     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP2}
     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ifconfig
-    ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
-    ${EXT_RT2} =    Set Variable    destination=50.1.1.0/24,nexthop=${VM_IP_NET10[0]}
-    ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${EXT_RT2}
+    ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
+    ${EXT_RT2} =    Set Variable    destination=50.1.1.0/24,gateway=${VM_IP_NET10[0]}
+    ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}    ${RT_OPTIONS}    ${EXT_RT2}
     Update Router    @{ROUTERS}[0]    ${cmd}
     Show Router    @{ROUTERS}[0]    -D
     Log    "Verify FIB table"
@@ -216,7 +217,7 @@ Delete And Recreate Extra Route
     Log    "Adding extra route to VM"
     ${CONFIG_EXTRA_ROUTE_IP1} =    Catenate    sudo ifconfig eth0:1 @{EXTRA_NW_IP}[0] netmask 255.255.255.0 up
     ${output} =    Execute Command on VM Instance    @{NETWORKS}[0]    ${VM_IP_NET10[0]}    ${CONFIG_EXTRA_ROUTE_IP1}
-    ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,nexthop=${VM_IP_NET10[0]}
+    ${EXT_RT1} =    Set Variable    destination=40.1.1.0/24,gateway=${VM_IP_NET10[0]}
     ${cmd} =    Catenate    ${RT_OPTIONS}    ${EXT_RT1}
     Update Router    @{ROUTERS}[0]    ${cmd}
     Show Router    @{ROUTERS}[0]    -D
index 01071fd2b2e89d40dae78eb1562fb4365e5efa0b..c836101c69dc2cc996f593a7eb1b19ad02f8df47 100644 (file)
@@ -149,19 +149,18 @@ Create Setup
     : FOR    ${subnet}    IN    @{SUBNETS}
     \    Should Contain    ${SUB_LIST}    ${subnet}
     Neutron Security Group Create    ${SECURITY_GROUP}
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    ${allowed_address_pairs_args}=    Set Variable    --allowed-address-pairs type=dict list=true ip_address=@{EXTRA_NW_IP}[0] ip_address=@{EXTRA_NW_IP}[1]
-    Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[2]}    ${PORT_LIST[4]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
-    Create Port    ${NETWORKS[2]}    ${PORT_LIST[5]}    sg=${SECURITY_GROUP}    additional_args=${allowed_address_pairs_args}
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    protocol=icmp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    ${SECURITY_GROUP}    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
+    Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
+    Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
+    Create Port    ${NETWORKS[1]}    ${PORT_LIST[2]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
+    Create Port    ${NETWORKS[1]}    ${PORT_LIST[3]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
+    Create Port    ${NETWORKS[1]}    ${PORT_LIST[4]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
+    Create Port    ${NETWORKS[1]}    ${PORT_LIST[5]}    sg=${SECURITY_GROUP}    allowed_address_pairs=@{EXTRA_NW_IP}
     Create Vm Instance With Port On Compute Node    ${PORT_LIST[0]}    ${VM_INSTANCES_NET1[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
     Create Vm Instance With Port On Compute Node    ${PORT_LIST[1]}    ${VM_INSTANCES_NET1[1]}    ${OS_COMPUTE_2_IP}    sg=${SECURITY_GROUP}
     Create Vm Instance With Port On Compute Node    ${PORT_LIST[2]}    ${VM_INSTANCES_NET2[0]}    ${OS_COMPUTE_1_IP}    sg=${SECURITY_GROUP}
index 19dd51934e06195cd67f90273699c19f61e5efd8..6fcd7639e2198b61e27b92c17c4866043398df54 100644 (file)
@@ -249,12 +249,12 @@ Create Setup
     Should Contain    ${SUB_LIST}    ${SUBNETS[1]}
     Wait Until Keyword Succeeds    3s    1s    Check For Elements At URI    ${SUBNETWORK_URL}    ${SUBNETS}
     Neutron Security Group Create    sg-vpnservice1
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    protocol=icmp
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    sg-vpnservice1    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
     Log    Create four ports under previously created subnets
     Create Port    ${NETWORKS[0]}    ${PORT_LIST[0]}    sg=sg-vpnservice1
     Create Port    ${NETWORKS[0]}    ${PORT_LIST[1]}    sg=sg-vpnservice1
index ed6fcfd32cf38df97bde29c9f81931708b423ab9..3de76c2ca6e61596573e4f2d79299cc01c4a2094 100644 (file)
@@ -33,7 +33,7 @@ Create VLAN Network (l2_network_1)
     \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
     \    Exit For Loop If    '${feature_check_status}' == 'True'
     Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
-    ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
+    ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
 
 Create VXLAN Network (l2_network_2)
     [Documentation]    Create Network with neutron request.
@@ -50,12 +50,12 @@ Create Subnets For l2_network_2
 Add Ssh Allow Rule
     [Documentation]    Allow all TCP/UDP/ICMP packets for this suite
     Neutron Security Group Create    csit
-    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    csit    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    csit    direction=egress    protocol=icmp
+    Neutron Security Group Rule Create    csit    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    csit    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
 
 Create Vm Instances For l2_network_1
     [Documentation]    Create Four Vm instances using flavor and image names for a network.
index 63bbfc707a4b8e9f55602118f1c8620819ba0f7c..c8825d2af52d1c7739f9926d1b40358ecb624d31 100644 (file)
@@ -33,7 +33,7 @@ Create VLAN Network (network_1)
     \    ${feature_check_status}=    Run Keyword And Return Status    Verify Feature Is Installed    ${feature_name}
     \    Exit For Loop If    '${feature_check_status}' == 'True'
     Run Keyword If    '${feature_check_status}' == 'True'    Create Network    @{NETWORKS_NAME}[0]
-    ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider:network_type=vlan --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} --provider:segmentation_id=${network1_vlan_id}
+    ...    ELSE    Create Network    @{NETWORKS_NAME}[0]    --provider-network-type vlan --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK} --provider-segment ${network1_vlan_id}
 
 Create VXLAN Network (network_2)
     [Documentation]    Create Network with neutron request.
index fe81f16778ec0d347ae5822ad7ffceb30b41dd52..3cd40936581af72eec5d46bfab020e7410e69da2 100644 (file)
@@ -78,7 +78,7 @@ Check Vm Instances Have Ip Address
     ...    AND    Get Test Teardown Debugs
 
 Create External Network And Subnet
-    Create Network    ${external_net_name} --router:external --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK}
+    Create Network    ${external_net_name}    --external --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
     Create Subnet    ${external_net_name}    ${external_subnet_name}    ${external_subnet}    --gateway ${external_gateway} --allocation-pool ${external_subnet_allocation_pool}
 
 Create Router
index b2aab03f31e3dfbd71801eae875b961be0fb5fda..e35feec8204f3484cdb8a81a2de4f9bd34528ab4 100644 (file)
@@ -36,8 +36,8 @@ Create Subnets For network_1
 Add TCP Allow Rules
     [Documentation]    Allow only TCP packets for this suite
     Security Group Create Without Default Security Rules    csit-remote-sgs
-    Neutron Security Group Rule Create    csit-remote-sgs    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    csit-remote-sgs    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    csit-remote-sgs    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    csit-remote-sgs    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
     Neutron Security Group Show    csit-remote-sgs
 
 Create Vm Instances For network_1
@@ -91,8 +91,8 @@ No Ping From Vm Instance2 To Vm Instance1
     Test Operations From Vm Instance    network_1    @{NET1_VM_IPS}[1]    ${VM1_LIST}    ping_should_succeed=${expect_ping_to_work}
 
 Add Ping Allow Rules With Remote SG (only between VMs)
-    Neutron Security Group Rule Create    csit-remote-sgs    direction=ingress    protocol=icmp    remote_group_id=csit-remote-sgs
-    Neutron Security Group Rule Create    csit-remote-sgs    direction=egress    protocol=icmp    remote_group_id=csit-remote-sgs
+    Neutron Security Group Rule Create Legacy Cli    csit-remote-sgs    direction=ingress    protocol=icmp    remote_group_id=csit-remote-sgs
+    Neutron Security Group Rule Create Legacy Cli    csit-remote-sgs    direction=egress    protocol=icmp    remote_group_id=csit-remote-sgs
     Neutron Security Group Show    csit-remote-sgs
 
 Verify No Ping From DHCP To Vm Instance1
@@ -116,7 +116,8 @@ Ping From Vm Instance2 To Vm Instance1
 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
-    Neutron Security Group Rule Create    additional-sg    direction=ingress    protocol=icmp    remote_ip_prefix=@{NET1_DHCP_IP}[0]/32
+    #TODO Remove this after the Newton jobs are removed, Openstack CLI with Newton lacks support to configure rule with remote_ip_prefix
+    Neutron Security Group Rule Create Legacy Cli    additional-sg    direction=ingress    protocol=icmp    remote_ip_prefix=@{NET1_DHCP_IP}[0]/32
     Neutron Security Group Show    additional-sg
     : FOR    ${VM}    IN    @{NET_1_VM_INSTANCES}
     \    Add Security Group To VM    ${VM}    additional-sg
index 28e712bf879b06a00827dad507ab22c3b4811513..51fd0c5380cdafda8369b19a5bfbf1051c419ed2 100644 (file)
@@ -34,12 +34,12 @@ Create Subnets For network_1
 Add Allow All Rules
     [Documentation]    Allow all packets for this suite
     Neutron Security Group Create    sg-sfc
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-sfc    direction=ingress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
-    Neutron Security Group Rule Create    sg-sfc    direction=egress    protocol=icmp    remote_ip_prefix=0.0.0.0/0
+    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=tcp
+    Neutron Security Group Rule Create    sg-sfc    direction=ingress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    sg-sfc    direction=egress    port_range_max=65535    port_range_min=1    protocol=udp
+    Neutron Security Group Rule Create    sg-sfc    direction=ingress    protocol=icmp
+    Neutron Security Group Rule Create    sg-sfc    direction=egress    protocol=icmp
 
 Create Neutron Ports
     [Documentation]    Precreate neutron ports to be used for SFC VMs
index 6e9f967697319989e21cce82ef4649ed7056db57..99847439b72d8f7a9114a6fd0fced667aa11c1ca 100644 (file)
@@ -93,7 +93,7 @@ Log In To Tempest Executor And Setup Test Environment
     ${source_pwd}    Set Variable    yes
     Set Suite Variable    ${source_pwd}
     # Tempest tests need an existing external network in order to create routers.
-    Create Network    ${external_net_name}    --router:external --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK}
+    Create Network    ${external_net_name}    --external --default --provider-network-type flat --provider-physical-network ${PUBLIC_PHYSICAL_NETWORK}
     Create Subnet    ${external_net_name}    ${external_subnet_name}    ${external_subnet}    --gateway ${external_gateway} --allocation-pool ${external_subnet_allocation_pool}
     List Networks
     ${control_node_conn_id}=    SSHLibrary.Open Connection    ${OS_CONTROL_NODE_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
index 5af57c9d660fb7f756d415f2368353c52f51dc57..ae05ff96c1ad29e9f554527fde5659ac3e0949ab 100644 (file)
@@ -130,6 +130,7 @@ ${OPERATIONAL_NODES_API}    /restconf/operational/opendaylight-inventory:nodes
 ${OPERATIONAL_NODES_NETVIRT}    /restconf/operational/network-topology:network-topology/topology/netvirt:1    \    # FIXME: Move to a separate Resource and add description.
 ${OPERATIONAL_TOPO_API}    /restconf/operational/network-topology:network-topology    # FIXME: Move to a separate Resource and add description.
 ${OS_SYSTEM_PROMPT}    \$    # Prompt substring specific to OpenStack systems.
+${OS_CMD_SUCCESS}    Command Returns 0
 ${OSREST}         /v2.0/networks    # FIXME: Move to a separate Neutron-related Resource and add description.
 ${OVSDBPORT}      6640    # Port number ODL uses for OVSDB protocol communication. TODO: Move to OVSDB-specific Resource.
 ${PASSWORD}       ${DEFAULT_PASSWORD}    # Deprecated. FIXME: Eradicate.