3 # Copyright (c) 2020 by VMware, Inc. ("VMware")
4 # Used Copyright (c) 2018 by Network Device Education Foundation,
5 # Inc. ("NetDEF") in this file.
7 # Permission to use, copy, modify, and/or distribute this software
8 # for any purpose with or without fee is hereby granted, provided
9 # that the above copyright notice and this permission notice appear
12 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
13 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
15 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
16 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
17 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
18 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 Following tests are covered to test bgp aggregation functionality:
25 1. Verify route summarisation with summary-only for redistributed as well as
26 locally generated routes.
27 2. Verify route summarisation with as-set for redistributed routes.
36 from time
import sleep
37 from copy
import deepcopy
39 # Save the Current Working Directory to find configuration files.
40 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
41 sys
.path
.append(os
.path
.join(CWD
, "../"))
43 # pylint: disable=C0413
44 # Import topogen and topotest helpers
45 from lib
import topotest
46 from lib
.micronet_compat
import Topo
47 from lib
.topogen
import Topogen
, get_topogen
49 # Import topoJson from lib, to create topology and initial configuration
50 from lib
.common_config
import (
55 reset_config_on_routers
,
63 from lib
.topolog
import logger
65 verify_bgp_convergence
,
69 verify_bgp_timers_and_functionality
,
71 from lib
.topojson
import build_topo_from_json
, build_config_from_json
73 pytestmark
= [pytest
.mark
.bgpd
, pytest
.mark
.staticd
]
76 # Reading the data from JSON File for topology and configuration creation
77 jsonFile
= "{}/bgp_aggregation.json".format(CWD
)
79 with
open(jsonFile
, "r") as topoJson
:
80 topo
= json
.load(topoJson
)
82 logger
.info("Could not read file:", jsonFile
)
85 BGP_CONVERGENCE
= False
86 ADDR_TYPES
= check_address_types()
88 NETWORK_1_1
= {"ipv4": "10.1.1.0/24", "ipv6": "10:1::1:0/120"}
89 NETWORK_1_2
= {"ipv4": "10.1.2.0/24", "ipv6": "10:1::2:0/120"}
90 NETWORK_1_3
= {"ipv4": "10.1.3.0/24", "ipv6": "10:1::3:0/120"}
91 NETWORK_1_4
= {"ipv4": "10.1.4.0/24", "ipv6": "10:1::4:0/120"}
92 NETWORK_1_5
= {"ipv4": "10.1.5.0/24", "ipv6": "10:1::5:0/120"}
93 NETWORK_2_1
= {"ipv4": "10.1.1.100/32", "ipv6": "10:1::1:0/124"}
94 NETWORK_2_2
= {"ipv4": "10.1.5.0/24", "ipv6": "10:1::5:0/120"}
95 NETWORK_2_3
= {"ipv4": "10.1.6.0/24", "ipv6": "10:1::6:0/120"}
96 NETWORK_2_4
= {"ipv4": "10.1.7.0/24", "ipv6": "10:1::7:0/120"}
97 NETWORK_3_1
= {"ipv4": "10.1.8.0/24", "ipv6": "10:1::8:0/120"}
98 NETWORK_4_1
= {"ipv4": "10.2.1.0/24", "ipv6": "10:2::1:0/120"}
99 NEXT_HOP
= {"ipv4": "Null0", "ipv6": "Null0"}
100 AGGREGATE_NW
= {"ipv4": "10.1.0.0/20", "ipv6": "10:1::/96"}
108 "0:1 0:2 0:3 0:4 0:5 0:10 0:20 0:30 0:40 0:50 0:100 0:200 0:300 0:400 0:500",
109 "0:3 0:4 0:5 0:30 0:40 0:50 0:300 0:400 0:500",
112 "0:3 0:4 0:5 0:6 0:30 0:40 0:50 0:60 0:300 0:400 0:500 0:600",
116 class CreateTopo(Topo
):
118 Test BasicTopo - topology 1
120 * `Topo`: Topology object
123 def build(self
, *_args
, **_opts
):
125 tgen
= get_topogen(self
)
127 # Building topology from json file
128 build_topo_from_json(tgen
, topo
)
131 def setup_module(mod
):
133 Sets up the pytest environment
138 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
139 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
140 logger
.info("=" * 40)
142 logger
.info("Running setup_module to create topology")
144 # This function initiates the topology build with Topogen...
145 tgen
= Topogen(CreateTopo
, mod
.__name
__)
146 # ... and here it calls Mininet initialization functions.
148 # Starting topology, create tmp files which are loaded to routers
149 # to start deamons and then start routers
152 # Creating configuration from JSON
153 build_config_from_json(tgen
, topo
)
155 # Don't run this test if we have any failure.
156 if tgen
.routers_have_failure():
157 pytest
.skip(tgen
.errors
)
159 # Api call verify whether BGP is converged
160 ADDR_TYPES
= check_address_types()
162 for addr_type
in ADDR_TYPES
:
163 BGP_CONVERGENCE
= verify_bgp_convergence(tgen
, topo
)
164 assert BGP_CONVERGENCE
is True, "setup_module :Failed \n Error:" " {}".format(
168 logger
.info("Running setup_module() done")
171 def teardown_module(mod
):
173 Teardown the pytest environment
178 logger
.info("Running teardown_module to delete topology")
182 # Stop toplogy and Remove tmp files
186 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
188 logger
.info("=" * 40)
191 #####################################################
195 #####################################################
198 def test_route_summarisation_with_summary_only_p1(request
):
200 Verify route summarisation with summary-only for redistributed as well as
201 locally generated routes.
205 tc_name
= request
.node
.name
206 reset_config_on_routers(tgen
)
207 write_test_header(tc_name
)
209 # Don"t run this test if we have any failure.
210 if tgen
.routers_have_failure():
211 pytest
.skip(tgen
.errors
)
213 step("Configure static routes on router R1 and redistribute in " "BGP process.")
215 for addr_type
in ADDR_TYPES
:
221 NETWORK_1_1
[addr_type
],
222 NETWORK_1_2
[addr_type
],
223 NETWORK_1_3
[addr_type
],
225 "next_hop": NEXT_HOP
[addr_type
],
230 input_redistribute
= {
235 "unicast": {"redistribute": [{"redist_type": "static"}]}
242 step("Configuring {} static routes on router R1 ".format(addr_type
))
244 result
= create_static_routes(tgen
, input_static
)
245 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
248 "Configuring redistribute static for {} address-family on router R1 ".format(
253 result
= create_router_bgp(tgen
, topo
, input_redistribute
)
254 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
258 step("Verify that Static routes are redistributed in BGP process")
260 for addr_type
in ADDR_TYPES
:
266 NETWORK_1_1
[addr_type
],
267 NETWORK_1_2
[addr_type
],
268 NETWORK_1_3
[addr_type
],
275 result
= verify_rib(tgen
, addr_type
, "r3", input_static
)
276 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
278 step("Advertise some prefixes using network command")
280 "Additionally advertise 10.1.4.0/24 & 10.1.5.0/24 and "
281 "10:1::4:0/120 & 10:1::5:0/120 from R4 to R1."
284 for addr_type
in ADDR_TYPES
:
291 "advertise_networks": [
294 NETWORK_2_1
[addr_type
],
295 NETWORK_2_2
[addr_type
],
296 NETWORK_2_3
[addr_type
],
297 NETWORK_2_4
[addr_type
],
311 "advertise_networks": [
314 NETWORK_1_4
[addr_type
],
315 NETWORK_1_5
[addr_type
],
326 result
= create_router_bgp(tgen
, topo
, input_advertise
)
327 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
332 "Verify that advertised prefixes using network command are being "
333 "advertised in BGP process"
336 for addr_type
in ADDR_TYPES
:
343 "advertise_networks": [
346 NETWORK_2_1
[addr_type
],
347 NETWORK_2_2
[addr_type
],
348 NETWORK_2_3
[addr_type
],
349 NETWORK_2_4
[addr_type
],
360 result
= verify_rib(tgen
, addr_type
, "r3", input_advertise
)
361 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
363 step("Configure aggregate-address to summarise all the advertised routes.")
365 for addr_type
in ADDR_TYPES
:
372 "aggregate_address": [
374 "network": AGGREGATE_NW
[addr_type
],
385 result
= create_router_bgp(tgen
, topo
, route_aggregate
)
386 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
391 "Verify that we see 1 summarised route and remaining suppressed "
392 "routes on advertising router R1 and only 1 summarised route on "
393 "receiving router R3 for both AFIs."
396 for addr_type
in ADDR_TYPES
:
398 "r1": {"static_routes": [{"network": AGGREGATE_NW
[addr_type
]}]}
406 NETWORK_1_1
[addr_type
],
407 NETWORK_1_2
[addr_type
],
408 NETWORK_1_3
[addr_type
],
415 result
= verify_rib(tgen
, addr_type
, "r3", input_static_agg
, protocol
="bgp")
416 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
419 tgen
, addr_type
, "r3", input_static
, protocol
="bgp", expected
=False
423 ), "Testcase : Failed \n " "Routes are still present \n Error: {}".format(
427 result
= verify_rib(tgen
, addr_type
, "r1", input_static_agg
, protocol
="bgp")
428 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
430 result
= verify_rib(tgen
, addr_type
, "r1", input_static
)
431 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
433 for action
, value
in zip(["removed", "add"], [True, False]):
436 "{} static routes as below: "
437 "(no) ip route 10.1.1.0/24 and (no) ip route 10.1.2.0/24"
438 "(no) ipv6 route 10:1::1:0/120 and (no) ip route 10:1::2:0/120".format(
443 for addr_type
in ADDR_TYPES
:
448 "network": [NETWORK_1_1
[addr_type
], NETWORK_1_2
[addr_type
]],
449 "next_hop": NEXT_HOP
[addr_type
],
456 result
= create_static_routes(tgen
, input_static
)
457 assert result
is True, "Testcase : Failed \n Error: {}".format(
462 "Verify that there is no impact on R3, as summarised route remains "
463 "intact. However suppressed routes on R1 disappear and re-appear "
464 "based on {} static routes.".format(action
)
467 for addr_type
in ADDR_TYPES
:
471 {"network": [NETWORK_1_1
[addr_type
], NETWORK_1_2
[addr_type
]]}
477 "r1": {"static_routes": [{"network": AGGREGATE_NW
[addr_type
]}]}
482 tgen
, addr_type
, "r1", input_static_1
, expected
=False
484 assert result
is not True, (
485 "Testcase : Failed \n "
486 "Routes are still present \n Error: {}".format(tc_name
, result
)
489 result
= verify_rib(tgen
, addr_type
, "r1", input_static_1
)
490 assert result
is True, "Testcase : Failed \n Error: {}".format(
494 result
= verify_rib(tgen
, addr_type
, "r3", input_static_2
, protocol
="bgp")
495 assert result
is True, "Testcase : Failed \n Error: {}".format(
500 "{} prefixes using network command as below:"
501 "(no) network 10.1.6.1/24 and (no) network 10.1.7.1/24"
502 "(no) network 10:1::6:0/120 and (no) network 10:1::7:0/120".format(action
)
505 for addr_type
in ADDR_TYPES
:
512 "advertise_networks": [
515 NETWORK_2_3
[addr_type
],
516 NETWORK_2_4
[addr_type
],
528 result
= create_router_bgp(tgen
, topo
, input_advertise
)
529 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
534 "Verify that there is no impact on R3, as summarised route remains "
535 "intact. However suppressed routes on R1 disappear and re-appear "
536 "based on {} of network command.".format(action
)
539 for addr_type
in ADDR_TYPES
:
540 input_advertise_1
= {
546 "advertise_networks": [
549 NETWORK_2_3
[addr_type
],
550 NETWORK_2_4
[addr_type
],
561 input_advertise_2
= {
567 "advertise_networks": [
568 {"network": AGGREGATE_NW
[addr_type
]}
578 result
= verify_bgp_rib(
579 tgen
, addr_type
, "r1", input_advertise_1
, expected
=False
581 assert result
is not True, (
582 "Testcase : Failed \n "
583 "Routes are still present \n Error: {}".format(tc_name
, result
)
586 result
= verify_bgp_rib(tgen
, addr_type
, "r1", input_advertise_1
)
587 assert result
is True, "Testcase : Failed \n Error: {}".format(
591 result
= verify_rib(tgen
, addr_type
, "r3", input_advertise_2
)
592 assert result
is True, "Testcase : Failed \n Error: {}".format(
597 "Add a new network each one from out of aggregation range and "
598 "other within aggregation range. "
601 for addr_type
in ADDR_TYPES
:
605 {"network": NETWORK_3_1
[addr_type
], "next_hop": NEXT_HOP
[addr_type
]}
610 result
= create_static_routes(tgen
, input_static
)
611 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
613 for addr_type
in ADDR_TYPES
:
620 "advertise_networks": [
622 "network": NETWORK_4_1
[addr_type
],
632 result
= create_router_bgp(tgen
, topo
, input_advertise
)
633 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
638 "Verify that when a network within aggregation range is added, "
639 "there is no impact on receiving router. However if a network "
640 "outside aggregation range is added/removed, R3 receives and "
641 "withdraws it accordingly."
644 for addr_type
in ADDR_TYPES
:
645 input_static
= {"r1": {"static_routes": [{"network": AGGREGATE_NW
[addr_type
]}]}}
647 result
= verify_rib(tgen
, addr_type
, "r3", input_static
, protocol
="bgp")
648 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
650 input_advertise_2
= {
656 "advertise_networks": [
659 NETWORK_4_1
[addr_type
],
660 AGGREGATE_NW
[addr_type
],
671 result
= verify_rib(tgen
, addr_type
, "r3", input_advertise_2
, protocol
="bgp")
672 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
674 for action
, value
in zip(["Delete", "Re-add"], [True, False]):
675 step("{} aggregation command from R1.".format(action
))
677 for addr_type
in ADDR_TYPES
:
684 "aggregate_address": [
686 "network": AGGREGATE_NW
[addr_type
],
698 result
= create_router_bgp(tgen
, topo
, route_aggregate
)
699 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
704 "Verify on both routers that summarised route is withdrawn from R1 "
705 "and R3 when aggregate-address command is removed and appears again "
706 "when aggregate-address command is re-added. Check for both AFIs."
709 for addr_type
in ADDR_TYPES
:
711 "r1": {"static_routes": [{"network": AGGREGATE_NW
[addr_type
]}]}
716 tgen
, addr_type
, "r1", input_static_agg
, expected
=False
718 assert result
is not True, (
719 "Testcase : Failed \n "
720 "Aggregated route is still present \n Error: {}".format(
726 tgen
, addr_type
, "r3", input_static_agg
, expected
=False
728 assert result
is not True, (
729 "Testcase : Failed \n "
730 "Aggregated route is still present \n Error: {}".format(
735 result
= verify_rib(tgen
, addr_type
, "r1", input_static_agg
)
736 assert result
is True, "Testcase : Failed \n Error: {}".format(
740 result
= verify_rib(tgen
, addr_type
, "r3", input_static_agg
)
741 assert result
is True, "Testcase : Failed \n Error: {}".format(
745 write_test_footer(tc_name
)
748 def test_route_summarisation_with_as_set_p1(request
):
750 Verify route summarisation with as-set for redistributed routes.
754 tc_name
= request
.node
.name
755 reset_config_on_routers(tgen
)
756 write_test_header(tc_name
)
758 # Don"t run this test if we have any failure.
759 if tgen
.routers_have_failure():
760 pytest
.skip(tgen
.errors
)
762 step("Configure static routes on router R1 and redistribute in " "BGP process.")
764 for addr_type
in ADDR_TYPES
:
770 NETWORK_1_1
[addr_type
],
771 NETWORK_1_2
[addr_type
],
772 NETWORK_1_3
[addr_type
],
773 NETWORK_1_4
[addr_type
],
774 NETWORK_1_5
[addr_type
],
776 "next_hop": NEXT_HOP
[addr_type
],
781 input_redistribute
= {
786 "unicast": {"redistribute": [{"redist_type": "static"}]}
793 step("Configuring {} static routes on router R1 ".format(addr_type
))
795 result
= create_static_routes(tgen
, input_static
)
796 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
799 "Configuring redistribute static for {} address-family on router R1 ".format(
804 result
= create_router_bgp(tgen
, topo
, input_redistribute
)
805 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
809 step("Verify that Static routes are redistributed in BGP process")
811 for addr_type
in ADDR_TYPES
:
817 NETWORK_1_1
[addr_type
],
818 NETWORK_1_2
[addr_type
],
819 NETWORK_1_3
[addr_type
],
820 NETWORK_1_4
[addr_type
],
821 NETWORK_1_5
[addr_type
],
828 result
= verify_rib(tgen
, addr_type
, "r3", input_static
)
829 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
832 "Configure a route-map to attach a unique community attribute value "
833 "to each of these prefixes, while re-distributing static."
836 for addr_type
in ADDR_TYPES
:
837 for pfx
, seq_id
, network
, in zip(
839 [10, 20, 30, 40, 50],
840 [NETWORK_1_1
, NETWORK_1_2
, NETWORK_1_3
, NETWORK_1_4
, NETWORK_1_5
],
846 "pf_list_{}_{}".format(addr_type
, pfx
): [
849 "network": network
[addr_type
],
857 result
= create_prefix_lists(tgen
, prefix_list
)
858 assert result
is True, "Test case {} : Failed \n Error: {}".format(
862 step("Create route-map for applying prefix-list on r1")
864 for addr_type
in ADDR_TYPES
:
865 for pfx
, comm_id
in zip([1, 2, 3, 4, 5], [0, 1, 2, 3, 4]):
869 "rmap_{}".format(addr_type
): [
874 "prefix_lists": "pf_list_{}_{}".format(
879 "set": {"community": {"num": COMMUNITY
[comm_id
]}},
886 result
= create_route_maps(tgen
, route_map
)
887 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
891 step("Re-configure redistribute static with route-map")
893 for addr_type
in ADDR_TYPES
:
894 input_redistribute
= {
902 "redist_type": "static",
904 "route-map": "rmap_{}".format(addr_type
)
915 result
= create_router_bgp(tgen
, topo
, input_redistribute
)
916 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
920 step("Configure aggregate-address to summarise all the advertised routes.")
922 for addr_type
in ADDR_TYPES
:
929 "aggregate_address": [
930 {"network": AGGREGATE_NW
[addr_type
], "as_set": True}
939 result
= create_router_bgp(tgen
, topo
, route_aggregate
)
940 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
945 "Verify that we see summarised route on router R3 with all the "
946 "community attribute values combined with that aggregate route."
949 for addr_type
in ADDR_TYPES
:
950 input_dict
= {"community": COMMUNITY
[5]}
951 result
= verify_bgp_community(
952 tgen
, addr_type
, "r3", [AGGREGATE_NW
[addr_type
]], input_dict
954 assert result
is True, "Test case {} : Failed \n Error: {}".format(
959 "Remove static routes as below: "
960 "(no) ip route 10.1.1.0/24 blackhole "
961 "(no) ip route 10.1.2.0/24 blackhole "
962 "(no) ipv6 route 10:1::1:0/120 blackhole "
963 "(no) ipv6 route 10:1::2:0/120 blackhole "
966 for addr_type
in ADDR_TYPES
:
971 "network": [NETWORK_1_1
[addr_type
], NETWORK_1_2
[addr_type
]],
972 "next_hop": NEXT_HOP
[addr_type
],
979 result
= create_static_routes(tgen
, input_static
)
980 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
983 "Verify on R3 that whenever we remove the static routes, we still"
984 " see aggregated route however the corresponding community attribute"
985 "values are withdrawn."
988 for addr_type
in ADDR_TYPES
:
989 input_dict
= {"community": COMMUNITY
[6]}
990 result
= verify_bgp_community(
991 tgen
, addr_type
, "r3", [AGGREGATE_NW
[addr_type
]], input_dict
993 assert result
is True, "Test case {} : Failed \n Error: {}".format(
998 "Add/remove a new network with community value, each one from out of "
999 "aggregation range and other within aggregation range. "
1003 "Add a new network each one from out of aggregation range and "
1004 "other within aggregation range. "
1007 for addr_type
in ADDR_TYPES
:
1012 "network": [NETWORK_3_1
[addr_type
], NETWORK_4_1
[addr_type
]],
1013 "next_hop": NEXT_HOP
[addr_type
],
1019 result
= create_static_routes(tgen
, input_static
)
1020 assert result
is True, "Testcase : Failed \n Error: {}".format(tc_name
, result
)
1022 for addr_type
in ADDR_TYPES
:
1027 ) in zip([6, 7], [60, 70], [NETWORK_3_1
, NETWORK_4_1
]):
1032 "pf_list_{}_{}".format(addr_type
, pfx
): [
1035 "network": network
[addr_type
],
1043 result
= create_prefix_lists(tgen
, prefix_list
)
1044 assert result
is True, "Test case {} : Failed \n Error: {}".format(
1048 step("Create route-map for applying prefix-list on r1")
1050 for addr_type
in ADDR_TYPES
:
1051 for pfx
, comm_id
in zip([6, 7], [7, 8]):
1055 "rmap_{}".format(addr_type
): [
1060 "prefix_lists": "pf_list_{}_{}".format(
1065 "set": {"community": {"num": COMMUNITY
[comm_id
]}},
1072 result
= create_route_maps(tgen
, route_map
)
1073 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
1078 "Verify on R3 when route is added within the summary range, aggregated"
1079 " route also has associated community value added. However if the route"
1080 " is beyond the summary range the aggregated route would have no impact"
1083 for addr_type
in ADDR_TYPES
:
1084 input_dict
= {"community": COMMUNITY
[9]}
1085 result
= verify_bgp_community(
1086 tgen
, addr_type
, "r3", [AGGREGATE_NW
[addr_type
]], input_dict
1088 assert result
is True, "Test case {} : Failed \n Error: {}".format(
1092 for action
, value
in zip(["Delete", "Re-add"], [True, False]):
1093 step("{} aggregation command from R1.".format(action
))
1095 for addr_type
in ADDR_TYPES
:
1102 "aggregate_address": [
1104 "network": AGGREGATE_NW
[addr_type
],
1116 result
= create_router_bgp(tgen
, topo
, route_aggregate
)
1117 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
1122 "Verify that when as-set command is removed, we do not see community "
1123 "attribute added to summarised route on R3. However when as-set option "
1124 "is re-added, all the community attribute values must appear with "
1128 for addr_type
in ADDR_TYPES
:
1129 input_static_agg
= {
1130 "r1": {"static_routes": [{"network": AGGREGATE_NW
[addr_type
]}]}
1134 result
= verify_rib(
1135 tgen
, addr_type
, "r1", input_static_agg
, expected
=False
1137 assert result
is not True, (
1138 "Testcase : Failed \n "
1139 "Aggregated route is still present \n Error: {}".format(
1144 result
= verify_rib(
1145 tgen
, addr_type
, "r3", input_static_agg
, expected
=False
1147 assert result
is not True, (
1148 "Testcase : Failed \n "
1149 "Aggregated route is still present \n Error: {}".format(
1154 result
= verify_rib(tgen
, addr_type
, "r1", input_static_agg
)
1155 assert result
is True, "Testcase : Failed \n Error: {}".format(
1159 result
= verify_rib(tgen
, addr_type
, "r3", input_static_agg
)
1160 assert result
is True, "Testcase : Failed \n Error: {}".format(
1164 input_dict
= {"community": COMMUNITY
[9]}
1165 result
= verify_bgp_community(
1166 tgen
, addr_type
, "r3", [AGGREGATE_NW
[addr_type
]], input_dict
1168 assert result
is True, "Test case {} : Failed \n Error: {}".format(
1172 write_test_footer(tc_name
)
1175 if __name__
== "__main__":
1176 args
= ["-s"] + sys
.argv
[1:]
1177 sys
.exit(pytest
.main(args
))