diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-04-10 22:24:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-07 21:18:04 +0900 |
commit | 2dbca9e29a6813f2df53261ffaa59b9439c13fdd (patch) | |
tree | 8303b71da5741ffb592bc74738b6548d078a0253 /test/scenario_test/route_server_policy_test.py | |
parent | 756cc9162afb675dd7ca159b6f07a6d5b927bcc1 (diff) |
use sorted single master table for route server setup
https://github.com/osrg/gobgp/issues/1249
The IN policy was removed. The modification by the IMPORT policy are
visible to all route server peers.
This saves some dozens bytes memory per a path.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test/route_server_policy_test.py')
-rw-r--r-- | test/scenario_test/route_server_policy_test.py | 293 |
1 files changed, 0 insertions, 293 deletions
diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py index bc3637aa..3c6297d4 100644 --- a/test/scenario_test/route_server_policy_test.py +++ b/test/scenario_test/route_server_policy_test.py @@ -2317,245 +2317,6 @@ class ExportPolicyMedSub(object): @register_scenario -class InPolicyReject(object): - """ - No.31 in-policy reject test - ---------------- - e1 ->r1(community=65100:10) -> x | -> q1-rib -> | -> r2 --> q1 - r2(192.168.10.0/24) -> o | | - | -> q2-rib -> | -> r2 --> q2 - ---------------- - """ - @staticmethod - def boot(env): - lookup_scenario('ImportPolicy').boot(env) - - @staticmethod - def setup(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]} - - g1.set_bgp_defined_set(cs0) - - st0 = {'name': 'st0', - 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0'}}}, - 'actions': {'route-disposition': 'reject-route'}} - - policy = {'name': 'policy0', - 'statements': [st0]} - g1.add_policy(policy, e1, 'in') - - e1.add_route('192.168.100.0/24', community=['65100:10']) - e1.add_route('192.168.10.0/24') - - for c in [e1, q1, q2]: - g1.wait_for(BGP_FSM_ESTABLISHED, c) - - @staticmethod - def check(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - wait_for(lambda: len(g1.get_adj_rib_in(e1)) == 2) - wait_for(lambda: len(g1.get_local_rib(q1)) == 1) - wait_for(lambda: len(g1.get_adj_rib_out(q1)) == 1) - wait_for(lambda: len(q1.get_global_rib()) == 1) - wait_for(lambda: len(g1.get_local_rib(q2)) == 1) - wait_for(lambda: len(g1.get_adj_rib_out(q2)) == 1) - wait_for(lambda: len(q2.get_global_rib()) == 1) - - @staticmethod - def executor(env): - lookup_scenario("InPolicyReject").boot(env) - lookup_scenario("InPolicyReject").setup(env) - lookup_scenario("InPolicyReject").check(env) - - -@register_scenario -class InPolicyAccept(object): - """ - No.32 in-policy accept test - ---------------- - e1 ->r1(community=65100:10) -> x | -> q1-rib -> | -> r2 --> q1 - r2(192.168.10.0/24) -> o | | - | -> q2-rib -> | -> r2 --> q2 - ---------------- - """ - @staticmethod - def boot(env): - lookup_scenario('ImportPolicy').boot(env) - - @staticmethod - def setup(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - cs0 = {'community-sets': [{'community-set-name': 'cs0', 'community-list': ['65100:10']}]} - - g1.set_bgp_defined_set(cs0) - - st0 = {'name': 'st0', - 'conditions': {'bgp-conditions': {'match-community-set': {'community-set': 'cs0'}}}, - 'actions': {'route-disposition': 'accept-route'}} - - policy = {'name': 'policy0', - 'statements': [st0]} - g1.add_policy(policy, e1, 'in', 'reject') - - e1.add_route('192.168.100.0/24', community=['65100:10']) - e1.add_route('192.168.10.0/24') - - for c in [e1, q1, q2]: - g1.wait_for(BGP_FSM_ESTABLISHED, c) - - @staticmethod - def check(env): - lookup_scenario('InPolicyReject').check(env) - - @staticmethod - def executor(env): - lookup_scenario("InPolicyAccept").boot(env) - lookup_scenario("InPolicyAccept").setup(env) - lookup_scenario("InPolicyAccept").check(env) - - -@register_scenario -class InPolicyUpdate(object): - """ - No.35 in-policy update test - r1:192.168.2.0 - r2:192.168.20.0 - r3:192.168.200.0 - ------------------------------------- - | q1 | - e1 ->(r1,r2,r3)-> | ->(r1)-> rib ->(r1)-> adj-rib-out | ->(r1)-> q1 - | | - | q2 | - | ->(r1)-> rib ->(r1)-> adj-rib-out | ->(r1)-> q2 - ------------------------------------- - | - update distribute policy - | - V - ------------------------------------------- - | q1 | - e1 ->(r1,r2,r3)-> | ->(r1,r2)-> rib ->(r1,r2)-> adj-rib-out | ->(r1,r2)-> q1 - | | - | q2 | - | ->(r1,r3)-> rib ->(r1,r3)-> adj-rib-out | ->(r1,r3)-> q2 - ------------------------------------------- - """ - @staticmethod - def boot(env): - lookup_scenario('ImportPolicy').boot(env) - - @staticmethod - def setup(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - - p0 = {'ip-prefix': '192.168.20.0/24'} - p1 = {'ip-prefix': '192.168.200.0/24'} - - ps0 = {'prefix-set-name': 'ps0', - 'prefix-list': [p0, p1]} - g1.set_prefix_set(ps0) - - ns0 = {'neighbor-set-name': 'ns0', - 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]} - g1.set_neighbor_set(ns0) - - st0 = {'name': 'st0', - 'conditions': { - 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}, - 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}}, - 'actions': {'route-disposition': 'reject-route'}} - - policy = {'name': 'policy0', - 'statements': [st0]} - g1.add_policy(policy, e1, 'in') - - e1.add_route('192.168.2.0/24') - e1.add_route('192.168.20.0/24') - e1.add_route('192.168.200.0/24') - - for c in [e1, q1, q2]: - g1.wait_for(BGP_FSM_ESTABLISHED, c) - - @staticmethod - def check(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - wait_for(lambda: len(g1.get_adj_rib_in(e1)) == 3) - wait_for(lambda: len(g1.get_local_rib(q1)) == 1) - wait_for(lambda: len(g1.get_adj_rib_out(q1)) == 1) - wait_for(lambda: len(q1.get_global_rib()) == 1) - wait_for(lambda: len(g1.get_local_rib(q2)) == 1) - wait_for(lambda: len(g1.get_adj_rib_out(q2)) == 1) - wait_for(lambda: len(q2.get_global_rib()) == 1) - - @staticmethod - def setup2(env): - g1 = env.g1 - e1 = env.e1 - # q1 = env.q1 - # q2 = env.q2 - g1.clear_policy() - - p0 = {'ip-prefix': '192.168.20.0/24'} - - ps0 = {'prefix-set-name': 'ps0', - 'prefix-list': [p0]} - g1.set_prefix_set(ps0) - - ns0 = {'neighbor-set-name': 'ns0', - 'neighbor-info-list': [g1.peers[e1]['neigh_addr'].split('/')[0]]} - g1.set_neighbor_set(ns0) - - st0 = {'name': 'st0', - 'conditions': { - 'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}, - 'match-neighbor-set': {'neighbor-set': ns0['neighbor-set-name']}}, - 'actions': {'route-disposition': 'reject-route'}} - - policy = {'name': 'policy0', - 'statements': [st0]} - g1.add_policy(policy, e1, 'in') - g1.softreset(e1) - - @staticmethod - def check2(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - wait_for(lambda: len(g1.get_adj_rib_in(e1)) == 3) - wait_for(lambda: len(g1.get_local_rib(q1)) == 2) - wait_for(lambda: len(g1.get_adj_rib_out(q1)) == 2) - wait_for(lambda: len(q1.get_global_rib()) == 2) - wait_for(lambda: len(g1.get_local_rib(q2)) == 2) - wait_for(lambda: len(g1.get_adj_rib_out(q2)) == 2) - wait_for(lambda: len(q2.get_global_rib()) == 2) - - @staticmethod - def executor(env): - lookup_scenario("InPolicyUpdate").boot(env) - lookup_scenario("InPolicyUpdate").setup(env) - lookup_scenario("InPolicyUpdate").check(env) - lookup_scenario("InPolicyUpdate").setup2(env) - lookup_scenario("InPolicyUpdate").check2(env) - - -@register_scenario class ExportPolicyAsPathPrepend(object): """ No.37 aspath prepend action export @@ -2898,60 +2659,6 @@ class ImportPolicyExCommunityTargetCondition(object): lookup_scenario("ImportPolicyExCommunityTargetCondition").check(env) -@register_scenario -class InPolicyPrefixCondition(object): - """ - No.42 prefix only condition accept in - ----------------- - e1 ->r1(192.168.100.0/24) -> o | -> q1-rib -> | -> r2 --> q1 - r2(192.168.10.0/24) -> x | | - | -> q2-rib -> | -> r2 --> q2 - ----------------- - """ - @staticmethod - def boot(env): - lookup_scenario('ImportPolicy').boot(env) - - @staticmethod - def setup(env): - g1 = env.g1 - e1 = env.e1 - q1 = env.q1 - q2 = env.q2 - - p0 = {'ip-prefix': '192.168.10.0/24'} - - ps0 = {'prefix-set-name': 'ps0', - 'prefix-list': [p0]} - g1.set_prefix_set(ps0) - - st0 = {'name': 'st0', - 'conditions': {'match-prefix-set': {'prefix-set': ps0['prefix-set-name']}}, - 'actions': {'route-disposition': 'reject-route'}} - - policy = {'name': 'policy0', - 'statements': [st0]} - g1.add_policy(policy, e1, 'in') - - # this will be blocked - e1.add_route('192.168.100.0/24') - # this will pass - e1.add_route('192.168.10.0/24') - - for c in [e1, q1, q2]: - g1.wait_for(BGP_FSM_ESTABLISHED, c) - - @staticmethod - def check(env): - lookup_scenario('InPolicyReject').check(env) - - @staticmethod - def executor(env): - lookup_scenario("InPolicyPrefixCondition").boot(env) - lookup_scenario("InPolicyPrefixCondition").setup(env) - lookup_scenario("InPolicyPrefixCondition").check(env) - - def ext_community_exists(path, extcomm): typ = extcomm.split(':')[0] value = ':'.join(extcomm.split(':')[1:]) |