diff --git a/src/tests/tools/mock_mw_sdn_ctrl/MockMWSdnCtrl.py b/src/tests/tools/mock_mw_sdn_ctrl/MockMWSdnCtrl.py index f002d23769dbb5d8b2c118eb7fb36b593fe736a7..d4aabbe5b0325e476fc524fc26dec00a98758c46 100644 --- a/src/tests/tools/mock_mw_sdn_ctrl/MockMWSdnCtrl.py +++ b/src/tests/tools/mock_mw_sdn_ctrl/MockMWSdnCtrl.py @@ -91,22 +91,37 @@ class Services(Resource): return jsonify({'ietf-eth-tran-service:etht-svc': {'etht-svc-instances': services}}) def post(self): + LOGGER.info('[post] begin') try: - json_request = request.json - if not json_request: abort(400) - if not isinstance(json_request, dict): abort(400) - if 'etht-svc-instances' not in json_request: abort(400) + json_request = request.get_json() + LOGGER.info('[post] json_request={:s}'.format(str(json_request))) + if not json_request: + LOGGER.info('[post] abort 1') + abort(400) + if not isinstance(json_request, dict): + LOGGER.info('[post] abort 2') + abort(400) + if 'etht-svc-instances' not in json_request: + LOGGER.info('[post] abort 3') + abort(400) json_services = json_request['etht-svc-instances'] - if not isinstance(json_services, list): abort(400) - if len(json_services) != 1: abort(400) + LOGGER.info('[post] json_services={:s}'.format(str(json_services))) + if not isinstance(json_services, list): + LOGGER.info('[post] abort 4') + abort(400) + if len(json_services) != 1: + LOGGER.info('[post] abort 5') + abort(400) svc_data = json_services[0] + LOGGER.info('[post] svc_data={:s}'.format(str(svc_data))) etht_svc_name = svc_data['etht-svc-name'] + LOGGER.info('[post] etht_svc_name={:s}'.format(str(etht_svc_name))) NETWORK_SERVICES[etht_svc_name] = svc_data + LOGGER.info('[post] done') return jsonify({}), 201 except: LOGGER.exception('Exception in POST') - class DelServices(Resource): def delete(self, service_uuid : str): NETWORK_SERVICES.pop(service_uuid, None)