summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2017-07-03 10:34:53 +0000
committerJing Lu <lvjing5@huawei.com>2017-07-04 09:39:24 +0000
commitffe83c920736716f0caea36dceeff7b7e910db7c (patch)
tree5270c2488280199d9a527106e511f097cd8d0f9a
parent8e2da9dd467f0e0a28bb92097d80d707d579bd4f (diff)
support segmentation_id for vlan provider network
If a network specified in the test case is a vlan provider network, new attribute "segmentation_id" can be used to specify the desired vlan tag in the test case network section: networks: test-net: cidr: '192.168.1.0/24' provider: "vlan" physical_network: 'physnet1' segmentation_id: "1000" If the "segmentation_id" attribute is absent, a random vlan tag will be allocated to the network. Change-Id: Ic53852447a3c1bd8feb9ebd42d35f1ade3684be1 Signed-off-by: JingLu5 <lvjing5@huawei.com>
-rw-r--r--yardstick/benchmark/contexts/heat.py3
-rw-r--r--yardstick/benchmark/contexts/model.py1
-rw-r--r--yardstick/orchestrator/heat.py8
3 files changed, 9 insertions, 3 deletions
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index aa134d694..fed8fc342 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -152,7 +152,8 @@ class HeatContext(Context):
for network in self.networks.values():
template.add_network(network.stack_name,
network.physical_network,
- network.provider)
+ network.provider,
+ network.segmentation_id)
template.add_subnet(network.subnet_stack_name, network.stack_name,
network.subnet_cidr)
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 1f8c6f11c..5077a9786 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -107,6 +107,7 @@ class Network(Object):
self.router = None
self.physical_network = attrs.get('physical_network', 'physnet1')
self.provider = attrs.get('provider', None)
+ self.segmentation_id = attrs.get('segmentation_id', None)
if "external_network" in attrs:
self.router = Router("router", self.name,
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index a99d4631d..fd6c4f6ff 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -1,4 +1,4 @@
-##############################################################################
+#############################################################################
# Copyright (c) 2015-2017 Ericsson AB and others.
#
# All rights reserved. This program and the accompanying materials
@@ -230,7 +230,8 @@ name (i.e. %s).\
'value': {'get_resource': name}
}
- def add_network(self, name, physical_network='physnet1', provider=None):
+ def add_network(self, name, physical_network='physnet1', provider=None,
+ segmentation_id=None):
"""add to the template a Neutron Net"""
log.debug("adding Neutron::Net '%s'", name)
if provider is None:
@@ -247,6 +248,9 @@ name (i.e. %s).\
'physical_network': physical_network
}
}
+ if segmentation_id:
+ seg_id_dit = {'segmentation_id': segmentation_id}
+ self.resources[name]["properties"].update(seg_id_dit)
def add_server_group(self, name, policies): # pragma: no cover
"""add to the template a ServerGroup"""