VOL-288: Minor fixes for xPON cli in VOLTHA
Fix the following issues detected in the xPON cli:
* Missing validation for device ID
* 'show' command to display v_ont_ani, ont_ani
and v_enet does not work for specific device id
VOL-290: Use interface_stack to implement child-parent relationship for xPON interface objects
Move to an elegant approach to use child-parent relationship for xPON interface objects to
determine the OLT and ONU device id(s) for sending configuration
Change-Id: Ia26154e3fe1fba1a650c6a53f4d5232fb7369ce3
Removing extra characters
Change-Id: I11d1e86bfa8c87c1c00852a469aa5a4e21d5b49c
diff --git a/cli/main.py b/cli/main.py
index c0dbef6..8e51851 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -257,10 +257,16 @@
def do_xpon(self, line):
"""xpon <optional> [device_ID] - Enter xpon level command mode"""
device_id = line.strip()
- if not device_id:
- sub = XponCli(self.get_channel, "")
- else:
- sub = XponCli(self.get_channel, device_id)
+ if device_id:
+ stub = self.get_stub()
+ try:
+ res = stub.GetDevice(voltha_pb2.ID(id=device_id))
+ except Exception:
+ self.poutput(self.colorize('Error: ', 'red') + \
+ 'No device id ' + self.colorize(device_id, 'blue') + \
+ ' is found')
+ return
+ sub = XponCli(self.get_channel, device_id)
sub.cmdloop()
def do_pdb(self, line):