diff options
-rw-r--r-- | tests/unit/benchmark/contexts/test_model.py | 4 | ||||
-rw-r--r-- | tests/unit/orchestrator/test_heat.py | 6 | ||||
-rw-r--r-- | yardstick/benchmark/contexts/model.py | 4 | ||||
-rw-r--r-- | yardstick/orchestrator/heat.py | 9 |
4 files changed, 15 insertions, 8 deletions
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py index 1ce550306..5444c2bc8 100644 --- a/tests/unit/benchmark/contexts/test_model.py +++ b/tests/unit/benchmark/contexts/test_model.py @@ -237,6 +237,7 @@ class ServerTestCase(unittest.TestCase): mock_network.name = 'some-network' mock_network.stack_name = 'some-network-stack' mock_network.allowed_address_pairs = ["1", "2"] + mock_network.vnic_type = 'normal' mock_network.subnet_stack_name = 'some-network-stack-subnet' mock_network.provider = 'sriov' mock_network.external_network = 'ext_net' @@ -249,6 +250,7 @@ class ServerTestCase(unittest.TestCase): 'some-server-some-network-port', mock_network.stack_name, mock_network.subnet_stack_name, + mock_network.vnic_type, sec_group_id=self.mock_context.secgroup_name, provider=mock_network.provider, allowed_address_pairs=mock_network.allowed_address_pairs) @@ -312,6 +314,7 @@ class ServerTestCase(unittest.TestCase): self.mock_context.flavors = ['flavor2'] mock_network = mock.Mock() mock_network.allowed_address_pairs = ["1", "2"] + mock_network.vnic_type = 'normal' mock_network.configure_mock(name='some-network', stack_name='some-network-stack', subnet_stack_name='some-network-stack-subnet', provider='some-provider') @@ -323,6 +326,7 @@ class ServerTestCase(unittest.TestCase): 'ServerFlavor-2-some-network-port', mock_network.stack_name, mock_network.subnet_stack_name, + mock_network.vnic_type, provider=mock_network.provider, sec_group_id=self.mock_context.secgroup_name, allowed_address_pairs=mock_network.allowed_address_pairs) diff --git a/tests/unit/orchestrator/test_heat.py b/tests/unit/orchestrator/test_heat.py index c127dd0c9..151070423 100644 --- a/tests/unit/orchestrator/test_heat.py +++ b/tests/unit/orchestrator/test_heat.py @@ -135,9 +135,9 @@ class HeatTemplateTestCase(unittest.TestCase): heat_template.add_subnet("subnet2", "network2", "cidr2") heat_template.add_router("router1", "gw1", "subnet1") heat_template.add_router_interface("router_if1", "router1", "subnet1") - heat_template.add_port("port1", "network1", "subnet1") - heat_template.add_port("port2", "network2", "subnet2", sec_group_id="sec_group1",provider="not-sriov") - heat_template.add_port("port3", "network2", "subnet2", sec_group_id="sec_group1",provider="sriov") + heat_template.add_port("port1", "network1", "subnet1", "normal") + heat_template.add_port("port2", "network2", "subnet2", "normal", sec_group_id="sec_group1",provider="not-sriov") + heat_template.add_port("port3", "network2", "subnet2", "normal", sec_group_id="sec_group1",provider="sriov") heat_template.add_floating_ip("floating_ip1", "network1", "port1", "router_if1") heat_template.add_floating_ip("floating_ip2", "network2", "port2", "router_if2", "foo-secgroup") heat_template.add_floating_ip_association("floating_ip1_association", "floating_ip1", "port1") diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py index 0bf85d03d..aed1a3f60 100644 --- a/yardstick/benchmark/contexts/model.py +++ b/yardstick/benchmark/contexts/model.py @@ -111,6 +111,7 @@ class Network(Object): self.segmentation_id = attrs.get('segmentation_id') self.network_type = attrs.get('network_type') self.port_security_enabled = attrs.get('port_security_enabled') + self.vnic_type = attrs.get('vnic_type', 'normal') self.allowed_address_pairs = attrs.get('allowed_address_pairs', []) try: # we require 'null' or '' to disable setting gateway_ip @@ -263,7 +264,8 @@ class Server(Object): # pragma: no cover # don't refactor to pass in network object, that causes JSON # circular ref encode errors template.add_port(port_name, network.stack_name, network.subnet_stack_name, - sec_group_id=sec_group_id, provider=network.provider, + network.vnic_type, sec_group_id=sec_group_id, + provider=network.provider, allowed_address_pairs=network.allowed_address_pairs) port_name_list.append(port_name) diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 05e359717..beb63b421 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -359,17 +359,18 @@ name (i.e. %s).\ } } - def add_port(self, name, network_name, subnet_name, sec_group_id=None, provider=None, - allowed_address_pairs=None): + def add_port(self, name, network_name, subnet_name, vnic_type, sec_group_id=None, + provider=None, allowed_address_pairs=None): """add to the template a named Neutron Port """ - log.debug("adding Neutron::Port '%s', network:'%s', subnet:'%s', " - "secgroup:%s", name, network_name, subnet_name, sec_group_id) + log.debug("adding Neutron::Port '%s', network:'%s', subnet:'%s', vnic_type:'%s', " + "secgroup:%s", name, network_name, subnet_name, vnic_type, sec_group_id) self.resources[name] = { 'type': 'OS::Neutron::Port', 'depends_on': [subnet_name], 'properties': { 'name': name, + 'binding:vnic_type': vnic_type, 'fixed_ips': [{'subnet': {'get_resource': subnet_name}}], 'network_id': {'get_resource': network_name}, 'replacement_policy': 'AUTO', |