From f11eb13638a7c606982afee44d94006514b4d703 Mon Sep 17 00:00:00 2001 From: Jo¶rgen Karlsson Date: Wed, 17 Feb 2016 16:17:04 +0100 Subject: Add heat template workaround for odl-l3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I476fdd4d0e0e97cb1457ae15f92442c42aa77b4e Signed-off-by: Jo¶rgen Karlsson (cherry picked from commit c3949144ecd32e7152ba89a45795d7ca401d5d50) --- yardstick/benchmark/contexts/model.py | 8 ++++++++ yardstick/orchestrator/heat.py | 34 ++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py index bb61c613d..80abb9df3 100644 --- a/yardstick/benchmark/contexts/model.py +++ b/yardstick/benchmark/contexts/model.py @@ -145,8 +145,10 @@ class Server(Object): self.ports = {} self.floating_ip = None + self.floating_ip_assoc = None if "floating_ip" in attrs: self.floating_ip = {} + self.floating_ip_assoc = {} if self.floating_ip is not None: ext_net = Network.find_external_network() @@ -199,6 +201,12 @@ class Server(Object): port_name, network.router.stack_if_name, self.secgroup_name) + self.floating_ip_assoc["stack_name"] = \ + server_name + "-fip-assoc" + template.add_floating_ip_association( + self.floating_ip_assoc["stack_name"], + self.floating_ip["stack_name"], + server_name) template.add_server(server_name, self.image, self.flavor, ports=port_name_list, diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 8d535c252..553e7b8f1 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -274,18 +274,17 @@ class HeatTemplate(HeatObject): def add_floating_ip(self, name, network_name, port_name, router_if_name, secgroup_name=None): - '''add to the template a Neutron FloatingIP resource + '''add to the template a Nova FloatingIP resource see: https://bugs.launchpad.net/heat/+bug/1299259 ''' - log.debug("adding Neutron::FloatingIP '%s', network '%s', port '%s', " + log.debug("adding Nova::FloatingIP '%s', network '%s', port '%s', " "rif '%s'", name, network_name, port_name, router_if_name) self.resources[name] = { - 'type': 'OS::Neutron::FloatingIP', + 'type': 'OS::Nova::FloatingIP', 'depends_on': [port_name, router_if_name], 'properties': { - 'floating_network': network_name, - 'port_id': {'get_resource': port_name} + 'pool': network_name } } @@ -294,7 +293,22 @@ class HeatTemplate(HeatObject): self._template['outputs'][name] = { 'description': 'floating ip %s' % name, - 'value': {'get_attr': [name, 'floating_ip_address']} + 'value': {'get_attr': [name, 'ip']} + } + + def add_floating_ip_association(self, name, floating_ip_name, server_name): + '''add to the template a Nova FloatingIP Association resource + ''' + log.debug("adding Nova::FloatingIPAssociation '%s', server '%s', " + "floating_ip '%s'", name, server_name, floating_ip_name) + + self.resources[name] = { + 'type': 'OS::Nova::FloatingIPAssociation', + 'depends_on': [server_name], + 'properties': { + 'floating_ip': {'get_resource': floating_ip_name}, + 'server_id': {'get_resource': server_name} + } } def add_keypair(self, name): @@ -338,9 +352,13 @@ class HeatTemplate(HeatObject): 'description': "Group allowing icmp and upd/tcp on all ports", 'rules': [ {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'tcp'}, + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'udp'}, + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, {'remote_ip_prefix': '0.0.0.0/0', 'protocol': 'icmp'} ] -- cgit 1.2.3-korg