Loading src/nbi/service/ipowdm/Resources.py +12 −4 Original line number Diff line number Diff line Loading @@ -37,9 +37,14 @@ class IpowdmService(Resource): return {'status': 'error', 'message': f'Failed to create TFS service: {str(e)}'}, 500 # Send the configuration to the corresponding device. # ietf_l3vpn driver is usually loaded in the IP Controller. device_id_str = "IP Controller" # The request payload nests the device id under `services`. try: services = data.get("services") if not services or not isinstance(services, list): raise KeyError("services") service_entry = services[0][0] device_id_str = service_entry["endpoint_id"]["device_id"]["device_uuid"]["uuid"] device = Device() device.device_id.device_uuid.uuid = device_id_str config_rule = ConfigRule() Loading @@ -51,8 +56,11 @@ class IpowdmService(Resource): self.device_client.ConfigureDevice(device) LOGGER.info("Configured device %s with IPoWDM service %s", device_id_str, sliceId) except KeyError as e: LOGGER.error("Invalid request data, missing field: %s; data: %s", str(e), json.dumps(data)) return {'status': 'error', 'message': f'Invalid request data: missing {str(e)}'}, 400 except Exception as e: LOGGER.error("Failed to configure device: %s", str(e)) LOGGER.error("Failed to configure device: %s", str(e), exc_info=True) return {'status': 'error', 'message': f'Failed to configure device: {str(e)}'}, 500 return { Loading Loading
src/nbi/service/ipowdm/Resources.py +12 −4 Original line number Diff line number Diff line Loading @@ -37,9 +37,14 @@ class IpowdmService(Resource): return {'status': 'error', 'message': f'Failed to create TFS service: {str(e)}'}, 500 # Send the configuration to the corresponding device. # ietf_l3vpn driver is usually loaded in the IP Controller. device_id_str = "IP Controller" # The request payload nests the device id under `services`. try: services = data.get("services") if not services or not isinstance(services, list): raise KeyError("services") service_entry = services[0][0] device_id_str = service_entry["endpoint_id"]["device_id"]["device_uuid"]["uuid"] device = Device() device.device_id.device_uuid.uuid = device_id_str config_rule = ConfigRule() Loading @@ -51,8 +56,11 @@ class IpowdmService(Resource): self.device_client.ConfigureDevice(device) LOGGER.info("Configured device %s with IPoWDM service %s", device_id_str, sliceId) except KeyError as e: LOGGER.error("Invalid request data, missing field: %s; data: %s", str(e), json.dumps(data)) return {'status': 'error', 'message': f'Invalid request data: missing {str(e)}'}, 400 except Exception as e: LOGGER.error("Failed to configure device: %s", str(e)) LOGGER.error("Failed to configure device: %s", str(e), exc_info=True) return {'status': 'error', 'message': f'Failed to configure device: {str(e)}'}, 500 return { Loading