Skip to content

Commit

Permalink
Merge "Revert "[config] Routing Policy simple color identifier""
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins CI authored and opencontrail-ci-admin committed Sep 11, 2020
2 parents 6ed0b70 + 3cbebf1 commit b72dec6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
10 changes: 4 additions & 6 deletions src/config/api-server/vnc_cfg_api_server/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,14 @@ def _validate_communityattribute_type(cls, value):
if value in poss_values:
return

res = re.match('^(color:|0x030b:)?[0-9]{1,5}:[0-9]{1,10}$', value)
res = re.match('[0-9]+:[0-9]+', value)
if res is None:
raise ValueError('Invalid community format %s. '
'Change to \'number:number\''
'or extended format color:number:number'
% value)
% value)

community = value.split(':')
asn = community[-2]
if int(asn) > 65535:
asn = value.split(':')
if int(asn[0]) > 65535:
raise ValueError('Out of range ASN value %s. '
'ASN values cannot exceed 65535.'
% value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import cfgm_common
from testtools import ExpectedException
from vnc_api.vnc_api import ActionCommunityType, ActionUpdateType
from vnc_api.vnc_api import CommunityListType
from vnc_api.vnc_api import InterfaceRouteTable
from vnc_api.vnc_api import PolicyStatementType, PolicyTermType
from vnc_api.vnc_api import PrefixListMatchType
Expand Down Expand Up @@ -243,22 +241,4 @@ def test_routing_policy_for_network_device(self):
self._vnc_lib.routing_policy_delete(id=rp_uuid)
# end test_routing_policy_for_network_device

def test_routing_policy_community_target(self):
rp = RoutingPolicy(name=self.id(), term_type='network-device')
rp.set_routing_policy_entries(PolicyStatementType(term=[
PolicyTermType(
term_match_condition=TermMatchConditionType(),
term_action_list=TermActionListType(
action='accept',
update=ActionUpdateType(
community=ActionCommunityType(
add=CommunityListType(community=['color:30:12345',
'30:1234556890',
'0x030b:1:1'])
)))),
]))
self._vnc_lib.routing_policy_create(rp)
self.assertIsNotNone(rp.uuid)
# end test_routing_policy_community_target

# end TestRoutingPolicy

0 comments on commit b72dec6

Please sign in to comment.