diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-08-04 20:20:51 +0900 |
---|---|---|
committer | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-08-04 20:34:24 +0900 |
commit | 064c8834e94349f611be6e9555ec355bd1aef351 (patch) | |
tree | c03880a8ac4de1fa37856075fb8ebe14a8e8b21b /test/scenario_test | |
parent | 9914904631b942af6863eb4db1064549aa8e32fe (diff) |
scenario_test: add test in the case of setting only the prefix condition
Diffstat (limited to 'test/scenario_test')
-rw-r--r-- | test/scenario_test/policy/policy_generator.go | 10 | ||||
-rw-r--r-- | test/scenario_test/route_server_policy_test.py | 64 |
2 files changed, 74 insertions, 0 deletions
diff --git a/test/scenario_test/policy/policy_generator.go b/test/scenario_test/policy/policy_generator.go index abf0fc0f..d1a32299 100644 --- a/test/scenario_test/policy/policy_generator.go +++ b/test/scenario_test/policy/policy_generator.go @@ -313,6 +313,8 @@ func createPolicyConfig() *config.RoutingPolicy { st_eComTarget := createStatement("st_eComRegExp", "psExabgp", "nsExabgp", false) st_eComTarget.Conditions.BgpConditions.MatchExtCommunitySet.ExtCommunitySet = "eComTarget" + st_only_prefix_condition_accept := createStatement("st_only_prefix_condition_accept", "psExabgp", "", true) + test_01_import_policy_initial := config.PolicyDefinition{ Name: "test_01_import_policy_initial", Statements: config.Statements{ @@ -635,6 +637,13 @@ func createPolicyConfig() *config.RoutingPolicy { }, } + test_42_only_prefix_condition_accept := config.PolicyDefinition{ + Name: "test_42_only_prefix_condition_accept", + Statements : config.Statements{ + StatementList: []config.Statement{st_only_prefix_condition_accept}, + }, + } + ds := config.DefinedSets{} ds.PrefixSets.PrefixSetList = []config.PrefixSet{ps0, ps1, ps2, ps3, ps4, ps5, ps6, psExabgp} ds.NeighborSets.NeighborSetList = []config.NeighborSet{nsPeer2, nsPeer2V6, nsExabgp} @@ -692,6 +701,7 @@ func createPolicyConfig() *config.RoutingPolicy { test_39_aspath_prepend_action_lastas_export, test_40_ecommunity_origin_condition_import, test_41_ecommunity_target_condition_export, + test_42_only_prefix_condition_accept, }, }, } diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py index fe4304c5..1107eadb 100644 --- a/test/scenario_test/route_server_policy_test.py +++ b/test/scenario_test/route_server_policy_test.py @@ -2808,6 +2808,70 @@ class GoBGPTest(GoBGPTestBase): qpath = self.get_route(peer2, prefix1, retry=1, interval=w) self.assertIsNone(qpath) + """ + distribute-policy test + --------------------- + exabgp ->r1(192.168.100.0/24) -> o | -> peer1-rib -> | -> r2 --> peer1 + r2(192.168.10.0/24) -> x | | + | -> peer2-rib -> | -> r2 --> peer2 + --------------------- + """ + def test_42_only_prefix_condition_accept(self): + # generate exabgp configuration file + r1 = "192.168.100.0/24" + r2 = "192.168.10.0/24" + + e = ExabgpConfig(EXABGP_COMMON_CONF) + e.add_route(r1, aspath='65100') + e.add_route(r2, aspath='65101') + e.write() + + self.quagga_num = 2 + self.use_exa_bgp = True + self.use_ipv6_gobgp = False + + peer1 = "10.0.0.1" + peer2 = "10.0.0.2" + exabgp = "10.0.0.100" + w = self.wait_per_retry + + # policy:test_42_only_prefix_condition_accept which accepts 192.168.100.0/24 + # is attached to exabgp(10.0.0.100)'s distribute policy. + self.setup_config(exabgp, "test_42_only_prefix_condition_accept", "distribute", add_exabgp=True, defaultReject=True) + self.initialize() + + addresses = self.get_neighbor_address(self.gobgp_config) + self.retry_routine_for_state(addresses, "BGP_FSM_ESTABLISHED") + + + path = self.get_paths_in_localrib(peer1, r1, retry=self.retry_count_common, interval=w) + self.assertIsNotNone(path) + + # check show ip bgp on peer1(quagga1) + qpath = self.get_route(peer1, r1, retry=self.retry_count_common, interval=w) + self.assertIsNotNone(qpath) + + path = self.get_paths_in_localrib(peer2, r1, retry=self.retry_count_common, interval=w) + self.assertIsNotNone(path) + + # check show ip bgp on peer2(quagga2) + qpath = self.get_route(peer2, r1, retry=self.retry_count_common, interval=w) + self.assertIsNotNone(qpath) + + path = self.get_paths_in_localrib(peer1, r2, retry=self.retry_count_common, interval=w) + self.assertIsNone(path) + + # check show ip bgp on peer1(quagga1) + qpath = self.get_route(peer1, r2, retry=self.retry_count_common, interval=w) + self.assertIsNone(qpath) + + path = self.get_paths_in_localrib(peer2, r2, retry=self.retry_count_common, interval=w) + self.assertIsNone(path) + + # check show ip bgp on peer1(quagga1) + qpath = self.get_route(peer2, r2, retry=self.retry_count_common, interval=w) + self.assertIsNone(qpath) + class ExabgpConfig(object): |