X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FVpnOperations.robot;h=fe705bd682bc7f7f0b586b2c680d3c168b614fbf;hb=74a9320261f1f32c814842d57527d9680b04c081;hp=b396f0dcc6a1af33321b9f1a74ef91553d55a0b6;hpb=4cfc780475608e2102334a465a230ac4074de03d;p=integration%2Ftest.git diff --git a/csit/libraries/VpnOperations.robot b/csit/libraries/VpnOperations.robot index b396f0dcc6..fe705bd682 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 @@ -49,6 +51,16 @@ VPN Get L3VPN 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()} + Associate L3VPN To Network [Arguments] &{Kwargs} [Documentation] Associate the created L3VPN to a network-id received as dictionary argument @@ -62,12 +74,14 @@ Dissociate L3VPN From Networks 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=default http_timeout=${SESSION_TIMEOUT} + 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=default http_timeout=${SESSION_TIMEOUT} + 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} @@ -99,7 +113,7 @@ 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} @@ -118,7 +132,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} @@ -132,7 +146,8 @@ Verify ARP REQUEST in groupTable 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 @@ -176,13 +191,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 - OpenStackOperations.Stop Packet Capture On Nodes + [Arguments] ${conn_ids}=@{EMPTY} + OpenStackOperations.Stop Packet Capture On Nodes ${conn_ids} Get Test Teardown Debugs Verify IPv4 GWMAC Flow Entry On Flow Table @@ -207,8 +223,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} @@ -223,7 +239,10 @@ 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}