Descriptive log for onu activate failures.
Onu activate may fail if the adapter tries to activate
an onu that is being activated.
Change-Id: I7f417e4e8824bd8f7280d8afdf8779efd817fc0a
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index f38f604..105db1d 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -574,8 +574,19 @@
serial_number=serial_number, pir=pir)
onu = openolt_pb2.Onu(intf_id=intf_id, onu_id=onu_id,
serial_number=serial_number, pir=pir)
- self.stub.ActivateOnu(onu)
- self.log.info('onu-activated', serial_number=serial_number_str)
+ try:
+ self.stub.ActivateOnu(onu)
+ except grpc.RpcError as grpc_e:
+ if grpc_e.code() == grpc.StatusCode.ALREADY_EXISTS:
+ self.log.info('onu activation in progress',
+ serial_number=serial_number_str,
+ e=grpc_e)
+ else:
+ self.log.error('onu activation failed',
+ serial_number=serial_number_str,
+ grpc_error=grpc_e)
+ else:
+ self.log.info('onu-activated', serial_number=serial_number_str)
# FIXME - instead of passing child_device around, delete_child_device
# needs to change to use serial_number.