Connectivity Tests for the Openstack Jobs 48/37848/21
authorgvrangan <venkatrangang@hcl.com>
Tue, 19 Apr 2016 23:58:16 +0000 (23:58 +0000)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 25 Apr 2016 15:43:56 +0000 (15:43 +0000)
* Simple Connectivity Tests for netvirt 1-node and 3-node
* simple connectivity test for VTN

Change-Id: I4e1cd76fb51955b740b3c4d809b357448ba450f7
Signed-off-by: gvrangan <venkatrangang@hcl.com>
csit/libraries/DevstackUtils.robot
csit/libraries/OpenStackOperations.robot
csit/libraries/Utils.robot
csit/suites/openstack/connectivity/01_l2_tests.robot [new file with mode: 0644]
csit/suites/openstack/connectivity/02_l3_tests.robot [new file with mode: 0644]
csit/suites/ovsdb/Devstack_Tempest_Tests/01__single_node_devstack_tempest_tests.robot
csit/testplans/netvirt-1node-openstack.txt [new file with mode: 0644]
csit/testplans/netvirt-3node-openstack.txt [new file with mode: 0644]
csit/testplans/vtn-1node-openstack.txt [new file with mode: 0644]

index 62ef262093b4a93361681991b8eda1cb5180c596..61cc9850e0f042422b973a54ee38465149ba8d64 100644 (file)
@@ -24,6 +24,7 @@ ${CLEAN_DEVSTACK_HOST}    False
 *** Keywords ***
 Run Tempest Tests
     [Arguments]    ${tempest_regex}    ${timeout}=600s
+    [Documentation]  Execute the tempest tests
     Write Commands Until Prompt    cd /opt/stack/new/tempest
     Write Commands Until Prompt    sudo rm -rf /opt/stack/new/tempest/.testrepository
     Write Commands Until Prompt    sudo testr init
@@ -31,7 +32,14 @@ Run Tempest Tests
     Should Contain    ${results}    Failed: 0
     # TODO: also need to verify some non-zero pass count as well as other results are ok (e.g. skipped, etc)
 
+Devstack Suite Setup Tests
+    [Documentation]  Login to  the Openstack Control Node to run tempest suite
+    SSHLibrary.Open Connection    ${OS_CONTROL_NODE_IP}    prompt=${DEFAULT_LINUX_PROMPT}
+    Utils.Flexible SSH Login    ${OS_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
+    SSHLibrary.Set Client Configuration    timeout=${default_devstack_prompt_timeout}
+
 Devstack Suite Setup
+    [Documentation]  Login to  the Openstack Control Node to run tempest suite
     SSHLibrary.Open Connection    ${DEVSTACK_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}
     Utils.Flexible SSH Login    ${DEVSTACK_SYSTEM_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
     SSHLibrary.Set Client Configuration    timeout=${default_devstack_prompt_timeout}
@@ -95,6 +103,7 @@ Write Commands Until Prompt
     [Return]    ${output}
 
 Get Networking ODL Version Of Release
+    [Documentation]   Get version of ODL to be installed
     [Arguments]    ${version}
     # once Beryllium SR1 goes out, we can change beryllium-latest to use 0.4.2
     Return From Keyword If    "${version}" == "beryllium-latest"    beryllium-snapshot-0.4.2
@@ -110,6 +119,7 @@ Get Networking ODL Version Of Release
     Return From Keyword If    "${version}" == "helium"    helium
 
 Show Devstack Debugs
+    [Documentation]   Collect the devstack logs to debug in case of failure
     Write Commands Until Prompt    gunzip /opt/stack/logs/devstacklog.txt.gz
     Write Commands Until Prompt    tail -n2000 /opt/stack/logs/devstacklog.txt    timeout=600s
     Write Commands Until Prompt    grep 'distribution-karaf.*zip' /opt/stack/logs/devstacklog.txt
index 9d5a809b8b78e81fdc775e09277d6b8cf812bd17..fdc0dc1bae9524cdd0beea348319f69382707c71 100644 (file)
@@ -6,9 +6,9 @@ Variables         ../variables/Variables.py
 
 *** Keywords ***
 Create Network
-    [Arguments]    ${network_name}
+    [Arguments]    ${network_name}     ${devstack_path}=/opt/stack/new/devstack
     [Documentation]    Create Network with neutron request.
-    ${output}=    Write Commands Until Prompt    cd /opt/stack/new/devstack && cat localrc
+    ${output}=    Write Commands Until Prompt    cd ${devstack_path} && cat localrc
     Log    ${output}
     ${output}=    Write Commands Until Prompt    source openrc admin admin
     Log    ${output}
@@ -122,8 +122,9 @@ Ping From Instance
 
 Curl Metadata Server
     [Documentation]    Ping to the expected destination ip.
-    ${output}=   Write Commands Until Expected Prompt    curl http://169.254.169.254    $
-    Log    ${output}
+    ${output}=   Write Commands Until Expected Prompt    curl -i http://169.254.169.254    $
+    Write Commands Until Prompt    exit
+    Should Contain     ${output}     200
 
 Close Vm Instance
     [Documentation]    Exit the vm instance.
@@ -131,9 +132,9 @@ Close Vm Instance
     Log    ${output}
 
 Ssh Vm Instance
-    [Arguments]    ${net_id}    ${vm_ip}    ${user}=cirros    ${password}=cubswin:)
+    [Arguments]    ${net_id}    ${vm_ip}    ${user}=cirros    ${password}=cubswin:)     ${key_file}=test.pem
     [Documentation]    Login to the vm instance using ssh in the network.
