def handlePOST(self, path, ctype, length, data):
     parser = PTParser()
     try:
         handled = parser.process(data)
     except:
         handled = False
     return (parser, handled)
Esempio n. 2
0
 def send(self, timeout=30):
     status, json = self._send(self.toDict(), timeout)
     rep = None
     if status == 200:
         self.__json = json["report"]
         rep = PTParser()
         rep.process(json)
     else:
         pass
     return status
Esempio n. 3
0
 def send(self, timeout=30):
     status, json = self._send(self.toDict(), timeout)
     rep = None
     if status == 200:
         self.__json = json["report"]
         rep = PTParser()
         rep.process(json)
     else:
         pass
     return status
Esempio n. 4
0
 def send(self, timeout=30):
     status, json = self._send(self.toDict(), timeout)
     rep = None
     if status == 200:
         self.__json = json["report"]
         self.__json[0]["cancellation-id"] = self.getLastUsedSerial()
         rep = PTParser()
         rep.process(json)
     else:
         pass
     return status
Esempio n. 5
0
 def send(self, timeout=30):
     status, json = self._send(self.toDict(), timeout)
     rep = None
     if status == 200:
         self.__json = json["report"]
         self.__json[0]["cancellation-id"] = self.getLastUsedSerial()
         rep = PTParser()
         rep.process(json)
     else:
         pass
     return status
 def test_packet_trace_supported_drop_reasons(self):
     rep = PTParser()
     rep.process(self.packet_trace_supported_drop_reasons_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 1)
     d = data[0]
     self.assertTrue("timestamp" in d)
     self.assertTrue("name" in d)
     self.assertTrue("dimensions" in d)
     self.assertEqual(d["name"], "broadview.pt.packet-trace-supported-drop-reasons")
     dim = d["dimensions"]
     self.assertTrue("reasons" in dim)
     self.assertEqual(len(dim["reasons"]), 2)
     self.assertEqual(dim["reasons"][0], "l2-lookup-failure")
     self.assertEqual(dim["reasons"][1], "vlan-mismatch")
Esempio n. 7
0
 def test_packet_trace_supported_drop_reasons(self):
     rep = PTParser()
     rep.process(self.packet_trace_supported_drop_reasons_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 1)
     d = data[0]
     self.assertTrue("timestamp" in d)
     self.assertTrue("name" in d)
     self.assertTrue("payload" in d)
     self.assertEqual(d["name"], "broadview.pt.packet-trace-supported-drop-reasons")
     dim = d["payload"]
     self.assertTrue("reasons" in dim)
     self.assertEqual(len(dim["reasons"]), 2)
     self.assertEqual(dim["reasons"][0], "l2-lookup-failure")
     self.assertEqual(dim["reasons"][1], "vlan-mismatch")
 def test_packet_trace_drop_reason(self):
     rep = PTParser()
     rep.process(self.packet_trace_drop_reason_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 2)
     i = 0
     for x in data:
         self.assertTrue("timestamp" in x)
         self.assertTrue("name" in x)
         self.assertTrue("dimensions" in x)
         self.assertEqual(x["name"],
                          "broadview.pt.packet-trace-drop-reason")
         dim = x["dimensions"]
         if i == 0:
             self.assertEqual(dim["reason"], "l2-lookup-failure")
             l = dim["port-list"]
             self.assertEqual(len(l), 4)
             self.assertEqual(l[0], "1")
             self.assertEqual(l[1], "5")
             self.assertEqual(l[2], "6")
             self.assertEqual(l[3], "10-15")
             self.assertEqual(dim["send-dropped-packet"], 0)
             self.assertEqual(dim["trace-profile"], 0)
             self.assertEqual(dim["packet-threshold"], 0)
             self.assertEqual(x["value"], 4)
         else:
             self.assertEqual(dim["reason"], "vlan-mismatch")
             l = dim["port-list"]
             self.assertEqual(len(l), 4)
             self.assertEqual(l[0], "11")
             self.assertEqual(l[1], "15")
             self.assertEqual(l[2], "16")
             self.assertEqual(l[3], "20-25")
             self.assertEqual(dim["send-dropped-packet"], 1)
             self.assertEqual(dim["trace-profile"], 1)
             self.assertEqual(dim["packet-threshold"], 10)
             self.assertEqual(x["value"], 3)
         i = i + 1
 def test_packet_trace_drop_reason(self):
     rep = PTParser()
     rep.process(self.packet_trace_drop_reason_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 2)
     i = 0
     for x in data:
         self.assertTrue("timestamp" in x)
         self.assertTrue("name" in x)
         self.assertTrue("dimensions" in x)
         self.assertEqual(x["name"], "broadview.pt.packet-trace-drop-reason")
         dim = x["dimensions"]
         if i == 0:
             self.assertEqual(dim["reason"], "l2-lookup-failure")
             l = dim["port-list"]
             self.assertEqual(len(l), 4)
             self.assertEqual(l[0], "1")
             self.assertEqual(l[1], "5")
             self.assertEqual(l[2], "6")
             self.assertEqual(l[3], "10-15")
             self.assertEqual(dim["send-dropped-packet"], 0)
             self.assertEqual(dim["trace-profile"], 0)
             self.assertEqual(dim["packet-threshold"], 0)
             self.assertEqual(x["value"], 4)
         else:
             self.assertEqual(dim["reason"], "vlan-mismatch")
             l = dim["port-list"]
             self.assertEqual(len(l), 4)
             self.assertEqual(l[0], "11")
             self.assertEqual(l[1], "15")
             self.assertEqual(l[2], "16")
             self.assertEqual(l[3], "20-25")
             self.assertEqual(dim["send-dropped-packet"], 1)
             self.assertEqual(dim["trace-profile"], 1)
             self.assertEqual(dim["packet-threshold"], 10)
             self.assertEqual(x["value"], 3)
         i = i + 1
