diff --git a/src/device/service/drivers/transport_api/Tools.py b/src/device/service/drivers/transport_api/Tools.py index 6faee37ce540443b982b523239e37a2edc779659..6ae928eb8f6bf8371dbf28b7ee9cc1995b3c191f 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 diff --git a/src/webui/service/templates/slice/detail.html b/src/webui/service/templates/slice/detail.html index 936b0f08fb1b7def156e11f16bf552b8d60018be..07734f32304b60365f76413d4689a37b66cc60a3 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 %}