Commit support Device Management- Self Test on Device
https://jira.opencord.org/browse/VOL-27
Addressed review comments
Change-Id: I9f70e476b28ee40f90b312744a4c44fc8e7f7481
diff --git a/cli/main.py b/cli/main.py
index 0adee54..327f122 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -324,6 +324,20 @@
         except Exception, e:
             self.poutput('Error rebooting {}.  Error:{}'.format(device_id, e))
 
+    def do_self_test(self, line):
+        """
+        Self Test a device. ID of the device needs to be provided
+        """
+        device_id = line or self.default_device_id
+        self.poutput('Self Testing {}'.format(device_id))
+        try:
+            stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+            res = stub.SelfTest(voltha_pb2.ID(id=device_id))
+            self.poutput('Self Tested {}'.format(device_id))
+            self.poutput(dumps(pb2dict(res), indent=4))
+        except Exception, e:
+            self.poutput('Error in self test {}.  Error:{}'.format(device_id, e))
+
     def do_delete(self, line):
         """
         Deleting a device. ID of the device needs to be provided