aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-09-08 11:34:48 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-13 18:36:38 -0700
commit8ba961d5cded6a0993ef00e8f9b5e0a7cd32d216 (patch)
tree628282b15759770782534e5613994cb89b548253 /tests/unit/benchmark
parent53a55a8e95ad31ef6af0978e871092ddeb2dc597 (diff)
Heat: support non-mesh network toplogy
Previsouly we added all servers to every network in Heat in a full mesh. To more closely replicate test topology and to limit then number of ports we need to all each server to specify which ports should be connected to each network. This should also allow for some kind of multiport setup. Add optional network_ports dict to each server with network to port_list mapping match inteface based on port name or vld_id replace vld_id matching with network name matching, since network_name == vld_id Change-Id: I5de46b8f673949e3c17d8df6fa96f055c43886ce Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py38
-rw-r--r--tests/unit/benchmark/core/test_task.py52
2 files changed, 29 insertions, 61 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index cc0c7bc8e..582d9ab99 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -13,7 +13,6 @@
from __future__ import absolute_import
-import ipaddress
import logging
import os
import unittest
@@ -147,30 +146,6 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.user = 'foo'
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
- @mock.patch('yardstick.benchmark.contexts.heat.get_neutron_client')
- def test_attrs_get(self, mock_neutron, mock_template):
- image, flavor, user = expected_tuple = 'foo1', 'foo2', 'foo3'
- self.assertNotEqual(self.test_context.image, image)
- self.assertNotEqual(self.test_context.flavor, flavor)
- self.assertNotEqual(self.test_context.user, user)
- self.test_context._image = image
- self.test_context._flavor = flavor
- self.test_context._user = user
- attr_tuple = self.test_context.image, self.test_context.flavor, self.test_context.user
- self.assertEqual(attr_tuple, expected_tuple)
-
- @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
- def test_attrs_set_negative(self, mock_template):
- with self.assertRaises(AttributeError):
- self.test_context.image = 'foo'
-
- with self.assertRaises(AttributeError):
- self.test_context.flavor = 'foo'
-
- with self.assertRaises(AttributeError):
- self.test_context.user = 'foo'
-
- @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_deploy(self, mock_template):
self.test_context.name = 'foo'
self.test_context.template_file = '/bar/baz/some-heat-file'
@@ -210,8 +185,8 @@ class HeatContextTestCase(unittest.TestCase):
}
server = mock.MagicMock()
server.ports = OrderedDict([
- ('a', {'stack_name': 'b'}),
- ('c', {'stack_name': 'd'}),
+ ('a', {'stack_name': 'b', 'port': 'port_a'}),
+ ('c', {'stack_name': 'd', 'port': 'port_c'}),
])
expected = {
@@ -231,7 +206,7 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.add_server_port(server)
self.assertEqual(server.private_ip, '10.20.30.45')
self.assertEqual(len(server.interfaces), 2)
- self.assertDictEqual(server.interfaces['a'], expected)
+ self.assertDictEqual(server.interfaces['port_a'], expected)
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_undeploy(self, mock_template):
@@ -472,7 +447,6 @@ class HeatContextTestCase(unittest.TestCase):
network2 = mock.MagicMock()
network2.name = 'net_2'
- network2.vld_id = 'vld999'
network2.segmentation_id = 'seg45'
network2.network_type = 'type_b'
network2.physical_network = 'virt'
@@ -488,16 +462,15 @@ class HeatContextTestCase(unittest.TestCase):
attr_name = {}
self.assertIsNone(self.test_context._get_network(attr_name))
- attr_name = {'vld_id': 'vld777'}
+ attr_name = {'network_type': 'nosuch'}
self.assertIsNone(self.test_context._get_network(attr_name))
attr_name = 'vld777'
self.assertIsNone(self.test_context._get_network(attr_name))
- attr_name = {'vld_id': 'vld999'}
+ attr_name = {'segmentation_id': 'seg45'}
expected = {
"name": 'net_2',
- "vld_id": 'vld999',
"segmentation_id": 'seg45',
"network_type": 'type_b',
"physical_network": 'virt',
@@ -508,7 +481,6 @@ class HeatContextTestCase(unittest.TestCase):
attr_name = 'a'
expected = {
"name": 'net_1',
- "vld_id": 'vld111',
"segmentation_id": 'seg54',
"network_type": 'type_a',
"physical_network": 'phys',
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index 14027e43c..e3917b5b2 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -66,31 +66,27 @@ class TaskTestCase(unittest.TestCase):
nodes = {
'node1': {
'interfaces': {
- 'eth0': {
- 'name': 'mgmt',
+ 'mgmt': {
+ 'network_name': 'mgmt',
},
- 'eth1': {
- 'name': 'external',
- 'vld_id': '23',
+ 'xe0': {
+ 'network_name': 'private_0',
},
- 'eth10': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'xe1': {
+ 'network_name': 'public_0',
},
},
},
'node2': {
'interfaces': {
- 'eth4': {
- 'name': 'mgmt',
+ 'mgmt': {
+ 'network_name': 'mgmt',
},
- 'eth2': {
- 'name': 'external',
- 'vld_id': '32',
+ 'private_0': {
+ 'network_name': 'private_0',
},
- 'eth11': {
- 'name': 'internal',
- 'vld_id': '55',
+ 'public_0': {
+ 'network_name': 'public_0',
},
},
},
@@ -99,30 +95,30 @@ class TaskTestCase(unittest.TestCase):
mock_context.get_network.side_effect = iter([
None,
{
- 'name': 'a',
- 'network_type': 'private',
+ 'name': 'mgmt',
+ 'network_type': 'flat',
},
{},
{
- 'name': 'b',
- 'vld_id': 'y',
+ 'name': 'private_0',
'subnet_cidr': '10.20.0.0/16',
},
{
- 'name': 'c',
- 'vld_id': 'x',
+ 'name': 'public_0',
+ 'segmentation_id': '1001',
},
{
- 'name': 'd',
- 'vld_id': 'w',
+ 'name': 'private_1',
},
])
- # once for each vld_id in the nodes dict
- expected_get_network_calls = 4
+ # one for each interface
+ expected_get_network_calls = 6
expected = {
- 'a': {'name': 'a', 'network_type': 'private'},
- 'b': {'name': 'b', 'vld_id': 'y', 'subnet_cidr': '10.20.0.0/16'},
+ 'mgmt': {'name': 'mgmt', 'network_type': 'flat'},
+ 'private_0': {'name': 'private_0', 'subnet_cidr': '10.20.0.0/16'},
+ 'private_1': {'name': 'private_1'},
+ 'public_0': {'name': 'public_0', 'segmentation_id': '1001'},
}
networks = task.get_networks_from_nodes(nodes)