diff --git a/broadview_lib/config/pt.py b/broadview_lib/config/pt.py index d1bc8c2..52b2502 100644 --- a/broadview_lib/config/pt.py +++ b/broadview_lib/config/pt.py @@ -347,7 +347,7 @@ class GetPacketTraceLAGResolution(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} @@ -406,7 +406,7 @@ class GetPacketTraceECMPResolution(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} @@ -465,7 +465,7 @@ class GetPacketTraceProfile(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} @@ -505,7 +505,7 @@ class GetPacketTraceDropReason(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} @@ -548,7 +548,7 @@ class GetPacketTraceDropCounterReport(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} @@ -585,7 +585,7 @@ class GetPacketTraceSupportedDropReasons(AgentAPI): rep.process(json) else: pass - return status, rep + return status def toDict(self): ret = {} diff --git a/broadview_lib/pt/laglinkresolution.py b/broadview_lib/pt/laglinkresolution.py index 2d231c2..504755b 100644 --- a/broadview_lib/pt/laglinkresolution.py +++ b/broadview_lib/pt/laglinkresolution.py @@ -17,6 +17,8 @@ class LAGLinkResolution(): self.lag_id = None self.lag_members = None self.dst_lag_member = None + self.fabric_trunk_id = None + self.fabric_trunk_members = None def getLAGID(self): return self.lag_id @@ -27,6 +29,12 @@ class LAGLinkResolution(): def getDstLAGMember(self): return self.dst_lag_member + def getFabricTrunkID(self): + return self.fabric_trunk_id + + def getFabricTrunkMembers(self): + return self.fabric_trunk_members + def __repr__(self): return "lag-link-resolution" @@ -44,4 +52,12 @@ class LAGLinkResolution(): self.dst_lag_member = data["dst-lag-member"] else: ret = False + if "fabric-trunk-id" in data: + self.fabric_trunk_id = data["fabric-trunk-id"] + else: + ret = False + if "fabric-trunk-members" in data: + self.fabric_trunk_members = data["fabric-trunk-members"] + else: + ret = False return ret diff --git a/broadview_lib/pt/pt_parser.py b/broadview_lib/pt/pt_parser.py index 082589b..ceeb75d 100644 --- a/broadview_lib/pt/pt_parser.py +++ b/broadview_lib/pt/pt_parser.py @@ -301,6 +301,8 @@ class TestParser(unittest.TestCase): "data": { "lag-id": "2", "lag-members": ["1", "2", "3", "4"], + "fabric-trunk-id": "6", + "fabric-trunk-members": ["1", "2", "3"], "dst-lag-member": "4" } }, @@ -334,7 +336,9 @@ class TestParser(unittest.TestCase): "data": { "lag-id": "3", "lag-members": ["5","6","7","8"], - "dst-lag-member": "6" + "dst-lag-member": "6", + "fabric-trunk-id": "5", + "fabric-trunk-members": ["8", "9", "10"], } }, { @@ -377,7 +381,9 @@ class TestParser(unittest.TestCase): "data": { "lag-id": "2", "lag-members": ["1", "2", "3", "4"], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "7", + "fabric-trunk-members": ["11", "12", "13"], } }, { @@ -410,7 +416,9 @@ class TestParser(unittest.TestCase): "data": { "lag-id": "2", "lag-members": ["1","2","3","4"], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "9", + "fabric-trunk-members": ["21", "32", "43"], } }, { @@ -778,7 +786,9 @@ class TestParser(unittest.TestCase): "3", "4" ], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "3", + "fabric-trunk-members": ["17", "18", "19"], } }, { @@ -791,6 +801,8 @@ class TestParser(unittest.TestCase): "7", "8" ], + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], "dst-lag-member": "7" } } @@ -1745,6 +1757,13 @@ class TestParser(unittest.TestCase): self.assertEqual(True, "3" in lm) self.assertEqual(True, "4" in lm) + self.assertEqual(llr.getFabricTrunkID(), "3") + lm = llr.getFabricTrunkMembers() + self.assertEqual(len(lm), 3) + self.assertEqual(True, "17" in lm) + self.assertEqual(True, "18" in lm) + self.assertEqual(True, "19" in lm) + self.assertEqual(llr.getDstLAGMember(), "4") elif m.getPort() == "2": self.assertEqual(llr.getLAGID(), "2") @@ -1756,6 +1775,13 @@ class TestParser(unittest.TestCase): self.assertEqual(True, "7" in lm) self.assertEqual(True, "8" in lm) + self.assertEqual(llr.getFabricTrunkID(), "6") + lm = llr.getFabricTrunkMembers() + self.assertEqual(len(lm), 3) + self.assertEqual(True, "27" in lm) + self.assertEqual(True, "28" in lm) + self.assertEqual(True, "29" in lm) + self.assertEqual(llr.getDstLAGMember(), "7") else: self.assertEqual("unexpected port {}".format(llr.getPort()), True) @@ -2135,6 +2161,13 @@ class TestParser(unittest.TestCase): self.assertEqual(True, "3" in lm) self.assertEqual(True, "4" in lm) + self.assertEqual(llr.getFabricTrunkID(), "6") + lm = llr.getFabricTrunkMembers() + self.assertEqual(len(lm), 3) + self.assertEqual(True, "1" in lm) + self.assertEqual(True, "2" in lm) + self.assertEqual(True, "3" in lm) + self.assertEqual(llr.getDstLAGMember(), "4") elif m.getPort() == "2": self.assertEqual(llr.getLAGID(), "3") @@ -2146,6 +2179,13 @@ class TestParser(unittest.TestCase): self.assertEqual(True, "7" in lm) self.assertEqual(True, "8" in lm) + self.assertEqual(llr.getFabricTrunkID(), "5") + lm = llr.getFabricTrunkMembers() + self.assertEqual(len(lm), 3) + self.assertEqual(True, "8" in lm) + self.assertEqual(True, "9" in lm) + self.assertEqual(True, "10" in lm) + self.assertEqual(llr.getDstLAGMember(), "6") else: self.assertEqual("unexpected port {}".format(llr.getPort()), True) diff --git a/broadview_lib/tools/bv-bhdctl.py b/broadview_lib/tools/bv-bhdctl.py index bb64346..2b1a51b 100644 --- a/broadview_lib/tools/bv-bhdctl.py +++ b/broadview_lib/tools/bv-bhdctl.py @@ -148,7 +148,7 @@ class BHDCommand(): print "invalid enable: bad argument count" status = x.send(timeout=self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -172,7 +172,7 @@ class BHDCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -244,7 +244,7 @@ class BHDCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -274,7 +274,7 @@ class BHDCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -293,7 +293,7 @@ class BHDCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -312,7 +312,7 @@ class BHDCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -332,7 +332,7 @@ class BHDCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -344,7 +344,7 @@ class BHDCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret diff --git a/broadview_lib/tools/bv-bstctl.py b/broadview_lib/tools/bv-bstctl.py index 11ec597..178240a 100644 --- a/broadview_lib/tools/bv-bstctl.py +++ b/broadview_lib/tools/bv-bstctl.py @@ -155,7 +155,7 @@ class BSTConfigCommand(): x.setAsyncFullReports("async_full_reports" in args) status = x.send(timeout=self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -195,7 +195,7 @@ class BSTConfigCommand(): x.setTrackDevice("track_device" in args) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -230,7 +230,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid device: bad argument count" usage = True @@ -243,7 +243,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-cpu-queue: bad argument count" usage = True @@ -256,7 +256,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-rqe-queue: bad argument count" usage = True @@ -273,7 +273,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-port-service-pool: bad argument count" usage = True @@ -288,7 +288,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-service-pool: bad argument count" usage = True @@ -301,7 +301,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-uc-queue: bad argument count" usage = True @@ -314,7 +314,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-uc-queue-group: bad argument count" usage = True @@ -328,7 +328,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid egress-mc-queue-group: bad argument count" usage = True @@ -343,7 +343,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid ingress-port-priority-group: bad argument count" usage = True @@ -357,7 +357,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid ingress-port-service-pool: bad argument count" usage = True @@ -370,7 +370,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) else: print "invalid ingress-service-pool: bad argument count" usage = True @@ -406,7 +406,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -422,7 +422,7 @@ class BSTConfigCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -442,7 +442,7 @@ class BSTConfigCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret @@ -461,7 +461,7 @@ class BSTConfigCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret def helpGetTracking(self, name): @@ -491,7 +491,7 @@ class BSTConfigCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret @@ -537,7 +537,7 @@ class BSTConfigCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret diff --git a/broadview_lib/tools/bv-ctl.py b/broadview_lib/tools/bv-ctl.py index da6588c..5fd93bf 100644 --- a/broadview_lib/tools/bv-ctl.py +++ b/broadview_lib/tools/bv-ctl.py @@ -114,7 +114,7 @@ class BroadViewCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret @@ -133,7 +133,7 @@ class BroadViewCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) return usage, ret diff --git a/broadview_lib/tools/bv-ptctl-examples.sh b/broadview_lib/tools/bv-ptctl-examples.sh index 64e370b..b2ab185 100644 --- a/broadview_lib/tools/bv-ptctl-examples.sh +++ b/broadview_lib/tools/bv-ptctl-examples.sh @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -host=10.14.244.128 -port=8082 +host=10.18.20.217 +port=8080 echo "********** get-system-feature **********" python bv-ctl.py get-system-feature timeout:30 host:$host port:$port @@ -35,5 +35,5 @@ python bv-ptctl.py cancel-lag-resolution timeout:30 host:$host port:$port echo "********** pt cancel-ecmp-resolution **********" python bv-ptctl.py cancel-ecmp-resolution timeout:30 host:$host port:$port echo "********** pt get-profile **********" -python bv-ptctl.py get-profile drop-packet:1 collection-interval:45 timeout:30 host:$host port:$port +python bv-ptctl.py get-lag-resolution packet:"1MOyoQIABAAAAAAAAAAAAP//AAABAAAANlMKVgAAAABDAAAAQwAAAAAAAAAGAAAO7DIeCoEAAAoAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8V5EQ=" port-list:"0/4" drop-packet:1 collection-interval:10 timeout:30 host:$host port:$port diff --git a/broadview_lib/tools/bv-ptctl.py b/broadview_lib/tools/bv-ptctl.py index fdc9a0c..b39b979 100644 --- a/broadview_lib/tools/bv-ptctl.py +++ b/broadview_lib/tools/bv-ptctl.py @@ -145,7 +145,7 @@ class PTCommand(): x.setEnable("enable" in args) status = x.send(timeout=self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -180,7 +180,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -217,7 +217,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -242,7 +242,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -258,7 +258,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -274,7 +274,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -305,7 +305,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -314,7 +314,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -350,7 +350,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -359,7 +359,7 @@ class PTCommand(): x.setASIC(asic) status = x.send(self._timeout) if status != 200: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -383,7 +383,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -417,7 +417,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -436,7 +436,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -477,7 +477,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -496,7 +496,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -533,12 +533,16 @@ class PTCommand(): print "invalid packet: bad argument count" usage = True elif "port-list:" in arg: + print "port-list enter" v = arg.split(":") + print "port-list args {}".format(v) if len(v) == 2: v2 = v[1].split(",") + print "port-list v2 {}".format(v2) port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) + print "setting port_list {}".format(port_list) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -557,7 +561,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -578,12 +582,12 @@ class PTCommand(): if not usage: x = GetPacketTraceDropReason(host, port) x.setASIC(asic) - status = x.send(self._timeout) + status, rep = x.send(self._timeout) if status == 200: - ret = json.dumps(x.getJSON()) + ret = json.dumps(rep.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -614,7 +618,7 @@ class PTCommand(): v2 = v[1].split(",") port_list = [] for y in v2: - port_list.append(x) + port_list.append(y) x.setPortList(port_list) else: print "invalid port-list: bad argument count" @@ -632,7 +636,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret @@ -657,7 +661,7 @@ class PTCommand(): ret = json.dumps(x.getJSON()) print ret else: - print "failure: %d" % (status) + print "failure: {}".format(status) ret = None return usage, ret