From: Dasa Simkova Date: Tue, 28 Aug 2018 16:43:14 +0000 (+0200) Subject: Add bgp funct rt constrain validation test suite X-Git-Tag: pre-potassium~517 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F75531%2F58;p=integration%2Ftest.git Add bgp funct rt constrain validation test suite This suite tests advertising rt-constrain routes to odl. It runs with 3 bgp peers configured. It tests whether app peer advertizes l3vpn route to bgp peers based on whether app peer received route containing route-target argument from given bgp peer. Change-Id: I2e56acb0a4982de182669d3a6750a79bb63ef92e Signed-off-by: Dasa Simkova --- diff --git a/csit/libraries/BGPSpeaker.robot b/csit/libraries/BGPSpeaker.robot index de5f2a8cd2..9b853bd4b3 100644 --- a/csit/libraries/BGPSpeaker.robot +++ b/csit/libraries/BGPSpeaker.robot @@ -87,3 +87,10 @@ Kill_BGP_Speaker BuiltIn.Return_From_Keyword_If '${status}' == 'PASS' BuiltIn.Log ${message} BuiltIn.Fail The prompt was not seen within timeout period. + +Kill_All_BGP_Speakers + [Documentation] Kill all play.py processes. + ${command}= BuiltIn.Set_Variable ps axf | grep play.py | grep -v grep | awk '{print \"kill -9 \" $1}' | sh + SSHLibrary.Write ${command} + ${output}= SSHLibrary.Read_Until_Prompt + BuiltIn.Log ${output} diff --git a/csit/libraries/BgpRpcClient.py b/csit/libraries/BgpRpcClient.py index b42c43a49c..fe60e2c3be 100644 --- a/csit/libraries/BgpRpcClient.py +++ b/csit/libraries/BgpRpcClient.py @@ -12,9 +12,9 @@ import xmlrpclib class BgpRpcClient(object): """The client for SimpleXMLRPCServer.""" - def __init__(self, peer_addr): + def __init__(self, peer_addr, port=8000): """Setup destination point of the rpc server""" - self.proxy = xmlrpclib.ServerProxy("http://{}:8000".format(peer_addr)) + self.proxy = xmlrpclib.ServerProxy("http://{}:{}".format(peer_addr, port)) def exa_announce(self, full_exabgp_cmd): """The full command to be passed to exabgp.""" diff --git a/csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot b/csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot new file mode 100644 index 0000000000..02fdc00cf3 --- /dev/null +++ b/csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot @@ -0,0 +1,247 @@ +*** Settings *** +Documentation Functional test for bgp - route-target-constrain safi +... +... Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. +... +... This program and the accompanying materials are made available under the +... terms of the Eclipse Public License v1.0 which accompanies this distbmution, +... and is available at http://www.eclipse.org/legal/epl-v10.html +... +... This suite tests advertising rt-constrain routes to odl. For advertising from peer, +... play.py is used, sending hex messages to odl. +... There are 3 peers: ebgp and two ibgps. First peer sends l3vpn route with specific RT to odl, second peer +... sends RT route and third peer only establishes connection. Then it is checked that odl advertizes l3vpn route +... to second peer. Third peer sends wildcard RT route and it is checked that odl doesn't advertize l3vpn route +... to it. Then second peer removes RT and it is checked that second peer withdrew RT route and that odl withdrew +... l3vpn route from it. +Suite Setup Start_Suite +Suite Teardown Stop_Suite +Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing +Library RequestsLibrary +Library SSHLibrary +Library String +Library ../../../libraries/BgpRpcClient.py ${ODL_SYSTEM_IP} 8002 WITH NAME BgpRpcClient2 +Library ../../../libraries/BgpRpcClient.py ${ODL_SYSTEM_IP} 8003 WITH NAME BgpRpcClient3 +Library ../../../libraries/BgpRpcClient.py ${ODL_SYSTEM_IP} 8004 WITH NAME BgpRpcClient4 +Resource ../../../libraries/BGPcliKeywords.robot +Resource ../../../libraries/BgpOperations.robot +Resource ../../../libraries/BGPSpeaker.robot +Resource ../../../libraries/SetupUtils.robot +Resource ../../../libraries/SSHKeywords.robot +Resource ../../../libraries/TemplatedRequests.robot +Resource ../../../libraries/TemplatedRequests.robot +Resource ../../../variables/Variables.robot + +*** Variables *** +${HOLDTIME} 180 +${CONFIG_SESSION} config-session +${RT_CONSTRAIN_DIR} ${CURDIR}/../../../variables/bgpfunctional/rt_constrain +${L3VPN_RIB_URI} ${CURDIR}/../../../variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib +${L3VPN_IPV4_DIR} ${CURDIR}/../../../variables/bgpfunctional/l3vpn_ipv4 +${L3VPN_RSPEMPTY} ${L3VPN_IPV4_DIR}/bgp-l3vpn-ipv4-empty.json +${EBGP_DIR} ${CURDIR}/../../../variables/bgpfunctional/ebgp_peer +${PLAY_SCRIPT} ${CURDIR}/../../../../tools/fastbgp/play.py +${RIB_NAME} example-bgp-rib +${ODL_2_IP} 127.0.0.2 +${ODL_3_IP} 127.0.0.3 +${ODL_4_IP} 127.0.0.4 +@{BGP_PEER_TYPES} external internal internal +@{BGP_PEER_AS_NUMBERS} 65000 64496 64496 +@{ODL_IP_INDICES_ALL} 2 3 4 +@{L3VPN_RT_CHECK} false true false +&{LOC_RIB} PATH=loc-rib BGP_RIB=${RIB_NAME} +&{RT_CONSTRAIN_APP_PEER} IP=${ODL_SYSTEM_IP} BGP_RIB=${RIB_NAME} +&{ADJ_RIB_OUT} PATH=peer/bgp:%2F%2F${ODL_3_IP}/adj-rib-out BGP_RIB=${RIB_NAME} + +*** Test Cases *** +Reconfigure_ODL_To_Accept_Connection + [Documentation] Configures BGP peer module with initiate-connection set to false. + [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing + : FOR ${i} ${type} IN ZIP ${ODL_IP_INDICES_ALL} ${BGP_PEER_TYPES} + \ &{ODL_CONFIG}= BuiltIn.Create Dictionary IP=${ODL_${i}_IP} TYPE=${type} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} + \ ... INITIATE=false BGP_RIB=${RIB_NAME} PASSIVE_MODE=true + \ TemplatedRequests.Put_As_Xml_Templated ${EBGP_DIR} mapping=${ODL_CONFIG} session=${CONFIG_SESSION} + +Start_Bgp_Peers + [Documentation] Start Python speaker to connect to ODL. We give each speaker time until odl really starts to accept incoming + ... bgp connection. The failure happens if the incoming connection comes too quickly after configuring the peer. + [Tags] local_run + [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing + : FOR ${i} ${as_number} IN ZIP ${ODL_IP_INDICES_ALL} ${BGP_PEER_AS_NUMBERS} + \ BuiltIn.Log Many IP: ${ODL_${i}_IP} as_number: ${as_number} + \ Start_Bgp_Peer ${ODL_${i}_IP} ${as_number} 800${i} play.py.090.${i} + +Play_To_Odl_ext_l3vpn_rt_arg + [Documentation] This TC sends route-target route containing route-target argument from node 1 to odl + ... so odl can identify this peer as appropriate for advertizement when it recieves such route. + Play_To_Odl_Non_Removal_BgpRpcClient2 ext_l3vpn_rt_arg ${RT_CONSTRAIN_DIR} + &{EFFECTIVE_RIB_IN}= BuiltIn.Create Dictionary PATH=peer/bgp:%2F%2F${ODL_2_IP}/effective-rib-in BGP_RIB=${RIB_NAME} + BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${RT_CONSTRAIN_DIR}/ext_l3vpn_rt_arg/rib mapping=${EFFECTIVE_RIB_IN} session=${CONFIG_SESSION} + ... verify=True + +Play_To_Odl_rt_constrain_type_0 + [Documentation] Sends RT route from node 2 to odl and then checks that odl advertizes l3vpn route from previous TC. + Play_To_Odl_Non_Removal_BgpRpcClient3 rt_constrain_type_0 ${RT_CONSTRAIN_DIR} + BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${RT_CONSTRAIN_DIR}/rt_constrain_type_0/rib mapping=${LOC_RIB} session=${CONFIG_SESSION} + ... verify=True + +Check_Presence_Of_l3vpn_Route_In_Node_2_Effective_Rib_In_Table + [Documentation] Checks l3vpn route is present in node 2 effective-rib-in table. + BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${RT_CONSTRAIN_DIR}/ext_l3vpn_rt_arg/rib mapping=${ADJ_RIB_OUT} session=${CONFIG_SESSION} + ... verify=True + +Check_l3vpn_Route_Advertisement_On_Each_Node + [Documentation] Checks that each node received or did not receive update message containing given hex message. + ${announce}= OperatingSystem.Get_File ${RT_CONSTRAIN_DIR}/ext_l3vpn_rt_arg/announce_ext_l3vpn_rt_arg.hex + ${announce_hex}= String.Remove_String ${announce} \n + Check_For_L3VPN_Odl_Avertisement ${announce_hex} + +Play_To_Odl_rt_constrain_type_1 + [Documentation] Sends RT route from node 3 to odl and then checks that odl does not advertize l3vpn route from previous TC, + ... that is that update message is empty. + Play_To_Odl_Non_Removal_BgpRpcClient4 rt_constrain_type_1 ${RT_CONSTRAIN_DIR} + &{EFFECTIVE_RIB_IN}= BuiltIn.Create Dictionary PATH=peer/bgp:%2F%2F${ODL_4_IP}/effective-rib-in BGP_RIB=${RIB_NAME} + BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${RT_CONSTRAIN_DIR}/rt_constrain_type_1/rib mapping=${EFFECTIVE_RIB_IN} session=${CONFIG_SESSION} + ... verify=True + ${update}= BgpRpcClient4.play_get + BuiltIn.Should_Be_Equal ${update} ${Empty} + +Play_To_Odl_remove_rt + [Documentation] Removes RT from odl and then checks that second node withdrew l3vpn route and third node did not receive any message. + BgpRpcClient3.play_clean + Play_To_Odl_Routes_Removal_Template_BgpRpcClient3 rt_constrain_type_0 ${RT_CONSTRAIN_DIR} + ${uri}= Resolve_Text_From_File ${L3VPN_RIB_URI} location.uri mapping=${ADJ_RIB_OUT} + BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s Verify_Reported_Data ${uri} ${L3VPN_RSPEMPTY} + ${update}= BgpRpcClient4.play_get + BuiltIn.Should_Be_Equal ${update} ${Empty} + +Play_To_Odl_remove_routes + [Documentation] Removes rt arguments from odl. + Play_To_Odl_Routes_Removal_Template_BgpRpcClient2 ext_l3vpn_rt_arg ${RT_CONSTRAIN_DIR} + Play_To_Odl_Routes_Removal_Template_BgpRpcClient4 rt_constrain_type_1 ${RT_CONSTRAIN_DIR} + +Kill_Talking_BGP_Speakers + [Documentation] Abort all Python speakers. + [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing + BGPcliKeywords.Store_File_To_Workspace play.py.090.2 090_rt_constrain_play_1.log + BGPcliKeywords.Store_File_To_Workspace play.py.090.3 090_rt_constrain_play_2.log + BGPcliKeywords.Store_File_To_Workspace play.py.090.4 090_rt_constrain_play_3.log + BGPSpeaker.Kill_All_BGP_Speakers + +Delete_Bgp_Peers_Configuration + [Documentation] Revert the BGP configuration to the original state: without any configured peers. + [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing + : FOR ${i} ${type} IN ZIP ${ODL_IP_INDICES_ALL} ${BGP_PEER_TYPES} + \ &{ODL_CONFIG}= BuiltIn.Create Dictionary IP=${ODL_${i}_IP} TYPE=${type} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} + \ ... INITIATE=false BGP_RIB=${RIB_NAME} PASSIVE_MODE=true + \ TemplatedRequests.Delete_Templated ${EBGP_DIR} mapping=${ODL_CONFIG} session=${CONFIG_SESSION} + +*** Keywords *** +Start_Suite + [Documentation] Initialize SetupUtils. Suite setup keyword. + SetupUtils.Setup_Utils_For_Setup_And_Teardown + ${conn_id} = SSHLibrary.Open Connection ${ODL_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s + Builtin.Set_Suite_Variable ${conn_id} + SSHKeywords.Flexible_Controller_Login + RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} + SSHLibrary.Put_File ${PLAY_SCRIPT} . + SSHKeywords.Assure_Library_Ipaddr target_dir=. + +Stop_Suite + [Documentation] Suite teardown keyword + SSHLibrary.Close_All_Connections + RequestsLibrary.Delete_All_Sessions + +Start_Bgp_Peer + [Arguments] ${ip} ${as_number} ${port} ${filename} + [Documentation] Starts bgp peer. + ${command}= BuiltIn.Set_Variable python play.py --amount 0 --myip=${ip} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --asnumber=${as_number} --peerport=${ODL_BGP_PORT} --port=${port} --usepeerip --debug --allf --wfr 1 &> ${filename} & + BuiltIn.Log ${command} + ${output}= SSHLibrary.Write ${command} + +Play_To_Odl_Non_Removal_BgpRpcClient2 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/announce_${totest}.hex and send it to odl. + ${announce_hex}= OperatingSystem.Get_File ${dir}/${totest}/announce_${totest}.hex + BgpRpcClient2.play_send ${announce_hex} + +Play_To_Odl_Non_Removal_BgpRpcClient3 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/announce_${totest}.hex and send it to odl. + ${announce_hex}= OperatingSystem.Get_File ${dir}/${totest}/announce_${totest}.hex + BgpRpcClient3.play_send ${announce_hex} + +Play_To_Odl_Non_Removal_BgpRpcClient4 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/announce_${totest}.hex and send it to odl. + ${announce_hex}= OperatingSystem.Get_File ${dir}/${totest}/announce_${totest}.hex + BgpRpcClient4.play_send ${announce_hex} + +Play_To_Odl_Routes_Removal_Template_BgpRpcClient2 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/withdraw_${totest}.hex and send it to odl to remove rt argument from odl. + ${withdraw_hex} = OperatingSystem.Get_File ${dir}/${totest}/withdraw_${totest}.hex + BgpRpcClient2.play_clean + BgpRpcClient2.play_send ${withdraw_hex} + +Play_To_Odl_Routes_Removal_Template_BgpRpcClient3 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/withdraw_${totest}.hex and send it to odl to remove rt argument from odl. + ${withdraw_hex} = OperatingSystem.Get_File ${dir}/${totest}/withdraw_${totest}.hex + BgpRpcClient3.play_clean + BgpRpcClient3.play_send ${withdraw_hex} + +Play_To_Odl_Routes_Removal_Template_BgpRpcClient4 + [Arguments] ${totest} ${dir} ${ipv}=ipv4 + [Documentation] Read contents of file ${dir}/${totest}/withdraw_${totest}.hex and send it to odl to remove rt argument from odl. + ${withdraw_hex} = OperatingSystem.Get_File ${dir}/${totest}/withdraw_${totest}.hex + BgpRpcClient4.play_clean + BgpRpcClient4.play_send ${withdraw_hex} + +Get_Update_Message_And_Compare_With_Hex_BgpRpcClient2 + [Arguments] ${hex} ${option} + [Documentation] Returns hex update message and compares it to hex. + ${update}= BgpRpcClient2.play_get + BuiltIn.Run_Keyword_If "${option}"=="true" BuiltIn.Should_Be_Equal_As_Strings ${update} ${hex} + BuiltIn.Run_Keyword_If "${option}"=="false" BuiltIn.Should_Not_Be_Equal_As_Strings ${update} ${hex} + +Get_Update_Message_And_Compare_With_Hex_BgpRpcClient3 + [Arguments] ${hex} ${option} + [Documentation] Returns hex update message and compares it to hex. + ${update}= BgpRpcClient3.play_get + BuiltIn.Run_Keyword_If "${option}"=="true" BuiltIn.Should_Be_Equal_As_Strings ${update} ${hex} + BuiltIn.Run_Keyword_If "${option}"=="false" BuiltIn.Should_Not_Be_Equal_As_Strings ${update} ${hex} + +Get_Update_Message_And_Compare_With_Hex_BgpRpcClient4 + [Arguments] ${hex} ${option} + [Documentation] Returns hex update message and compares it to hex. + ${update}= BgpRpcClient4.play_get + BuiltIn.Run_Keyword_If "${option}"=="true" BuiltIn.Should_Be_Equal_As_Strings ${update} ${hex} + BuiltIn.Run_Keyword_If "${option}"=="false" BuiltIn.Should_Not_Be_Equal_As_Strings ${update} ${hex} + +Check_For_L3VPN_Odl_Avertisement + [Arguments] ${announce_hex} + [Documentation] Checks that each node received or did not receive update message containing given hex message. + : FOR ${i} ${option} IN ZIP ${ODL_IP_INDICES_ALL} ${L3VPN_RT_CHECK} + \ ${keyword_name}= BuiltIn.Set_Variable Get_Update_Message_And_Compare_With_Hex_BgpRpcClient${i} + \ BuiltIn.Run_Keyword ${keyword_name} ${announce_hex} ${option} + +Resolve_Text_From_File + [Arguments] ${folder} ${file_name} ${mapping}={} + [Documentation] Read and Log contents of file ${folder}/${file_name}, remove endline, + ... perform safe substitution, return result. + ${file_path}= BuiltIn.Set_Variable ${folder}${/}${file_name} + ${template} = OperatingSystem.Get_File ${file_path} + BuiltIn.Log ${template} + ${final_text} = BuiltIn.Evaluate string.Template('''${template}'''.rstrip()).safe_substitute(${mapping}) modules=string + [Return] ${final_text} + +Verify_Reported_Data + [Arguments] ${url} ${exprspfile} + [Documentation] Verifies expected response + ${expresponse}= OperatingSystem.Get File ${exprspfile} + BuiltIn.Log expected_response: ${expresponse} + ${rsp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${url} + BuiltIn.Log actual_response: ${rsp} + BuiltIn.Log actual_response_content: ${rsp.content} + TemplatedRequests.Normalize_Jsons_And_Compare ${expresponse} ${rsp.content} diff --git a/csit/testplans/bgpcep-userfeatures-fluorine.txt b/csit/testplans/bgpcep-userfeatures-fluorine.txt index d02eb3f6da..a45fffd95e 100644 --- a/csit/testplans/bgpcep-userfeatures-fluorine.txt +++ b/csit/testplans/bgpcep-userfeatures-fluorine.txt @@ -22,5 +22,6 @@ integration/test/csit/suites/bgpcep/bgpfunct/020_bgp_functional_multipath.robot integration/test/csit/suites/bgpcep/bgpfunct/060_bgp_functional_mvpn.robot integration/test/csit/suites/bgpcep/bgpfunct/070_bgp_functional_l3vpn_mcast.robot integration/test/csit/suites/bgpcep/bgpfunct/080_bgp_functional_rt_constrain.robot +integration/test/csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot integration/test/csit/suites/bgpcep/bgpfunct/bgp_policies_default.robot integration/test/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot diff --git a/csit/testplans/bgpcep-userfeatures-neon.txt b/csit/testplans/bgpcep-userfeatures-neon.txt index d02eb3f6da..a45fffd95e 100644 --- a/csit/testplans/bgpcep-userfeatures-neon.txt +++ b/csit/testplans/bgpcep-userfeatures-neon.txt @@ -22,5 +22,6 @@ integration/test/csit/suites/bgpcep/bgpfunct/020_bgp_functional_multipath.robot integration/test/csit/suites/bgpcep/bgpfunct/060_bgp_functional_mvpn.robot integration/test/csit/suites/bgpcep/bgpfunct/070_bgp_functional_l3vpn_mcast.robot integration/test/csit/suites/bgpcep/bgpfunct/080_bgp_functional_rt_constrain.robot +integration/test/csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot integration/test/csit/suites/bgpcep/bgpfunct/bgp_policies_default.robot integration/test/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot diff --git a/csit/variables/bgpfunctional/ebgp_peer/data.xml b/csit/variables/bgpfunctional/ebgp_peer/data.xml new file mode 100644 index 0000000000..e9e5dbb046 --- /dev/null +++ b/csit/variables/bgpfunctional/ebgp_peer/data.xml @@ -0,0 +1,6 @@ + + $IP + + /bgp/neighbors/neighbor/bgp/peer-groups/peer-group[peer-group-name="$TYPE-neighbor"] + + diff --git a/csit/variables/bgpfunctional/ebgp_peer/location.uri b/csit/variables/bgpfunctional/ebgp_peer/location.uri new file mode 100644 index 0000000000..2e9bef7295 --- /dev/null +++ b/csit/variables/bgpfunctional/ebgp_peer/location.uri @@ -0,0 +1 @@ +restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/$BGP_RIB/bgp/neighbors/neighbor/$IP diff --git a/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/announce_ext_l3vpn_rt_arg.hex b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/announce_ext_l3vpn_rt_arg.hex new file mode 100644 index 0000000000..4a292aa388 --- /dev/null +++ b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/announce_ext_l3vpn_rt_arg.hex @@ -0,0 +1 @@ +ffffffffffffffffffffffffffffffff0052020000003b4001010040020602010000fbf0800e200001800c00000000000000000a00fffe007005dc510001010203040001010101c010080002fbf000000065 diff --git a/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/data.json b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/data.json new file mode 100644 index 0000000000..6401c6a1cf --- /dev/null +++ b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/data.json @@ -0,0 +1,43 @@ +{ + "bgp-vpn-ipv4:vpn-ipv4-routes": { + "vpn-route": [ + { + "route-key": "WAABAQIDBAABAQEB", + "path-id": 0, + "label-stack": [ + { + "label-value": 24005 + } + ], + "route-distinguisher": "1.2.3.4:1", + "attributes": { + "extended-communities": [ + { + "transitive": true, + "route-target-extended-community": { + "global-administrator": 64496, + "local-administrator": "AAAAZQ==" + } + } + ], + "ipv4-next-hop": { + "global": "10.0.255.254" + }, + "origin": { + "value": "igp" + }, + "as-path": { + "segments": [ + { + "as-sequence": [ + 64496 + ] + } + ] + } + }, + "prefix": "1.1.1.0/24" + } + ] + } +} diff --git a/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/location.uri b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/location.uri new file mode 100644 index 0000000000..08fb5603d5 --- /dev/null +++ b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/rib/location.uri @@ -0,0 +1 @@ +restconf/operational/bgp-rib:bgp-rib/rib/$BGP_RIB/$PATH/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes diff --git a/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/withdraw_ext_l3vpn_rt_arg.hex b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/withdraw_ext_l3vpn_rt_arg.hex new file mode 100644 index 0000000000..daabfbdd91 --- /dev/null +++ b/csit/variables/bgpfunctional/rt_constrain/ext_l3vpn_rt_arg/withdraw_ext_l3vpn_rt_arg.hex @@ -0,0 +1 @@ +ffffffffffffffffffffffffffffffff0045020000002e4001010040020040050400000064800f12000180708000000001010203040001010101c010080002fbf000000065 diff --git a/csit/variables/bgpfunctional/rt_constrain/l3vpn_rt_arg/rib/location.uri b/csit/variables/bgpfunctional/rt_constrain/l3vpn_rt_arg/rib/location.uri index 77394ca8e6..08fb5603d5 100644 --- a/csit/variables/bgpfunctional/rt_constrain/l3vpn_rt_arg/rib/location.uri +++ b/csit/variables/bgpfunctional/rt_constrain/l3vpn_rt_arg/rib/location.uri @@ -1 +1 @@ -/restconf/config/bgp-rib:application-rib/$IP/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes +restconf/operational/bgp-rib:bgp-rib/rib/$BGP_RIB/$PATH/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes diff --git a/tools/fastbgp/play.py b/tools/fastbgp/play.py index 2d50d4c28d..728af5e75f 100755 --- a/tools/fastbgp/play.py +++ b/tools/fastbgp/play.py @@ -65,6 +65,8 @@ def parse_arguments(): # we should mirror AS number from peer's open message. str_help = "Amount of IP prefixes to generate. (negative means ""infinite"")." parser.add_argument("--amount", default="1", type=int, help=str_help) + str_help = "Rpc server port." + parser.add_argument("--port", default="8000", type=int, help=str_help) str_help = "Maximum number of IP prefixes to be announced in one iteration" parser.add_argument("--insert", default="1", type=int, help=str_help) str_help = "Maximum number of IP prefixes to be withdrawn in one iteration" @@ -126,6 +128,8 @@ def parse_arguments(): parser.add_argument("--threshold", default="1000", type=int, help=str_help) str_help = "RFC 4760 Multiprotocol Extensions for BGP-4 supported" parser.add_argument("--rfc4760", default=True, type=bool, help=str_help) + str_help = "Using peerip instead of myip for xmlrpc server" + parser.add_argument("--usepeerip", default=False, action="store_true", help=str_help) str_help = "Link-State NLRI supported" parser.add_argument("--bgpls", default=False, type=bool, help=str_help) str_help = "Link-State NLRI: Identifier" @@ -185,7 +189,7 @@ def establish_connection(arguments): """Establish connection to BGP peer. Arguments: - :arguments: following command-line argumets are used + :arguments: following command-line arguments are used - arguments.myip: local IP address - arguments.myport: local port - arguments.peerip: remote IP address @@ -334,13 +338,14 @@ class MessageGenerator(object): options for MesageGenerator initialisation Notes: Calculates and stores default values used later on for - message geeration. + message generation. """ self.total_prefix_amount = args.amount # Number of update messages left to be sent. self.remaining_prefixes = self.total_prefix_amount # New parameters initialisation + self.port = args.port self.iteration = 0 self.prefix_base_default = args.firstprefix self.prefix_length_default = args.prefixlen @@ -2046,6 +2051,7 @@ def threaded_job(arguments): utils_left = arguments.multiplicity prefix_current = arguments.firstprefix myip_current = arguments.myip + port = arguments.port thread_args = [] rpcqueue = Queue.Queue() storage = SafeDict() @@ -2074,7 +2080,11 @@ def threaded_job(arguments): print "Error: unable to start thread." raise SystemExit(2) - rpcserver = SimpleXMLRPCServer((arguments.myip.compressed, 8000), allow_none=True) + if arguments.usepeerip: + ip = arguments.peerip + else: + ip = arguments.myip + rpcserver = SimpleXMLRPCServer((ip.compressed, port), allow_none=True) rpcserver.register_instance(Rpcs(rpcqueue, storage)) rpcserver.serve_forever()