X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FBgpOperations.robot;h=e44c3367383bc4247067a630734582a86319c00f;hb=95fb461b33883108097e6b320ac6df57b59ea20d;hp=98809ed4b2d0fe06b0673cb3efb52eda8951523e;hpb=f08fb5f92c3c46074bf91aaf546d9d411ccd0e84;p=integration%2Ftest.git diff --git a/csit/libraries/BgpOperations.robot b/csit/libraries/BgpOperations.robot index 98809ed4b2..e44c336738 100644 --- a/csit/libraries/BgpOperations.robot +++ b/csit/libraries/BgpOperations.robot @@ -21,6 +21,9 @@ ${NEW_AS_PATH} ${EMPTY} &{APP_PEER} IP=${ODL_SYSTEM_IP} BGP_RIB=${RIB_NAME} ${NEW_IPV4_ROUTES_LINE} ${EMPTY} ${OLD_IPV4_ROUTES_LINE} \n"bgp-inet:ipv4-routes": {}, +${BGP_CONFIG_SERVER_CMD} bgp-connect -h ${ODL_SYSTEM_IP} -p 7644 add +${VPNV4_ADDR_FAMILY} vpnv4 +${DISPLAY_VPN4_ALL} show-bgp --cmd "ip bgp ${VPNV4_ADDR_FAMILY} all" *** Keywords *** Start Quagga Processes On ODL @@ -65,12 +68,18 @@ Start Quagga Processes On DCGW Restart BGP Processes On DCGW [Arguments] ${dcgw_ip} - [Documentation] To Restart the zrpcd, bgpd,and zebra processes on DCGW + [Documentation] To Restart the zrpcd, bgpd and zebra processes on DCGW ${dcgw_conn_id} = Open_Connection_To_Tools_System ip_address=${dcgw_ip} Switch Connection ${dcgw_conn_id} Write Commands Until Expected Prompt sudo pkill -f bgpd ${DEFAULT_LINUX_PROMPT_STRICT} Start Quagga Processes On DCGW ${dcgw_ip} +Stop BGP Processes On Node + [Arguments] ${node_ip} + [Documentation] To stop the bgpd , qthriftd processes on specific node given by user. + Utils.Run Command On Remote System ${node_ip} sudo pkill -f bgpd + Utils.Run Command On Remote System ${node_ip} sudo pkill -f zrpcd + Show Quagga Configuration On ODL [Arguments] ${odl_ip} ${rd} [Documentation] Show quagga config from ODL @@ -154,13 +163,34 @@ Verify BGP Neighbor Status On Quagga Log ${output} Should Contain ${output} BGP state = Established +Setup BGP Peering On ODL + [Arguments] ${odl_ip} ${as_id} ${nbr_ip} + [Documentation] Setup BGP peering between ODL and given neighbor IP. + ... Configuring and starting BGP on ODL node with given AS number + ... Adding and verifying BGP neighbor + KarafKeywords.Issue Command On Karaf Console ${BGP_CONFIG_SERVER_CMD} + BgpOperations.Create BGP Configuration On ODL localas=${as_id} routerid=${odl_ip} + BgpOperations.AddNeighbor To BGP Configuration On ODL remoteas=${as_id} neighborAddr=${nbr_ip} + ${output} = BgpOperations.Get BGP Configuration On ODL session + BuiltIn.Should Contain ${output} ${nbr_ip} + +Setup BGP Peering On DCGW + [Arguments] ${dcgw_ip} ${as_id} ${nbr_ip} ${vrf_name} ${rd} ${loopback_ip} + [Documentation] Setup BGP peering between DCGW and given neighbor IP. + ... Configuring,adding neighbor on DCGW node and verifying BGP neighbor. + BgpOperations.Configure BGP And Add Neighbor On DCGW ${dcgw_ip} ${as_id} ${dcgw_ip} ${nbr_ip} ${vrf_name} ${rd} + ... ${loopback_ip} + ${output} = BgpOperations.Execute Show Command On Quagga ${dcgw_ip} ${RUN_CONFIG} + BuiltIn.Should Contain ${output} ${nbr_ip} + Verify Routes On Quagga [Arguments] ${dcgw_ip} ${rd} ${ip_list} [Documentation] Verify routes on quagga ${output} = Execute Show Command On quagga ${dcgw_ip} show ip bgp vrf ${rd} Log ${output} - : FOR ${ip} IN @{ip_list} - \ Should Contain ${output} ${ip} + FOR ${ip} IN @{ip_list} + Should Contain ${output} ${ip} + END Delete BGP Config On Quagga [Arguments] ${dcgw_ip} ${bgp_id} ${user}=bgpd ${password}=sdncbgpc @@ -191,8 +221,9 @@ Delete L3VPN on DCGW BgpOperations.Create Quagga Telnet Session ${dcgw_ip} bgpd sdncbgpc BgpOperations.Execute Command On Quagga Telnet Session configure terminal BgpOperations.Execute Command On Quagga Telnet Session router bgp ${as_id} - : FOR ${vpn} IN @{vpns} - \ BgpOperations.Execute Command On Quagga Telnet Session no vrf ${vpn} + FOR ${vpn} IN @{vpns} + BgpOperations.Execute Command On Quagga Telnet Session no vrf ${vpn} + END BgpOperations.Execute Command On Quagga Telnet Session end Verify L3VPN On DCGW @@ -220,22 +251,23 @@ Create BGP Configuration On ODL AddNeighbor To BGP Configuration On ODL [Arguments] &{Kwargs} [Documentation] Associate the created L3VPN to a network-id received as dictionary argument - TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE_BGP}/addNeighbor_bgp mapping=${Kwargs} session=session + CompareStream.Run_Keyword_If_Less_Than_Magnesium TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE_BGP}/addNeighbor_bgp mapping=${Kwargs} session=session + CompareStream.Run_Keyword_If_At_Least_Magnesium TemplatedRequests.Post_As_Json_Templated folder=${VAR_BASE_BGP}/addNeighborsContainer_bgp mapping=${Kwargs} session=session Get BGP Configuration On ODL [Arguments] ${odl_session} [Documentation] Get bgp configuration ${resp} = RequestsLibrary.Get Request ${odl_session} ${CONFIG_API}/ebgp:bgp/ - Log ${resp.content} - [Return] ${resp.content} + Log ${resp.text} + [Return] ${resp.text} Delete BGP Configuration On ODL [Arguments] ${odl_session} [Documentation] Delete BGP ${resp} = RequestsLibrary.Delete Request ${odl_session} ${CONFIG_API}/ebgp:bgp/ - Log ${resp.content} + Log ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.content} + [Return] ${resp.text} Create External Tunnel Endpoint Configuration [Arguments] &{Kwargs} @@ -251,8 +283,8 @@ Get External Tunnel Endpoint Configuration [Arguments] ${ip} [Documentation] Get bgp configuration ${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/itm:dc-gateway-ip-list/dc-gateway-ip/${ip}/ - Log ${resp.content} - [Return] ${resp.content} + Log ${resp.text} + [Return] ${resp.text} Teardown_Everything [Documentation] Create and Log the diff between expected and actual responses, make sure Python tool was killed. @@ -374,12 +406,15 @@ Verify_Two_Hex_Messages_Are_Equal ${len_1} = BuiltIn.Get_Length ${hex_1} ${len_2} = BuiltIn.Get_Length ${hex_2} BuiltIn.Should_Be_Equal ${len_1} ${len_2} - ${sum_1} = Sum_Hex_Message_Arguments_To_Integer ${hex_1} - ${sum_2} = Sum_Hex_Message_Arguments_To_Integer ${hex_2} + ${sum_1} = BgpRpcClient.Sum_Hex_Message ${hex_1} + ${sum_2} = BgpRpcClient.Sum_Hex_Message ${hex_2} BuiltIn.Should_Be_Equal ${sum_1} ${sum_2} -Sum_Hex_Message_Arguments_To_Integer - [Arguments] ${hex_string} - [Documentation] Converts hex message arguments to integers and sums them up and returns the sum. - ${final_sum} = BuiltIn.Evaluate sum(map(lambda x: int(x, 16), re.compile('[a-f\d]{2}').findall('${hex_string}'[32:]))) modules=re - [Return] ${final_sum} +Check BGP VPNv4 Nbr On ODL + [Arguments] ${dcgw_count} ${flag}=True ${start}=${START_VALUE} + [Documentation] Check all BGP VPNv4 neighbor on ODL + ${output} = KarafKeywords.Issue Command On Karaf Console ${DISPLAY_VPN4_ALL} + FOR ${index} IN RANGE ${start} ${dcgw_count} + BuiltIn.Run Keyword If ${flag}==True BuiltIn.Should Contain ${output} ${DCGW_IP_LIST[${index}]} + ... ELSE BuiltIn.Should Not Contain ${output} ${DCGW_IP_LIST[${index}]} + END