X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Fsuites%2Fnetvirt%2Fsnatdnat%2Fsnat_dnat.robot;h=fd63b126882a8adfa7684923f55a7041c623d949;hb=540125131c520642019271cd3ce8a8e694df4af2;hp=2378c6e80ddc7da1eb0ab858b6d486f465794a86;hpb=b390514a09ab9f9d2a9a90d25455bbe31dcf5e7c;p=integration%2Ftest.git diff --git a/csit/suites/netvirt/snatdnat/snat_dnat.robot b/csit/suites/netvirt/snatdnat/snat_dnat.robot index 2378c6e80d..fd63b12688 100644 --- a/csit/suites/netvirt/snatdnat/snat_dnat.robot +++ b/csit/suites/netvirt/snatdnat/snat_dnat.robot @@ -1,45 +1,49 @@ *** Settings *** -Documentation Test suite to validate network address translation(snat/dnat) functionality in openstack integrated environment. -... 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 Suite Setup -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 -Resource ../../../libraries/Utils.robot -Resource ../../../libraries/VpnOperations.robot -Resource ../../../variables/Variables.robot -Resource ../../../variables/netvirt/Variables.robot +Documentation Test suite to validate network address translation(snat/dnat) functionality in openstack integrated environment. +... 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. + +Library Collections +Library RequestsLibrary +Library SSHLibrary +Library String +Resource ../../../libraries/BgpOperations.robot +Resource ../../../libraries/OpenStackOperations.robot +Resource ../../../libraries/SetupUtils.robot +Resource ../../../libraries/Tcpdump.robot +Resource ../../../libraries/Utils.robot +Resource ../../../libraries/VpnOperations.robot +Resource ../../../variables/Variables.robot +Resource ../../../variables/netvirt/Variables.robot + +Suite Setup Suite Setup +Suite Teardown Stop Suite +Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing +Test Teardown OpenStackOperations.Get Test Teardown Debugs + *** Variables *** -${SECURITY_GROUP} nat_sg -${NETWORK_TYPE} gre -${SNAT_ENABLED} "enable_snat": true -${SNAT_DISABLED} "enable_snat": false -${ROUTER} nat_router -${AS_ID} 100 -${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 -${ExtIP} 100.100.100.24 -@{NETWORKS} nat_net_1 nat_net_2 -@{EXTERNAL_NETWORKS} nat_ext_11 nat_ext_22 +${SECURITY_GROUP} nat_sg +${NETWORK_TYPE} gre +${SNAT_ENABLED} "enable_snat": true +${SNAT_DISABLED} "enable_snat": false +${ROUTER} nat_router +${AS_ID} 100 +${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 +${ExtIP} 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 -@{SUBNETS} nat_sub_net_1 nat_sub_net_2 -@{SUBNET_CIDRS} 10.1.1.0/24 20.1.1.0/24 -@{EXT_SUBNET_CIDRS} 100.100.100.0/24 200.200.200.0/24 -@{PORTS} nat_port_1 nat_port_2 nat_port_3 nat_port_4 -@{NET_1_VMS} nat_net_1_vm_1 nat_net_1_vm_2 nat_net_1_vm_3 nat_net_1_vm_4 +@{SUBNETS} nat_sub_net_1 nat_sub_net_2 +@{SUBNET_CIDRS} 10.1.1.0/24 20.1.1.0/24 +@{EXT_SUBNET_CIDRS} 100.100.100.0/24 200.200.200.0/24 +@{PORTS} nat_port_1 nat_port_2 nat_port_3 nat_port_4 +@{NET_1_VMS} nat_net_1_vm_1 nat_net_1_vm_2 nat_net_1_vm_3 nat_net_1_vm_4 + *** Test Cases *** Verify Successful Creation Of External Network With Router External Set To TRUE @@ -68,29 +72,53 @@ Verify Successful Deletion Of External Network 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}"] + 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=${ExtIP} + OpenStackOperations.Add Router Gateway + ... ${ROUTER} + ... ${EXTERNAL_NETWORKS}[0] + ... --fixed-ip subnet=${subnetid},ip-address=${ExtIP} ${float} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NETWORKS}[0] ${NET_1_VMS}[0] ${float} = BuiltIn.Set Variable ${float}[0] @{matching_paras} = BuiltIn.Create List nw_dst=${float} goto_table:${DNAT_TABLE} - BuiltIn.Wait Until Keyword Succeeds 10s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${PDNAT_TABLE} True - ... ${EMPTY} @{matching_paras} + BuiltIn.Wait Until Keyword Succeeds + ... 10s + ... 5s + ... OVSDB.Verify Dump Flows For Specific Table + ... ${OS_CMP1_IP} + ... ${PDNAT_TABLE} + ... True + ... ${EMPTY} + ... @{matching_paras} @{matching_paras} = BuiltIn.Create List actions=set_field:${float} goto_table:${SNAT_TABLE} - BuiltIn.Wait Until Keyword Succeeds 10s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${PSNAT_TABLE} True - ... ${EMPTY} @{matching_paras} + BuiltIn.Wait Until Keyword Succeeds + ... 10s + ... 5s + ... OVSDB.Verify Dump Flows For Specific Table + ... ${OS_CMP1_IP} + ... ${PSNAT_TABLE} + ... True + ... ${EMPTY} + ... @{matching_paras} 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} + ${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} @@ -100,30 +128,57 @@ Verify Floating Ip Re-provision And Reachability From External Network Via Neutr [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=${ExtIP} + OpenStackOperations.Add Router Gateway + ... ${ROUTER} + ... ${EXTERNAL_NETWORKS}[0] + ... --fixed-ip subnet=${subnetid},ip-address=${ExtIP} ${float} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NETWORKS}[0] ${NET_1_VMS}[0] ${float} = BuiltIn.Set Variable ${float}[0] @{matching_paras} = BuiltIn.Create List nw_dst=${float} goto_table:${DNAT_TABLE} - BuiltIn.Wait Until Keyword Succeeds 10s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${PDNAT_TABLE} True - ... ${EMPTY} @{matching_paras} + BuiltIn.Wait Until Keyword Succeeds + ... 10s + ... 5s + ... OVSDB.Verify Dump Flows For Specific Table + ... ${OS_CMP1_IP} + ... ${PDNAT_TABLE} + ... True + ... ${EMPTY} + ... @{matching_paras} @{matching_paras} = BuiltIn.Create List actions=set_field:${float} goto_table:${SNAT_TABLE} - BuiltIn.Wait Until Keyword Succeeds 10s 5s OVSDB.Verify Dump Flows For Specific Table ${OS_CMP1_IP} ${PSNAT_TABLE} True - ... ${EMPTY} @{matching_paras} + BuiltIn.Wait Until Keyword Succeeds + ... 10s + ... 5s + ... OVSDB.Verify Dump Flows For Specific Table + ... ${OS_CMP1_IP} + ... ${PSNAT_TABLE} + ... True + ... ${EMPTY} + ... @{matching_paras} Verify Multiple Floating Ip Creation and Association to external network [Documentation] Check Multiple floating IPs should be present in dump flows after creating multiple floating IPs and 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=${ExtIP} - ${FloatIp1} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NETWORKS}[0] ${NET_1_VMS}[1] - ${FloatIp2} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NETWORKS}[0] ${NET_1_VMS}[2] - ${FloatIp3} = OpenStackOperations.Create And Associate Floating IPs ${EXTERNAL_NETWORKS}[0] ${NET_1_VMS}[3] + OpenStackOperations.Add Router Gateway + ... ${ROUTER} + ... ${EXTERNAL_NETWORKS}[0] + ... --fixed-ip subnet=${subnetid},ip-address=${ExtIP} + ${FloatIp1} = OpenStackOperations.Create And Associate Floating IPs + ... ${EXTERNAL_NETWORKS}[0] + ... ${NET_1_VMS}[1] + ${FloatIp2} = OpenStackOperations.Create And Associate Floating IPs + ... ${EXTERNAL_NETWORKS}[0] + ... ${NET_1_VMS}[2] + ${FloatIp3} = OpenStackOperations.Create And Associate Floating IPs + ... ${EXTERNAL_NETWORKS}[0] + ... ${NET_1_VMS}[3] ${output} = OVSDB.Get Flow Entries On Node ${OS_CMP2_CONN_ID} BuiltIn.Should Match Regexp ${output} ${ExtIP} BuiltIn.Should Match Regexp ${output} .*${FloatIp1}.* BuiltIn.Should Match Regexp ${output} .*${FloatIp2}.* BuiltIn.Should Match Regexp ${output} .*${FloatIp3}.* + *** Keywords *** Suite Setup [Documentation] Test Suite for Subnet_Routing_and_Multicast_Deployments. @@ -137,12 +192,21 @@ Suite Setup Create Setup Create Neutron Networks Create Neutron Subnets - OpenStackOperations.Create SubNet ${EXTERNAL_NETWORKS}[0] ${EXTERNAL_SUB_NETWORKS}[0] ${EXT_SUBNET_CIDRS}[0] + OpenStackOperations.Create SubNet + ... ${EXTERNAL_NETWORKS}[0] + ... ${EXTERNAL_SUB_NETWORKS}[0] + ... ${EXT_SUBNET_CIDRS}[0] 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} + 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] OpenStackOperations.Add Router Interface ${ROUTER} ${SUBNETS}[1] @@ -161,7 +225,12 @@ Create Neutron Subnets FOR ${index} IN RANGE 0 ${num_of_networks} OpenStackOperations.Create SubNet ${NETWORKS}[${index}] ${SUBNETS}[${index}] ${SUBNET_CIDRS}[${index}] END - BuiltIn.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${SUBNETWORK_URL} ${SUBNETS} + BuiltIn.Wait Until Keyword Succeeds + ... 3s + ... 1s + ... Utils.Check For Elements At URI + ... ${SUBNETWORK_URL} + ... ${SUBNETS} Create Neutron Ports [Documentation] Create required number of ports under previously created subnets @@ -169,14 +238,35 @@ Create Neutron Ports OpenStackOperations.Create Port ${NETWORKS}[0] ${PORTS}[1] sg=${SECURITY_GROUP} OpenStackOperations.Create Port ${NETWORKS}[1] ${PORTS}[2] sg=${SECURITY_GROUP} OpenStackOperations.Create Port ${NETWORKS}[1] ${PORTS}[3] sg=${SECURITY_GROUP} - BuiltIn.Wait Until Keyword Succeeds 3s 1s Utils.Check For Elements At URI ${CONFIG_API}/neutron:neutron/ports/ ${PORTS} + BuiltIn.Wait Until Keyword Succeeds + ... 3s + ... 1s + ... Utils.Check For Elements At URI + ... ${CONFIG_API}/neutron:neutron/ports/ + ... ${PORTS} Create Nova VMs [Documentation] Create Vm instances on compute nodes - OpenStackOperations.Create Vm Instance With Port On Compute Node ${PORTS}[0] ${NET_1_VMS}[0] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP} - OpenStackOperations.Create Vm Instance With Port On Compute Node ${PORTS}[1] ${NET_1_VMS}[1] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP} - OpenStackOperations.Create Vm Instance With Port On Compute Node ${PORTS}[2] ${NET_1_VMS}[2] ${OS_CMP1_HOSTNAME} sg=${SECURITY_GROUP} - OpenStackOperations.Create Vm Instance With Port On Compute Node ${PORTS}[3] ${NET_1_VMS}[3] ${OS_CMP2_HOSTNAME} sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instance With Port On Compute Node + ... ${PORTS}[0] + ... ${NET_1_VMS}[0] + ... ${OS_CMP1_HOSTNAME} + ... sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instance With Port On Compute Node + ... ${PORTS}[1] + ... ${NET_1_VMS}[1] + ... ${OS_CMP2_HOSTNAME} + ... sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instance With Port On Compute Node + ... ${PORTS}[2] + ... ${NET_1_VMS}[2] + ... ${OS_CMP1_HOSTNAME} + ... sg=${SECURITY_GROUP} + OpenStackOperations.Create Vm Instance With Port On Compute Node + ... ${PORTS}[3] + ... ${NET_1_VMS}[3] + ... ${OS_CMP2_HOSTNAME} + ... sg=${SECURITY_GROUP} @{NET_1_VM_IPS} ${NET_1_DHCP_IP} = OpenStackOperations.Get VM IPs @{NET_1_VMS} BuiltIn.Set Suite Variable @{NET_1_VM_IPS} BuiltIn.Should Not Contain ${NET_1_VM_IPS} None