Esempio n. 10
0
 def test_packet_trace_drop_counter_report(self):
     rep = PTParser()
     rep.process(self.packet_trace_drop_counter_report_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 18)
     i = 0
     for x in data:
         self.assertTrue("timestamp" in x)
         self.assertTrue("name" in x)
         self.assertTrue("payload" in x)
         self.assertEqual(x["name"], "broadview.pt.packet-trace-drop-counter-report")
         dim = x["payload"]
         if i == 0:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 10) 
         elif i == 1:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 2:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 3:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 4:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 50) 
         elif i == 5:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 60) 
         elif i == 6:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 70) 
         elif i == 7:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 8:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 9:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 10:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 80) 
         elif i == 11:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 90) 
         elif i == 12:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 10) 
         elif i == 13:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 14:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 15:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 16:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 50) 
         elif i == 17:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 60) 
         i = i + 1
Esempio n. 11
0
    def test_packet_trace_ecmp_resolution_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_ecmp_resolution_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 4)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("payload" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-ecmp-resolution")
        dim = data[0]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "100005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "1.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "11")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.2.2.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100004")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "18")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.6.6.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100005")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "11")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "100256")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("payload" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[1]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "200001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "2.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "21")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "200100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[2])
        timestamp = int(data[2]["timestamp"]) / 1000
        self.assertTrue("name" in data[2])
        self.assertTrue("payload" in data[2])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[2]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "300005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "3.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "31")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "3.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "300001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "38")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "3.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "300002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "31")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "300100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")

        self.assertTrue("timestamp" in data[3])
        timestamp = int(data[3]["timestamp"]) / 1000
        self.assertTrue("name" in data[3])
        self.assertTrue("payload" in data[3])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[3]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "400001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "4.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "41")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "4.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "400001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "48")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "4.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "400002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "41")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "400100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")
