aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios
diff options
context:
space:
mode:
authorkubi <jean.gaoliang@huawei.com>2015-12-31 14:38:49 +0800
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>2016-01-08 13:53:55 +0000
commitcd80b44f3fd9b8c9e2afc51bc67d7a5cf34fb1c6 (patch)
treed5767deff3e8808fdd91313d0455ae353fa08999 /yardstick/benchmark/scenarios
parente2027b26582a839dc5c25a54fc5621695b9026c0 (diff)
support for ipv6
JIRA:YARDSTICK-187 Change-Id: I1cecd400b4449a09d22d43f4a42e889f00dd4fe7 Signed-off-by: kubi <jean.gaoliang@huawei.com>
Diffstat (limited to 'yardstick/benchmark/scenarios')
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6.py119
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6_benchmark.bash20
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6_metadata.txt82
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6_setup.bash84
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6_teardown.bash58
5 files changed, 363 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
new file mode 100644
index 000000000..629f62be5
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping6.py
@@ -0,0 +1,119 @@
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import pkg_resources
+import logging
+
+import yardstick.ssh as ssh
+from yardstick.benchmark.scenarios import base
+
+LOG = logging.getLogger(__name__)
+
+
+class Ping6(base.Scenario): # pragma: no cover
+ """Execute ping6 between two hosts
+
+ read link below for more ipv6 info description:
+ http://wiki.opnfv.org/ipv6_opnfv_project
+ """
+ __scenario_type__ = "Ping6"
+
+ TARGET_SCRIPT = 'ping6_benchmark.bash'
+ SETUP_SCRIPT = 'ping6_setup.bash'
+ TEARDOWN_SCRIPT = 'ping6_teardown.bash'
+ METADATA_SCRIPT = 'ping6_metadata.txt'
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.setup_done = False
+ self.run_done = False
+
+ def _ssh_host(self):
+ # ssh host1
+ host = self.context_cfg['host']
+ host_user = host.get('user', 'ubuntu')
+ host_ip = host.get('ip', None)
+ host_pwd = host.get('password', 'root')
+ LOG.info("user:%s, host:%s", host_user, host_ip)
+ self.client = ssh.SSH(host_user, host_ip, password=host_pwd)
+ self.client.wait(timeout=600)
+
+ def setup(self):
+ '''scenario setup'''
+ self.setup_script = pkg_resources.resource_filename(
+ 'yardstick.benchmark.scenarios.networking',
+ Ping6.SETUP_SCRIPT)
+
+ self.ping6_metadata_script = pkg_resources.resource_filename(
+ 'yardstick.benchmark.scenarios.networking',
+ Ping6.METADATA_SCRIPT)
+ # ssh host1
+ self._ssh_host()
+ # run script to setup ipv6
+ self.client.run("cat > ~/setup.sh",
+ stdin=open(self.setup_script, "rb"))
+ self.client.run("cat > ~/metadata.txt",
+ stdin=open(self.ping6_metadata_script, "rb"))
+ cmd = "sudo bash setup.sh"
+ status, stdout, stderr = self.client.execute(cmd)
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the benchmark"""
+ # ssh vm1
+ self.ping6_script = pkg_resources.resource_filename(
+ 'yardstick.benchmark.scenarios.networking',
+ Ping6.TARGET_SCRIPT)
+
+ if not self.setup_done:
+ self._ssh_host()
+
+ self.client.run("cat > ~/ping6.sh",
+ stdin=open(self.ping6_script, "rb"))
+ cmd = "sudo bash ping6.sh"
+ LOG.debug("Executing command: %s", cmd)
+ status, stdout, stderr = self.client.execute(cmd)
+ print stdout
+ if status:
+ raise RuntimeError(stderr)
+
+ if stdout:
+ result["rtt"] = float(stdout)
+
+ if "sla" in self.scenario_cfg:
+ sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
+ assert result["rtt"] <= sla_max_rtt, "rtt %f > sla:max_rtt(%f); " % \
+ (result["rtt"], sla_max_rtt)
+ else:
+ LOG.error("ping6 timeout")
+ self.run_done = True
+
+ def teardown(self):
+ """teardown the benchmark"""
+
+ if not self.run_done:
+ self._ssh_host()
+
+ self.teardown_script = pkg_resources.resource_filename(
+ 'yardstick.benchmark.scenarios.networking',
+ Ping6.TEARDOWN_SCRIPT)
+ self.client.run("cat > ~/teardown.sh",
+ stdin=open(self.teardown_script, "rb"))
+ cmd = "sudo bash teardown.sh"
+ status, stdout, stderr = self.client.execute(cmd)
+
+ if status:
+ raise RuntimeError(stderr)
+
+ if stdout:
+ pass
+ else:
+ LOG.error("ping6 teardown failed")
diff --git a/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash b/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash
new file mode 100644
index 000000000..6df354a1b
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping6_benchmark.bash
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Run a single ping6 command towards a ipv6 router
+
+set -e
+
+# TODO find host
+sudo ip netns exec qdhcp-$(neutron net-list | grep -w ipv4-int-network1 | awk '{print $2}') bash
+# TODO find VM ip
+ssh -i vRouterkey fedora@20.0.0.4
+ping6 -c 1 2001:db8:0:1::1 | grep ttl | awk -F [=\ ] '{printf $10}'
diff --git a/yardstick/benchmark/scenarios/networking/ping6_metadata.txt b/yardstick/benchmark/scenarios/networking/ping6_metadata.txt
new file mode 100644
index 000000000..5dc08d30f
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping6_metadata.txt
@@ -0,0 +1,82 @@
+#cloud-config
+bootcmd:
+ - /usr/sbin/ifdown eth0
+ - /usr/sbin/ifup eth0
+ - /usr/sbin/ifdown eth1
+ - ip link set dev eth0 mtu 1300
+ - ip link set dev eth1 mtu 1300
+ - /usr/sbin/ifup eth1
+ - ip link set dev eth0 mtu 1300
+ - ip link set dev eth1 mtu 1300
+ - setenforce 0
+ - /sbin/sysctl -w net.ipv6.conf.all.forwarding=1
+ - /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra=2
+ - /sbin/sysctl -w net.ipv6.conf.eth0.accept_ra_defrtr=1
+ - /sbin/sysctl -w net.ipv6.conf.eth0.router_solicitations=1
+packages:
+ - radvd
+runcmd:
+ - /usr/sbin/ifdown eth1
+ - /usr/sbin/ifup eth1
+ - ip link set dev eth0 mtu 1300
+ - ip link set dev eth1 mtu 1300
+ - /usr/bin/systemctl disable NetworkManager
+ - /usr/bin/systemctl start radvd
+ - echo 'complete' >> /tmp/cloud-config.log
+write_files:
+ - content: |
+ TYPE="Ethernet"
+ BOOTPROTO="dhcp"
+ DEFROUTE="yes"
+ PEERDNS="yes"
+ PEERROUTES="yes"
+ IPV4_FAILURE_FATAL="no"
+ IPV6INIT="yes"
+ IPV6_AUTOCONF="yes"
+ IPV6_DEFROUTE="yes"
+ IPV6_PEERROUTES="yes"
+ IPV6_PEERDNS="yes"
+ IPV6_FAILURE_FATAL="no"
+ NAME="eth0"
+ DEVICE="eth0"
+ ONBOOT="yes"
+ path: /etc/sysconfig/network-scripts/ifcfg-eth0
+ permissions: '0755'
+ owner: root:root
+ - content: |
+ TYPE="Ethernet"
+ BOOTPROTO=static
+ IPV6INIT=yes
+ IPV6ADDR="2001:db8:0:2::1/64"
+ NAME=eth1
+ DEVICE=eth1
+ ONBOOT=yes
+ NM_CONTROLLED=no
+ path: /etc/sysconfig/network-scripts/ifcfg-eth1
+ permissions: '0755'
+ owner: root:root
+ - content: |
+ interface eth1
+ {
+ AdvSendAdvert on;
+ MinRtrAdvInterval 3;
+ MaxRtrAdvInterval 10;
+ AdvHomeAgentFlag off;
+ AdvManagedFlag on;
+ AdvOtherConfigFlag on;
+ prefix 2001:db8:0:2::/64
+ {
+ AdvOnLink on;
+ ### On link tells the host that the default router is on the same "link" as it is
+ AdvAutonomous on;
+ AdvRouterAddr off;
+ };
+ };
+ path: /etc/radvd.conf
+ permissions: '0644'
+ owner: root:root
+ - content: |
+ IPV6FORWARDING=yes
+ path: /etc/sysconfig/network
+ permissions: '0644'
+ owner: root:root \ No newline at end of file
diff --git a/yardstick/benchmark/scenarios/networking/ping6_setup.bash b/yardstick/benchmark/scenarios/networking/ping6_setup.bash
new file mode 100644
index 000000000..2a54da2ba
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping6_setup.bash
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# download and create image
+source /opt/admin-openrc.sh
+wget https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-22-20150521.x86_64.qcow2
+glance image-create --name 'Fedora22' --disk-format qcow2 \
+--container-format bare --file ./Fedora-Cloud-Base-22-20150521.x86_64.qcow2
+
+# create external network
+neutron net-create net04_ext --router:external --provider:physical_network physnet \
+--provider:network_type vlan --provider:segmentation_id 1411
+neutron subnet-create net04_ext 10.145.140.0/24 --name net04_ext__subnet \
+--allocation-pool start=10.145.140.13,end=10.145.140.20 --disable-dhcp --gateway 10.145.140.1
+
+# create router
+neutron router-create ipv4-router
+neutron router-create ipv6-router
+
+
+# create (ipv4,ipv6)router and net and subnet
+neutron net-create --port_security_enabled=False ipv4-int-network1
+neutron net-create --port_security_enabled=False ipv6-int-network2
+
+# Create IPv4 subnet and associate it to ipv4-router
+neutron subnet-create --name ipv4-int-subnet1 \
+--dns-nameserver 8.8.8.8 ipv4-int-network1 20.0.0.0/24
+neutron router-interface-add ipv4-router ipv4-int-subnet1
+
+# Associate the net04_ext to the Neutron routers
+neutron router-gateway-set ipv6-router net04_ext
+neutron router-gateway-set ipv4-router net04_ext
+
+# Create two subnets, one IPv4 subnet ipv4-int-subnet2 and
+# one IPv6 subnet ipv6-int-subnet2 in ipv6-int-network2, and associate both subnets to ipv6-router
+neutron subnet-create --name ipv4-int-subnet2 --dns-nameserver 8.8.8.8 ipv6-int-network2 10.0.0.0/24
+neutron subnet-create --name ipv6-int-subnet2 \
+ --ip-version 6 --ipv6-ra-mode slaac --ipv6-address-mode slaac ipv6-int-network2 2001:db8:0:1::/64
+
+
+neutron router-interface-add ipv6-router ipv4-int-subnet2
+neutron router-interface-add ipv6-router ipv6-int-subnet2
+
+
+# create key
+nova keypair-add vRouterKey > ~/vRouterKey
+
+# Create ports for vRouter
+neutron port-create --name eth0-vRouter --mac-address fa:16:3e:11:11:11 ipv6-int-network2
+neutron port-create --name eth1-vRouter --mac-address fa:16:3e:22:22:22 ipv4-int-network1
+
+# Create ports for VM1 and VM2.
+neutron port-create --name eth0-VM1 --mac-address fa:16:3e:33:33:33 ipv4-int-network1
+neutron port-create --name eth0-VM2 --mac-address fa:16:3e:44:44:44 ipv4-int-network1
+
+# Update ipv6-router with routing information to subnet 2001:db8:0:2::/64
+neutron router-update ipv6-router \
+ --routes type=dict list=true destination=2001:db8:0:2::/64,nexthop=2001:db8:0:1:f816:3eff:fe11:1111
+
+# vRouter boot
+nova boot --image Fedora22 --flavor m1.small \
+--user-data ./metadata.txt \
+--nic port-id=$(neutron port-list | grep -w eth0-vRouter | awk '{print $2}') \
+--nic port-id=$(neutron port-list | grep -w eth1-vRouter | awk '{print $2}') \
+--key-name vRouterKey vRouter
+
+# VM create
+nova boot --image Fedora22 --flavor m1.small \
+--nic port-id=$(neutron port-list | grep -w eth0-VM1 | awk '{print $2}') \
+--key-name vRouterKey VM1
+
+nova boot --image Fedora22 --flavor m1.small \
+--nic port-id=$(neutron port-list | grep -w eth0-VM2 | awk '{print $2}') \
+--key-name vRouterKey VM2
+
+nova list
diff --git a/yardstick/benchmark/scenarios/networking/ping6_teardown.bash b/yardstick/benchmark/scenarios/networking/ping6_teardown.bash
new file mode 100644
index 000000000..7ab145523
--- /dev/null
+++ b/yardstick/benchmark/scenarios/networking/ping6_teardown.bash
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+# delete VM
+nova delete VM1
+nova delete VM2
+nova delete vRouter
+#clear routes
+neutron router-update ipv6-router --routes action=clear
+
+#VM1,VM2 port delete
+neutron port-delete --name eth0-VM1
+neutron port-delete --name eth0-VM2
+
+#vRouter port delete
+neutron port-delete --name eth0-vRouter
+neutron port-delete --name eth1-vRouter
+
+#delete key
+nova keypair-delete vRouterKey
+
+#delete ipv6 router interface
+neutron router-interface-delete ipv6-router ipv6-int-subnet2
+neutron router-interface-delete ipv6-router ipv4-int-subnet2
+
+#delete subnet
+neutron subnet-delete --name ipv6-int-subnet2
+neutron subnet-delete --name ipv4-int-subnet2
+
+#clear gateway
+neutron router-gateway-clear ipv4-router net04_ext
+neutron router-gateway-clear ipv6-router net04_ext
+
+#delete ipv4 router interface
+neutron router-interface-delete ipv4-router ipv4-int-subnet1
+neutron subnet-delete --name ipv4-int-subnet1
+
+#delete network
+neutron net-delete ipv6-int-network2
+neutron net-delete ipv4-int-network1
+
+# delete router
+neutron router-delete ipv4-router
+neutron router-delete ipv6-router
+
+# delete ext net
+neutron subnet-delete net04_ext__subnet
+neutron net-delete net04_ext
+
+# delete glance image
+glance --os-image-api-version 1 image-delete Fedora22 \ No newline at end of file