diff options
-rw-r--r-- | README.rst | 6 | ||||
-rw-r--r-- | docker/Dockerfile | 2 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/test_model.py | 48 | ||||
-rw-r--r-- | yardstick/benchmark/contexts/model.py | 11 | ||||
-rw-r--r-- | yardstick/orchestrator/heat.py | 28 |
5 files changed, 67 insertions, 28 deletions
diff --git a/README.rst b/README.rst index c6ff99185..76ea9723c 100644 --- a/README.rst +++ b/README.rst @@ -23,7 +23,7 @@ service performance to be within a certain level of agreement. For more information on Yardstick project, please visit: https://wiki.opnfv.org/display/yardstick/Yardstick - http://artifacts.opnfv.org/yardstick/colorado/3.0/docs/userguide/index.html#document-01-introduction + http://artifacts.opnfv.org/yardstick/docs/userguide/index.html#document-01-introduction Architecture @@ -42,7 +42,7 @@ records to a file. For more information on Yardstick architecture, please read: - http://artifacts.opnfv.org/yardstick/colorado/3.0/docs/userguide/index.html#document-03-architecture + http://artifacts.opnfv.org/yardstick/docs/userguide/index.html#document-03-architecture Installation @@ -53,7 +53,7 @@ Yardstick supports installation on Ubuntu 14.04 or via a Docker image. To learn how to install Yardstick, consult the documentation available online at: - http://artifacts.opnfv.org/yardstick/colorado/3.0/docs/userguide/index.html#document-07-installation + http://artifacts.opnfv.org/yardstick/docs/userguide/index.html#document-09-installation Developers diff --git a/docker/Dockerfile b/docker/Dockerfile index b48a550bf..a58bbbc7b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,7 +24,7 @@ ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick ENV RELENG_REPO_DIR ${REPOS_DIR}/releng ENV STORPERF_REPO_DIR ${REPOS_DIR}/storperf -RUN apt-get update && apt-get install -y git python-setuptools python-pip +RUN apt-get update && apt-get install -y git python-setuptools python-pip && apt-get -y autoremove && apt-get clean RUN easy_install -U setuptools==30.0.0 RUN pip install appdirs==1.4.0 diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py index 3e94168b5..53b035b82 100644 --- a/tests/unit/benchmark/contexts/test_model.py +++ b/tests/unit/benchmark/contexts/test_model.py @@ -179,6 +179,7 @@ class NetworkTestCase(unittest.TestCase): test_network = model.Network('foo', self.mock_context, attrs) self.assertIsNone(test_network.gateway_ip) + class ServerTestCase(unittest.TestCase): def setUp(self): @@ -190,7 +191,6 @@ class ServerTestCase(unittest.TestCase): netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'} self.mock_context.networks = [model.Network("some-network", self.mock_context, netattrs)] - def test_construct_defaults(self): attrs = None @@ -227,8 +227,9 @@ class ServerTestCase(unittest.TestCase): @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') def test__add_instance(self, mock_template): - - attrs = {'image': 'some-image', 'flavor': 'some-flavor', 'floating_ip': '192.168.1.10', 'floating_ip_assoc': 'some-vm'} + attrs = {'image': 'some-image', 'flavor': 'some-flavor', 'floating_ip': '192.168.1.10', + 'floating_ip_assoc': 'some-vm', + 'availability_zone': 'zone'} test_server = model.Server('foo', self.mock_context, attrs) self.mock_context.flavors = ['flavor1', 'flavor2', 'some-flavor'] @@ -241,7 +242,8 @@ class ServerTestCase(unittest.TestCase): mock_network.subnet_stack_name = 'some-network-stack-subnet' mock_network.provider = 'sriov' mock_network.external_network = 'ext_net' - mock_network.router = model.Router('some-router', 'some-network', self.mock_context, 'ext_net') + mock_network.router = model.Router('some-router', 'some-network', self.mock_context, + 'ext_net') test_server._add_instance(mock_template, 'some-server', [mock_network], 'hints') @@ -277,7 +279,8 @@ class ServerTestCase(unittest.TestCase): user=self.mock_context.user, key_name=self.mock_context.keypair_name, user_data='', - scheduler_hints='hints') + scheduler_hints='hints', + availability_zone='zone') def test_override_ip(self): network_ports = { @@ -471,7 +474,30 @@ class ServerTestCase(unittest.TestCase): user=self.mock_context.user, key_name=self.mock_context.keypair_name, user_data=user_data, - scheduler_hints='hints') + scheduler_hints='hints', + availability_zone=None) + + @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') + def test__add_instance_with_availablity_zone(self, mock_template): + attrs = { + 'image': 'some-image', 'flavor': 'some-flavor', + 'availability_zone': 'zone', + } + test_server = model.Server('foo', self.mock_context, attrs) + + test_server._add_instance(mock_template, 'some-server', + [], 'hints') + + mock_template.add_server.assert_called_with( + 'some-server', 'some-image', + flavor='some-flavor', + flavors=self.mock_context.flavors, + ports=[], + user=self.mock_context.user, + key_name=self.mock_context.keypair_name, + user_data='', + scheduler_hints='hints', + availability_zone='zone') @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') def test__add_instance_plus_flavor(self, mock_template): @@ -511,7 +537,8 @@ class ServerTestCase(unittest.TestCase): user=self.mock_context.user, key_name=self.mock_context.keypair_name, user_data=user_data, - scheduler_hints='hints') + scheduler_hints='hints', + availability_zone=None) @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') def test__add_instance_misc(self, mock_template): @@ -523,7 +550,7 @@ class ServerTestCase(unittest.TestCase): } test_server = model.Server('ServerFlavor-3', self.mock_context, attrs) - self.mock_context.flavors = ['flavor2'] + self.mock_context.flavors = ['flavor2'] self.mock_context.flavor = {'vcpus': 4} mock_network = mock.Mock() mock_network.name = 'some-network' @@ -533,7 +560,6 @@ class ServerTestCase(unittest.TestCase): test_server._add_instance(mock_template, 'ServerFlavor-3', [mock_network], 'hints') - mock_template.add_port( 'ServerFlavor-3-some-network-port', mock_network.stack_name, @@ -559,5 +585,5 @@ class ServerTestCase(unittest.TestCase): user=self.mock_context.user, key_name=self.mock_context.keypair_name, user_data=user_data, - scheduler_hints='hints') - + scheduler_hints='hints', + availability_zone=None) diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py index 97560c9f6..ae56066ee 100644 --- a/yardstick/benchmark/contexts/model.py +++ b/yardstick/benchmark/contexts/model.py @@ -239,6 +239,7 @@ class Server(Object): # pragma: no cover self._flavor = attrs["flavor"] self.user_data = attrs.get('user_data', '') + self.availability_zone = attrs.get('availability_zone') Server.list.append(self) @@ -355,12 +356,10 @@ class Server(Object): # pragma: no cover mountpoint=self.volume_mountpoint) template.add_server(server_name, self.image, flavor=self.flavor_name, - flavors=self.context.flavors, - ports=port_name_list, - user=self.user, - key_name=self.keypair_name, - user_data=self.user_data, - scheduler_hints=scheduler_hints) + flavors=self.context.flavors, ports=port_name_list, + scheduler_hints=scheduler_hints, user=self.user, + key_name=self.keypair_name, user_data=self.user_data, + availability_zone=self.availability_zone) def add_to_template(self, template, networks, scheduler_hints=None): """adds to the template one or more servers (instances)""" diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 455ddc34e..d58ae5618 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -497,7 +497,7 @@ name (i.e. %s).\ 'type': 'OS::Neutron::SecurityGroup', 'properties': { 'name': name, - 'description': "Group allowing icmp and upd/tcp on all ports", + 'description': "Group allowing IPv4 and IPv6 for icmp and upd/tcp on all ports", 'rules': [ {'remote_ip_prefix': '0.0.0.0/0', 'protocol': 'tcp', @@ -508,7 +508,20 @@ name (i.e. %s).\ 'port_range_min': '1', 'port_range_max': '65535'}, {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'icmp'} + 'protocol': 'icmp'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'ipv6-icmp'} ] } } @@ -518,11 +531,10 @@ name (i.e. %s).\ 'value': {'get_resource': name} } - def add_server(self, name, image, flavor, flavors, ports=None, - networks=None, scheduler_hints=None, user=None, - key_name=None, user_data=None, metadata=None, - additional_properties=None): - """add to the template a Nova Server""" + def add_server(self, name, image, flavor, flavors, ports=None, networks=None, + scheduler_hints=None, user=None, key_name=None, user_data=None, metadata=None, + additional_properties=None, availability_zone=None): + """add to the template a Nova Server """ log.debug("adding Nova::Server '%s', image '%s', flavor '%s', " "ports %s", name, image, flavor, ports) @@ -537,6 +549,8 @@ name (i.e. %s).\ 'flavor': {}, 'networks': [] # list of dictionaries } + if availability_zone: + server_properties["availability_zone"] = availability_zone if flavor in flavors: self.resources[name]['depends_on'].append(flavor) |