-    ${output}=   Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ssh -i test.pem ${user}@${vm_ip}    (yes/no)?
+    ${output}=   Write Commands Until Expected Prompt    sudo ip netns exec qdhcp-${net_id} ssh -i ${key_file} ${user}@${vm_ip}    (yes/no)?
     Log    ${output}
     ${output}=   Write Commands Until Expected Prompt    yes    d:
     Log    ${output}
@@ -145,20 +146,33 @@ Ssh Vm Instance
     Log    ${output}
 
 Create Router
+    [Arguments]    ${router_name}
     [Documentation]    Create Router and Add Interface to the subnets.
-    ${output}=    Write Commands Until Prompt    neutron -v router-create router_1
-    Log    ${output}
-    : FOR    ${SubnetElement}    IN    @{SUBNETS_NAME}
-    \    ${output}=    Write Commands Until Prompt    neutron -v router-interface-add router_1 ${SubnetElement}
-    Log    ${output}
+    ${output}=    Write Commands Until Prompt    neutron -v router-create ${router_name}
+    Should Contain     ${output}     Created a new router
+
+Add Router Interface
+    [Arguments]    ${router_name}     ${interface_name}
+    ${output}=    Write Commands Until Prompt    neutron -v router-interface-add ${router_name} ${interface_name}
+    Should Contain     ${output}     Added interface
 
 Remove Interface
+    [Arguments]    ${router_name}     ${interface_name}
     [Documentation]    Remove Interface to the subnets.
-    : FOR    ${SubnetElement}    IN    @{SUBNETS_NAME}
-    \    ${output}=    Write Commands Until Prompt    neutron -v router-interface-delete router_1 ${SubnetElement}
-    \    Log    ${output}
+    ${output}=    Write Commands Until Prompt    neutron -v router-interface-delete ${router_name} ${interface_name}
+    Should Contain     ${output}     Removed interface from router
 
 Delete Router
+    [Arguments]    ${router_name}
     [Documentation]    Delete Router and Interface to the subnets.
-    ${output}=    Write Commands Until Prompt    neutron -v router-delete router_1
-    Log    ${output}
+    ${output}=    Write Commands Until Prompt    neutron -v router-delete ${router_name}
+    Should Contain     ${output}     Deleted router:
+
+Show Debugs
+    [Arguments]    ${vm_indices}
+    [Documentation]   Run these commands for debugging, it can list state of VM instances and ip information in control node
+    ${output}=   Write Commands Until Prompt     sudo ip netns list
+    Log     ${output}
+    : FOR    ${index}    IN    @{vm_indices}
+    \     ${output}=   Write Commands Until Prompt     nova show ${index}
+    \     Log    ${output}
index 4d57d466f90a3c4c43c4c78adba50f7a8419e135..15e837b6a86893c9eca3357df42b58474f50c401 100644 (file)
@@ -482,7 +482,7 @@ Convert_To_Minutes
     [Return]    ${minutes}
 
 Write Commands Until Expected Prompt
-    [Arguments]    ${cmd}    ${prompt}    ${timeout}=${DEFAULT_TIMEOUT}
+    [Arguments]    ${cmd}    ${prompt}    ${timeout}=30s
     [Documentation]    quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
     SSHLibrary.Set Client Configuration    timeout=${timeout}
     SSHLibrary.Write    ${cmd}
