VOL-789 If enable on activating device, go back to waiting for activation
Change-Id: Iaff40006ff4e7e9b2f690230ca2d69c8eaedf6e0
diff --git a/cli/main.py b/cli/main.py
index 441b292..6ca318a 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -350,10 +350,12 @@
stub = self.get_stub()
device = stub.GetDevice(voltha_pb2.ID(id=device_id))
if device.admin_state == voltha_pb2.AdminState.ENABLED:
- self.poutput('Error: Device is already enabled')
- return
- stub.EnableDevice(voltha_pb2.ID(id=device_id))
- self.poutput('enabling {}'.format(device_id))
+ if device.oper_status != voltha_pb2.OperStatus.ACTIVATING:
+ self.poutput('Error: Device is already enabled')
+ return
+ else:
+ stub.EnableDevice(voltha_pb2.ID(id=device_id))
+ self.poutput('enabling {}'.format(device_id))
while True:
device = stub.GetDevice(voltha_pb2.ID(id=device_id))