From c0d7bc29f038c9f22eb8c91293442c9261b29757 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 26 Oct 2022 13:07:37 +0000 Subject: [PATCH 1/2] WebUI: - minor styling improvements in Slice pages --- src/webui/service/templates/slice/detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/service/templates/slice/detail.html b/src/webui/service/templates/slice/detail.html index 936b0f08f..07734f323 100644 --- a/src/webui/service/templates/slice/detail.html +++ b/src/webui/service/templates/slice/detail.html @@ -128,7 +128,7 @@ - {{ constraint.sla_availability.num_disjoint_paths }} disjoint paths; - {% if constraint.sla_availability.all_active %}all{% else %}single{% endif %}active + {% if constraint.sla_availability.all_active %}all{% else %}single{% endif %}-active {% else %} -- GitLab From e60e63677b06f3460292aabace0682a5f08d2e15 Mon Sep 17 00:00:00 2001 From: gifrerenom Date: Wed, 26 Oct 2022 13:07:45 +0000 Subject: [PATCH 2/2] Device - TransportAPIDriver: - improved HTTP status code checks --- src/device/service/drivers/transport_api/Tools.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/device/service/drivers/transport_api/Tools.py b/src/device/service/drivers/transport_api/Tools.py index 6faee37ce..6ae928eb8 100644 --- a/src/device/service/drivers/transport_api/Tools.py +++ b/src/device/service/drivers/transport_api/Tools.py @@ -17,6 +17,12 @@ from device.service.driver_api._Driver import RESOURCE_ENDPOINTS LOGGER = logging.getLogger(__name__) +HTTP_OK_CODES = { + 200, # OK + 201, # Created + 202, # Accepted + 204, # No Content +} def find_key(resource, key): return json.loads(resource[1])[key] @@ -97,10 +103,10 @@ def create_connectivity_service( LOGGER.exception('Exception creating ConnectivityService(uuid={:s}, data={:s})'.format(str(uuid), str(data))) results.append(e) else: - if response.status_code != 201: + if response.status_code not in HTTP_OK_CODES: msg = 'Could not create ConnectivityService(uuid={:s}, data={:s}). status_code={:s} reply={:s}' LOGGER.error(msg.format(str(uuid), str(data), str(response.status_code), str(response))) - results.append(response.status_code == 201) + results.append(response.status_code in HTTP_OK_CODES) return results def delete_connectivity_service(root_url, timeout, uuid): @@ -113,8 +119,8 @@ def delete_connectivity_service(root_url, timeout, uuid): LOGGER.exception('Exception deleting ConnectivityService(uuid={:s})'.format(str(uuid))) results.append(e) else: - if response.status_code != 201: + if response.status_code not in HTTP_OK_CODES: msg = 'Could not delete ConnectivityService(uuid={:s}). status_code={:s} reply={:s}' LOGGER.error(msg.format(str(uuid), str(response.status_code), str(response))) - results.append(response.status_code == 202) + results.append(response.status_code in HTTP_OK_CODES) return results -- GitLab