Skip to content

Commit

Permalink
[DM]: Configure local-as value if global asn is different
Browse files Browse the repository at this point in the history
When mx bgp router is conifgured with 'local-autonomous-system',
DM should generate local-as conifguraion as follows.

protocols {
    bgp {
        group __contrail_external__ {
            type internal;
            neighbor 10.84.7.31 {
                peer-as 1000;
           }
        }

More details in the bug.

Change-Id: If2cfb53095a6af64fa7f05e1d98c07beed7f6d0c
Closes-Bug: #1549614
Closes-Bug: #1451972
  • Loading branch information
sbalineni committed Jul 11, 2016
1 parent dd9461d commit f0fabb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/config/device-manager/device_manager/db.py
Expand Up @@ -560,8 +560,11 @@ def push_config(self):
peer = BgpRouterDM.get(peer_uuid)
if peer is None:
continue
external = (bgp_router.params['autonomous_system'] !=
peer.params['autonomous_system'])
local_as = bgp_router.params.get('local_autonomous_system') or \
bgp_router.params.get('autonomous_system')
peer_as = peer.params.get('local_autonomous_system') or \
peer.params.get('autonomous_system')
external = (local_as != peer_as)
self.config_manager.add_bgp_peer(peer.params['address'],
peer.params, attr, external)
self.config_manager.set_bgp_config(bgp_router.params)
Expand Down
Expand Up @@ -810,9 +810,8 @@ def _get_neighbor_config_xml(self, bgp_config, peers):
self._add_family_etree(nbr, session_attr)
self.add_bgp_auth_config(nbr, session_attr)
break
if params.get('autonomous_system') is not None:
etree.SubElement(
nbr, "peer-as").text = str(params.get('autonomous_system'))
peer_as = params.get('local_autonomous_system') or params.get('autonomous_system')
etree.SubElement(nbr, "peer-as").text = str(peer_as)
# end _get_neighbor_config_xml

def send_bgp_config(self):
Expand All @@ -832,8 +831,8 @@ def send_bgp_config(self):
etree.SubElement(
routing_options_config,
"route-distinguisher-id").text = self.bgp_params['identifier']
etree.SubElement(routing_options_config, "autonomous-system").text = \
str(self.bgp_params.get('autonomous_system'))
local_as = self.bgp_params.get('local_autonomous_system') or self.bgp_params.get('autonomous_system')
etree.SubElement(routing_options_config, "autonomous-system").text = str(local_as)
config_list = [proto_config, routing_options_config]
if self.ri_config is not None:
config_list.append(self.ri_config)
Expand Down

0 comments on commit f0fabb5

Please sign in to comment.