Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion generic_config_updater/change_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class ChangeApplier:
def __init__(self):
self.config_db = get_config_db()
self.backend_tables = [
"bgpraw",
"BUFFER_PG",
"BUFFER_PROFILE",
"FLEX_COUNTER_TABLE"
Expand Down
4 changes: 3 additions & 1 deletion generic_config_updater/gu_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def __init__(self, yang_dir = YANG_DIR):

def get_config_db_as_json(self):
text = self._get_config_db_as_text()
return json.loads(text)
config_db_json = json.loads(text)
config_db_json.pop("bgpraw", None)
return config_db_json

def _get_config_db_as_text(self):
# TODO: Getting configs from CLI is very slow, need to get it from sonic-cffgen directly
Expand Down
14 changes: 13 additions & 1 deletion tests/generic_config_updater/gu_common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@
import jsonpatch
import sonic_yang
import unittest
from unittest.mock import MagicMock, Mock
from unittest.mock import MagicMock, Mock, patch

from .gutest_helpers import create_side_effect_dict, Files
import generic_config_updater.gu_common as gu_common

class TestDryRunConfigWrapper(unittest.TestCase):
@patch('generic_config_updater.gu_common.subprocess.Popen')
def test_get_config_db_as_json(self, mock_popen):
config_wrapper = gu_common.DryRunConfigWrapper()
mock_proc = MagicMock()
mock_proc.communicate = MagicMock(
return_value=('{"PORT": {}, "bgpraw": ""}', None))
mock_proc.returncode = 0
mock_popen.return_value = mock_proc
actual = config_wrapper.get_config_db_as_json()
expected = {"PORT": {}}
self.assertDictEqual(actual, expected)

def test_get_config_db_as_json__returns_imitated_config_db(self):
# Arrange
config_wrapper = gu_common.DryRunConfigWrapper(Files.CONFIG_DB_AS_JSON)
Expand Down