summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAshish Pant <ashish12pant@gmail.com>2019-10-17 05:14:55 +0530
committerAshish Pant <ashish12pant@gmail.com>2019-10-17 09:17:03 +0530
commit06e693f11bf60d52e2bdfa53e5e6fa1549b9c644 (patch)
tree966336f8776594146daf2c5ff3fa22944bc91b2a /tests
parentca2ef9e6ff55af54845d37f2d2736273e7478ca1 (diff)
tests: Update bgp api for community and aggregate address
Signed-off-by: Ashish Pant <ashish12pant@gmail.com> Add support for not sending community data in bgp and update aggregate address configuration code
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/lib/bgp.py59
1 files changed, 26 insertions, 33 deletions
diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py
index 41d6a326cf..7ec584bf5f 100644
--- a/tests/topotests/lib/bgp.py
+++ b/tests/topotests/lib/bgp.py
@@ -200,29 +200,6 @@ def __create_bgp_global(tgen, input_dict, router, build=False):
config_data.append("bgp router-id {}".format(
router_id))
- aggregate_address = bgp_data.setdefault("aggregate_address",
- {})
- if aggregate_address:
- network = aggregate_address.setdefault("network", None)
- if not network:
- logger.error("Router %s: 'network' not present in "
- "input_dict for BGP", router)
- else:
- cmd = "aggregate-address {}".format(network)
-
- as_set = aggregate_address.setdefault("as_set", False)
- summary = aggregate_address.setdefault("summary", False)
- del_action = aggregate_address.setdefault("delete", False)
- if as_set:
- cmd = "{} {}".format(cmd, "as-set")
- if summary:
- cmd = "{} {}".format(cmd, "summary")
-
- if del_action:
- cmd = "no {}".format(cmd)
-
- config_data.append(cmd)
-
return config_data
@@ -300,15 +277,25 @@ def __create_bgp_unicast_neighbor(tgen, topo, input_dict, router,
ebgp
))
- aggregate_address = addr_data.setdefault("aggregate_address",
- {})
- if aggregate_address:
- ip = aggregate_address("network", None)
- attribute = aggregate_address("attribute", None)
- if ip:
- cmd = "aggregate-address {}".format(ip)
- if attribute:
- cmd = "{} {}".format(cmd, attribute)
+ aggregate_addresses = addr_data.setdefault("aggregate_address", [])
+ for aggregate_address in aggregate_addresses:
+ network = aggregate_address.setdefault("network", None)
+ if not network:
+ logger.debug("Router %s: 'network' not present in "
+ "input_dict for BGP", router)
+ else:
+ cmd = "aggregate-address {}".format(network)
+
+ as_set = aggregate_address.setdefault("as_set", False)
+ summary = aggregate_address.setdefault("summary", False)
+ del_action = aggregate_address.setdefault("delete", False)
+ if as_set:
+ cmd = "{} as-set".format(cmd)
+ if summary:
+ cmd = "{} summary".format(cmd)
+
+ if del_action:
+ cmd = "no {}".format(cmd)
config_data.append(cmd)
@@ -481,14 +468,20 @@ def __create_bgp_unicast_address_family(topo, input_dict, router, addr_type,
send_community = peer.setdefault("send_community", None)
prefix_lists = peer.setdefault("prefix_lists", {})
route_maps = peer.setdefault("route_maps", {})
+ no_send_community = peer.setdefault("no_send_community", None)
# next-hop-self
if next_hop_self:
config_data.append("{} next-hop-self".format(neigh_cxt))
- # no_send_community
+ # send_community
if send_community:
config_data.append("{} send-community".format(neigh_cxt))
+ # no_send_community
+ if no_send_community:
+ config_data.append("no {} send-community {}".format(
+ neigh_cxt, no_send_community))
+
if prefix_lists:
for prefix_list in prefix_lists:
name = prefix_list.setdefault("name", {})