From 482b0e03dfa920d88b2793479f1d061b526caec4 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Wed, 27 Nov 2024 14:41:24 +0100 Subject: [PATCH 01/11] add the patch position to the file --- src/cnaas_nms/api/interface.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index bf881338..c2e5a1d9 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -30,6 +30,10 @@ "redundant_link": fields.Boolean(required=False, example=True), "tags": fields.List(fields.String(), required=False, description="List of tags", example=["tag1", "tag2"]), "cli_append_str": fields.String(required=False), + "patch_position": fields.String( + required=False, + description="Patch Position", + ), }, ) @@ -271,6 +275,13 @@ def put(self, hostname): errors.append( "cli_append_str must be a string, got: {}".format(if_dict["data"]["cli_append_str"]) ) + if "patch_postion" in if_dict["data"]: + if isinstance(if_dict["data"]["patch_postion"], str): + intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + else: + errors.append( + "patch_postion must be a string, got: {}".format(if_dict["data"]["patch_postion"]) + ) elif "data" in if_dict and not if_dict["data"]: intfdata = None From 419f202dda8e530f043286241da22f90cbf7173a Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Mon, 16 Dec 2024 09:18:46 +0100 Subject: [PATCH 02/11] changes to add patch positions to interfaces --- src/cnaas_nms/api/interface.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index c2e5a1d9..4158fcc4 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -98,6 +98,7 @@ def put(self, hostname): json_data = request.get_json() data = {} errors = [] + patch_positions = [] device_settings = None with sqla_session() as session: @@ -277,7 +278,13 @@ def put(self, hostname): ) if "patch_postion" in if_dict["data"]: if isinstance(if_dict["data"]["patch_postion"], str): - intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + if if_dict["data"]["patch_postion"] not in patch_positions: + intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + patch_positions.append(if_dict["data"]["patch_postion"]) + else: + errors.append( + "patch_postion must be unique: {}".format(if_dict["data"]["patch_postion"]) + ) else: errors.append( "patch_postion must be a string, got: {}".format(if_dict["data"]["patch_postion"]) From 40d8114ac8b293a72b2ba6e226d43b418c1a7304 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Wed, 27 Nov 2024 14:41:24 +0100 Subject: [PATCH 03/11] add the patch position to the file --- src/cnaas_nms/api/interface.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index a57b6258..7a61c782 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -30,6 +30,10 @@ "redundant_link": fields.Boolean(required=False, example=True), "tags": fields.List(fields.String(), required=False, description="List of tags", example=["tag1", "tag2"]), "cli_append_str": fields.String(required=False), + "patch_position": fields.String( + required=False, + description="Patch Position", + ), }, ) @@ -270,6 +274,13 @@ def put(self, hostname): errors.append( "cli_append_str must be a string, got: {}".format(if_dict["data"]["cli_append_str"]) ) + if "patch_postion" in if_dict["data"]: + if isinstance(if_dict["data"]["patch_postion"], str): + intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + else: + errors.append( + "patch_postion must be a string, got: {}".format(if_dict["data"]["patch_postion"]) + ) elif "data" in if_dict and not if_dict["data"]: intfdata: None = None # type: ignore [no-redef] From 4f49b403251834a930fc1147b25712933c05ed32 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Mon, 16 Dec 2024 09:18:46 +0100 Subject: [PATCH 04/11] changes to add patch positions to interfaces --- src/cnaas_nms/api/interface.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index 7a61c782..927e0f69 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -98,6 +98,7 @@ def put(self, hostname): json_data = request.get_json() data = {} errors = [] + patch_positions = [] device_settings = None with sqla_session() as session: # type: ignore dev: Optional[Device] = session.query(Device).filter(Device.hostname == hostname).one_or_none() @@ -276,7 +277,13 @@ def put(self, hostname): ) if "patch_postion" in if_dict["data"]: if isinstance(if_dict["data"]["patch_postion"], str): - intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + if if_dict["data"]["patch_postion"] not in patch_positions: + intfdata["patch_postion"] = if_dict["data"]["patch_postion"] + patch_positions.append(if_dict["data"]["patch_postion"]) + else: + errors.append( + "patch_postion must be unique: {}".format(if_dict["data"]["patch_postion"]) + ) else: errors.append( "patch_postion must be a string, got: {}".format(if_dict["data"]["patch_postion"]) From 82c75004fa24327fe649c8e69fb4aa082e724db5 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Tue, 17 Dec 2024 12:41:46 +0100 Subject: [PATCH 05/11] update requirements to fix junos interface bug --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index cbd677dc..eb293513 100644 --- a/requirements.txt +++ b/requirements.txt @@ -41,3 +41,4 @@ PyYAML==5.3.1 pytz==2023.3.post1 types-pytz==2024.2.0.20241003 types-requests==2.32.0.20241016 +junos-eznc==2.7.1 From fc7e14b173a72e028102f04e7691f8487d1e5cde Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Thu, 19 Dec 2024 14:33:41 +0100 Subject: [PATCH 06/11] fixed bugs and added unit tests --- src/cnaas_nms/api/interface.py | 22 ++-- src/cnaas_nms/api/tests/test_interface.py | 143 ++++++++++++++++++++++ 2 files changed, 156 insertions(+), 9 deletions(-) create mode 100644 src/cnaas_nms/api/tests/test_interface.py diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index 927e0f69..4318bab0 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -98,14 +98,16 @@ def put(self, hostname): json_data = request.get_json() data = {} errors = [] - patch_positions = [] + device_settings = None with sqla_session() as session: # type: ignore dev: Optional[Device] = session.query(Device).filter(Device.hostname == hostname).one_or_none() if not dev: return empty_result("error", "Device not found"), 404 - updated = False + intfs = session.query(Interface).filter(Interface.device == dev).all() + patch_positions = [intf.data["patch_position"] for intf in intfs if "patch_position" in intf.data] + print(patch_positions) if "interfaces" in json_data and isinstance(json_data["interfaces"], dict): for if_name, if_dict in json_data["interfaces"].items(): if not isinstance(if_dict, dict): @@ -275,18 +277,20 @@ def put(self, hostname): errors.append( "cli_append_str must be a string, got: {}".format(if_dict["data"]["cli_append_str"]) ) - if "patch_postion" in if_dict["data"]: - if isinstance(if_dict["data"]["patch_postion"], str): - if if_dict["data"]["patch_postion"] not in patch_positions: - intfdata["patch_postion"] = if_dict["data"]["patch_postion"] - patch_positions.append(if_dict["data"]["patch_postion"]) + if "patch_position" in if_dict["data"]: + if isinstance(if_dict["data"]["patch_position"], str): + if if_dict["data"]["patch_position"] not in patch_positions: + intfdata["patch_position"] = if_dict["data"]["patch_position"] + patch_positions.append(if_dict["data"]["patch_position"]) else: errors.append( - "patch_postion must be unique: {}".format(if_dict["data"]["patch_postion"]) + "patch_position must be unique for the interfaces: {}".format( + if_dict["data"]["patch_position"] + ) ) else: errors.append( - "patch_postion must be a string, got: {}".format(if_dict["data"]["patch_postion"]) + "patch_position must be a string, got: {}".format(if_dict["data"]["patch_position"]) ) elif "data" in if_dict and not if_dict["data"]: intfdata: None = None # type: ignore [no-redef] diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py new file mode 100644 index 00000000..b7248c3b --- /dev/null +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -0,0 +1,143 @@ +import json +import os +import unittest +from ipaddress import IPv4Address + +import pkg_resources +import pytest +import yaml + +from cnaas_nms.api import app +from cnaas_nms.api.tests.app_wrapper import TestAppWrapper +from cnaas_nms.db.device import Device, DeviceState, DeviceType +from cnaas_nms.db.interface import Interface, InterfaceConfigType +from cnaas_nms.db.session import sqla_session +from cnaas_nms.db.stackmember import Stackmember + + +@pytest.mark.integration +class InterfaceTests(unittest.TestCase): + @pytest.fixture(autouse=True) + def requirements(self, postgresql, settings_directory): + """Ensures the required pytest fixtures are loaded implicitly for all these tests""" + pass + + def cleandb(self): + with sqla_session() as session: # type: ignore + for hardware_id in ["AB1234", "CD5555", "GF43534"]: + stack = session.query(Stackmember).filter(Stackmember.hardware_id == hardware_id).one_or_none() + if stack: + session.delete(stack) + session.commit() + for hostname in ["testdevice", "testdevice2"]: + device = session.query(Device).filter(Device.hostname == hostname).one_or_none() + if device: + session.delete(device) + session.commit() + + def setUp(self): + self.jwt_auth_token = None + data_dir = pkg_resources.resource_filename(__name__, "data") + with open(os.path.join(data_dir, "testdata.yml"), "r") as f_testdata: + self.testdata = yaml.safe_load(f_testdata) + if "jwt_auth_token" in self.testdata: + self.jwt_auth_token = self.testdata["jwt_auth_token"] + self.app = app.app + self.app.wsgi_app = TestAppWrapper(self.app.wsgi_app, self.jwt_auth_token) + self.client = self.app.test_client() + self.cleandb() + device_id, hostname = self.add_device() + self.device_id = device_id + self.device_hostname = hostname + interface_name = self.add_interface(device_id) + self.interface_name = interface_name + + def tearDown(self): + self.cleandb() + + def add_device(self): + with sqla_session() as session: # type: ignore + device = Device( + hostname="testdevice", + platform="eos", + management_ip=IPv4Address("10.0.1.22"), + state=DeviceState.MANAGED, + device_type=DeviceType.ACCESS, + ) + session.add(device) + session.commit() + return device.id, device.hostname + + def add_interface(self, device_id): + with sqla_session() as session: # type: ignore + interface = Interface( + name="123", + configtype=InterfaceConfigType.ACCESS_AUTO, + data={ + "description": "test2", + "patch_position": "test", + }, + device_id=device_id, + ) + interface2 = Interface( + name="567", + configtype=InterfaceConfigType.ACCESS_AUTO, + data={}, + device_id=device_id, + ) + session.add(interface) + session.add(interface2) + session.commit() + return interface.name + + def test_get_interface(self): + result = self.client.get(f"/api/v1.0/device/{self.device_hostname}/interfaces") + self.assertEqual(result.status_code, 200) + json_data = json.loads(result.data.decode()) + self.assertEqual(["123", "567"], [interface["name"] for interface in json_data["data"]["interfaces"]]) + + def test_update_interface_not_unique(self): + modify_data = { + "interfaces": { + "123": { + "data": { + "description": "test", + } + }, + "567": { + "data": { + "description": "test", + "patch_position": "test", + } + }, + } + } + result = self.client.put(f"/api/v1.0/device/{self.device_hostname}/interfaces", json=modify_data) + json_data = json.loads(result.data.decode()) + self.assertEqual(result.status_code, 400) + self.assertEqual(json_data["status"], "error") + + def test_update_interface(self): + modify_data = { + "interfaces": { + "123": { + "data": { + "description": "test", + } + }, + "567": { + "data": { + "description": "test", + "patch_position": "patch_position2", + } + }, + } + } + result = self.client.put(f"/api/v1.0/device/{self.device_hostname}/interfaces", json=modify_data) + json_data = json.loads(result.data.decode()) + self.assertEqual(result.status_code, 200) + self.assertEqual(["123", "567"], list(json_data["data"]["updated"].keys())) + + +if __name__ == "__main__": + unittest.main() From da6c763f9c53d3b66524b30fa83f20da418d3482 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Thu, 19 Dec 2024 15:43:32 +0100 Subject: [PATCH 07/11] changed values to be more realistic --- src/cnaas_nms/api/tests/test_interface.py | 34 +++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py index b7248c3b..8ac1ec19 100644 --- a/src/cnaas_nms/api/tests/test_interface.py +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -49,8 +49,7 @@ def setUp(self): device_id, hostname = self.add_device() self.device_id = device_id self.device_hostname = hostname - interface_name = self.add_interface(device_id) - self.interface_name = interface_name + self.add_interfaces(device_id) def tearDown(self): self.cleandb() @@ -68,19 +67,18 @@ def add_device(self): session.commit() return device.id, device.hostname - def add_interface(self, device_id): + def add_interfaces(self, device_id): with sqla_session() as session: # type: ignore interface = Interface( - name="123", + name="testinterface1", configtype=InterfaceConfigType.ACCESS_AUTO, data={ - "description": "test2", - "patch_position": "test", + "patch_position": "3E-H12", }, device_id=device_id, ) interface2 = Interface( - name="567", + name="testinterface2", configtype=InterfaceConfigType.ACCESS_AUTO, data={}, device_id=device_id, @@ -88,26 +86,26 @@ def add_interface(self, device_id): session.add(interface) session.add(interface2) session.commit() - return interface.name def test_get_interface(self): result = self.client.get(f"/api/v1.0/device/{self.device_hostname}/interfaces") self.assertEqual(result.status_code, 200) json_data = json.loads(result.data.decode()) - self.assertEqual(["123", "567"], [interface["name"] for interface in json_data["data"]["interfaces"]]) + self.assertEqual( + ["testinterface1", "testinterface2"], [interface["name"] for interface in json_data["data"]["interfaces"]] + ) def test_update_interface_not_unique(self): modify_data = { "interfaces": { - "123": { + "testinterface1": { "data": { - "description": "test", + "description": "new description", } }, - "567": { + "testinterface2": { "data": { - "description": "test", - "patch_position": "test", + "patch_position": "3E-H12", } }, } @@ -120,15 +118,15 @@ def test_update_interface_not_unique(self): def test_update_interface(self): modify_data = { "interfaces": { - "123": { + "testinterface1": { "data": { "description": "test", } }, - "567": { + "testinterface2": { "data": { "description": "test", - "patch_position": "patch_position2", + "patch_position": "XW.H4.23", } }, } @@ -136,7 +134,7 @@ def test_update_interface(self): result = self.client.put(f"/api/v1.0/device/{self.device_hostname}/interfaces", json=modify_data) json_data = json.loads(result.data.decode()) self.assertEqual(result.status_code, 200) - self.assertEqual(["123", "567"], list(json_data["data"]["updated"].keys())) + self.assertEqual(["testinterface1", "testinterface2"], list(json_data["data"]["updated"].keys())) if __name__ == "__main__": From fce3f2071b6501a3addf95ee403e2d344ff5d629 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Fri, 20 Dec 2024 10:33:20 +0100 Subject: [PATCH 08/11] improved unit test cleanup --- src/cnaas_nms/api/tests/test_interface.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py index 8ac1ec19..60f403c2 100644 --- a/src/cnaas_nms/api/tests/test_interface.py +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -12,7 +12,6 @@ from cnaas_nms.db.device import Device, DeviceState, DeviceType from cnaas_nms.db.interface import Interface, InterfaceConfigType from cnaas_nms.db.session import sqla_session -from cnaas_nms.db.stackmember import Stackmember @pytest.mark.integration @@ -24,10 +23,10 @@ def requirements(self, postgresql, settings_directory): def cleandb(self): with sqla_session() as session: # type: ignore - for hardware_id in ["AB1234", "CD5555", "GF43534"]: - stack = session.query(Stackmember).filter(Stackmember.hardware_id == hardware_id).one_or_none() - if stack: - session.delete(stack) + for interface_name in ["testinterface1", "testinterface2"]: + interface = session.query(Interface).filter(Interface.name == interface_name).one_or_none() + if interface: + session.delete(interface) session.commit() for hostname in ["testdevice", "testdevice2"]: device = session.query(Device).filter(Device.hostname == hostname).one_or_none() From c8c0f2b2c08bfa8d9f3bddd288d9963e7c66e93f Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Fri, 20 Dec 2024 10:52:07 +0100 Subject: [PATCH 09/11] change names of interfaces to not disturb other tests --- src/cnaas_nms/api/tests/test_interface.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py index 60f403c2..364bdc7c 100644 --- a/src/cnaas_nms/api/tests/test_interface.py +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -23,7 +23,7 @@ def requirements(self, postgresql, settings_directory): def cleandb(self): with sqla_session() as session: # type: ignore - for interface_name in ["testinterface1", "testinterface2"]: + for interface_name in ["custom_testinterface1", "custom_testinterface2"]: interface = session.query(Interface).filter(Interface.name == interface_name).one_or_none() if interface: session.delete(interface) @@ -69,7 +69,7 @@ def add_device(self): def add_interfaces(self, device_id): with sqla_session() as session: # type: ignore interface = Interface( - name="testinterface1", + name="custom_testinterface1", configtype=InterfaceConfigType.ACCESS_AUTO, data={ "patch_position": "3E-H12", @@ -77,7 +77,7 @@ def add_interfaces(self, device_id): device_id=device_id, ) interface2 = Interface( - name="testinterface2", + name="custom_testinterface2", configtype=InterfaceConfigType.ACCESS_AUTO, data={}, device_id=device_id, @@ -91,18 +91,19 @@ def test_get_interface(self): self.assertEqual(result.status_code, 200) json_data = json.loads(result.data.decode()) self.assertEqual( - ["testinterface1", "testinterface2"], [interface["name"] for interface in json_data["data"]["interfaces"]] + ["custom_testinterface1", "custom_testinterface2"], + [interface["name"] for interface in json_data["data"]["interfaces"]], ) - def test_update_interface_not_unique(self): + def test_update_interface_invalid_patch_position_not_unique(self): modify_data = { "interfaces": { - "testinterface1": { + "custom_testinterface1": { "data": { "description": "new description", } }, - "testinterface2": { + "custom_testinterface2": { "data": { "patch_position": "3E-H12", } @@ -117,12 +118,12 @@ def test_update_interface_not_unique(self): def test_update_interface(self): modify_data = { "interfaces": { - "testinterface1": { + "custom_testinterface1": { "data": { "description": "test", } }, - "testinterface2": { + "custom_testinterface2": { "data": { "description": "test", "patch_position": "XW.H4.23", @@ -133,7 +134,7 @@ def test_update_interface(self): result = self.client.put(f"/api/v1.0/device/{self.device_hostname}/interfaces", json=modify_data) json_data = json.loads(result.data.decode()) self.assertEqual(result.status_code, 200) - self.assertEqual(["testinterface1", "testinterface2"], list(json_data["data"]["updated"].keys())) + self.assertEqual(["custom_testinterface1", "custom_testinterface2"], list(json_data["data"]["updated"].keys())) if __name__ == "__main__": From df5ce01764f0c936e2e7b4d979338cb1523dc4e3 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Fri, 20 Dec 2024 11:10:47 +0100 Subject: [PATCH 10/11] change names of interfaces to be more realistic --- src/cnaas_nms/api/tests/test_interface.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py index 364bdc7c..db63d559 100644 --- a/src/cnaas_nms/api/tests/test_interface.py +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -23,12 +23,12 @@ def requirements(self, postgresql, settings_directory): def cleandb(self): with sqla_session() as session: # type: ignore - for interface_name in ["custom_testinterface1", "custom_testinterface2"]: + for interface_name in ["custom", "downlink"]: interface = session.query(Interface).filter(Interface.name == interface_name).one_or_none() if interface: session.delete(interface) session.commit() - for hostname in ["testdevice", "testdevice2"]: + for hostname in ["testdevice"]: device = session.query(Device).filter(Device.hostname == hostname).one_or_none() if device: session.delete(device) @@ -69,7 +69,7 @@ def add_device(self): def add_interfaces(self, device_id): with sqla_session() as session: # type: ignore interface = Interface( - name="custom_testinterface1", + name="custom", configtype=InterfaceConfigType.ACCESS_AUTO, data={ "patch_position": "3E-H12", @@ -77,7 +77,7 @@ def add_interfaces(self, device_id): device_id=device_id, ) interface2 = Interface( - name="custom_testinterface2", + name="downlink", configtype=InterfaceConfigType.ACCESS_AUTO, data={}, device_id=device_id, @@ -91,19 +91,19 @@ def test_get_interface(self): self.assertEqual(result.status_code, 200) json_data = json.loads(result.data.decode()) self.assertEqual( - ["custom_testinterface1", "custom_testinterface2"], + ["custom", "downlink"], [interface["name"] for interface in json_data["data"]["interfaces"]], ) def test_update_interface_invalid_patch_position_not_unique(self): modify_data = { "interfaces": { - "custom_testinterface1": { + "custom": { "data": { "description": "new description", } }, - "custom_testinterface2": { + "downlink": { "data": { "patch_position": "3E-H12", } @@ -118,12 +118,12 @@ def test_update_interface_invalid_patch_position_not_unique(self): def test_update_interface(self): modify_data = { "interfaces": { - "custom_testinterface1": { + "custom": { "data": { "description": "test", } }, - "custom_testinterface2": { + "downlink": { "data": { "description": "test", "patch_position": "XW.H4.23", @@ -134,7 +134,7 @@ def test_update_interface(self): result = self.client.put(f"/api/v1.0/device/{self.device_hostname}/interfaces", json=modify_data) json_data = json.loads(result.data.decode()) self.assertEqual(result.status_code, 200) - self.assertEqual(["custom_testinterface1", "custom_testinterface2"], list(json_data["data"]["updated"].keys())) + self.assertEqual(["custom", "downlink"], list(json_data["data"]["updated"].keys())) if __name__ == "__main__": From 94c367491fba88c59e2c290b66facb5173771c65 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Fri, 20 Dec 2024 11:35:03 +0100 Subject: [PATCH 11/11] add patch_position to sync_devices --- src/cnaas_nms/devicehandler/sync_devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cnaas_nms/devicehandler/sync_devices.py b/src/cnaas_nms/devicehandler/sync_devices.py index 85b3ceff..099531bc 100644 --- a/src/cnaas_nms/devicehandler/sync_devices.py +++ b/src/cnaas_nms/devicehandler/sync_devices.py @@ -271,7 +271,7 @@ def populate_device_vars( ifindexnum = 0 if "ifclass" not in intf: continue - extra_keys = ["aggregate_id", "enabled", "cli_append_str", "metric", "mtu", "tags"] + extra_keys = ["aggregate_id", "enabled", "cli_append_str", "metric", "mtu", "tags", "patch_postion"] if intf["ifclass"] == "downlink": data = {} if intf["name"] in ifname_peer_map: