From 694b4c30fe6c50d6a86827ecfa546224a23f24c0 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Wed, 6 Nov 2024 15:44:46 +0000 Subject: [PATCH 1/3] feat: add tls support for nms --- tests/integration/nms_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/nms_helper.py b/tests/integration/nms_helper.py index 8c44ed0c..334a8379 100644 --- a/tests/integration/nms_helper.py +++ b/tests/integration/nms_helper.py @@ -62,7 +62,7 @@ def create_subscriber(self, imsi: str) -> None: imsi (str): Subscriber's IMSI """ SUBSCRIBER_CONFIG["UeId"] = imsi - url = f"http://{self.nms_ip}:5000/api/subscriber/imsi-{imsi}" + url = f"https://{self.nms_ip}:5000/api/subscriber/imsi-{imsi}" response = requests.post(url=url, data=json.dumps(SUBSCRIBER_CONFIG)) response.raise_for_status() logger.info(f"Created subscriber with IMSI {imsi}.") @@ -75,7 +75,7 @@ def create_device_group(self, device_group_name: str, imsis: list) -> None: imsis (list): List of IMSIs to be included in the device group """ DEVICE_GROUP_CONFIG["imsis"] = imsis - url = f"http://{self.nms_ip}:5000/config/v1/device-group/{device_group_name}" + url = f"https://{self.nms_ip}:5000/config/v1/device-group/{device_group_name}" response = requests.post(url, json=DEVICE_GROUP_CONFIG) response.raise_for_status() now = time.time() @@ -96,7 +96,7 @@ def create_network_slice(self, network_slice_name: str, device_groups: list) -> device_groups (list): List of device groups to be included in the network slice """ NETWORK_SLICE_CONFIG["site-device-group"] = device_groups - url = f"http://{self.nms_ip}:5000/config/v1/network-slice/{network_slice_name}" + url = f"https://{self.nms_ip}:5000/config/v1/network-slice/{network_slice_name}" response = requests.post(url, json=NETWORK_SLICE_CONFIG) response.raise_for_status() now = time.time() From e1e9f109f975f8a44068fb4e37f4106a420969f4 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Mon, 18 Nov 2024 12:35:35 +0000 Subject: [PATCH 2/3] remove TLS verification on request for tests --- tests/integration/nms_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/nms_helper.py b/tests/integration/nms_helper.py index 334a8379..bea17ec7 100644 --- a/tests/integration/nms_helper.py +++ b/tests/integration/nms_helper.py @@ -63,7 +63,7 @@ def create_subscriber(self, imsi: str) -> None: """ SUBSCRIBER_CONFIG["UeId"] = imsi url = f"https://{self.nms_ip}:5000/api/subscriber/imsi-{imsi}" - response = requests.post(url=url, data=json.dumps(SUBSCRIBER_CONFIG)) + response = requests.post(url=url, data=json.dumps(SUBSCRIBER_CONFIG), verify=False) response.raise_for_status() logger.info(f"Created subscriber with IMSI {imsi}.") @@ -76,7 +76,7 @@ def create_device_group(self, device_group_name: str, imsis: list) -> None: """ DEVICE_GROUP_CONFIG["imsis"] = imsis url = f"https://{self.nms_ip}:5000/config/v1/device-group/{device_group_name}" - response = requests.post(url, json=DEVICE_GROUP_CONFIG) + response = requests.post(url, json=DEVICE_GROUP_CONFIG, verify=False) response.raise_for_status() now = time.time() timeout = 5 @@ -97,7 +97,7 @@ def create_network_slice(self, network_slice_name: str, device_groups: list) -> """ NETWORK_SLICE_CONFIG["site-device-group"] = device_groups url = f"https://{self.nms_ip}:5000/config/v1/network-slice/{network_slice_name}" - response = requests.post(url, json=NETWORK_SLICE_CONFIG) + response = requests.post(url, json=NETWORK_SLICE_CONFIG, verify=False) response.raise_for_status() now = time.time() timeout = 5 From 11bf82838c396fac7b049ace2b58f7ea3e9cc8c7 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Mon, 18 Nov 2024 12:58:43 +0000 Subject: [PATCH 3/3] remove TLS verification on requests --- tests/integration/nms_helper.py | 4 ++-- tests/integration/test_integration.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/integration/nms_helper.py b/tests/integration/nms_helper.py index bea17ec7..8a533429 100644 --- a/tests/integration/nms_helper.py +++ b/tests/integration/nms_helper.py @@ -81,7 +81,7 @@ def create_device_group(self, device_group_name: str, imsis: list) -> None: now = time.time() timeout = 5 while time.time() - now <= timeout: - if requests.get(url).json(): + if requests.get(url, verify=False).json(): logger.info(f"Created device group {device_group_name}.") return else: @@ -102,7 +102,7 @@ def create_network_slice(self, network_slice_name: str, device_groups: list) -> now = time.time() timeout = 5 while time.time() - now <= timeout: - if requests.get(url).json(): + if requests.get(url, verify=False).json(): logger.info(f"Created network slice {network_slice_name}.") return else: diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 25960d89..d397ea93 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -70,9 +70,9 @@ async def test_given_external_hostname_configured_for_traefik_when_calling_sdcor self, configure_traefik_external_hostname ): nms_url = self._get_nms_url() - network_configuration_resp = requests.get(f"{nms_url}/network-configuration") + network_configuration_resp = requests.get(f"{nms_url}/network-configuration", verify=False) network_configuration_resp.raise_for_status() - subscribers_resp = requests.get(f"{nms_url}/subscribers") + subscribers_resp = requests.get(f"{nms_url}/subscribers", verify=False) subscribers_resp.raise_for_status() @pytest.mark.abort_on_fail