netvirt: add floating IP connectivity test 12/48412/25
authorAlon Kochba <alonko@hpe.com>
Wed, 16 Nov 2016 14:14:28 +0000 (16:14 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 21 Nov 2016 19:33:41 +0000 (19:33 +0000)
add initial tests using external networks and
floating IP connectivity.

Depends-On: https://git.opendaylight.org/gerrit/#/c/48403/

Change-Id: I903d97b2e3bb2caa3d4ece65d699d954ecd5c23f
Signed-off-by: Alon Kochba <alonko@hpe.com>
Signed-off-by: Sam Hague <shague@redhat.com>
csit/libraries/OpenStackOperations.robot
csit/suites/openstack/connectivity/03_external_network_tests.robot [new file with mode: 0644]
csit/testplans/netvirt-legacy-1node-openstack.txt
csit/testplans/netvirt-legacy-3node-openstack.txt

index b41296082263f6c1d8696db3724c48d38fad52f1..3c9ca4bf0d34d4d9a845d49f36daf653070f7d3c 100644 (file)
@@ -67,11 +67,11 @@ Delete Network
     Should Match Regexp    ${output}    Deleted network: ${network_name}|Deleted network\\(s\\): ${network_name}
 
 Create SubNet
-    [Arguments]    ${network_name}    ${subnet}    ${range_ip}
+    [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}    30s
+    ${output}=    Write Commands Until Prompt    neutron -v subnet-create ${network_name} ${range_ip} --name ${subnet} ${additional_args}    30s
     Close Connection
     Log    ${output}
     Should Contain    ${output}    Created a new subnet
@@ -105,6 +105,21 @@ List Ports
     Log    ${output}
     [Return]    ${output}
 
+Create And Associate Floating IPs
+    [Arguments]    ${external_net}    @{vm_list}
+    [Documentation]    Create and associate floating IPs to VMs with nova request
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${ip_list}=    Create List    @{EMPTY}
+    : FOR    ${vm}    IN    @{vm_list}
+    \    ${output}=    Write Commands Until Prompt    nova floating-ip-create ${external_net} | grep "${external_net}"    30s
+    \    Log    ${output}
+    \    @{output_words}    Split String    ${output}
+    \    Append To List    ${ip_list}    @{output_words}[3]
+    \    ${output}=    Write Commands Until Prompt    nova floating-ip-associate ${vm} @{output_words}[3]    30s
+    \    Log    ${output}
+    [Return]    ${ip_list}
+
 Verify Gateway Ips
     [Documentation]    Verifies the Gateway Ips with dump flow.
     ${output}=    Write Commands Until Prompt    sudo ovs-ofctl -O OpenFlow13 dump-flows br-int
@@ -217,7 +232,7 @@ Verify VM Is ACTIVE
 
 Verify VMs Received DHCP Lease
     [Arguments]    @{vm_list}
-    [Documentation]    Using nova console-log on the provided ${vm_name} to search for the string "obtained" which
+    [Documentation]    Using nova console-log on the provided ${vm_list} to search for the string "obtained" which
     ...    correlates to the instance receiving it's IP address via DHCP. This should provide a good indication
     ...    that the instance is fully up and ready.
     ${devstack_conn_id}=    Get ControlNode Connection
@@ -268,6 +283,17 @@ Ping From DHCP Should Not Succeed
     Log    ${output}
     Should Not Contain    ${output}    64 bytes
 
+Ping Vm From Control Node
+    [Arguments]    ${vm_floating_ip}
+    [Documentation]    Ping VM floating IP from control node
+    Log    ${vm_floating_ip}
+    ${devstack_conn_id}=    Get ControlNode Connection
+    Switch Connection    ${devstack_conn_id}
+    ${output}=    Write Commands Until Prompt    ping -c 3 ${vm_floating_ip}    20s
+    Log    ${output}
+    Close Connection
+    Should Contain    ${output}    64 bytes
+
 Ping From Instance
     [Arguments]    ${dest_vm_ip}
     [Documentation]    Ping to the expected destination ip.
@@ -373,6 +399,14 @@ Add Router Interface
     Close Connection
     Should Contain    ${output}    Added interface
 
+Add Router Gateway
+    [Arguments]    ${router_name}    ${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}
+    Close Connection
+    Should Contain    ${output}    Set gateway
+
 Remove Interface
     [Arguments]    ${router_name}    ${interface_name}
     [Documentation]    Remove Interface to the subnets.
diff --git a/csit/suites/openstack/connectivity/03_external_network_tests.robot b/csit/suites/openstack/connectivity/03_external_network_tests.robot
new file mode 100644 (file)
index 0000000..8cbf976
--- /dev/null
@@ -0,0 +1,124 @@
+*** Settings ***
+Documentation     Test suite to check North-South connectivity in L3 using a router and an external network
+Suite Setup       Devstack Suite Setup Tests    source_pwd=yes
+Suite Teardown    Close All Connections
+Test Teardown     Get OvsDebugInfo
+Library           SSHLibrary
+Library           OperatingSystem
+Library           RequestsLibrary
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/OpenStackOperations.robot
+Resource          ../../../libraries/DevstackUtils.robot
+
+*** Variables ***
+@{NETWORKS_NAME}    l3_net
+@{SUBNETS_NAME}    l3_subnet
+@{VM_INSTANCES}    VmInstance1_net    VmInstance2_net
+@{SUBNETS_RANGE}    90.0.0.0/24
+${external_gateway}    10.10.10.250
+${external_subnet}    10.10.10.0/24
+${external_physical_network}    physnet1
+${external_net_name}    external-net
+${external_subnet_name}    external-subnet
+
+*** Test Cases ***
+Create All Controller Sessions
+    [Documentation]    Create sessions for all three controllers
+    ClusterManagement.ClusterManagement Setup
+
+Create Private Network
+    [Documentation]    Create Network with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    OpenStackOperations.Create Network    ${NetworkElement}
+
+Create Subnet For Private Network
+    [Documentation]    Create Sub Nets for the Networks with neutron request.
+    OpenStackOperations.Create SubNet    @{NETWORKS_NAME}[0]    @{SUBNETS_NAME}[0]    @{SUBNETS_RANGE}[0]
+
+Create External Network And Subnet
+    Create Network    ${external_net_name} --router:external --provider:network_type=flat --provider:physical_network=${external_physical_network}
+    Create Subnet    ${external_net_name}    ${external_subnet_name}    ${external_subnet}    --gateway ${external_gateway}
+
+Create Router
+    [Documentation]    Create Router and Add Interface to the subnets.
+    OpenStackOperations.Create Router    router1
+
+Add Interfaces To Router
+    [Documentation]    Add Interfaces
+    : FOR    ${interface}    IN    @{SUBNETS_NAME}
+    \    OpenStackOperations.Add Router Interface    router1    ${interface}
+
+Add Router Gateway To Router
+    [Documentation]    Add Router Gateway
+    OpenStackOperations.Add Router Gateway    router1    ${external_net_name}
+
+Verify Created Routers
+    [Documentation]    Check created routers using northbound rest calls
+    ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
+    Log    ${data}
+    Should Contain    ${data}    router1
+
+Create Vm Instances
+    [Documentation]    Create VM instances using flavor and image names for a network.
+    OpenStackOperations.Create Vm Instances    @{NETWORKS_NAME}[0]    ${VM_INSTANCES}    sg=csit
+
+Check Vm Instances Have Ip Address
+    [Documentation]    Test case to verify that all created VMs are ready and have received their ip addresses.
+    ...    We are polling first and longest on the last VM created assuming that if it's received it's address
+    ...    already the other instances should have theirs already or at least shortly thereafter.
+    # first, ensure all VMs are in ACTIVE state.    if not, we can just fail the test case and not waste time polling
+    # for dhcp addresses
+    : FOR    ${vm}    IN    @{VM_INSTANCES}
+    \    Wait Until Keyword Succeeds    15s    5s    Verify VM Is ACTIVE    ${vm}
+    Wait Until Keyword Succeeds    180s    10s    Verify VMs Received DHCP Lease    @{VM_INSTANCES}
+    [Teardown]    Run Keywords    Show Debugs    ${VM_INSTANCES}
+    ...    AND    Get OvsDebugInfo
+
+Create And Associate Floating IPs for VMs
+    [Documentation]    Create and associate a floating IP for the VM
+    ${VM_FLOATING_IPS}    OpenStackOperations.Create And Associate Floating IPs    ${external_net_name}    @{VM_INSTANCES}
+    Set Suite Variable    ${VM_FLOATING_IPS}
+    [Teardown]    Run Keywords    Show Debugs    ${VM_INSTANCES}
+    ...    AND    Get OvsDebugInfo
+
+Ping External Gateway From Control Node
+    [Documentation]    Check reachability of external gateway by pinging it from the control node.
+    OpenStackOperations.Ping Vm From Control Node    ${external_gateway}
+
+Ping Vm Instance1 Floating IP From Control Node
+    [Documentation]    Check reachability of VM instance through floating IP by pinging them.
+    OpenStackOperations.Ping Vm From Control Node    @{VM_FLOATING_IPS}[0]
+
+Ping Vm Instance2 Floating IP From Control Node
+    [Documentation]    Check reachability of VM instance through floating IP by pinging them.
+    OpenStackOperations.Ping Vm From Control Node    @{VM_FLOATING_IPS}[1]
+
+Delete Vm Instances
+    [Documentation]    Delete Vm instances using instance names.
+    : FOR    ${VmElement}    IN    @{VM_INSTANCES}
+    \    OpenStackOperations.Delete Vm Instance    ${VmElement}
+
+Delete Router Interfaces
+    [Documentation]    Remove Interface to the subnets.
+    : FOR    ${interface}    IN    @{SUBNETS_NAME}
+    \    OpenStackOperations.Remove Interface    router1    ${interface}
+
+Delete Routers
+    [Documentation]    Delete Router and Interface to the subnets.
+    OpenStackOperations.Delete Router    router1
+
+Verify Deleted Routers
+    [Documentation]    Check deleted routers using northbound rest calls
+    ${data}    Utils.Get Data From URI    1    ${NEUTRON_ROUTERS_API}
+    Log    ${data}
+    Should Not Contain    ${data}    router1
+
+Delete Sub Networks
+    [Documentation]    Delete Sub Nets for the Networks with neutron request.
+    OpenStackOperations.Delete SubNet    @{SUBNETS_NAME}[0]
+
+Delete Networks
+    [Documentation]    Delete Networks with neutron request.
+    : FOR    ${NetworkElement}    IN    @{NETWORKS_NAME}
+    \    OpenStackOperations.Delete Network    ${NetworkElement}
+    OpenStackOperations.Delete Network    ${external_net_name}
index c4370d89a3c4f628467b523f712c3ee1bb7c0550..e3ffcffee431409718c1dc74ed418e529148010d 100644 (file)
@@ -1,3 +1,4 @@
-integration/test/csit/suites/openstack/connectivity/
+integration/test/csit/suites/openstack/connectivity/01_l2_tests.robot
+integration/test/csit/suites/openstack/connectivity/02_l3_tests.robot
 integration/test/csit/suites/openstack/tempest/
 integration/test/csit/suites/integration/Create_JVM_Plots.robot
index 0d9dfbd4876089d0f21faff5a3c20e5fa7d28cab..56bc8f6584059ad9c25bd83d2463132b434be30b 100644 (file)
@@ -1,4 +1,5 @@
-integration/test/csit/suites/openstack/connectivity/
+integration/test/csit/suites/openstack/connectivity/01_l2_tests.robot
+integration/test/csit/suites/openstack/connectivity/02_l3_tests.robot
 integration/test/csit/suites/openstack/clustering/
 integration/test/csit/suites/integration/Create_JVM_Plots.robot