diff options
Diffstat (limited to 'patches/opnfv-fuel/0010-reap.py-Support-reading-MTU-values.patch')
-rw-r--r-- | patches/opnfv-fuel/0010-reap.py-Support-reading-MTU-values.patch | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0010-reap.py-Support-reading-MTU-values.patch b/patches/opnfv-fuel/0010-reap.py-Support-reading-MTU-values.patch new file mode 100644 index 00000000..c55824bd --- /dev/null +++ b/patches/opnfv-fuel/0010-reap.py-Support-reading-MTU-values.patch @@ -0,0 +1,104 @@ +-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +-: Copyright (c) 2017 Enea AB and others. +-: +-: All rights reserved. This program and the accompanying materials +-: are made available under the terms of the Apache License, Version 2.0 +-: which accompanies this distribution, and is available at +-: http://www.apache.org/licenses/LICENSE-2.0 +-:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +From: Catalina Focsa <catalina.focsa@enea.com> +Date: Wed, 3 May 2017 14:53:30 +0200 +Subject: [PATCH] reap.py: Support reading MTU values + +Add an interfaces_properties list containing +mtu data for each interface + +JIRA: ARMBAND-251 + +Signed-off-by: Catalina Focsa <catalina.focsa@enea.com> +--- + deploy/reap.py | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/deploy/reap.py b/deploy/reap.py +index be72918..fe6bebf 100644 +--- a/deploy/reap.py ++++ b/deploy/reap.py +@@ -143,6 +143,31 @@ class Reap(object): + interfaces[if_name] = interface + return if_name, mac + ++ def reap_properties(self, node_id, properties): ++ properties_name = None ++ node_file = glob.glob('%s/deployment_%s/%s.yaml' ++ % (self.temp_dir, self.env_id, node_id)) ++ with open(node_file[0]) as f: ++ node_config = yaml.load(f) ++ ++ interface = {'interfaces': node_config['network_scheme']['interfaces']} ++ interface_properties = {k:v for k, v in interface['interfaces'].items()} ++ ++ mtu_properties = {} ++ for k, v in interface_properties.items(): ++ if 'mtu' in v: ++ mtu_properties[k]={'mtu':v['mtu']} ++ else: ++ mtu_properties[k] = 'null' ++ interface_properties = mtu_properties ++ ++ properties_name = self.check_dict_exists(properties, interface) if properties else None ++ if not properties_name: ++ properties_name = 'interfaces_properties' ++ properties[properties_name] = interface_properties ++ return properties_name, interface_properties ++ ++ + def reap_transformation(self, node_id, roles, transformations): + main_role = 'controller' if 'controller' in roles else 'compute' + node_file = glob.glob('%s/deployment_%s/%s.yaml' +@@ -172,8 +197,10 @@ class Reap(object): + min_node = min(real_node_ids) + interfaces = {} + transformations = {} ++ properties = {} + dea_nodes = [] + dha_nodes = [] ++ properties_nodes = [] + + for real_node_id in real_node_ids: + node_id = real_node_id - min_node + 1 +@@ -185,14 +212,19 @@ class Reap(object): + dea_node = {'id': node_id, + 'role': roles} + dha_node = {'id': node_id} ++ properties_node = {'id': node_id} + if_name, mac = self.reap_interface(real_node_id, interfaces) + log('reap transformation for node %s' % real_node_id) ++ pr_name, interface_properties = self.reap_properties(real_node_id, properties) + tr_name = self.reap_transformation(real_node_id, roles, + transformations) + dea_node.update( + {'interfaces': if_name, ++ 'properties': pr_name, + 'transformations': tr_name}) + ++ properties_node.update({'interface_configuration': interface_properties}) ++ + dha_node.update( + {'pxeMac': mac if mac else None, + 'ipmiIp': None, +@@ -203,10 +235,12 @@ class Reap(object): + + dea_nodes.append(dea_node) + dha_nodes.append(dha_node) ++ properties_nodes.append(properties_node) + + self.write_yaml(self.dha_file, {'nodes': dha_nodes}, False) + self.write_yaml(self.dea_file, {'nodes': dea_nodes}) + self.write_yaml(self.dea_file, interfaces) ++ self.write_yaml(self.dea_file, {'interfaces_properties': properties_nodes}) + self.write_yaml(self.dea_file, transformations) + self.reap_fuel_node_info() + self.write_yaml(self.dha_file, {'disks': DISKS}) +-- +1.9.1 |