This commit address the changes in CLI required to work with the
global forwarder. A new CLI option (-G) has been added.
Change-Id: I9bef1af65d0a8078bdb9a75bc807a124a3063847
diff --git a/cli/device.py b/cli/device.py
index c1e9ba6..6c7eea2 100644
--- a/cli/device.py
+++ b/cli/device.py
@@ -38,9 +38,9 @@
class DeviceCli(Cmd):
- def __init__(self, get_channel, device_id):
+ def __init__(self, device_id, get_stub):
Cmd.__init__(self)
- self.get_channel = get_channel
+ self.get_stub = get_stub
self.device_id = device_id
self.prompt = '(' + self.colorize(
self.colorize('device {}'.format(device_id), 'red'), 'bold') + ') '
@@ -51,7 +51,7 @@
self._cmdloop()
def get_device(self, depth=0):
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = self.get_stub()
res = stub.GetDevice(voltha_pb2.ID(id=self.device_id),
metadata=(('get-depth', str(depth)), ))
return res
@@ -286,7 +286,7 @@
return
elif line.strip() == "commit" and self.pm_config_dirty:
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = self.get_stub()
stub.UpdateDevicePmConfigs(self.pm_config_last)
self.pm_config_last = self.get_device(depth=-1).pm_configs
self.pm_config_dirty = False