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

Device component:

- Corrected driver instantiation/selection
parent a1fb0827
No related branches found
No related tags found
1 merge request!142Release TeraFlowSDN 2.1
......@@ -109,7 +109,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer):
if device is None:
raise NotFoundException('Device', device_uuid, extra_details='loading in ConfigureDevice')
driver : _Driver = self.driver_instance_cache.get(device_uuid)
driver : _Driver = get_driver(self.driver_instance_cache, device)
if driver is None:
msg = ERROR_MISSING_DRIVER.format(device_uuid=str(device_uuid))
raise OperationFailedException('ConfigureDevice', extra_details=msg)
......@@ -150,6 +150,11 @@ class DeviceServiceServicerImpl(DeviceServiceServicer):
self.mutex_queues.wait_my_turn(device_uuid)
try:
context_client = ContextClient()
device = get_device(context_client, device_uuid, rw_copy=False)
if device is None:
raise NotFoundException('Device', device_uuid, extra_details='loading in DeleteDevice')
device_uuid = device.device_id.device_uuid.uuid
self.monitoring_loops.remove_device(device_uuid)
self.driver_instance_cache.delete(device_uuid)
context_client.RemoveDevice(request)
......@@ -163,7 +168,12 @@ class DeviceServiceServicerImpl(DeviceServiceServicer):
self.mutex_queues.wait_my_turn(device_uuid)
try:
driver : _Driver = self.driver_instance_cache.get(device_uuid)
context_client = ContextClient()
device = get_device(context_client, device_uuid, rw_copy=False)
if device is None:
raise NotFoundException('Device', device_uuid, extra_details='loading in DeleteDevice')
driver : _Driver = get_driver(self.driver_instance_cache, device)
if driver is None:
msg = ERROR_MISSING_DRIVER.format(device_uuid=str(device_uuid))
raise OperationFailedException('GetInitialConfig', extra_details=msg)
......@@ -197,7 +207,12 @@ class DeviceServiceServicerImpl(DeviceServiceServicer):
self.mutex_queues.wait_my_turn(device_uuid)
try:
driver : _Driver = self.driver_instance_cache.get(device_uuid)
context_client = ContextClient()
device = get_device(context_client, device_uuid, rw_copy=False)
if device is None:
raise NotFoundException('Device', device_uuid, extra_details='loading in DeleteDevice')
driver : _Driver = get_driver(self.driver_instance_cache, device)
if driver is None:
msg = ERROR_MISSING_DRIVER.format(device_uuid=str(device_uuid))
raise OperationFailedException('MonitorDeviceKpi', extra_details=msg)
......
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