diff --git a/csit/suites/openstack/connectivity/01_l2_tests.robot b/csit/suites/openstack/connectivity/01_l2_tests.robot
new file mode 100644 (file)
index 0000000..7aaea56
--- /dev/null
@@ -0,0 +1,138 @@
+*** Settings ***
+Documentation     Test suite to verify packet flows between vm instances.
+Suite Setup       Devstack Suite Setup Tests
+Library           SSHLibrary
+Library           OperatingSystem
+Library           RequestsLibrary
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/OpenStackOperations.robot
+Resource          ../../../libraries/DevstackUtils.robot
+
+*** Variables ***
+@{NETWORKS_NAME}    network_1    network_2
+@{SUBNETS_NAME}    subnet_1    subnet_2
+@{NET_1_VM_INSTANCES}    MyFirstInstance_1    MySecondInstance_1
+@{NET_2_VM_INSTANCES}    MyFirstInstance_2    MySecondInstance_2
+@{NET_1_VM_IPS}    30.0.0.3    30.0.0.4
+@{NET_2_VM_IPS}    40.0.0.3    40.0.0.4
+@{VM_IPS_NOT_DELETED}    30.0.0.4
+@{GATEWAY_IPS}    30.0.0.1    40.0.0.1
+@{DHCP_IPS}    30.0.0.2    40.0.0.2
+
+*** Test Cases ***
+Create Networks
+    [Documentation]    Create Network with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    Create Network    ${NetworkElement}    devstack_path=/opt/stack/devstack
+
+Create Subnets For network_1
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    Create SubNet    network_1    subnet_1    30.0.0.0/24
+
+Create Subnets For network_2
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    Create SubNet    network_2    subnet_2    40.0.0.0/24
+
+Create Vm Instances For network_1
+    [Documentation]    Create Four Vm instances using flavor and image names for a network.
+    ${net_id}=    Get Net Id    network_1
+    Create Vm Instances    ${net_id}    ${NET_1_VM_INSTANCES}
+    [Teardown]    Show Debugs      ${NET_1_VM_INSTANCES}
+
+Create Vm Instances For network_2
+    [Documentation]    Create Four Vm instances using flavor and image names for a network.
+    ${net_id}=    Get Net Id    network_2
+    Set Suite Variable    ${net_id}
+    Create Vm Instances    ${net_id}    ${NET_2_VM_INSTANCES}
+    [Teardown]    Show Debugs      ${NET_2_VM_INSTANCES}
+
+Ping All Vm Instances In network_1
+    [Documentation]    Check reachability of vm instances by pinging to them.
+    ${net_id}=    Get Net Id    network_1
+    : FOR    ${VmIpElement}    IN    @{NET_1_VM_IPS}
+    \    ${output}    Ping Vm From DHCP Namespace    ${net_id}    ${VmIpElement}
+    \    Should Contain    ${output}    64 bytes
+
+Ping All Vm Instances In network_2
+    [Documentation]    Check reachability of vm instances by pinging to them.
+    ${net_id}=    Get Net Id    network_2
+    : FOR    ${VmIpElement}    IN    @{NET_2_VM_IPS}
+    \    ${output}    Ping Vm From DHCP Namespace    ${net_id}    ${VmIpElement}
+    \    Should Contain    ${output}    64 bytes
+
+Login to Vm Instances In network_1 Using Ssh
+    [Documentation]    Logging to the vm instance using generated key pair.
+    ${net_id}=    Get Net Id    network_1
+    Ssh Vm Instance    ${net_id}    30.0.0.3
+
+Ping Vm Instance From Instance In network_1
+    [Documentation]    Check reachability of vm instances by pinging.
+    ${output}=    Ping From Instance    30.0.0.4
+    Should Contain    ${output}    64 bytes
+
+Ping Dhcp Server From Instance In network_1
+    [Documentation]    ping the dhcp server from instance.
+    ${output}=    Ping From Instance    30.0.0.2
+    Should Contain    ${output}    64 bytes
+
+Ping Metadata Server From Instance In network_1
+    [Documentation]    ping the metadata server from instance.
+    Curl Metadata Server
+
+Login to Vm Instances In network_2 Using Ssh
+    [Documentation]    Logging to the vm instance using generated key pair.
+    ${net_id}=    Get Net Id    network_2
+    Ssh Vm Instance    ${net_id}    40.0.0.3
+
+Ping Vm Instance From Instance In network_2
+    [Documentation]    Check reachability of vm instances by pinging.
+    ${output}=    Ping From Instance    40.0.0.4
+    Should Contain    ${output}    64 bytes
+
+Ping Dhcp Server From Instance In network_2
+    [Documentation]    ping the dhcp server from instance.
+    ${output}=    Ping From Instance    40.0.0.2
+    Should Contain    ${output}    64 bytes
+
+Ping Metadata Server From Instance In network_2
+    [Documentation]    ping the metadata server from instance.
+    Curl Metadata Server
+
+Delete Vm Instance
+    [Documentation]    Delete Vm instances using instance names.
+    Delete Vm Instance    MyFirstInstance_1
+
+Ping All Vm Instances
+    [Documentation]    Check reachability of vm instances by pinging to them.
+    ${net_id}=    Get Net Id    network_1
+    : FOR    ${VmIpElement}    IN    @{VM_IPS_NOT_DELETED}
+    \    ${output}=    Ping Vm From DHCP Namespace    ${net_id}    ${VmIpElement}
+    \    Should Contain    ${output}    64 bytes
+
+No Ping For Deleted Vm
+    [Documentation]    Check non reachability of deleted vm instances by pinging to them.
+    ${output}=    Ping Vm From DHCP Namespace    ${net_id}    30.0.0.3
+    Should Contain    ${output}    Destination Host Unreachable
+
+Delete Vm Instances In network_1
+    [Documentation]    Delete Vm instances using instance names in network_1.
+    : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
+    \    Delete Vm Instance    ${VmElement}
+
+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}
+
+Delete Sub Networks In network_1
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    Delete SubNet    subnet_1
+
+Delete Sub Networks In network_2
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    Delete SubNet    subnet_2
+
+Delete Networks
+    [Documentation]    Delete Networks with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    Delete Network    ${NetworkElement}
diff --git a/csit/suites/openstack/connectivity/02_l3_tests.robot b/csit/suites/openstack/connectivity/02_l3_tests.robot
new file mode 100644 (file)
index 0000000..59e75b8
--- /dev/null
@@ -0,0 +1,130 @@
+*** Settings ***
+Documentation     Test suite to check connectivity in L3 using routers.
+Suite Setup       Devstack Suite Setup Tests
+Library           SSHLibrary
+Library           OperatingSystem
+Library           RequestsLibrary
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/OpenStackOperations.robot
+Resource          ../../../libraries/DevstackUtils.robot
+
+*** Variables ***
+@{NETWORKS_NAME}    network_1    network_2
+@{SUBNETS_NAME}    subnet_1    subnet_2
+@{NET_1_VM_INSTANCES}    MyFirstInstance_1
+@{NET_2_VM_INSTANCES}    MyFirstInstance_2
+@{NET_1_VM_IPS}    50.0.0.3
+@{NET_2_VM_IPS}    60.0.0.3
+@{GATEWAY_IPS}    50.0.0.1    60.0.0.1
+@{DHCP_IPS}    50.0.0.2    60.0.0.2
+
+*** Test Cases ***
+Create Networks
+    [Documentation]    Create Network with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    Create Network    ${NetworkElement}    devstack_path=/opt/stack/devstack
+
+Create Subnets For network_1
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    Create SubNet    network_1    subnet_1    50.0.0.0/24
+
+Create Subnets For network_2
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    Create SubNet    network_2    subnet_2    60.0.0.0/24
+
+Create Vm Instances For network_1
+    [Documentation]    Create Four Vm instances using flavor and image names for a network.
+    ${net_id}=    Get Net Id    network_1
+    Create Vm Instances    ${net_id}    ${NET_1_VM_INSTANCES}
+    [Teardown]    Show Debugs      ${NET_1_VM_INSTANCES}
+
+Create Vm Instances For network_2
+    [Documentation]    Create Four Vm instances using flavor and image names for a network.
+    ${net_id}=    Get Net Id    network_2
+    Create Vm Instances    ${net_id}    ${NET_2_VM_INSTANCES}
+    [Teardown]    Show Debugs      ${NET_2_VM_INSTANCES}
+
+Create Routers
+    [Documentation]    Create Router
+    Create Router    router_1
+
+Add Interfaces To Router
+    [Documentation]    Add Interfaces
+    : FOR     ${interface}    IN     @{SUBNETS_NAME}
+    \    Add Router Interface     router_1     ${interface}
+
+Ping Vm Instance In network_2 From network_1
+    [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
+    ${net_id}=    Get Net Id    network_1
+    ${output}    Ping Vm From DHCP Namespace    ${net_id}    60.0.0.3
+    Should Contain    ${output}    64 bytes
+
+Ping Vm Instance In network_1 From network_2
+    [Documentation]    Check reachability of vm instances by pinging to them after creating routers.
+    ${net_id}=    Get Net Id    network_2
+    ${output}    Ping Vm From DHCP Namespace    ${net_id}    50.0.0.3
+    Should Contain    ${output}    64 bytes
+
+Login to Vm Instances In network_1 Using Ssh
+    [Documentation]    Logging to the vm instance using generated key pair.
+    ${net_id}=    Get Net Id    network_1
+    Ssh Vm Instance    ${net_id}    50.0.0.3
+
+Ping Vm Instance From Instance In network_1
+    [Documentation]    Check reachability of vm instances by pinging.
+    ${output}=    Ping From Instance    60.0.0.3
+    Should Contain    ${output}    64 bytes
+
+Ping Dhcp Server In network_2 From Instance In network_1
+    [Documentation]    ping the dhcp server from instance.
+    ${output}=    Ping From Instance    60.0.0.2
+    Should Contain    ${output}    64 bytes
+    Close Vm Instance
+
+Login to Vm Instances In network_2 Using Ssh
+    [Documentation]    Logging to the vm instance using generated key pair.
+    ${net_id}=    Get Net Id    network_2
+    Ssh Vm Instance    ${net_id}    60.0.0.3
+
+Ping Vm Instance From Instance In network_2
+    [Documentation]    Check reachability of vm instances by pinging.
+    ${output}=    Ping From Instance    50.0.0.3
+    Should Contain    ${output}    64 bytes
+
+Ping Dhcp Server In network_1 From Instance In network_2
+    [Documentation]    ping the dhcp server from instance.
+    ${output}=    Ping From Instance    50.0.0.2
+    Should Contain    ${output}    64 bytes
+    Close Vm Instance
+
+Delete Vm Instances In network_1
+    [Documentation]    Delete Vm instances using instance names in network_1.
+    : FOR    ${VmElement}    IN    @{NET_1_VM_INSTANCES}
+    \    Delete Vm Instance    ${VmElement}
+
+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}
+
+Delete Router Interfaces
+    [Documentation]    Remove Interface to the subnets.
+    : FOR     ${interface}    IN     @{SUBNETS_NAME}
+    \     Remove Interface     router_1     ${interface}
+
+Delete Routers
+    [Documentation]    Delete Router and Interface to the subnets.
+    Delete Router    router_1
+
+Delete Sub Networks In network_1
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    Delete SubNet    subnet_1
+
+Delete Sub Networks In network_2
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    Delete SubNet    subnet_2
+
+Delete Networks
+    [Documentation]    Delete Networks with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    Delete Network    ${NetworkElement}
index a90a3a51821a0d63ecd1447eab47e1ed82533fa9..88dcb4c616a1246c1ddb22c95a7e7421a67450fa 100644 (file)
@@ -95,7 +95,7 @@ Verify Created Vm Instance In Dump Flow
 
 Create Routers
     [Documentation]    Create Router and Add Interface to the subnets.
