diff options
author | MatthewLi <matthew.lijun@huawei.com> | 2016-09-12 06:53:54 -0400 |
---|---|---|
committer | MatthewLi <matthew.lijun@huawei.com> | 2016-09-13 06:12:39 -0400 |
commit | 212a60535c5a84efcf236110caa0aa83499aefe2 (patch) | |
tree | 1e3868965d0a4441111f2be9a0ae1b4d9205beee | |
parent | 83fc1c299e38ecc303aeeca5116871a57fef69da (diff) |
add ping6 parameters
JIRA: YARDSTICK-315
1) make packetsize workable
2) add ping_count parameter
Change-Id: Ice2235fc5744b94df6a3f981c23159ca8280d876
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
-rw-r--r-- | samples/ping6.yaml | 1 | ||||
-rw-r--r-- | tests/unit/benchmark/scenarios/networking/test_ping6.py | 10 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping6.py | 12 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/ping6_benchmark.bash | 3 |
4 files changed, 19 insertions, 7 deletions
diff --git a/samples/ping6.yaml b/samples/ping6.yaml index 6f2c93d05..2fb99dfb4 100644 --- a/samples/ping6.yaml +++ b/samples/ping6.yaml @@ -8,6 +8,7 @@ scenarios: type: Ping6 options: packetsize: 200 + ping_count: 5 host: host1,host2,host3,host4,host5 nodes: host1: node1.IPV6 diff --git a/tests/unit/benchmark/scenarios/networking/test_ping6.py b/tests/unit/benchmark/scenarios/networking/test_ping6.py index b600e4103..995113e28 100644 --- a/tests/unit/benchmark/scenarios/networking/test_ping6.py +++ b/tests/unit/benchmark/scenarios/networking/test_ping6.py @@ -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 = {} diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py index e68756462..dc896b2c6 100644 --- a/yardstick/benchmark/scenarios/networking/ping6.py +++ b/yardstick/benchmark/scenarios/networking/ping6.py @@ -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) diff --git a/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash b/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash index 16cb0f07e..9a08b098a 100644 --- a/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash +++ b/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash @@ -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}'" |