Skip to content
Snippets Groups Projects
Commit 07965010 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/ecoc22-dc-interconnect-disjoint' into 'develop'

Minor code polishing after ECOC'22 demo

See merge request !13
parents a8abefcd e60e6367
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!13Minor code polishing after ECOC'22 demo
......@@ -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
......@@ -128,7 +128,7 @@
<td>-</td>
<td>
{{ 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
</td>
</tr>
{% else %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment