support for ipv6 27/5727/3
authorkubi <jean.gaoliang@huawei.com>
Thu, 31 Dec 2015 06:38:49 +0000 (14:38 +0800)
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>
Fri, 8 Jan 2016 13:53:55 +0000 (13:53 +0000)
JIRA:YARDSTICK-187

Change-Id: I1cecd400b4449a09d22d43f4a42e889f00dd4fe7
Signed-off-by: kubi <jean.gaoliang@huawei.com>
etc/yardstick/nodes/compass_sclab_physical/pod.yaml [new file with mode: 0644]
samples/ping6.yaml [new file with mode: 0644]
setup.py
tests/unit/benchmark/scenarios/networking/test_ping6.py [new file with mode: 0644]
yardstick/benchmark/contexts/node.py
yardstick/benchmark/runners/iteration.py [changed mode: 0755->0644]
yardstick/benchmark/scenarios/networking/ping6.py [new file with mode: 0644]
yardstick/benchmark/scenarios/networking/ping6_benchmark.bash [new file with mode: 0644]
yardstick/benchmark/scenarios/networking/ping6_metadata.txt [new file with mode: 0644]
yardstick/benchmark/scenarios/networking/ping6_setup.bash [new file with mode: 0644]
yardstick/benchmark/scenarios/networking/ping6_teardown.bash [new file with mode: 0644]

diff --git a/etc/yardstick/nodes/compass_sclab_physical/pod.yaml b/etc/yardstick/nodes/compass_sclab_physical/pod.yaml
new file mode 100644 (file)
index 0000000..e062988
--- /dev/null
@@ -0,0 +1,42 @@
+---
+# sample config file about the POD information, including the
+# name/IP/user/ssh key of Bare Metal and Controllers/Computes
+#
+# The options of this config file include:
+# name: the name of this node
+# role: node's role, support role: Master/Controller/Comupte/BareMetal
+# ip: the node's IP address
+# user: the username for login
+# key_filename:the path of the private key file for login
+
+nodes:
+-
+    name: node1
+    role: Controller
+    ip: 10.1.0.50
+    user: root
+    password: root
+-
+    name: node2
+    role: Controller
+    ip: 10.1.0.51
+    user: root
+    password: root
+-
+    name: node3
+    role: Controller
+    ip: 10.1.0.52
+    user: root
+    password: root
+-
+    name: node4
+    role: Compute
+    ip: 10.1.0.53
+    user: root
+    password: root
+-
+    name: node5
+    role: Compute
+    ip: 10.1.0.54
+    user: root
+    password: root
diff --git a/samples/ping6.yaml b/samples/ping6.yaml
new file mode 100644 (file)
index 0000000..22b8bb9
--- /dev/null
@@ -0,0 +1,28 @@
+---
+# Sample test case for ipv6
+
+schema: "yardstick:task:0.1"
+
+scenarios:
+-
+  type: Ping6
+  options:
+    packetsize: 200
+  host: node1.IPV6
+
+  runner:
+    type: Iteration
+    iterations: 1
+    interval: 1
+    run_step: 'setup,run,teardown'
+  sla:
+    max_rtt: 10
+    action: monitor
+
+
+context:
+  type: Node
+  name: IPV6
+  file: /root/yardstick/etc/yardstick/nodes/compass_sclab_physical/pod.yaml
+
+
index 654ea0f..872760a 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,7 @@ setup(
             'benchmark/scenarios/availability/attacker/scripts/*.bash',
             'benchmark/scenarios/compute/*.bash',
             'benchmark/scenarios/networking/*.bash',
+            'benchmark/scenarios/networking/*.txt',
             'benchmark/scenarios/storage/*.bash',
             'resources/files/*'
         ]
diff --git a/tests/unit/benchmark/scenarios/networking/test_ping6.py b/tests/unit/benchmark/scenarios/networking/test_ping6.py
new file mode 100644 (file)
index 0000000..662b85c
--- /dev/null
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2015 Ericsson AB 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
+##############################################################################
+
+# Unittest for yardstick.benchmark.scenarios.networking.ping.Ping
+
+import mock
+import unittest
+
+from yardstick.benchmark.scenarios.networking import ping6
+
+
+class PingTestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.ctx = {
+            'host': {
+                'ip': '172.16.0.137',
+                'user': 'cirros',
+                'key_filename': "mykey.key",
+                'password': "root"
+            },
+        }
+
+    @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
+    def test_pktgen_successful_setup(self, mock_ssh):
+
+        p = ping6.Ping6({}, self.ctx)
+        mock_ssh.SSH().execute.return_value = (0, '0', '')
+        p.setup()
+
+        self.assertEqual(p.setup_done, True)
+
+    @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
+    def test_ping_successful_no_sla(self, mock_ssh):
+
+        result = {}
+
+        p = ping6.Ping6({}, self.ctx)
+        p.client = mock_ssh.SSH()
+        mock_ssh.SSH().execute.return_value = (0, '100', '')
+        p.run(result)
+        self.assertEqual(result, {'rtt': 100.0})
+
+    @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
+    def test_ping_successful_sla(self, mock_ssh):
+
+        args = {
+            'sla': {'max_rtt': 150}
+            }
+        result = {}
+
+        p = ping6.Ping6(args, self.ctx)
+        p.client = mock_ssh.SSH()
+        mock_ssh.SSH().execute.return_value = (0, '100', '')
+        p.run(result)
+        self.assertEqual(result, {'rtt': 100.0})
+
+    @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
+    def test_ping_unsuccessful_sla(self, mock_ssh):
+
+        args = {
+            'options': {'packetsize': 200},
+            'sla': {'max_rtt': 50}
+        }
+        result = {}
+
+        p = ping6.Ping6(args, self.ctx)
+        p.client = mock_ssh.SSH()
+        mock_ssh.SSH().execute.return_value = (0, '100', '')
+        self.assertRaises(AssertionError, p.run, result)
+
+    @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh')
+    def test_ping_unsuccessful_script_error(self, mock_ssh):
+
+        args = {
+            'options': {'packetsize': 200},
+            'sla': {'max_rtt': 50}
+        }
+        result = {}
+
+        p = ping6.Ping6(args, self.ctx)
+        p.client = mock_ssh.SSH()
+        mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
+        self.assertRaises(RuntimeError, p.run, result)
+
+
+def main():
+    unittest.main()
+
+if __name__ == '__main__':
+    main()
index 04c8e7c..54ee076 100644 (file)
@@ -83,12 +83,5 @@ class NodeContext(Context):
             sys.exit(-1)
 
         node = nodes[0]
-
-        server = {
-            "name": attr_name,
-            "ip": node["ip"],
-            "user": node["user"],
-            "key_filename": node["key_filename"]
-        }
-
-        return server
+        node["name"] = attr_name
+        return node
old mode 100755 (executable)
new mode 100644 (file)
index e38ed37..c24957b
@@ -30,12 +30,15 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
 
     interval = runner_cfg.get("interval", 1)
     iterations = runner_cfg.get("iterations", 1)
+    run_step = runner_cfg.get("run_step", "setup,run,teardown")
     LOG.info("worker START, iterations %d times, class %s", iterations, cls)
 
     runner_cfg['runner_id'] = os.getpid()
 
     benchmark = cls(scenario_cfg, context_cfg)
-    benchmark.setup()
+    if "setup" in run_step:
+        benchmark.setup()
+
     method = getattr(benchmark, method_name)
 
     queue.put({'runner_id': runner_cfg['runner_id'],
@@ -45,53 +48,55 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
     sla_action = None
     if "sla" in scenario_cfg:
         sla_action = scenario_cfg["sla"].get("action", "assert")
-
-    while True:
-
-        LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
-                  {"runner": runner_cfg["runner_id"], "sequence": sequence})
-
-        data = {}
-        errors = ""
-
-        try:
-            method(data)
-        except AssertionError as assertion:
-            # SLA validation failed in scenario, determine what to do now
-            if sla_action == "assert":
-                raise
-            elif sla_action == "monitor":
-                LOG.warning("SLA validation failed: %s" % assertion.args)
-                errors = assertion.args
-        except Exception as e:
-            errors = traceback.format_exc()
-            LOG.exception(e)
-
-        time.sleep(interval)
-
-        benchmark_output = {
-            'timestamp': time.time(),
-            'sequence': sequence,
-            'data': data,
-            'errors': errors
-        }
-
-        record = {'runner_id': runner_cfg['runner_id'],
-                  'benchmark': benchmark_output}
-
-        queue.put(record)
-
-        LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
-                  {"runner": runner_cfg["runner_id"], "sequence": sequence})
-
-        sequence += 1
-
-        if (errors and sla_action is None) or \
-                (sequence > iterations or aborted.is_set()):
-            LOG.info("worker END")
-            break
-
-    benchmark.teardown()
+    if "run" in run_step:
+        while True:
+
+            LOG.debug("runner=%(runner)s seq=%(sequence)s START" %
+                      {"runner": runner_cfg["runner_id"],
+                       "sequence": sequence})
+
+            data = {}
+            errors = ""
+
+            try:
+                method(data)
+            except AssertionError as assertion:
+                # SLA validation failed in scenario, determine what to do now
+                if sla_action == "assert":
+                    raise
+                elif sla_action == "monitor":
+                    LOG.warning("SLA validation failed: %s" % assertion.args)
+                    errors = assertion.args
+            except Exception as e:
+                errors = traceback.format_exc()
+                LOG.exception(e)
+
+            time.sleep(interval)
+
+            benchmark_output = {
+                'timestamp': time.time(),
+                'sequence': sequence,
+                'data': data,
+                'errors': errors
+            }
+
+            record = {'runner_id': runner_cfg['runner_id'],
+                      'benchmark': benchmark_output}
+
+            queue.put(record)
+
+            LOG.debug("runner=%(runner)s seq=%(sequence)s END" %
+                      {"runner": runner_cfg["runner_id"],
+                       "sequence": sequence})
+
+            sequence += 1
+
+            if (errors and sla_action is None) or \
+                    (sequence > iterations or aborted.is_set()):
+                LOG.info("worker END")
+                break
+    if "teardown" in run_step:
+        benchmark.teardown()
 
 
 class IterationRunner(base.Runner):
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
new file mode 100644 (file)
index 0000000..629f62b
--- /dev/null
@@ -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 (file)
index 0000000..6df354a
--- /dev/null
@@ -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 (file)
index 0000000..5dc08d3
--- /dev/null
@@ -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 (file)
index 0000000..2a54da2
--- /dev/null
@@ -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 (file)
index 0000000..7ab1455
--- /dev/null
@@ -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