Skip to content

Commit

Permalink
Revert single asic
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqiangz committed May 7, 2024
1 parent 656dd5a commit ecdbf44
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 420 deletions.
15 changes: 3 additions & 12 deletions dockers/docker-fpm-frr/frr/bgpd/bgpd.main.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
!
! TSA configuration
!
{% set lo0_ipv4 = get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip %}
{% set lo4096_ipv4 = get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip %}
{% if lo0_ipv4 is not none %}
ip prefix-list PL_LoopbackV4 permit {{ lo0_ipv4 }}/32
{% endif %}
ip prefix-list PL_LoopbackV4 permit {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
!
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
{% if ( ('localhost' in DEVICE_METADATA) and ('bgp_adv_lo_prefix_as_128' in DEVICE_METADATA['localhost']) and
Expand Down Expand Up @@ -96,17 +93,11 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
bgp router-id {{ lo4096_ipv4 }}
{% endif %}
{% else %}
{% if "localhost" in DEVICE_METADATA and "bgp_router_id" in DEVICE_METADATA["localhost"] %}
bgp router-id {{ DEVICE_METADATA["localhost"]["bgp_router_id"] }}
{% elif lo0_ipv4 is not none%}
bgp router-id {{ lo0_ipv4 }}
{% endif %}
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}
{% endif %}
!
{# advertise loopback #}
{% if lo0_ipv4 is not none %}
network {{ lo0_ipv4 }}/32
{% endif %}
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
{% if lo4096_ipv4 is not none and ((multi_asic is defined and DEVICE_METADATA['localhost']['switch_type'] != 'chassis-packet') or (DEVICE_METADATA['localhost']['switch_type'] == 'voq')) %}
network {{ lo4096_ipv4 }}/32 route-map HIDE_INTERNAL
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
neighbor BGPMON peer-group
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'SpineRouter' %}
neighbor BGPMON update-source Loopback4096
{% elif loopback0_ipv4 %}
{% else %}
neighbor BGPMON update-source {{ loopback0_ipv4 | ip }}
{% endif %}

Expand Down
10 changes: 4 additions & 6 deletions src/sonic-bgpcfgd/bgpcfgd/managers_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def __init__(self, common_objs, db_name, table_name, peer_type, check_neig_meta)

deps = [
("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/bgp_asn"),
("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME, "Loopback0"),
("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME, "tsa_enabled"),
("LOCAL", "local_addresses", ""),
("LOCAL", "interfaces", ""),
Expand Down Expand Up @@ -164,11 +165,9 @@ def add_peer(self, vrf, nbr, data):
bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"]
#
lo0_ipv4 = self.get_lo_ipv4("Loopback0|")
if (lo0_ipv4 is None and "bgp_router_id"
not in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]):
log_warn("Loopback0 ipv4 address is not presented yet and bgp_router_id not configured")
if lo0_ipv4 is None:
log_warn("Loopback0 ipv4 address is not presented yet")
return False

#
if self.peer_type == 'internal':
lo4096_ipv4 = self.get_lo_ipv4("Loopback4096|")
Expand Down Expand Up @@ -202,11 +201,10 @@ def add_peer(self, vrf, nbr, data):
'vrf': vrf,
'neighbor_addr': nbr,
'bgp_session': data,
'loopback0_ipv4': lo0_ipv4,
'CONFIG_DB__LOOPBACK_INTERFACE':{ tuple(key.split('|')) : {} for key in self.directory.get_slot("CONFIG_DB", swsscommon.CFG_LOOPBACK_INTERFACE_TABLE_NAME)
if '|' in key }
}
if lo0_ipv4 is not None:
kwargs['loopback0_ipv4'] = lo0_ipv4
if self.check_neig_meta:
neigmeta = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_NEIGHBOR_METADATA_TABLE_NAME)
if 'name' in data and data["name"] not in neigmeta:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ecdbf44

Please sign in to comment.