diff options
-rw-r--r-- | table/policy.go | 22 | ||||
-rw-r--r-- | test/scenario_test/global_policy_test.py | 1 | ||||
-rw-r--r-- | test/scenario_test/route_server_policy_grpc_test.py | 21 | ||||
-rw-r--r-- | test/scenario_test/route_server_policy_test.py | 79 |
4 files changed, 85 insertions, 38 deletions
diff --git a/table/policy.go b/table/policy.go index 809bb984..7698bad6 100644 --- a/table/policy.go +++ b/table/policy.go @@ -1893,6 +1893,13 @@ func (s *Statement) Apply(path *Path) (RouteType, *Path) { "PolicyName": s.Name, }).Debug("statement evaluate : ", result) if result { + if len(s.ModActions) != 0 { + // apply all modification actions + path = path.Clone(path.Owner, path.IsWithdraw) + for _, action := range s.ModActions { + path = action.Apply(path) + } + } //Routing action if s.RouteAction == nil { log.WithFields(log.Fields{ @@ -1900,21 +1907,13 @@ func (s *Statement) Apply(path *Path) (RouteType, *Path) { "Path": path, "PolicyName": s.Name, }).Warn("route action is nil") - return ROUTE_TYPE_REJECT, path + return ROUTE_TYPE_NONE, path } p := s.RouteAction.Apply(path) if p == nil { return ROUTE_TYPE_REJECT, path } - if len(s.ModActions) == 0 { - return ROUTE_TYPE_ACCEPT, path - } - // apply all modification actions - cloned := path.Clone(p.Owner, p.IsWithdraw) - for _, action := range s.ModActions { - cloned = action.Apply(cloned) - } - return ROUTE_TYPE_ACCEPT, cloned + return ROUTE_TYPE_ACCEPT, path } return ROUTE_TYPE_NONE, path } @@ -2253,7 +2252,8 @@ func (p *Policy) Name() string { // subsequent conditions are skipped. func (p *Policy) Apply(path *Path) (RouteType, *Path) { for _, stmt := range p.Statements { - result, path := stmt.Apply(path) + var result RouteType + result, path = stmt.Apply(path) if result != ROUTE_TYPE_NONE { return result, path } diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py index a3397cd4..d3a417a9 100644 --- a/test/scenario_test/global_policy_test.py +++ b/test/scenario_test/global_policy_test.py @@ -115,7 +115,6 @@ class GoBGPTestBase(unittest.TestCase): self.gobgp.local('gobgp policy neighbor add ns0 {0}'.format(self.gobgp.peers[self.quaggas['q1']]['neigh_addr'].split('/')[0])) self.gobgp.local('gobgp policy statement add st0') self.gobgp.local('gobgp policy statement st0 add condition neighbor ns0') - self.gobgp.local('gobgp policy statement st0 add action accept') self.gobgp.local('gobgp policy statement st0 add action community add 65100:10') self.gobgp.local('gobgp policy add p0 st0') self.gobgp.local('gobgp global policy export add p0 default accept') diff --git a/test/scenario_test/route_server_policy_grpc_test.py b/test/scenario_test/route_server_policy_grpc_test.py index 0a0e5178..54dcf3da 100644 --- a/test/scenario_test/route_server_policy_grpc_test.py +++ b/test/scenario_test/route_server_policy_grpc_test.py @@ -106,6 +106,7 @@ class ImportPolicy(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -153,6 +154,7 @@ class ExportPolicy(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy export add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -221,6 +223,7 @@ class ImportPolicyUpdate(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -312,6 +315,7 @@ class ExportPolicyUpdate(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy export add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -415,6 +419,7 @@ class ImportPolicyIPV6(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -465,6 +470,7 @@ class ExportPolicyIPV6(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy export add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -529,6 +535,7 @@ class ImportPolicyIPV6Update(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -611,6 +618,7 @@ class ExportPolicyIPv6Update(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy export add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -676,6 +684,7 @@ class ImportPolicyAsPathLengthCondition(object): g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition as-path-length 10 ge') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -725,6 +734,7 @@ class ImportPolicyAsPathCondition(object): g1.local('gobgp policy as-path add as0 ^{0}'.format(e1.asn)) g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition as-path as0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -766,6 +776,7 @@ class ImportPolicyAsPathAnyCondition(object): g1.local('gobgp policy as-path add as0 65098') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition as-path as0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -807,6 +818,7 @@ class ImportPolicyAsPathOriginCondition(object): g1.local('gobgp policy as-path add as0 65090$') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition as-path as0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -848,6 +860,7 @@ class ImportPolicyAsPathOnlyCondition(object): g1.local('gobgp policy as-path add as0 ^65100$') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition as-path as0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -890,6 +903,7 @@ class ImportPolicyAsPathMismatchCondition(object): g1.local('gobgp policy community add cs0 65100:10') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition community cs0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -939,6 +953,7 @@ class ImportPolicyCommunityCondition(object): g1.local('gobgp policy community add cs0 65100:10') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition community cs0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -980,6 +995,7 @@ class ImportPolicyCommunityRegexp(object): g1.local('gobgp policy community add cs0 6[0-9]+:[0-9]+') g1.local('gobgp policy statement add st0') g1.local('gobgp policy statement st0 add condition community cs0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -1850,6 +1866,7 @@ class InPolicyReject(object): g1.local('gobgp policy community add cs0 65100:10') g1.local('gobgp policy statement st0 add condition community cs0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy in add policy0'.format(g1.peers[e1]['neigh_addr'].split('/')[0])) @@ -1954,6 +1971,7 @@ class InPolicyUpdate(object): g1.local('gobgp policy neighbor add ns0 {0}'.format(g1.peers[e1]['neigh_addr'].split('/')[0])) g1.local('gobgp policy statement st0 add condition prefix ps0') g1.local('gobgp policy statement st0 add condition neighbor ns0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy in add policy0'.format(g1.peers[e1]['neigh_addr'].split('/')[0])) @@ -2223,6 +2241,7 @@ class ImportPolicyExCommunityOriginCondition(object): g1.local('gobgp policy ext-community add es0 soo:65001.65100:200') g1.local('gobgp policy statement st0 add condition ext-community es0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -2260,6 +2279,7 @@ class ImportPolicyExCommunityTargetCondition(object): g1.local('gobgp policy ext-community add es0 rt:6[0-9]+:3[0-9]+') g1.local('gobgp policy statement st0 add condition ext-community es0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy import add policy0'.format(g1.peers[q2]['neigh_addr'].split('/')[0])) @@ -2297,6 +2317,7 @@ class InPolicyPrefixCondition(object): g1.local('gobgp policy prefix add ps0 192.168.10.0/24') g1.local('gobgp policy statement st0 add condition prefix ps0') + g1.local('gobgp policy statement st0 add action reject') g1.local('gobgp policy add policy0 st0') g1.local('gobgp neighbor {0} policy in add policy0'.format(g1.peers[e1]['neigh_addr'].split('/')[0])) diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py index 490d0173..773e5ce7 100644 --- a/test/scenario_test/route_server_policy_test.py +++ b/test/scenario_test/route_server_policy_test.py @@ -117,7 +117,8 @@ class ImportPolicy(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -179,7 +180,8 @@ class ExportPolicy(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -261,7 +263,8 @@ class ImportPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -310,7 +313,8 @@ class ImportPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -384,7 +388,8 @@ class ExportPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -433,7 +438,8 @@ class ExportPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -523,7 +529,8 @@ class ImportPolicyIPV6(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -588,7 +595,8 @@ class ExportPolicyIPV6(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -666,7 +674,8 @@ class ImportPolicyIPV6Update(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -711,7 +720,9 @@ class ImportPolicyIPV6Update(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': { + 'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -782,7 +793,8 @@ class ExportPolicyIPv6Update(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -827,7 +839,8 @@ class ExportPolicyIPv6Update(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'export', @@ -870,7 +883,8 @@ class ImportPolicyAsPathLengthCondition(object): q2 = env.q2 st0 = {'Name': 'st0', 'Conditions': {'BgpConditions': {'AsPathLength': {'Operator': 'ge', - 'Value': 10}}}} + 'Value': 10}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -924,7 +938,8 @@ class ImportPolicyAsPathCondition(object): g1.set_bgp_defined_set(as0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}} + 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -970,7 +985,8 @@ class ImportPolicyAsPathAnyCondition(object): g1.set_bgp_defined_set(as0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}} + 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -1016,7 +1032,8 @@ class ImportPolicyAsPathOriginCondition(object): g1.set_bgp_defined_set(as0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}} + 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -1062,7 +1079,8 @@ class ImportPolicyAsPathOnlyCondition(object): g1.set_bgp_defined_set(as0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}} + 'Conditions': {'BgpConditions': {'MatchAsPathSet': {'AsPathSet': 'as0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -1111,7 +1129,8 @@ class ImportPolicyAsPathMismatchCondition(object): g1.set_bgp_defined_set(cs0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}} + 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -1166,7 +1185,8 @@ class ImportPolicyCommunityCondition(object): g1.set_bgp_defined_set(cs0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}} + 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -1213,7 +1233,8 @@ class ImportPolicyCommunityRegexp(object): g1.set_bgp_defined_set(cs0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}} + 'Conditions': {'BgpConditions': {'MatchCommunitySet': {'CommunitySet': 'cs0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -2151,7 +2172,8 @@ class InPolicyReject(object): g1.set_bgp_defined_set(cs0) st0 = {'Name': 'st0', - 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}}} + 'Conditions':{'BgpConditions':{'MatchCommunitySet':{'CommunitySet': 'cs0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'in', @@ -2277,7 +2299,8 @@ class InPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': { 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'in', @@ -2327,7 +2350,8 @@ class InPolicyUpdate(object): st0 = {'Name': 'st0', 'Conditions': {'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}, - 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}} + 'MatchNeighborSet': {'NeighborSet': ns0['NeighborSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'in', @@ -2600,7 +2624,8 @@ class ImportPolicyExCommunityOriginCondition(object): g1.set_bgp_defined_set(es0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}}} + 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -2645,7 +2670,8 @@ class ImportPolicyExCommunityTargetCondition(object): g1.set_bgp_defined_set(es0) st0 = {'Name': 'st0', - 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}}} + 'Conditions': {'BgpConditions':{'MatchExtCommunitySet':{'ExtCommunitySet': 'es0'}}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'import', @@ -2692,7 +2718,8 @@ class InPolicyPrefixCondition(object): st0 = {'Name': 'st0', 'Conditions': { - 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}}} + 'MatchPrefixSet': {'PrefixSet': ps0['PrefixSetName']}}, + 'Actions': {'RouteDisposition': {'AcceptRoute': False}}} policy = {'name': 'policy0', 'type': 'in', |