From 5b9c0172ad7e3dabb5d462de6ed50698353a95e0 Mon Sep 17 00:00:00 2001 From: Volodymyr Samotiy Date: Wed, 17 Aug 2016 15:21:34 +0300 Subject: [PATCH] Add support for fabric-trunk data in LAG resolution reports Change-Id: If13b3d5fa15e60f14758fdabea5db52bef12df2d --- .../serializers/pt_to_monasca.py | 41 +++++++++++++++++-- .../tools/pt/pt_lag_resolution.py | 8 +++- broadview_collector/tools/pt/pt_profile.py | 8 +++- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/broadview_collector/serializers/pt_to_monasca.py b/broadview_collector/serializers/pt_to_monasca.py index f984389..d27ac3b 100644 --- a/broadview_collector/serializers/pt_to_monasca.py +++ b/broadview_collector/serializers/pt_to_monasca.py @@ -61,6 +61,8 @@ class PTToMonasca(BroadViewSerializerBase): m["dimensions"]["lag-id"] = r.getLAGID() m["dimensions"]["dst-lag-member"] = r.getDstLAGMember() m["dimensions"]["lag-members"] = r.getLAGMembers() + m["dimensions"]["fabric-trunk-members"] = r.getFabricTrunkMembers() + m["dimensions"]["fabric-trunk-id"] = r.getFabricTrunkID() m["dimensions"]["ignore-value"] = 1 ret.append(m) else: @@ -128,6 +130,8 @@ class PTToMonasca(BroadViewSerializerBase): m["dimensions"]["lag-id"] = ll.getLAGID() m["dimensions"]["dst-lag-member"] = ll.getDstLAGMember() m["dimensions"]["lag-members"] = ll.getLAGMembers() + m["dimensions"]["fabric-trunk-members"] = ll.getFabricTrunkMembers() + m["dimensions"]["fabric-trunk-id"] = ll.getFabricTrunkID() m["dimensions"]["ignore-value"] = 1 m["value"] = 0 ret.append(m) @@ -212,7 +216,9 @@ class TestSerializer(unittest.TestCase): "data": { "lag-id": "2", "lag-members": ["1", "2", "3", "4"], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], } }, { @@ -245,7 +251,9 @@ class TestSerializer(unittest.TestCase): "data": { "lag-id": "2", "lag-members": ["5", "6", "7", "8"], - "dst-lag-member": "5" + "dst-lag-member": "5", + "fabric-trunk-id": "7", + "fabric-trunk-members": ["37", "38", "39"], } }, { @@ -290,7 +298,9 @@ class TestSerializer(unittest.TestCase): "3", "4" ], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "8", + "fabric-trunk-members": ["47", "48", "49"], } }, { @@ -303,7 +313,9 @@ class TestSerializer(unittest.TestCase): "7", "8" ], - "dst-lag-member": "7" + "dst-lag-member": "7", + "fabric-trunk-id": "9", + "fabric-trunk-members": ["57", "58", "59"], } } ], @@ -539,6 +551,13 @@ class TestSerializer(unittest.TestCase): 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 @@ -658,6 +677,13 @@ class TestSerializer(unittest.TestCase): 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 @@ -684,6 +710,13 @@ class TestSerializer(unittest.TestCase): 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_ecmp_resolution_1(self): rep = PTParser() diff --git a/broadview_collector/tools/pt/pt_lag_resolution.py b/broadview_collector/tools/pt/pt_lag_resolution.py index 7a2d698..3178b2c 100644 --- a/broadview_collector/tools/pt/pt_lag_resolution.py +++ b/broadview_collector/tools/pt/pt_lag_resolution.py @@ -43,7 +43,9 @@ class PTLAGResolution(PTSim): "3", "4" ], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], } }, { @@ -56,7 +58,9 @@ class PTLAGResolution(PTSim): "7", "8" ], - "dst-lag-member": "7" + "dst-lag-member": "7", + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], } } ], diff --git a/broadview_collector/tools/pt/pt_profile.py b/broadview_collector/tools/pt/pt_profile.py index f9cf973..b578038 100644 --- a/broadview_collector/tools/pt/pt_profile.py +++ b/broadview_collector/tools/pt/pt_profile.py @@ -41,7 +41,9 @@ class PTProfile(PTSim): "data": { "lag-id": "2", "lag-members": ["1", "2", "3", "4"], - "dst-lag-member": "4" + "dst-lag-member": "4", + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], } }, { @@ -74,7 +76,9 @@ class PTProfile(PTSim): "data": { "lag-id": "3", "lag-members": ["5","6","7","8"], - "dst-lag-member": "6" + "dst-lag-member": "6", + "fabric-trunk-id": "6", + "fabric-trunk-members": ["27", "28", "29"], } }, {