Add peer group configuration 62/69662/34
authorTomas Markovic <tomas.markovic@pantheon.tech>
Tue, 20 Mar 2018 12:22:56 +0000 (13:22 +0100)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 4 Jun 2018 17:58:10 +0000 (17:58 +0000)
Add configuration of peer-group as template
for all the neighbors which are using
the same attributes.

Makes setting all the neighbors less
verbose, especially in the case when we
are reconfiguring 600 neighbors, and tests
new functionality.

Change-Id: Ice5fdff48d74c2745a7e12b881ba38ae15ad6f77
Signed-off-by: Tomas Markovic <tomas.markovic@pantheon.tech>
csit/suites/bgpcep/bgpingest/manypeers_changecount.robot
csit/variables/bgpuser/bgp_peer_group/location.uri

index 7d425ee7180820433dbbb4be4aad6a5a61ce3886..ec412ee08e7e27c1daf800b6d83607fa241447da 100644 (file)
@@ -1,7 +1,7 @@
 *** Settings ***
 Documentation     BGP performance of ingesting from many iBGP peers, data change counter is used.
 ...
-...               Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+...               Copyright (c) 2018 Cisco Systems, Inc. and others. 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 distribution,
@@ -52,8 +52,10 @@ Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_T
 Library           DateTime
 Library           RequestsLibrary
 Library           SSHLibrary    timeout=10s
+Resource          ../../../libraries/BGPcliKeywords.robot
 Resource          ../../../libraries/BGPSpeaker.robot
 Resource          ../../../libraries/ChangeCounter.robot
+Resource          ../../../libraries/CompareStream.robot
 Resource          ../../../libraries/FailFast.robot
 Resource          ../../../libraries/KarafKeywords.robot
 Resource          ../../../libraries/KillPythonTool.robot
@@ -83,6 +85,7 @@ ${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
 ${MULTIPLICITY}    2    # May be increased after Bug 4488 is fixed.
 ${MULTIPLICITY_CHANGE_COUNT}    ${MULTIPLICITY}
 ${MULTIPLICITY_CHANGE_COUNT_MANY}    ${MULTIPLICITY_CHANGE_COUNT}
+${PEER_GROUP}     internal-neighbors
 ${REPETITIONS}    1    # Should be increased depending on multiplicity.
 ${REPETITIONS_CHANGE_COUNT}    ${REPETITIONS}
 ${REPETITIONS_CHANGE_COUNT_MANY}    ${REPETITIONS_CHANGE_COUNT}
@@ -104,13 +107,16 @@ Check_For_Empty_Ipv4_Topology_Before_Talking
 
 Reconfigure_ODL_To_Accept_Connections
     [Documentation]    Configure BGP peer modules with initiate-connection set to false.
+    ...    In Versions Fluorine and above, it sets peer-group as template, and than sets all neighbors using it.
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Configure_Peer_Group
     : FOR    ${index}    IN RANGE    1    ${MULTIPLICITY_CHANGE_COUNT_MANY}+1
     \    ${peer_name} =    BuiltIn.Set_Variable    example-bgp-peer-${index}
     \    ${peer_ip} =    BuiltIn.Evaluate    str(ipaddr.IPAddress('${FIRST_PEER_IP}') + ${index} - 1)    modules=ipaddr
     \    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${peer_name}    IP=${peer_ip}    HOLDTIME=${HOLDTIME_CHANGE_COUNT_MANY}
     \    ...    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
-    \    ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
-    \    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
+    \    ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    \    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}
+    \    CompareStream.Run_Keyword_If_Less_Than_Fluorine    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
     # FIXME: Add testcase to change bgpcep and protocol log levels, when a Keyword that does it without messing with current connection is ready.
 
 Reconfigure_Data_Change_Counter
@@ -146,6 +152,7 @@ Kill_Talking_BGP_Speakers
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
     Store_Change_Count
     BGPSpeaker.Kill_BGP_Speaker
+    BGPcliKeywords.Store_File_To_Workspace    play.py.out    manypeers_cc_play.log
     FailFast.Do_Not_Fail_Fast_From_Now_On
     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
@@ -178,7 +185,10 @@ Delete_Bgp_Peer_Configuration
     \    ${peer_name} =    BuiltIn.Set_Variable    example-bgp-peer-${index}
     \    ${peer_ip} =    BuiltIn.Evaluate    str(ipaddr.IPAddress('${FIRST_PEER_IP}') + ${index} - 1)    modules=ipaddr
     \    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${peer_name}    IP=${peer_ip}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
-    \    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
+    \    ...    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    \    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}
+    \    CompareStream.Run_Keyword_If_Less_Than_Fluorine    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Deconfigure_Peer_Group
 
 *** Keywords ***
 Setup_Everything
@@ -219,3 +229,19 @@ Store_Change_Count
     [Documentation]    Get the count of changes from BGP change counter. Ignore error or store the value.
     ${status}    ${count} =    BuiltIn.Run_Keyword_And_Ignore_Error    ChangeCounter.Get_Change_Count
     BuiltIn.Run_Keyword_If    '${status}' == 'PASS'    BuiltIn.Set_Suite_Variable    ${last_change_count_many}    ${count}
+
+Configure_Peer_Group
+    [Documentation]    Configures peer group which is template for all the neighbors which are going
+    ...    to be configured. Also after PUT, this case verifies presence of peer group within
+    ...    peer-groups. This test case is specific to versions Fluorine and above.
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME_CHANGE_COUNT_MANY}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}peer_group    mapping=${mapping}
+    TemplatedRequests.Get_As_Json_Templated    ${BGP_VARIABLES_FOLDER}${/}verify_peer_group    mapping=${mapping}    verify=True
+
+Deconfigure_Peer_Group
+    [Documentation]    Deconfigures peer group which is template for all the neighbors.
+    ...    This test case is specific to versions Fluorine and above.
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME_CHANGE_COUNT_MANY}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}peer_group    mapping=${mapping}
index a630024e72ebe741318e5749d3f5705ff38dac0e..d713ddf1ec1b5c4cad75036a6e246354cfc1faae 100644 (file)
@@ -1,2 +1 @@
 restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/$BGP_RIB_OPENCONFIG/bgp/neighbors/neighbor/$IP
-