VOL-651: Entering CLI of non existing device

Change-Id: I1dff1304811cc3da3bcc7926d301228a798fda70
diff --git a/cli/main.py b/cli/main.py
index b8cb918..0f437c0 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -213,6 +213,10 @@
         device_id = line.strip() or self.default_device_id
         if not device_id:
             raise Exception('<device-id> parameter needed')
+        if device_id not in self.get_devices():
+            self.poutput( self.colorize('Error: ', 'red') +
+                            'There is no such device')
+            raise Exception('<device-id> is not a valid one')
         sub = DeviceCli(device_id, self.get_stub)
         sub.cmdloop()
 
@@ -221,6 +225,10 @@
         logical_device_id = line.strip() or self.default_logical_device_id
         if not logical_device_id:
             raise Exception('<logical-device-id> parameter needed')
+        if logical_device_id not in self.get_logical_devices():
+            self.poutput( self.colorize('Error: ', 'red') +
+                            'There is no such device')
+            raise Exception('<logical-device-id> is not a valid one')
         sub = LogicalDeviceCli(logical_device_id, self.get_stub)
         sub.cmdloop()