aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/contexts/test_heat.py
diff options
context:
space:
mode:
authorJing Zhang <jing.c.zhang@nokia.com>2017-03-31 09:20:46 -0400
committerJing Lu <lvjing5@huawei.com>2017-06-28 08:53:33 +0000
commit1dae2ed45bb425de276441c99da64b21ee4f97de (patch)
treecf9b71dff335141178aa3595bda1c4f22dfacf42 /tests/unit/benchmark/contexts/test_heat.py
parentac370f93eb345f9aee456cb19724902587c10209 (diff)
Add SRIOV support
A generic provider network solution is introduced. To identify whether a network specified in the test case is a provider network new attributes are introduced in the test case network section: networks: test-net: cidr: '192.168.1.0/24' provider: "sriov" physical_network: 'physnet1' If the "provider" attribute is present, the network is an existing provider network. If the value is "sriov", binding:vnic_type=direct is added to the interface in the heat deployment template. In orchestrator/heat.py, the interface creating functions are given a new parameter that tells if the network in use is a provider network. The benchmark/contexts/model.py is changed to store the value of the provider attribute from the test case and function calls to port creation is updated with the provider parameter. The same change is made in contexts/heat.py as well. Also calls for creating a new tenant network is replaced for creating a new provider network if the provider attribute is present. Update-1: Change test_model.py Update-2: Per comment, change comment style to """" Update-3: Change test_heat.py Update-4: Add unit test cases to pass coverage test Update-5: Add SRIOV provider network example in opnfv_yardstick_tc008.yaml Update-6: Per comment, remove empty line in orchestrator/test_heat.py Update-7: Per comment, change comment lines in orchestrator/test_heat.py Update-8: Add more unit test cases to pass coverage test Update-9: Change to create SRIOV provider network on the fly so as to support co-current test runs Update-10: Per comment, init physical_network to 'physnet1' Change-Id: I76004c4fcc9bffcfd8ed021fd647e0cecb346ef4 JIRA: YARDSTICK-612 Signed-off-by: Jing Zhang <jing.c.zhang@nokia.com> (cherry picked from commit f51ba41255d6ab2c03fd62a044d372b73b496459)
Diffstat (limited to 'tests/unit/benchmark/contexts/test_heat.py')
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index 8f4852ca8..b56d0c86d 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -21,6 +21,7 @@ import uuid
import mock
from yardstick.benchmark.contexts import heat
+from yardstick.benchmark.contexts import model
LOG = logging.getLogger(__name__)
@@ -102,12 +103,18 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.keypair_name = "foo-key"
self.test_context.secgroup_name = "foo-secgroup"
self.test_context.key_uuid = "2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b"
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.mock_context.name = 'bar'
+ self.test_context.networks = [model.Network("fool-network", self.mock_context, netattrs)]
self.test_context._add_resources_to_template(mock_template)
mock_template.add_keypair.assert_called_with(
"foo-key",
"2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b")
mock_template.add_security_group.assert_called_with("foo-secgroup")
+ mock_template.add_network.assert_called_with("bar-fool-network", 'physnet1', None)
+ mock_template.add_router.assert_called_with("bar-fool-network-router", netattrs["external_network"], "bar-fool-network-subnet")
+ mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0", "bar-fool-network-router", "bar-fool-network-subnet")
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_deploy(self, mock_template):