From bdf62ec129259b1b24e31a9418482b88f35f9f69 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Mon, 28 Oct 2024 13:38:17 +0100 Subject: [PATCH] fix bugs unittests --- src/cnaas_nms/api/interface.py | 4 ++-- src/cnaas_nms/db/settings_fields.py | 8 ++++---- src/cnaas_nms/devicehandler/tests/test_update.py | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cnaas_nms/api/interface.py b/src/cnaas_nms/api/interface.py index d6687f36..a233ebb1 100644 --- a/src/cnaas_nms/api/interface.py +++ b/src/cnaas_nms/api/interface.py @@ -129,8 +129,8 @@ def put(self, hostname): errors.append("configtype is not a string") else: if InterfaceConfigType.has_name(configtype): - if intf.configtype != str(InterfaceConfigType[configtype]): - intf.configtype = str(InterfaceConfigType[configtype]) + if intf.configtype != InterfaceConfigType[configtype]: + intf.configtype = InterfaceConfigType[configtype] updated = True data[if_name] = {"configtype": configtype} else: diff --git a/src/cnaas_nms/db/settings_fields.py b/src/cnaas_nms/db/settings_fields.py index 3ce53c5d..8fb26e82 100644 --- a/src/cnaas_nms/db/settings_fields.py +++ b/src/cnaas_nms/db/settings_fields.py @@ -225,7 +225,7 @@ class f_extroute_ospfv3(BaseModel): class f_extroute_bgp_neighbor_v4(BaseModel): peer_ipv4: str = ipv4_schema - peer_as: str = as_num_schema + peer_as: int = as_num_schema route_map_in: str = vlan_name_schema route_map_out: str = vlan_name_schema description: str = "undefined" @@ -242,7 +242,7 @@ class f_extroute_bgp_neighbor_v4(BaseModel): class f_extroute_bgp_neighbor_v6(BaseModel): peer_ipv6: str = ipv6_schema - peer_as: str = as_num_schema + peer_as: int = as_num_schema route_map_in: str = vlan_name_schema route_map_out: str = vlan_name_schema description: str = "undefined" @@ -259,7 +259,7 @@ class f_extroute_bgp_neighbor_v6(BaseModel): class f_extroute_bgp_vrf(BaseModel): name: str - local_as: str = as_num_schema + local_as: int = as_num_schema neighbor_v4: List[f_extroute_bgp_neighbor_v4] = [] neighbor_v6: List[f_extroute_bgp_neighbor_v6] = [] cli_append_str: str = "" @@ -326,7 +326,7 @@ class f_underlay(BaseModel): infra_lo_net: str = ipv4_if_schema infra_link_net: str = ipv4_if_schema mgmt_lo_net: str = ipv4_if_schema - bgp_asn: Optional[str] = as_num_schema + bgp_asn: Optional[int] = as_num_schema class f_user(BaseModel): diff --git a/src/cnaas_nms/devicehandler/tests/test_update.py b/src/cnaas_nms/devicehandler/tests/test_update.py index 085a6fa1..379d0763 100644 --- a/src/cnaas_nms/devicehandler/tests/test_update.py +++ b/src/cnaas_nms/devicehandler/tests/test_update.py @@ -25,6 +25,7 @@ def setUp(self): with open(os.path.join(data_dir, "testdata.yml"), "r") as f_testdata: self.testdata = yaml.safe_load(f_testdata) + # maybe ar tge type of dict def get_linknets(self, session, neighbors_data: Optional[dict] = None, hostname: str = "eosaccess"): if not neighbors_data: neighbors_data = self.testdata["lldp_data_redundant"]