From: mpany Date: Thu, 22 Nov 2018 07:26:58 +0000 (+0530) Subject: Add Floating Ip testcases to SNAT suite. X-Git-Tag: pre-potassium~410 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F37%2F78037%2F16;p=integration%2Ftest.git Add Floating Ip testcases to SNAT suite. Change-Id: I9483d953369951a1524e9bb5868c64fbcea699c9 Signed-off-by: mpany --- diff --git a/csit/libraries/OVSDB.robot b/csit/libraries/OVSDB.robot index 5f51abd9d4..c2963e621b 100644 --- a/csit/libraries/OVSDB.robot +++ b/csit/libraries/OVSDB.robot @@ -485,3 +485,11 @@ Verify Vni Packet Count After Traffic BuiltIn.Should Be True ${diff_count_ingress_port1} >= ${DEFAULT_PING_COUNT} BuiltIn.Should Be True ${diff_count_egress_port2} >= ${DEFAULT_PING_COUNT} BuiltIn.Should Be True ${diff_count_ingress_port2} >= ${DEFAULT_PING_COUNT} + +Get Flow Entries On Node + [Arguments] ${conn_id} ${switch}=${INTEGRATION_BRIDGE} + [Documentation] Return flow entries on the given Node. + SSHLibrary.Switch Connection ${conn_id} + ${output} = Utils.Write Commands Until Expected Prompt sudo ovs-ofctl -O OpenFlow13 dump-flows ${switch} ${DEFAULT_LINUX_PROMPT_STRICT} + BuiltIn.Log ${output} + [Return] ${output} diff --git a/csit/suites/netvirt/snatdnat/snat_dnat.robot b/csit/suites/netvirt/snatdnat/snat_dnat.robot index 4df20e3afc..31f7ea4bb2 100644 --- a/csit/suites/netvirt/snatdnat/snat_dnat.robot +++ b/csit/suites/netvirt/snatdnat/snat_dnat.robot @@ -3,13 +3,14 @@ Documentation Test suite to validate network address translation(snat/dnat) ... All the testcases were written to do flow validation since dc gateway is unavailable in csit environment. ... This suite assumes proper integration bridges and vxlan tunnels are configured in the environment. Suite Setup Start Suite -Suite Teardown OpenStackOperations.OpenStack Suite Teardown +Suite Teardown Stop Suite Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing Test Teardown OpenStackOperations.Get Test Teardown Debugs Library Collections Library RequestsLibrary Library SSHLibrary Library String +Resource ../../../libraries/BgpOperations.robot Resource ../../../libraries/OpenStackOperations.robot Resource ../../../libraries/SetupUtils.robot Resource ../../../libraries/Tcpdump.robot @@ -24,6 +25,14 @@ ${NETWORK_TYPE} gre ${SNAT_ENABLED} "enable_snat": true ${SNAT_DISABLED} "enable_snat": false ${ROUTER} nat_router +${AS_ID} 100 +${BGP_CONFIG_SERVER_CMD} bgp-connect -h ${ODL_SYSTEM_IP} -p 7644 add +${DCGW_SYSTEM_IP} ${TOOLS_SYSTEM_1_IP} +${LOOPBACK_IP} 5.5.5.2 +${DCGW_RD} 100:1 +${VPN_NAME} vpn_1 +${VPN_INSTANCE_ID} 4ae8cd92-48ca-49b5-94e1-b2921a261442 +${FIP} 100.100.100.24 @{NETWORKS} nat_net_1 nat_net_2 @{EXTERNAL_NETWORKS} nat_ext_11 nat_ext_22 @{EXTERNAL_SUB_NETWORKS} nat_ext_sub_net_1 nat_ext_sub_net_2 @@ -35,6 +44,7 @@ ${ROUTER} nat_router *** Test Cases *** Verify Successful Creation Of External Network With Router External Set To TRUE + [Documentation] Create external network,enable snat on router and validate the same. OpenStackOperations.Add Router Gateway ${ROUTER} @{EXTERNAL_NETWORKS}[0] --enable-snat ${output} = OpenStackOperations.Show Router ${ROUTER} BuiltIn.Should Contain ${output} ${SNAT_ENABLED} @@ -42,6 +52,7 @@ Verify Successful Creation Of External Network With Router External Set To TRUE BuiltIn.Should Contain ${output} @{EXTERNAL_NETWORKS}[0] Verify Successful Update Of Router With External_gateway_info, Disable SNAT And Enable SNAT + [Documentation] Disable snat, enable snat and validate the same. OpenStackOperations.Add Router Gateway ${ROUTER} @{EXTERNAL_NETWORKS}[0] --disable-snat ${output} = OpenStackOperations.Show Router ${ROUTER} BuiltIn.Should Contain ${output} ${SNAT_DISABLED} @@ -50,14 +61,52 @@ Verify Successful Update Of Router With External_gateway_info, Disable SNAT And BuiltIn.Should Contain ${output} ${SNAT_ENABLED} Verify Successful Deletion Of External Network + [Documentation] Delete the external network and validate the same. OpenStackOperations.Remove Gateway ${ROUTER} ${output} = OpenStackOperations.Show Router ${ROUTER} BuiltIn.Should Not Contain ${output} ${SNAT_ENABLED} +Verify Floating Ip Provision And Reachability From External Network Via Neutron Router Through L3vpn + [Documentation] Check floating IP should be present in dump flows after creating the floating IP and associating it to external network + ... which is associated to L3VPN + VpnOperations.VPN Create L3VPN vpnid=${VPN_INSTANCE_ID} name=${VPN_NAME} rd=["${DCGW_RD}"] exportrt=["${DCGW_RD}"] importrt=["${DCGW_RD}"] + ${ext_net_id} = OpenStackOperations.Get Net Id @{EXTERNAL_NETWORKS}[0] + VpnOperations.Associate L3VPN To Network networkid=${ext_net_id} vpnid=${VPN_INSTANCE_ID} + OpenStackOperations.Add Router Gateway ${ROUTER} @{EXTERNAL_NETWORKS}[0] --disable-snat + ${output} = OpenStackOperations.Show Router ${ROUTER} + BuiltIn.Should Contain ${output} ${SNAT_DISABLED} + ${subnetid} = OpenStackOperations.Get Subnet Id @{EXTERNAL_SUB_NETWORKS}[0] + OpenStackOperations.Add Router Gateway ${ROUTER} @{EXTERNAL_NETWORKS}[0] --fixed-ip subnet=${subnetid},ip-address=${FIP} + ${float} = OpenStackOperations.Create And Associate Floating IPs @{EXTERNAL_NETWORKS}[0] @{NET_1_VMS}[0] + ${output} = OVSDB.Get Flow Entries On Node ${OS_CMP1_CONN_ID} + BuiltIn.Should Contain ${output} ${FIP} + +Verify Floating Ip De-provision And Reachability From External Network Via Neutron Router Through L3vpn + [Documentation] Check floating IP should not be present in dump flows after deleting the floating IP + ... and removing the external gateway from router which is associated to L3VPN + OpenStackOperations.Get ControlNode Connection + ${output} = OpenStackOperations.OpenStack CLI openstack floating ip list |awk '{print$2}' + ${floating_id} = BuiltIn.Should Match Regexp ${output} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} + OpenStackOperations.Delete Floating IP ${floating_id} + OpenStackOperations.Remove Gateway ${ROUTER} + ${output} = OVSDB.Get Flow Entries On Node ${OS_CMP1_CONN_ID} + BuiltIn.Should Not Contain ${output} ${FIP} + +Verify Floating Ip Re-provision And Reachability From External Network Via Neutron Router Through L3vpn + [Documentation] Check floating IP should be present in dump flows after creating the floating IP again wnd associating it to external network + ... which is associated to L3VPN + ${subnetid} = OpenStackOperations.Get Subnet Id @{EXTERNAL_SUB_NETWORKS}[0] + OpenStackOperations.Add Router Gateway ${ROUTER} @{EXTERNAL_NETWORKS}[0] --fixed-ip subnet=${subnetid},ip-address=${FIP} + ${float} = OpenStackOperations.Create And Associate Floating IPs @{EXTERNAL_NETWORKS}[0] @{NET_1_VMS}[0] + ${output} = OVSDB.Get Flow Entries On Node ${OS_CMP1_CONN_ID} + BuiltIn.Should Contain ${output} ${FIP} + *** Keywords *** Start Suite [Documentation] Test Suite for Subnet_Routing_and_Multicast_Deployments. VpnOperations.Basic Suite Setup + BgpOperations.Start Quagga Processes On ODL ${ODL_SYSTEM_IP} + BgpOperations.Start Quagga Processes On DCGW ${DCGW_SYSTEM_IP} Create Setup OpenStackOperations.Show Debugs @{NET_1_VMS} OpenStackOperations.Get Suite Debugs @@ -69,6 +118,8 @@ Create Setup OpenStackOperations.Create Allow All SecurityGroup ${SECURITY_GROUP} Create Neutron Ports Create Nova VMs + BgpOperations.Setup BGP Peering On ODL ${ODL_SYSTEM_IP} ${AS_ID} ${DCGW_SYSTEM_IP} + BgpOperations.Setup BGP Peering On DCGW ${DCGW_SYSTEM_IP} ${AS_ID} ${ODL_SYSTEM_IP} ${VPN_NAME} ${DCGW_RD} ${LOOPBACK_IP} OpenStackOperations.Create Router ${ROUTER} OpenStackOperations.Add Router Interface ${ROUTER} @{SUBNETS}[0] @@ -104,3 +155,11 @@ Create Nova VMs BuiltIn.Set Suite Variable @{NET_1_VM_IPS} BuiltIn.Should Not Contain ${NET_1_VM_IPS} None BuiltIn.Should Not Contain ${NET_1_DHCP_IP} None + +Stop Suite + [Documentation] Test teardown for snat suite. + BgpOperations.Delete BGP Configuration On ODL session + BgpOperations.Delete BGP Config On Quagga ${DCGW_SYSTEM_IP} ${AS_ID} + BgpOperations.Stop BGP Processes On Node ${ODL_SYSTEM_IP} + BgpOperations.Stop BGP Processes On Node ${DCGW_SYSTEM_IP} + OpenStackOperations.OpenStack Suite Teardown