Esempio n. 12
0
    def test_packet_trace_lag_resolution_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_lag_resolution_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 2)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("payload" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_lag_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-lag-resolution")
        dim = data[0]["payload"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "1")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("1" in dim["lag-members"])
        self.assertTrue("2" in dim["lag-members"])
        self.assertTrue("3" in dim["lag-members"])
        self.assertTrue("4" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "4")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "8")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("47" in dim["fabric-trunk-members"])
        self.assertTrue("48" in dim["fabric-trunk-members"])
        self.assertTrue("49" in dim["fabric-trunk-members"])

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("payload" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_lag_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[1]["name"], "broadview.pt.packet-trace-lag-resolution")
        dim = data[1]["payload"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "2")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("5" in dim["lag-members"])
        self.assertTrue("6" in dim["lag-members"])
        self.assertTrue("7" in dim["lag-members"])
        self.assertTrue("8" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "7")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "9")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("57" in dim["fabric-trunk-members"])
        self.assertTrue("58" in dim["fabric-trunk-members"])
        self.assertTrue("59" in dim["fabric-trunk-members"])
 def test_packet_trace_drop_counter_report(self):
     rep = PTParser()
     rep.process(self.packet_trace_drop_counter_report_1)
     serializer = PTToMonasca()
     ret = serializer.serialize(self._host, rep)
     self.assertEqual(ret[0], True)
     data = json.loads(ret[1])
     self.assertTrue(len(data) == 18)
     i = 0
     for x in data:
         self.assertTrue("timestamp" in x)
         self.assertTrue("name" in x)
         self.assertTrue("dimensions" in x)
         self.assertEqual(x["name"], "broadview.pt.packet-trace-drop-counter-report")
         dim = x["dimensions"]
         if i == 0:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 10) 
         elif i == 1:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 2:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 3:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 4:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 50) 
         elif i == 5:
             self.assertEqual(dim["realm"], "vlan-xlate-miss-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 60) 
         elif i == 6:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 70) 
         elif i == 7:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 8:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 9:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 10:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 80) 
         elif i == 11:
             self.assertEqual(dim["realm"], "bpdu-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 90) 
         elif i == 12:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "1")
             self.assertEqual(x["value"], 10) 
         elif i == 13:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "5")
             self.assertEqual(x["value"], 20) 
         elif i == 14:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "6")
             self.assertEqual(x["value"], 30) 
         elif i == 15:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "10")
             self.assertEqual(x["value"], 40) 
         elif i == 16:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "11")
             self.assertEqual(x["value"], 50) 
         elif i == 17:
             self.assertEqual(dim["realm"], "trill-slowpath-drop")
             self.assertEqual(dim["port"], "12")
             self.assertEqual(x["value"], 60) 
         i = i + 1
    def test_packet_trace_ecmp_resolution_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_ecmp_resolution_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 4)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("dimensions" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-ecmp-resolution")
        dim = data[0]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "100005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "1.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "11")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.2.2.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100004")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "18")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.6.6.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100005")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "11")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "100256")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("dimensions" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[1]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "200001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "2.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "21")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "200100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[2])
        timestamp = int(data[2]["timestamp"]) / 1000
        self.assertTrue("name" in data[2])
        self.assertTrue("dimensions" in data[2])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[2]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "300005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "3.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "31")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "3.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "300001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "38")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "3.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "300002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "31")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "300100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")

        self.assertTrue("timestamp" in data[3])
        timestamp = int(data[3]["timestamp"]) / 1000
        self.assertTrue("name" in data[3])
        self.assertTrue("dimensions" in data[3])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_ecmp_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        dim = data[3]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "400001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "4.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "41")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "4.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "400001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "48")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "4.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "400002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "41")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "400100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")
    def test_packet_trace_lag_resolution_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_lag_resolution_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 2)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("dimensions" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_lag_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-lag-resolution")
        dim = data[0]["dimensions"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "1")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("1" in dim["lag-members"])
        self.assertTrue("2" in dim["lag-members"])
        self.assertTrue("3" in dim["lag-members"])
        self.assertTrue("4" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "4")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "8")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("47" in dim["fabric-trunk-members"])
        self.assertTrue("48" in dim["fabric-trunk-members"])
        self.assertTrue("49" in dim["fabric-trunk-members"])

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("dimensions" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_lag_resolution_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[1]["name"], "broadview.pt.packet-trace-lag-resolution")
        dim = data[1]["dimensions"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "2")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("5" in dim["lag-members"])
        self.assertTrue("6" in dim["lag-members"])
        self.assertTrue("7" in dim["lag-members"])
        self.assertTrue("8" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "2")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "7")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "9")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("57" in dim["fabric-trunk-members"])
        self.assertTrue("58" in dim["fabric-trunk-members"])
        self.assertTrue("59" in dim["fabric-trunk-members"])
    def test_packet_trace_profile_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_profile_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 6)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("dimensions" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-profile")
        dim = data[0]["dimensions"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"],
                         self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "lag-link-resolution")
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "2")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("1" in dim["lag-members"])
        self.assertTrue("2" in dim["lag-members"])
        self.assertTrue("3" in dim["lag-members"])
        self.assertTrue("4" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "4")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "6")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("27" in dim["fabric-trunk-members"])
        self.assertTrue("28" in dim["fabric-trunk-members"])
        self.assertTrue("29" in dim["fabric-trunk-members"])

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("dimensions" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[1]["name"], "broadview.pt.packet-trace-profile")
        dim = data[1]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"],
                         self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "ecmp-link-resolution")
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "100005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "1.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "11")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.2.2.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100004")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "18")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.6.6.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100005")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "11")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "100256")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[2])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[2])
        self.assertTrue("dimensions" in data[2])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[2]["name"], "broadview.pt.packet-trace-profile")
        dim = data[2]["dimensions"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"],
                         self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "ecmp-link-resolution")
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "200001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "2.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "21")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "200100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")
Esempio n. 17
0
    def test_packet_trace_profile_1(self):
        rep = PTParser()
        rep.process(self.packet_trace_profile_1)
        serializer = PTToMonasca()
        ret = serializer.serialize(self._host, rep)
        self.assertEqual(ret[0], True)
        data = json.loads(ret[1])
        self.assertTrue(len(data) == 6)

        self.assertTrue("timestamp" in data[0])
        timestamp = int(data[0]["timestamp"]) / 1000
        self.assertTrue("name" in data[0])
        self.assertTrue("payload" in data[0])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[0]["name"], "broadview.pt.packet-trace-profile")
        dim = data[0]["payload"]
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "lag-link-resolution")
        self.assertTrue("lag-id" in dim)
        self.assertEqual(dim["lag-id"], "2")
        self.assertTrue("lag-members" in dim)
        self.assertEqual(len(dim["lag-members"]), 4)
        self.assertTrue("1" in dim["lag-members"])
        self.assertTrue("2" in dim["lag-members"])
        self.assertTrue("3" in dim["lag-members"])
        self.assertTrue("4" in dim["lag-members"])
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")
        self.assertTrue("dst-lag-member" in dim)
        self.assertEqual(dim["dst-lag-member"], "4")
        self.assertTrue("fabric-trunk-id" in dim)
        self.assertEqual(dim["fabric-trunk-id"], "6")
        self.assertTrue("fabric-trunk-members" in dim)
        self.assertEqual(len(dim["fabric-trunk-members"]), 3)
        self.assertTrue("27" in dim["fabric-trunk-members"])
        self.assertTrue("28" in dim["fabric-trunk-members"])
        self.assertTrue("29" in dim["fabric-trunk-members"])

        self.assertTrue("timestamp" in data[1])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[1])
        self.assertTrue("payload" in data[1])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[1]["name"], "broadview.pt.packet-trace-profile")
        dim = data[1]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "ecmp-link-resolution")
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "100005")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "1.6.6.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "11")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.2.2.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100004")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "18")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "1.6.6.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "100005")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "11")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "100256")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")

        self.assertTrue("timestamp" in data[2])
        timestamp = int(data[1]["timestamp"]) / 1000
        self.assertTrue("name" in data[2])
        self.assertTrue("payload" in data[2])
        t1 = datetime.datetime.fromtimestamp(timestamp)
        t1 = t1.strftime("%Y-%m-%d - %H:%M:%S")
        t2 = self.packet_trace_profile_1["time-stamp"].strip()
        self.assertEqual(t1, t2)
        self.assertEqual(data[2]["name"], "broadview.pt.packet-trace-profile")
        dim = data[2]["payload"]
        self.assertTrue("asic-id" in dim)
        self.assertEqual(dim["asic-id"], self.packet_trace_profile_1["asic-id"])
        self.assertTrue("realm" in dim)
        self.assertEqual(dim["realm"], "ecmp-link-resolution")
        self.assertTrue("ecmp-dst-member" in dim)
        self.assertEqual(dim["ecmp-dst-member"], "200001")
        self.assertTrue("bv-agent" in dim)
        self.assertTrue("ecmp-next-hop-ip" in dim)
        self.assertEqual(dim["ecmp-next-hop-ip"], "2.3.3.2")
        self.assertTrue("ecmp-dst-port" in dim)
        self.assertEqual(dim["ecmp-dst-port"], "21")
        self.assertTrue("ecmp-members" in dim)
        self.assertEqual(len(dim["ecmp-members"]), 2)
        mem = dim["ecmp-members"][0]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.3.3.1")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200001")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        mem = dim["ecmp-members"][1]
        self.assertTrue("ip" in mem)
        self.assertEqual(mem["ip"], "2.7.7.2")
        self.assertTrue("id" in mem)
        self.assertEqual(mem["id"], "200002")
        self.assertTrue("port" in mem)
        self.assertEqual(mem["port"], "21")
        self.assertTrue("ecmp-group-id" in dim)
        self.assertEqual(dim["ecmp-group-id"], "200100")
        self.assertTrue("port" in dim)
        self.assertEqual(dim["port"], "1")