X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FVpnOperations.robot;h=9376bd6f81b0ccfb425104f0e36d8cf32f4c5ba9;hb=1140cf46a98c366057ccdc6b6bf8ea3e40d1c458;hp=aa98a5015d2997c6dd87be652b0fcebf934f00e6;hpb=de54cdb58aa62c24c4c4e2f6c307de105d0834ba;p=integration%2Ftest.git diff --git a/csit/libraries/VpnOperations.robot b/csit/libraries/VpnOperations.robot index aa98a5015d..9376bd6f81 100644 --- a/csit/libraries/VpnOperations.robot +++ b/csit/libraries/VpnOperations.robot @@ -1,10 +1,12 @@ *** Settings *** Documentation Openstack library. This library is useful for tests to create network, subnet, router and vm instances Library SSHLibrary +Resource CompareStream.robot Resource Utils.robot Resource TemplatedRequests.robot Resource KarafKeywords.robot Resource ../variables/Variables.robot +Resource ../variables/netvirt/Variables.robot Library Collections Library String Library OperatingSystem @@ -20,28 +22,18 @@ ${STATE_DOWN} DOWN ${STATE_UNKNOWN} UNKNOWN ${STATE_ENABLE} ENABLED ${STATE_DISABLE} DISABLE +${SESSION_TIMEOUT} 10 *** Keywords *** -Basic Vpnservice Suite Setup - SetupUtils.Setup_Utils_For_Setup_And_Teardown - DevstackUtils.Devstack Suite Setup - -Basic Vpnservice Suite Teardown - # Delete three L3VPNs created using Multiple L3VPN Test - Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[0]} - Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[1]} - Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${VPN_INSTANCE_ID[2]} - ${VM_INSTANCES} = Create List @{VM_INSTANCES_NET10} @{VM_INSTANCES_NET20} - : FOR ${VmInstance} IN @{VM_INSTANCES} - \ Run Keyword And Ignore Error Delete Vm Instance ${VmInstance} - : FOR ${Port} IN @{PORT_LIST} - \ Run Keyword And Ignore Error Delete Port ${Port} - : FOR ${Subnet} IN @{SUBNETS} - \ Run Keyword And Ignore Error Delete SubNet ${Subnet} - : FOR ${Network} IN @{NETWORKS} - \ Run Keyword And Ignore Error Delete Network ${Network} - Run Keyword And Ignore Error Delete SecurityGroup ${SECURITY_GROUP} - Close All Connections +Basic Suite Setup + OpenStackOperations.OpenStack Suite Setup + TemplatedRequests.Create Default Session timeout=${SESSION_TIMEOUT} + +Basic Vpnservice Suite Cleanup + [Arguments] ${vpn_instance_ids}=@{EMPTY} ${vms}=@{EMPTY} ${networks}=@{EMPTY} ${subnets}=@{EMPTY} ${ports}=@{EMPTY} ${sgs}=@{EMPTY} + : FOR ${vpn_instance_id} IN @{vpn_instance_ids} + \ BuiltIn.Run Keyword And Ignore Error VPN Delete L3VPN vpnid=${vpn_instance_id} + OpenStackOperations.Neutron Cleanup ${vms} ${networks} ${subnets} ${ports} ${sgs} VPN Create L3VPN [Arguments] &{Kwargs} @@ -50,46 +42,74 @@ VPN Create L3VPN ... ELSE Collections.Set_To_Dictionary ${Kwargs} router=${empty} &{L3vpn_create_actual_val} = Collections.Copy_Dictionary ${L3VPN_CREATE_DEFAULT} Collections.Set_To_Dictionary ${L3vpn_create_actual_val} &{Kwargs} - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_create mapping=${L3vpn_create_actual_val} session=session + TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_create mapping=${L3vpn_create_actual_val} session=default http_timeout=${SESSION_TIMEOUT} VPN Get L3VPN [Arguments] &{Kwargs} [Documentation] Will return detailed list of the L3VPN_ID received - ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping=${Kwargs} session=session + ${resp} = TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/get_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} Log ${resp} [Return] ${resp} +VPN Get L3VPN ID + [Arguments] ${vrf_id} + [Documentation] Check that sub interface ip has been learnt after ARP request + ${resp} = RequestsLibrary.Get Request session ${VPN_REST} + BuiltIn.Log ${resp.content} + @{list_any_matches} = String.Get_Regexp_Matches ${resp.content} \"vpn-instance-name\":\"${VPN_INSTANCE_ID}\",.*"vrf-id":"${vrf_id}",\"vpn-id\":(\\d+) 1 + ${result} = Evaluate ${list_any_matches[0]} * 2 + ${vpn_id_hex} = BuiltIn.Convert To Hex ${result} + [Return] ${vpn_id_hex.lower()} + +Verify L3VPN On ODL + [Arguments] @{vpns} + [Documentation] To verify L3VPN on ODL for given vpn ids + : FOR ${vpn} IN @{vpns} + \ ${resp} = VpnOperations.VPN Get L3VPN vpnid=${vpn} + \ BuiltIn.Should Contain ${resp} ${vpn} + Associate L3VPN To Network [Arguments] &{Kwargs} [Documentation] Associate the created L3VPN to a network-id received as dictionary argument - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=session + TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} + +Associate L3VPNs To Networks + [Arguments] ${vpnid_list} ${network_list} + [Documentation] Associates multiple networks to L3VPN and verify the same + : FOR ${network} ${vpnid} IN ZIP ${network_list} ${vpnid_list} + \ ${network_id} = OpenStackOperations.Get Net Id ${network} + \ VpnOperations.Associate L3VPN To Network networkid=${network_id} vpnid=${vpnid} + \ ${resp} = VpnOperations.VPN Get L3VPN vpnid=${vpnid} + \ BuiltIn.Should Contain ${resp} ${network_id} Dissociate L3VPN From Networks [Arguments] &{Kwargs} [Documentation] Disssociate the already associated networks from L3VPN - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=session + TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} Associate VPN to Router [Arguments] &{Kwargs} [Documentation] Associate the created L3VPN to a router-id received as argument - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_router_l3vpn mapping=${Kwargs} session=session + CompareStream.Run_Keyword_If_At_Least_Fluorine TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_two_router_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} + CompareStream.Run_Keyword_If_At_Most_Oxygen TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/assoc_router_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} Dissociate VPN to Router [Arguments] &{Kwargs} [Documentation] Dissociate the already associated routers from L3VPN - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_router_l3vpn mapping=${Kwargs} session=session + CompareStream.Run_Keyword_If_At_Least_Fluorine TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_two_router_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} + CompareStream.Run_Keyword_If_At_Most_Oxygen TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/dissoc_router_l3vpn mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} VPN Delete L3VPN [Arguments] &{Kwargs} [Documentation] Delete the created L3VPN - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_delete mapping=${Kwargs} session=session + TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/l3vpn_delete mapping=${Kwargs} session=default http_timeout=${SESSION_TIMEOUT} ITM Create Tunnel [Arguments] &{Kwargs} [Documentation] Creates Tunnel between the two DPNs received in the dictionary argument &{Itm_actual_val} = Collections.Copy_Dictionary ${ITM_CREATE_DEFAULT} Collections.Set_To_Dictionary ${Itm_actual_val} &{Kwargs} - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/itm_create mapping=${Itm_actual_val} session=session + TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE}/itm_create mapping=${Itm_actual_val} session=default http_timeout=${SESSION_TIMEOUT} ITM Get Tunnels [Documentation] Get all Tunnels and return the contents @@ -109,13 +129,19 @@ ITM Delete Tunnel Verify Flows Are Present For L3VPN [Arguments] ${ip} ${vm_ips} [Documentation] Verify Flows Are Present For L3VPN - ${flow_output}= Run Command On Remote System And Log ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int + ${flow_output}= Run Command On Remote System And Log ${ip} sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE} Should Contain ${flow_output} table=${ODL_FLOWTABLE_L3VPN} ${l3vpn_table} = Get Lines Containing String ${flow_output} table=${ODL_FLOWTABLE_L3VPN}, Log ${l3vpn_table} : FOR ${i} IN @{vm_ips} \ ${resp}= Should Contain ${l3vpn_table} ${i} +Verify Flows Are Present For L3VPN On All Compute Nodes + [Arguments] ${vm_ips} + [Documentation] Verify Flows Are Present For L3VPN On All Compute Nodes + : FOR ${ip} IN @{OS_CMP_IPS} + \ BuiltIn.Wait Until Keyword Succeeds 30s 10s VpnOperations.Verify Flows Are Present For L3VPN ${ip} ${vm_ips} + Verify GWMAC Entry On ODL [Arguments] ${GWMAC_ADDRS} [Documentation] get ODL GWMAC table entry @@ -128,7 +154,7 @@ Verify GWMAC Entry On ODL Verify GWMAC Flow Entry Removed From Flow Table [Arguments] ${cnIp} [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table. - ${flow_output}= Run Command On Remote System And Log ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int + ${flow_output}= Run Command On Remote System And Log ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE} Should Contain ${flow_output} table=${GWMAC_TABLE} ${gwmac_table} = Get Lines Containing String ${flow_output} table=${GWMAC_TABLE} Log ${gwmac_table} @@ -136,16 +162,23 @@ Verify GWMAC Flow Entry Removed From Flow Table : FOR ${macAdd} IN @{GWMAC_ADDRS} \ Should Not Contain ${gwmac_table} dl_dst=${macAdd} actions=goto_table:${L3_TABLE} +Verify GWMAC Flow Entry Removed From Flow Table On All Compute Nodes + [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table. + : FOR ${ip} IN @{OS_CMP_IPS} + \ BuiltIn.Wait Until Keyword Succeeds 30s 10s Verify GWMAC Flow Entry Removed From Flow Table ${ip} + Verify ARP REQUEST in groupTable [Arguments] ${group_output} ${Group-ID} [Documentation] get flow dump for group ID Should Contain ${group_output} group_id=${Group-ID} ${arp_group} = Get Lines Containing String ${group_output} group_id=${Group-ID} Log ${arp_group} - Should Match Regexp ${arp_group} ${ARP_REQUEST_GROUP_REGEX} + CompareStream.Run_Keyword_If_At_Most_Oxygen BuiltIn.Should Match Regexp ${arp_group} ${ARP_REQUEST_GROUP_REGEX} + CompareStream.Run_Keyword_If_At_Least_Fluorine BuiltIn.Should Match Regexp ${arp_group} ${ARP_REQUEST_GROUP_REGEX_FLUORINE} Verify Tunnel Status as UP [Documentation] Verify that the tunnels are UP + BuiltIn.Return From Keyword If ${OS_NODE_CNT} == ${1} ${True} ${output}= Issue Command On Karaf Console ${TEP_SHOW_STATE} Log ${output} Should Contain ${output} ${STATE_UP} @@ -186,16 +219,14 @@ Get Fib Entries Get Gateway MAC And IP Address [Arguments] ${router_Name} ${ip_regex}=${IP_REGEX} [Documentation] Get Gateway mac and IP Address - ${output} = Write Commands Until Prompt neutron router-port-list ${router_Name} 30s + ${output} = OpenStack CLI openstack port list --router ${router_Name} @{MacAddr-list} = Get Regexp Matches ${output} ${MAC_REGEX} @{IpAddr-list} = Get Regexp Matches ${output} ${ip_regex} [Return] ${MacAddr-list} ${IpAddr-list} Test Teardown With Tcpdump Stop - [Arguments] ${cn1_conn_id} ${cn2_conn_id} ${os_conn_id} - Stop Packet Capture on Node ${cn1_conn_id} - Stop Packet Capture on Node ${cn2_conn_id} - Stop Packet Capture on Node ${os_conn_id} + [Arguments] ${conn_ids}=@{EMPTY} + OpenStackOperations.Stop Packet Capture On Nodes ${conn_ids} Get Test Teardown Debugs Verify IPv4 GWMAC Flow Entry On Flow Table @@ -220,8 +251,8 @@ Verify IPv6 GWMAC Flow Entry On Flow Table Verify GWMAC Flow Entry On Flow Table [Arguments] ${cnIp} ${ipv}=ipv4 [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table. - ${flow_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows br-int - ${group_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-groups br-int + ${flow_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE} + ${group_output}= Run Command On Remote System ${cnIp} sudo ovs-ofctl -O OpenFlow13 dump-groups ${INTEGRATION_BRIDGE} Should Contain ${flow_output} table=${DISPATCHER_TABLE} ${dispatcher_table} = Get Lines Containing String ${flow_output} table=${DISPATCHER_TABLE} Should Contain ${dispatcher_table} goto_table:${GWMAC_TABLE} @@ -236,14 +267,31 @@ Verify GWMAC Flow Entry On Flow Table #Verify ARP_CHECK_TABLE - 43 #arp request and response ${arpchk_table} = Get Lines Containing String ${flow_output} table=${ARP_CHECK_TABLE} - Should Match Regexp ${arpchk_table} ${ARP_RESPONSE_REGEX} + CompareStream.Run_Keyword_If_At_Most_Oxygen BuiltIn.Should Match Regexp ${arpchk_table} ${ARP_RESPONSE_REGEX} + CompareStream.Run_Keyword_If_At_Least_Fluorine BuiltIn.Should Match Regexp ${arpchk_table} ${ARP_RESPONSE_REGEX_FLUORINE} + ${arppunt_table} = String.Get Lines Containing String ${flow_output} table=${ARP_PUNT_TABLE} + CompareStream.Run_Keyword_If_At_Least_Fluorine BuiltIn.Should Match Regexp ${arppunt_table} ${ARP_PUNT_RESPONSE_REGEX} ${match} = Should Match Regexp ${arpchk_table} ${ARP_REQUEST_REGEX} ${groupID} = Split String ${match} separator=: BuiltIn.Run Keyword If '${ipv}' == 'ipv4' Verify IPv4 GWMAC Flow Entry On Flow Table ${group_output} ${group_id} ${flow_output} ... ELSE Verify IPv6 GWMAC Flow Entry On Flow Table ${flow_output} +Verify GWMAC Flow Entry On Flow Table On All Compute Nodes + [Arguments] ${ipv}=ipv4 + [Documentation] Verify the GWMAC Table, ARP Response table and Dispatcher table. + : FOR ${ip} IN @{OS_CMP_IPS} + \ BuiltIn.Wait Until Keyword Succeeds 30s 10s VpnOperations.Verify GWMAC Flow Entry On Flow Table ${ip} ${ipv} + Delete Multiple L3VPNs [Arguments] @{vpns} [Documentation] Delete three L3VPNs created using Multiple L3VPN Test - : FOR ${vpn} IN ${vpns} + : FOR ${vpn} IN @{vpns} \ VPN Delete L3VPN vpnid=${vpn} + +VNI Test Setup + BuiltIn.Return From Keyword If "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp" + SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing + +VNI Test Teardown + BuiltIn.Return From Keyword If "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp" + OpenStackOperations.Get Test Teardown Debugs