murano-deployment/quantum_support/patches/heat/0001-Added-support-for-Allo...

83 lines
3.2 KiB
Diff

From 7b59f9f2c54d4b1c5440b5fb8777029412bd95d5 Mon Sep 17 00:00:00 2001
From: Serg Melikyan <smelikyan@mirantis.com>
Date: Wed, 30 Oct 2013 08:21:44 +0400
Subject: [PATCH] Added support for Allow-Address-Pairs feature
Added support for feature called Allow-Address-Pairs introduced in
Ie73b3886c5be8e1fc4ade86a0cfb854267f345ac
Refer to blueprint: allowed-address-pairs
Change-Id: I75ba642a63c82f00f4d542512a1dbdf5755e9318
---
heat/engine/resources/quantum/port.py | 46 ++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/heat/engine/resources/quantum/port.py b/heat/engine/resources/quantum/port.py
index c09a072..467e8ff 100644
--- a/heat/engine/resources/quantum/port.py
+++ b/heat/engine/resources/quantum/port.py
@@ -21,24 +21,29 @@ logger = logging.getLogger(__name__)
class Port(quantum.QuantumResource):
-
- fixed_ip_schema = {'subnet_id': {'Type': 'String',
- 'Required': True},
- 'ip_address': {'Type': 'String'}}
-
- properties_schema = {'network_id': {'Type': 'String',
- 'Required': True},
- 'name': {'Type': 'String'},
- 'value_specs': {'Type': 'Map',
- 'Default': {}},
- 'admin_state_up': {'Default': True,
- 'Type': 'Boolean'},
- 'fixed_ips': {'Type': 'List',
- 'Schema': {'Type': 'Map',
- 'Schema': fixed_ip_schema}},
- 'mac_address': {'Type': 'String'},
- 'device_id': {'Type': 'String'},
- 'security_groups': {'Type': 'List'}}
+ properties_schema = {
+ 'network_id': {'Type': 'String', 'Required': True},
+ 'name': {'Type': 'String'},
+ 'value_specs': {'Type': 'Map', 'Default': {}},
+ 'admin_state_up': {'Default': True, 'Type': 'Boolean'},
+ 'fixed_ips': {
+ 'Type': 'List',
+ 'Schema': {'Type': 'Map', 'Schema': {
+ 'subnet_id': {'Type': 'String', 'Required': True},
+ 'ip_address': {'Type': 'String'}
+ }}
+ },
+ 'mac_address': {'Type': 'String'},
+ 'device_id': {'Type': 'String'},
+ 'security_groups': {'Type': 'List'},
+ 'allowed_address_pairs': {
+ 'Type': 'List',
+ 'Schema': {'Type': 'Map', 'Schema': {
+ 'mac_address': {'Type': 'String'},
+ 'ip_address': {'Type': 'String', 'Required': True}
+ }}
+ }
+ }
def __init__(self, name, json_snippet, stack):
super(Port, self).__init__(name, json_snippet, stack)
@@ -47,6 +52,11 @@ class Port(quantum.QuantumResource):
props = self.prepare_properties(
self.properties,
self.physical_resource_name())
+
+ for pair in props.get('allowed_address_pairs', []):
+ if 'mac_address' in pair and pair['mac_address'] is None:
+ del pair['mac_address']
+
port = self.quantum().create_port({'port': props})['port']
self.resource_id_set(port['id'])
--
1.7.9.5