Fix UDPReplay VNF statistic parsing 69/66569/2
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Tue, 22 Jan 2019 15:31:07 +0000 (15:31 +0000)
committerStepan Andrushko <stepanx.andrushko@intel.com>
Fri, 5 Apr 2019 12:51:07 +0000 (15:51 +0300)
Fixed UDPReplay statistic parsing according to changes made in
UDPReplay sample VNF.

JIRA: YARDSTICK-1609

Change-Id: I093f6612cc736695fa96f15dce374c949d8c3459
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
yardstick/network_services/vnf_generic/vnf/udp_replay.py
yardstick/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py

index 3f99944..a3b0b9f 100644 (file)
@@ -109,7 +109,7 @@ class UdpReplayApproxVnf(SampleVNF):
 
     def collect_kpi(self):
         def get_sum(offset):
-            return sum(int(i) for i in split_stats[offset::5])
+            return sum(int(i) for i in split_stats[offset::6])
         # we can't get KPIs if the VNF is down
         check_if_process_failed(self._vnf_process)
 
@@ -117,7 +117,7 @@ class UdpReplayApproxVnf(SampleVNF):
 
         stats = self.get_stats()
         stats_words = stats.split()
-        split_stats = stats_words[stats_words.index('0'):][:number_of_ports * 5]
+        split_stats = stats_words[stats_words.index('arp_pkts') + 1:][:number_of_ports * 6]
 
         physical_node = ctx_base.Context.get_physical_node_from_server(
             self.scenario_helper.nodes[self.name])
index cbb4ee9..aabd402 100644 (file)
@@ -329,9 +329,9 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
         vnfd = self.VNFD_0
         get_stats_ret_val = \
             "stats\r\r\n\r\nUDP_Replay stats:\r\n--------------\r\n" \
-            "Port\t\tRx Packet\t\tTx Packet\t\tRx Pkt Drop\t\tTx Pkt Drop \r\n"\
-            "0\t\t7374156\t\t7374136\t\t\t0\t\t\t0\r\n" \
-            "1\t\t7374316\t\t7374315\t\t\t0\t\t\t0\r\n\r\nReplay>\r\r\nReplay>"
+            "Port\t\tRx Packet\t\tTx Packet\t\tRx Pkt Drop\t\tTx Pkt Drop\t\tarp_pkts \r\n"\
+            "0\t\t7374156\t\t7374136\t\t\t0\t\t\t0\t\t\t0\r\n" \
+            "1\t\t7374316\t\t7374315\t\t\t0\t\t\t0\t\t\t0\r\n\r\nReplay>\r\r\nReplay>"
         udp_replay_approx_vnf = UdpReplayApproxVnf(NAME, vnfd)
         udp_replay_approx_vnf.scenario_helper.scenario_cfg = {
             'nodes': {udp_replay_approx_vnf.name: "mock"}