-    Create Router
+    Create Router    router_1
 
 Verify Gateway Ip After Interface Added
     [Documentation]    Verify the existence of the gateway ips with the dump flow in Beryllium.
@@ -121,11 +121,11 @@ Verify Deleted Vm Instance Removed In Dump Flow
 
 Delete Router Interfaces
     [Documentation]    Remove Interface to the subnets.
-    Remove Interface
+    Remove Interface    router_1
 
 Delete Routers
     [Documentation]    Delete Router and Interface to the subnets.
-    Delete Router
+    Delete Router    router_1
 
 Verify Deleted Routers
     [Documentation]    Verify Deleted Routers for the Networks with dump flow.
diff --git a/csit/testplans/netvirt-1node-openstack.txt b/csit/testplans/netvirt-1node-openstack.txt
new file mode 100644 (file)
index 0000000..1440edf
--- /dev/null
@@ -0,0 +1 @@
+integration/test/csit/suites/openstack/connectivity/
diff --git a/csit/testplans/netvirt-3node-openstack.txt b/csit/testplans/netvirt-3node-openstack.txt
new file mode 100644 (file)
index 0000000..1440edf
--- /dev/null
@@ -0,0 +1 @@
+integration/test/csit/suites/openstack/connectivity/
diff --git a/csit/testplans/vtn-1node-openstack.txt b/csit/testplans/vtn-1node-openstack.txt
new file mode 100644 (file)
index 0000000..c78ce4e
--- /dev/null
@@ -0,0 +1 @@
+integration/test/csit/suites/openstack/connectivity/01_l2_tests.robot