Skip to content

Commit e412338

Browse files
committed
Revert "[bgp] Add 'allow list' manager feature (sonic-net#5309)"
This reverts commit 6eed082.
1 parent e3f8159 commit e412338

File tree

21 files changed

+22
-1515
lines changed

21 files changed

+22
-1515
lines changed

dockers/docker-fpm-frr/frr/bgpd/templates/general/peer-group.conf.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
2525
neighbor PEER_V6 allowas-in 1
2626
neighbor PEER_V6_INT allowas-in 1
27-
{% endif %}
27+
{% endif %}
2828
{% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
2929
neighbor PEER_V6_INT route-reflector-client
3030
{% endif %}

dockers/docker-fpm-frr/frr/bgpd/templates/general/policies.conf.j2

-27
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,6 @@
33
!
44
!
55
!
6-
{% if constants.bgp.allow_list is defined and constants.bgp.allow_list.enabled is defined and constants.bgp.allow_list.enabled %}
7-
{% if constants.bgp.allow_list.default_action is defined and constants.bgp.allow_list.default_action.strip() == 'deny' %}
8-
route-map ALLOW_LIST_DEPLOYMENT_ID_0_V4 permit 65535
9-
set community no-export additive
10-
!
11-
route-map ALLOW_LIST_DEPLOYMENT_ID_0_V6 permit 65535
12-
set community no-export additive
13-
{% else %}
14-
route-map ALLOW_LIST_DEPLOYMENT_ID_0_V4 permit 65535
15-
set community {{ constants.bgp.allow_list.drop_community }} additive
16-
!
17-
route-map ALLOW_LIST_DEPLOYMENT_ID_0_V6 permit 65535
18-
set community {{ constants.bgp.allow_list.drop_community }} additive
19-
{% endif %}
20-
!
21-
route-map FROM_BGP_PEER_V4 permit 2
22-
call ALLOW_LIST_DEPLOYMENT_ID_0_V4
23-
on-match next
24-
!
25-
route-map FROM_BGP_PEER_V6 permit 2
26-
call ALLOW_LIST_DEPLOYMENT_ID_0_V6
27-
on-match next
28-
!
29-
{% endif %}
30-
!
31-
!
32-
!
336
route-map FROM_BGP_PEER_V4 permit 100
347
!
358
route-map TO_BGP_PEER_V4 permit 100

files/image_config/constants/constants.yml

-12
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ constants:
1818
enabled: true
1919
ipv4: 64
2020
ipv6: 64
21-
allow_list:
22-
enabled: true
23-
default_action: "permit" # or "deny"
24-
drop_community: 5060:12345 # value of the community to identify a prefix to drop. Make sense only with allow_list_default_action equal to 'permit'
25-
default_pl_rules:
26-
v4:
27-
- "deny 0.0.0.0/0 le 17"
28-
- "permit 127.0.0.1/32"
29-
v6:
30-
- "deny 0::/0 le 59"
31-
- "deny 0::/0 ge 65"
32-
- "permit fe80::/64"
3321
peers:
3422
general: # peer_type
3523
db_table: "BGP_NEIGHBOR"

rules/sonic_bgpcfgd.mk

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ $(SONIC_BGPCFGD)_SRC_PATH = $(SRC_PATH)/sonic-bgpcfgd
66
# of sonic-config-engine and bgpcfgd explicitly calls sonic-cfggen
77
# as part of its unit tests.
88
# TODO: Refactor unit tests so that these dependencies are not needed
9-
$(SONIC_BGPCFGD)_DEPENDS += $(SONIC_PY_COMMON_PY2)
10-
$(SONIC_BGPCFGD)_DEBS_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
9+
$(SONIC_BGPCFGD)_DEPENDS += $(SWSSSDK_PY2) $(SONIC_PY_COMMON_PY2)
1110
$(SONIC_BGPCFGD)_PYTHON_VERSION = 2
1211
SONIC_PYTHON_WHEELS += $(SONIC_BGPCFGD)

src/sonic-bgpcfgd/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ app/*.pyc
66
tests/*.pyc
77
tests/__pycache__/
88
.idea
9-
.coverage

src/sonic-bgpcfgd/app/allow_list.py

-632
This file was deleted.

src/sonic-bgpcfgd/app/config.py

+1-19
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,19 @@ class ConfigMgr(object):
1010
""" The class represents frr configuration """
1111
def __init__(self):
1212
self.current_config = None
13-
self.current_config_raw = None
1413

1514
def reset(self):
1615
""" Reset stored config """
1716
self.current_config = None
18-
self.current_config_raw = None
1917

2018
def update(self):
2119
""" Read current config from FRR """
2220
self.current_config = None
23-
self.current_config_raw = None
2421
ret_code, out, err = run_command(["vtysh", "-c", "show running-config"])
2522
if ret_code != 0:
26-
# FIXME: should we throw exception here?
2723
log_crit("can't update running config: rc=%d out='%s' err='%s'" % (ret_code, out, err))
2824
return
29-
text = []
30-
for line in out.split('\n'):
31-
if line.lstrip().startswith('!'):
32-
continue
33-
text.append(line)
34-
text += [" "] # Add empty line to have something to work on, if there is no text
35-
self.current_config_raw = text
36-
self.current_config = self.to_canonical(out) # FIXME: use test as an input
37-
38-
def push_list(self, cmdlist):
39-
return self.push("\n".join(cmdlist))
25+
self.current_config = self.to_canonical(out)
4026

4127
def push(self, cmd):
4228
"""
@@ -65,12 +51,8 @@ def write(self, cmd):
6551
log_err("ConfigMgr::push(): can't push configuration '%s', rc='%d', stdout='%s', stderr='%s'" % err_tuple)
6652
if ret_code == 0:
6753
self.current_config = None # invalidate config
68-
self.current_config_raw = None
6954
return ret_code == 0
7055

71-
def get_text(self):
72-
return self.current_config_raw
73-
7456
@staticmethod
7557
def to_canonical(raw_config):
7658
"""

src/sonic-bgpcfgd/app/directory.py

-159
This file was deleted.

src/sonic-bgpcfgd/app/manager.py

-71
This file was deleted.

src/sonic-bgpcfgd/app/vars.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
g_debug = True # FIXME: read from env variable, or from constants
1+
g_debug = False

src/sonic-bgpcfgd/bgpcfgd

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ import jinja2
1515
import netaddr
1616
from swsscommon import swsscommon
1717

18-
from app.directory import Directory
19-
from app.manager import Manager
2018
from app.vars import g_debug
2119
from app.log import log_debug, log_notice, log_info, log_warn, log_err, log_crit
2220
from app.template import TemplateFabric
2321
from app.config import ConfigMgr
24-
from app.allow_list import BGPAllowListMgr
2522
from app.util import run_command
2623

2724
g_run = True
@@ -849,7 +846,7 @@ def wait_for_daemons(daemons, seconds):
849846
def read_constants():
850847
""" Read file with constants values from /etc/sonic/constants.yml """
851848
with open('/etc/sonic/constants.yml') as fp:
852-
content = yaml.load(fp) # FIXME: , Loader=yaml.FullLoader)
849+
content = yaml.load(fp)
853850
if "constants" not in content:
854851
log_crit("/etc/sonic/constants.yml doesn't have 'constants' key")
855852
raise Exception("/etc/sonic/constants.yml doesn't have 'constants' key")
@@ -881,8 +878,6 @@ def main():
881878
BGPPeerMgrBase(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_NEIGHBOR_TABLE_NAME, "general", True),
882879
BGPPeerMgrBase(common_objs, "CONFIG_DB", "BGP_MONITORS", "monitors", True),
883880
BGPPeerMgrBase(common_objs, "CONFIG_DB", "BGP_PEER_RANGE", "dynamic", False),
884-
# AllowList Managers
885-
BGPAllowListMgr(common_objs, "CONFIG_DB", "BGP_ALLOWED_PREFIXES"),
886881
]
887882
runner = Runner()
888883
for mgr in managers:

src/sonic-bgpcfgd/pytest.ini

-2
This file was deleted.

0 commit comments

Comments
 (0)