add ping6 parameters 95/20895/2
authorMatthewLi <matthew.lijun@huawei.com>
Mon, 12 Sep 2016 10:53:54 +0000 (06:53 -0400)
committerMatthewLi <matthew.lijun@huawei.com>
Tue, 13 Sep 2016 10:12:39 +0000 (06:12 -0400)
JIRA: YARDSTICK-315

1) make packetsize workable
2) add ping_count parameter

Change-Id: Ice2235fc5744b94df6a3f981c23159ca8280d876
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
samples/ping6.yaml
tests/unit/benchmark/scenarios/networking/test_ping6.py
yardstick/benchmark/scenarios/networking/ping6.py
yardstick/benchmark/scenarios/networking/ping6_benchmark.bash

index 6f2c93d..2fb99df 100644 (file)
@@ -8,6 +8,7 @@ scenarios:
   type: Ping6
   options:
     packetsize: 200
+    ping_count: 5
     host: host1,host2,host3,host4,host5
   nodes:
     host1: node1.IPV6
index b600e41..995113e 100644 (file)
@@ -34,7 +34,7 @@ class PingTestCase(unittest.TestCase):
     @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
     def test_ping_successful_setup(self, mock_ssh):
         args = {
-            'options': {'host': 'host1','packetsize': 200},
+            'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
             'sla': {'max_rtt': 50}
         }
         p = ping6.Ping6(args, self.ctx)
@@ -46,7 +46,7 @@ class PingTestCase(unittest.TestCase):
     @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
     def test_ping_successful_no_sla(self, mock_ssh):
         args = {
-            'options': {'host': 'host1','packetsize': 200},
+            'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
 
         }
         result = {}
@@ -61,7 +61,7 @@ class PingTestCase(unittest.TestCase):
     def test_ping_successful_sla(self, mock_ssh):
 
         args = {
-            'options': {'host': 'host1','packetsize': 200},
+            'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
             'sla': {'max_rtt': 150}
         }
         result = {}
@@ -76,7 +76,7 @@ class PingTestCase(unittest.TestCase):
     def test_ping_unsuccessful_sla(self, mock_ssh):
 
         args = {
-            'options': {'host': 'host1','packetsize': 200},
+            'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
             'sla': {'max_rtt': 50}
         }
         result = {}
@@ -90,7 +90,7 @@ class PingTestCase(unittest.TestCase):
     def test_ping_unsuccessful_script_error(self, mock_ssh):
 
         args = {
-            'options': {'host': 'host1','packetsize': 200},
+            'options': {'host': 'host1','packetsize': 200, 'ping_count': 5},
             'sla': {'max_rtt': 150}
         }
         result = {}
index e687564..dc896b2 100644 (file)
@@ -39,6 +39,7 @@ class Ping6(base.Scenario):  # pragma: no cover
         self.context_cfg = context_cfg
         self.setup_done = False
         self.run_done = False
+        self.ping_options = ''
 
     def _pre_setup(self):
         for node_name in self.host_list:
@@ -83,6 +84,10 @@ class Ping6(base.Scenario):  # pragma: no cover
             Ping6.RADVD_SCRIPT)
 
         options = self.scenario_cfg['options']
+        self.ping_options = "-s %s" % \
+            options.get("packetsize", '56') + \
+            "-c %s" % \
+            options.get("ping_count", '5')
         host_str = options.get("host", 'host1')
         self.host_list = host_str.split(',')
         self.host_list.sort()
@@ -126,6 +131,10 @@ class Ping6(base.Scenario):  # pragma: no cover
 
         if not self.setup_done:
             options = self.scenario_cfg['options']
+            self.ping_options = "-s %s" % \
+                options.get("packetsize", '56') + \
+                "-c %s" % \
+                options.get("ping_count", '5')
             host_str = options.get("host", 'host1')
             self.host_list = host_str.split(',')
             self.host_list.sort()
@@ -149,7 +158,8 @@ class Ping6(base.Scenario):  # pragma: no cover
         # run ping6 benchmark
         self.client.run("cat > ~/ping6.sh",
                         stdin=open(self.ping6_script, "rb"))
-        cmd = "sudo bash ping6.sh"
+        cmd_args = "%s" % (self.ping_options)
+        cmd = "sudo bash ping6.sh %s" % (cmd_args)
         LOG.debug("Executing command: %s", cmd)
         status, stdout, stderr = self.client.execute(cmd)
 
index 16cb0f0..9a08b09 100644 (file)
@@ -11,6 +11,7 @@
 
 # Run a single ping6 command towards a ipv6 router
 set -e
+ping6_options=$1
 source /opt/admin-openrc.sh
 chmod 600 vRouterKey
 # TODO find host
@@ -29,4 +30,4 @@ wait_vm_ok() {
 }
 wait_vm_ok
 sleep 360
-sudo ip netns exec qdhcp-$(neutron net-list | grep -w ipv4-int-network1 | awk '{print $2}') ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i vRouterKey fedora@20.0.0.4 "ping6 -c 1 2001:db8:0:1::1 | grep ttl | awk -F [=\ ] '{printf \$10}'"
\ No newline at end of file
+sudo ip netns exec qdhcp-$(neutron net-list | grep -w ipv4-int-network1 | awk '{print $2}') ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i vRouterKey fedora@20.0.0.4 "ping6 $ping6_options 2001:db8:0:1::1 | grep rtt | awk -F [\/\ ] '{printf \$8}'"