From 143022408c26f3c6a5f5c1eaf0dce8061242675a Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Tue, 20 Oct 2015 14:18:37 +0200 Subject: [PATCH] Plugin config + bugfix + refactoring ignoring external repo errors during plugin installation refactoring import common Install only those plugins which have a yaml config file located under plugins folder collect puppet errors from all nodes Change-Id: I8d5248cf31c4877a6d59bfcfe62b43daf4ad43ef Signed-off-by: Szilard Cserey --- fuel/deploy/cloud/configure_environment.py | 20 +++--- fuel/deploy/cloud/configure_network.py | 17 ++--- fuel/deploy/cloud/configure_nodes.py | 17 ++--- fuel/deploy/cloud/configure_settings.py | 18 ++--- fuel/deploy/cloud/deploy.py | 47 +++++------- fuel/deploy/cloud/deployment.py | 84 +++++++++++++++++----- fuel/deploy/common.py | 3 +- fuel/deploy/dea.py | 3 + fuel/deploy/deploy.py | 59 +++++++++------ fuel/deploy/deploy_env.py | 70 +++++++++++------- fuel/deploy/dha_adapters/amt_adapter.py | 10 +-- fuel/deploy/dha_adapters/hardware_adapter.py | 1 + fuel/deploy/dha_adapters/hp_adapter.py | 5 +- fuel/deploy/dha_adapters/ipmi_adapter.py | 9 +-- fuel/deploy/dha_adapters/libvirt_adapter.py | 14 ++-- fuel/deploy/environments/execution_environment.py | 15 ++-- fuel/deploy/environments/libvirt_environment.py | 18 ++--- fuel/deploy/environments/virtual_fuel.py | 14 ++-- fuel/deploy/execution_environment.py | 9 --- fuel/deploy/install_fuel_master.py | 48 +++++++------ fuel/deploy/reap.py | 23 +++--- fuel/deploy/ssh_client.py | 11 +-- .../conf/ericsson_montreal_lab/dea.yaml | 52 -------------- .../plugins_conf/opendaylight.yaml | 52 ++++++++++++++ .../conf/linux_foundation_lab/pod1/dea.yaml | 52 -------------- .../pod1/plugins_conf/opendaylight.yaml | 52 ++++++++++++++ .../conf/linux_foundation_lab/pod2/dea.yaml | 52 -------------- .../pod2/plugins_conf/opendaylight.yaml | 52 ++++++++++++++ .../hardware_environment/conf/opnfv_box/dea.yaml | 52 -------------- .../conf/opnfv_box/plugins_conf/opendaylight.yaml | 52 ++++++++++++++ .../templates/virtual_environment/conf/dea.yaml | 52 -------------- .../conf/plugins_conf/opendaylight.yaml | 52 ++++++++++++++ fuel/deploy/transplant_fuel_settings.py | 5 +- 33 files changed, 552 insertions(+), 488 deletions(-) create mode 100644 fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/plugins_conf/opendaylight.yaml create mode 100644 fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/plugins_conf/opendaylight.yaml create mode 100644 fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/plugins_conf/opendaylight.yaml create mode 100644 fuel/deploy/templates/hardware_environment/conf/opnfv_box/plugins_conf/opendaylight.yaml create mode 100644 fuel/deploy/templates/virtual_environment/conf/plugins_conf/opendaylight.yaml diff --git a/fuel/deploy/cloud/configure_environment.py b/fuel/deploy/cloud/configure_environment.py index 2d68c1ba8..ed89fa600 100644 --- a/fuel/deploy/cloud/configure_environment.py +++ b/fuel/deploy/cloud/configure_environment.py @@ -7,22 +7,20 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################### -import common from configure_settings import ConfigureSettings from configure_network import ConfigureNetwork from configure_nodes import ConfigureNodes -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -log = common.log -delete = common.delete -create_dir_if_not_exists = common.create_dir_if_not_exists +from common import ( + E, + exec_cmd, + parse, + err, + log, + delete, + create_dir_if_not_exists, +) class ConfigureEnvironment(object): diff --git a/fuel/deploy/cloud/configure_network.py b/fuel/deploy/cloud/configure_network.py index 00278949d..b3ff9e9e0 100644 --- a/fuel/deploy/cloud/configure_network.py +++ b/fuel/deploy/cloud/configure_network.py @@ -8,20 +8,15 @@ ############################################################################### -import common import yaml import io -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -check_file_exists = common.check_file_exists -log = common.log -backup = common.backup +from common import ( + exec_cmd, + check_file_exists, + log, + backup, +) class ConfigureNetwork(object): diff --git a/fuel/deploy/cloud/configure_nodes.py b/fuel/deploy/cloud/configure_nodes.py index e76d222c0..a456679ab 100644 --- a/fuel/deploy/cloud/configure_nodes.py +++ b/fuel/deploy/cloud/configure_nodes.py @@ -8,21 +8,16 @@ ############################################################################### -import common import yaml import io import glob -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -check_file_exists = common.check_file_exists -log = common.log -backup = common.backup +from common import ( + exec_cmd, + check_file_exists, + log, + backup, +) class ConfigureNodes(object): diff --git a/fuel/deploy/cloud/configure_settings.py b/fuel/deploy/cloud/configure_settings.py index fa918fd3d..c773e1b61 100644 --- a/fuel/deploy/cloud/configure_settings.py +++ b/fuel/deploy/cloud/configure_settings.py @@ -7,20 +7,16 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################### -import common + import yaml import io -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -check_file_exists = common.check_file_exists -log = common.log -backup = common.backup +from common import ( + exec_cmd, + check_file_exists, + log, + backup, +) class ConfigureSettings(object): diff --git a/fuel/deploy/cloud/deploy.py b/fuel/deploy/cloud/deploy.py index 705dda59c..14d6a9621 100644 --- a/fuel/deploy/cloud/deploy.py +++ b/fuel/deploy/cloud/deploy.py @@ -8,48 +8,37 @@ ############################################################################### -import os import yaml import io -import glob -import common from dea import DeploymentEnvironmentAdapter from configure_environment import ConfigureEnvironment from deployment import Deployment -YAML_CONF_DIR = '/var/lib/opnfv' +from common import ( + R, + exec_cmd, + parse, + check_file_exists, + commafy, + ArgParser, +) -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -check_file_exists = common.check_file_exists -log = common.log -commafy = common.commafy -ArgParser = common.ArgParser +YAML_CONF_DIR = '/var/lib/opnfv' class Deploy(object): - def __init__(self, dea_file, blade_node_file, no_health_check): + def __init__(self, dea_file, no_health_check): self.dea = DeploymentEnvironmentAdapter(dea_file) - self.blade_node_file = blade_node_file self.no_health_check = no_health_check self.macs_per_blade = {} self.blades = self.dea.get_node_ids() - self.blade_node_dict = {} + self.blade_node_dict = self.dea.get_blade_node_map() self.node_roles_dict = {} self.env_id = None self.wanted_release = self.dea.get_property('wanted_release') - def get_blade_node_mapping(self): - with io.open(self.blade_node_file, 'r') as stream: - self.blade_node_dict = yaml.load(stream) - def assign_roles_to_cluster_node_ids(self): self.node_roles_dict = {} for blade, node in self.blade_node_dict.iteritems(): @@ -74,8 +63,6 @@ class Deploy(object): def deploy(self): - self.get_blade_node_mapping() - self.assign_roles_to_cluster_node_ids() self.configure_environment() @@ -90,17 +77,17 @@ def parse_arguments(): help='Don\'t run health check after deployment') parser.add_argument('dea_file', action='store', help='Deployment Environment Adapter: dea.yaml') - parser.add_argument('blade_node_file', action='store', - help='Blade Node mapping: blade_node.yaml') args = parser.parse_args() check_file_exists(args.dea_file) - check_file_exists(args.blade_node_file) - return (args.dea_file, args.blade_node_file, args.no_health_check) + + kwargs = {'dea_file': args.dea_file, + 'no_health_check': args.no_health_check} + return kwargs def main(): - dea_file, blade_node_file, no_health_check = parse_arguments() - deploy = Deploy(dea_file, blade_node_file, no_health_check) + kwargs = parse_arguments() + deploy = Deploy(**kwargs) deploy.deploy() if __name__ == '__main__': diff --git a/fuel/deploy/cloud/deployment.py b/fuel/deploy/cloud/deployment.py index 90f24fd0b..defe5eb64 100644 --- a/fuel/deploy/cloud/deployment.py +++ b/fuel/deploy/cloud/deployment.py @@ -8,24 +8,24 @@ ############################################################################### -import common -import os -import shutil -import glob -import yaml -import io import time +import re -N = common.N -E = common.E -R = common.R -RO = common.RO -exec_cmd = common.exec_cmd -run_proc = common.run_proc -parse = common.parse -err = common.err -log = common.log +from common import ( + N, + E, + exec_cmd, + run_proc, + parse, + err, + log, + delete, +) +SEARCH_TEXT = 'Puppet (err)' +LOG_FILE = '/var/log/puppet.log' +GREP_LINES_OF_LEADING_CONTEXT = 100 +GREP_LINES_OF_TRAILING_CONTEXT = 100 class Deployment(object): @@ -36,6 +36,57 @@ class Deployment(object): self.env_id = env_id self.node_id_roles_dict = node_id_roles_dict self.no_health_check = no_health_check + self.pattern = re.compile( + '\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d') + + def collect_error_logs(self): + for node_id, roles_blade in self.node_id_roles_dict.iteritems(): + log_list = [] + cmd = ('ssh -q node-%s grep \'"%s"\' %s' + % (node_id, SEARCH_TEXT, LOG_FILE)) + results, _ = exec_cmd(cmd, False) + for result in results.splitlines(): + log_msg = '' + cmd = ('ssh -q node-%s grep -B%s \'"%s"\' %s' + % (node_id, GREP_LINES_OF_LEADING_CONTEXT, result, + LOG_FILE)) + details, _ = exec_cmd(cmd, False) + details_list = details.splitlines() + + found_prev_log = False + for i in range(len(details_list) - 2, -1, -1): + if self.pattern.match(details_list[i]): + found_prev_log = True + break + if found_prev_log: + log_msg += '\n'.join(details_list[i:-1]) + '\n' + + cmd = ('ssh -q node-%s grep -A%s \'"%s"\' %s' + % (node_id, GREP_LINES_OF_TRAILING_CONTEXT, result, + LOG_FILE)) + details, _ = exec_cmd(cmd, False) + details_list = details.splitlines() + + found_next_log = False + for i in range(1, len(details_list)): + if self.pattern.match(details_list[i]): + found_next_log = True + break + if found_next_log: + log_msg += '\n'.join(details_list[:i]) + else: + log_msg += details + + if log_msg: + log_list.append(log_msg) + + if log_list: + role = ('controller' if 'controller' in roles_blade[0] + else 'compute host') + log('_' * 40 + 'Errors in node-%s %s' % (node_id, role) + + '_' * 40) + for log_msg in log_list: + print(log_msg + '\n') def run_deploy(self): WAIT_LOOP = 180 @@ -61,11 +112,12 @@ class Deployment(object): break else: time.sleep(SLEEP_TIME) - exec_cmd('rm %s' % LOG_FILE) + delete(LOG_FILE) if ready: log('Environment %s successfully deployed' % self.env_id) else: + self.collect_error_logs() err('Deployment failed, environment %s is not operational' % self.env_id) diff --git a/fuel/deploy/common.py b/fuel/deploy/common.py index 2a8c0d149..cdc54b43a 100644 --- a/fuel/deploy/common.py +++ b/fuel/deploy/common.py @@ -7,6 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################### + import subprocess import sys import os @@ -43,7 +44,7 @@ def exec_cmd(cmd, check=True): return_code = process.returncode if check: if return_code > 0: - err(response) + raise Exception(response) else: return response return response, return_code diff --git a/fuel/deploy/dea.py b/fuel/deploy/dea.py index 5f1a41547..2d2b28ae8 100644 --- a/fuel/deploy/dea.py +++ b/fuel/deploy/dea.py @@ -97,3 +97,6 @@ class DeploymentEnvironmentAdapter(object): settings = self.get_property('settings') ntp_list = settings['editable']['external_ntp']['ntp_list']['value'] return [n.strip() for n in ntp_list.split(',')] + + def get_blade_node_map(self): + return self.dea_struct['blade_node_map'] diff --git a/fuel/deploy/deploy.py b/fuel/deploy/deploy.py index 178ae76e2..4e209a932 100644 --- a/fuel/deploy/deploy.py +++ b/fuel/deploy/deploy.py @@ -20,18 +20,18 @@ from dha import DeploymentHardwareAdapter from install_fuel_master import InstallFuelMaster from deploy_env import CloudDeploy from execution_environment import ExecutionEnvironment -import common - -log = common.log -exec_cmd = common.exec_cmd -err = common.err -warn = common.warn -check_file_exists = common.check_file_exists -check_dir_exists = common.check_dir_exists -create_dir_if_not_exists = common.create_dir_if_not_exists -delete = common.delete -check_if_root = common.check_if_root -ArgParser = common.ArgParser + +from common import ( + log, + exec_cmd, + err, + warn, + check_file_exists, + create_dir_if_not_exists, + delete, + check_if_root, + ArgParser, +) FUEL_VM = 'fuel' PATCH_DIR = 'fuel_patch' @@ -56,7 +56,8 @@ class AutoDeploy(object): def __init__(self, no_fuel, fuel_only, no_health_check, cleanup_only, cleanup, storage_dir, pxe_bridge, iso_file, dea_file, - dha_file, fuel_plugins_dir): + dha_file, fuel_plugins_dir, fuel_plugins_conf_dir, + no_plugins): self.no_fuel = no_fuel self.fuel_only = fuel_only self.no_health_check = no_health_check @@ -68,6 +69,8 @@ class AutoDeploy(object): self.dea_file = dea_file self.dha_file = dha_file self.fuel_plugins_dir = fuel_plugins_dir + self.fuel_plugins_conf_dir = fuel_plugins_conf_dir + self.no_plugins = no_plugins self.dea = (DeploymentEnvironmentAdapter(dea_file) if not cleanup_only else None) self.dha = DeploymentHardwareAdapter(dha_file) @@ -92,8 +95,8 @@ class AutoDeploy(object): def install_fuel_master(self): log('Install Fuel Master') - new_iso = '%s/deploy-%s' \ - % (self.tmp_dir, os.path.basename(self.iso_file)) + new_iso = ('%s/deploy-%s' + % (self.tmp_dir, os.path.basename(self.iso_file))) self.patch_iso(new_iso) self.iso_file = new_iso self.install_iso() @@ -103,14 +106,19 @@ class AutoDeploy(object): self.fuel_conf['ip'], self.fuel_username, self.fuel_password, self.fuel_node_id, self.iso_file, WORK_DIR, - self.fuel_plugins_dir) + self.fuel_plugins_dir, self.no_plugins) fuel.install() def patch_iso(self, new_iso): tmp_orig_dir = '%s/origiso' % self.tmp_dir tmp_new_dir = '%s/newiso' % self.tmp_dir - self.copy(tmp_orig_dir, tmp_new_dir) - self.patch(tmp_new_dir, new_iso) + try: + self.copy(tmp_orig_dir, tmp_new_dir) + self.patch(tmp_new_dir, new_iso) + except Exception as e: + exec_cmd('fusermount -u %s' % tmp_orig_dir, False) + delete(self.tmp_dir) + err(e) def copy(self, tmp_orig_dir, tmp_new_dir): log('Copying...') @@ -119,8 +127,7 @@ class AutoDeploy(object): exec_cmd('fuseiso %s %s' % (self.iso_file, tmp_orig_dir)) with cd(tmp_orig_dir): exec_cmd('find . | cpio -pd %s' % tmp_new_dir) - with cd(tmp_new_dir): - exec_cmd('fusermount -u %s' % tmp_orig_dir) + exec_cmd('fusermount -u %s' % tmp_orig_dir) delete(tmp_orig_dir) exec_cmd('chmod -R 755 %s' % tmp_new_dir) @@ -159,7 +166,8 @@ class AutoDeploy(object): def deploy_env(self): dep = CloudDeploy(self.dea, self.dha, self.fuel_conf['ip'], self.fuel_username, self.fuel_password, - self.dea_file, WORK_DIR, self.no_health_check) + self.dea_file, self.fuel_plugins_conf_dir, + WORK_DIR, self.no_health_check) return dep.deploy() def setup_execution_environment(self): @@ -271,6 +279,10 @@ def parse_arguments(): '[default: pxebr]') parser.add_argument('-p', dest='fuel_plugins_dir', action='store', help='Fuel Plugins directory') + parser.add_argument('-pc', dest='fuel_plugins_conf_dir', action='store', + help='Fuel Plugins Configuration directory') + parser.add_argument('-np', dest='no_plugins', action='store_true', + default=False, help='Do not install Fuel Plugins') args = parser.parse_args() log(args) @@ -294,13 +306,14 @@ def parse_arguments(): 'storage_dir': args.storage_dir, 'pxe_bridge': args.pxe_bridge, 'iso_file': args.iso_file, 'dea_file': args.dea_file, 'dha_file': args.dha_file, - 'fuel_plugins_dir': args.fuel_plugins_dir} + 'fuel_plugins_dir': args.fuel_plugins_dir, + 'fuel_plugins_conf_dir': args.fuel_plugins_conf_dir, + 'no_plugins': args.no_plugins} return kwargs def main(): kwargs = parse_arguments() - d = AutoDeploy(**kwargs) sys.exit(d.run()) diff --git a/fuel/deploy/deploy_env.py b/fuel/deploy/deploy_env.py index be8bed342..735ea66a3 100644 --- a/fuel/deploy/deploy_env.py +++ b/fuel/deploy/deploy_env.py @@ -13,20 +13,19 @@ import io import yaml import glob import time +import shutil from ssh_client import SSHClient -import common - -exec_cmd = common.exec_cmd -err = common.err -check_file_exists = common.check_file_exists -log = common.log -parse = common.parse -commafy = common.commafy -N = common.N -E = common.E -R = common.R -RO = common.RO + +from common import ( + err, + log, + parse, + N, + E, + R, + delete, +) CLOUD_DEPLOY_FILE = 'deploy.py' BLADE_RESTART_TIMES = 3 @@ -35,30 +34,48 @@ BLADE_RESTART_TIMES = 3 class CloudDeploy(object): def __init__(self, dea, dha, fuel_ip, fuel_username, fuel_password, - dea_file, work_dir, no_health_check): + dea_file, fuel_plugins_conf_dir, work_dir, no_health_check): self.dea = dea self.dha = dha self.fuel_ip = fuel_ip self.fuel_username = fuel_username self.fuel_password = fuel_password self.dea_file = dea_file + self.updated_dea_file = ( + '%s/.%s' % (os.path.dirname(self.dea_file), + os.path.basename(self.dea_file))) + shutil.copy2(self.dea_file, self.updated_dea_file) + self.fuel_plugins_conf_dir = fuel_plugins_conf_dir self.work_dir = work_dir self.no_health_check = no_health_check self.file_dir = os.path.dirname(os.path.realpath(__file__)) self.ssh = SSHClient(self.fuel_ip, self.fuel_username, self.fuel_password) - self.blade_node_file = '%s/blade_node.yaml' % self.file_dir self.node_ids = self.dha.get_node_ids() self.wanted_release = self.dea.get_property('wanted_release') self.blade_node_dict = {} self.macs_per_blade = {} + def merge_plugin_config_files_to_dea_file(self): + plugins_conf_dir = ( + self.fuel_plugins_conf_dir if self.fuel_plugins_conf_dir + else '%s/plugins_conf' % os.path.dirname(self.dea_file)) + if os.path.isdir(plugins_conf_dir): + with io.open(self.updated_dea_file) as stream: + updated_dea = yaml.load(stream) + for plugin_file in glob.glob('%s/*.yaml' % plugins_conf_dir): + with io.open(plugin_file) as stream: + plugin_conf = yaml.load(stream) + updated_dea['settings']['editable'].update(plugin_conf) + with io.open(self.updated_dea_file, 'w') as stream: + yaml.dump(updated_dea, stream, default_flow_style=False) + def upload_cloud_deployment_files(self): with self.ssh as s: s.exec_cmd('rm -rf %s' % self.work_dir, False) s.exec_cmd('mkdir %s' % self.work_dir) - s.scp_put(self.dea_file, self.work_dir) - s.scp_put(self.blade_node_file, self.work_dir) + s.scp_put(self.updated_dea_file, '%s/%s' % ( + self.work_dir, os.path.basename(self.dea_file))) s.scp_put('%s/common.py' % self.file_dir, self.work_dir) s.scp_put('%s/dea.py' % self.file_dir, self.work_dir) for f in glob.glob('%s/cloud/*' % self.file_dir): @@ -85,13 +102,9 @@ class CloudDeploy(object): log('START CLOUD DEPLOYMENT') deploy_app = '%s/%s' % (self.work_dir, deploy_app) dea_file = '%s/%s' % (self.work_dir, os.path.basename(self.dea_file)) - blade_node_file = '%s/%s' % ( - self.work_dir, os.path.basename(self.blade_node_file)) with self.ssh as s: - status = s.run( - 'python %s %s %s %s' % ( - deploy_app, ('-nh' if self.no_health_check else ''), - dea_file, blade_node_file)) + status = s.run('python %s %s %s' % ( + deploy_app, ('-nh' if self.no_health_check else ''), dea_file)) return status def check_supported_release(self): @@ -171,8 +184,11 @@ class CloudDeploy(object): err('Not all blades have been discovered: %s' % self.not_discovered_blades_summary()) - with io.open(self.blade_node_file, 'w') as stream: - yaml.dump(self.blade_node_dict, stream, default_flow_style=False) + with io.open(self.updated_dea_file) as stream: + updated_dea = yaml.load(stream) + updated_dea.update({'blade_node_map': self.blade_node_dict}) + with io.open(self.updated_dea_file, 'w') as stream: + yaml.dump(updated_dea, stream, default_flow_style=False) def discovery_waiting_loop(self, discovered_macs): WAIT_LOOP = 360 @@ -199,7 +215,7 @@ class CloudDeploy(object): if blade: log('Blade %s discovered as Node %s with MAC %s' % (blade, node[N['id']], node[N['mac']])) - self.blade_node_dict[blade] = node[N['id']] + self.blade_node_dict[blade] = int(node[N['id']]) def find_mac_in_dict(self, mac): for blade, mac_list in self.macs_per_blade.iteritems(): @@ -241,6 +257,10 @@ class CloudDeploy(object): self.wait_for_discovered_blades() + self.merge_plugin_config_files_to_dea_file() + self.upload_cloud_deployment_files() + delete(self.updated_dea_file) + return self.run_cloud_deploy(CLOUD_DEPLOY_FILE) diff --git a/fuel/deploy/dha_adapters/amt_adapter.py b/fuel/deploy/dha_adapters/amt_adapter.py index b92ec4ca6..02025b9dd 100644 --- a/fuel/deploy/dha_adapters/amt_adapter.py +++ b/fuel/deploy/dha_adapters/amt_adapter.py @@ -8,12 +8,14 @@ ############################################################################### -import common from hardware_adapter import HardwareAdapter -log = common.log -exec_cmd = common.exec_cmd -err = common.err +from common import ( + log, + exec_cmd, + err, +) + ''' This is hardware adapter for Intel AMT based system. It use amttool to interact diff --git a/fuel/deploy/dha_adapters/hardware_adapter.py b/fuel/deploy/dha_adapters/hardware_adapter.py index 29e04f182..2cd5ab842 100644 --- a/fuel/deploy/dha_adapters/hardware_adapter.py +++ b/fuel/deploy/dha_adapters/hardware_adapter.py @@ -7,6 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################### + import yaml import io diff --git a/fuel/deploy/dha_adapters/hp_adapter.py b/fuel/deploy/dha_adapters/hp_adapter.py index 51f55f32b..13bb3491a 100644 --- a/fuel/deploy/dha_adapters/hp_adapter.py +++ b/fuel/deploy/dha_adapters/hp_adapter.py @@ -8,11 +8,12 @@ ############################################################################### -import common from ipmi_adapter import IpmiAdapter from ssh_client import SSHClient -log = common.log +from common import ( + log, +) DEV = {'pxe': 'bootsource5', 'disk': 'bootsource3', diff --git a/fuel/deploy/dha_adapters/ipmi_adapter.py b/fuel/deploy/dha_adapters/ipmi_adapter.py index 25aa36ec9..8fda4f9f0 100644 --- a/fuel/deploy/dha_adapters/ipmi_adapter.py +++ b/fuel/deploy/dha_adapters/ipmi_adapter.py @@ -8,13 +8,14 @@ ############################################################################### -import common import time from hardware_adapter import HardwareAdapter -log = common.log -exec_cmd = common.exec_cmd -err = common.err +from common import ( + log, + exec_cmd, + err, +) class IpmiAdapter(HardwareAdapter): diff --git a/fuel/deploy/dha_adapters/libvirt_adapter.py b/fuel/deploy/dha_adapters/libvirt_adapter.py index b285c1676..d6a30d75e 100644 --- a/fuel/deploy/dha_adapters/libvirt_adapter.py +++ b/fuel/deploy/dha_adapters/libvirt_adapter.py @@ -8,13 +8,15 @@ ############################################################################### -import common from lxml import etree from hardware_adapter import HardwareAdapter -log = common.log -exec_cmd = common.exec_cmd -err = common.err +from common import ( + log, + exec_cmd, + err, + delete, +) DEV = {'pxe': 'network', 'disk': 'hd', @@ -80,7 +82,7 @@ class LibvirtAdapter(HardwareAdapter): with open(xml_file, 'w') as f: tree.write(f, pretty_print=True, xml_declaration=True) exec_cmd('virsh define %s' % xml_file) - exec_cmd('rm -fr %s' % temp_dir) + delete(temp_dir) def node_zero_mbr(self, node_id): vm_name = self.get_node_property(node_id, 'libvirtName') @@ -93,7 +95,7 @@ class LibvirtAdapter(HardwareAdapter): for source in sources: disk_file = source.get('file') disk_size = exec_cmd('ls -l %s' % disk_file).split()[4] - exec_cmd('rm -f %s' % disk_file) + delete(disk_file) exec_cmd('fallocate -l %s %s' % (disk_size, disk_file)) def node_eject_iso(self, node_id): diff --git a/fuel/deploy/environments/execution_environment.py b/fuel/deploy/environments/execution_environment.py index 63be5cd11..38e5bcdf7 100644 --- a/fuel/deploy/environments/execution_environment.py +++ b/fuel/deploy/environments/execution_environment.py @@ -9,16 +9,13 @@ from lxml import etree - -import common from dha_adapters.libvirt_adapter import LibvirtAdapter -exec_cmd = common.exec_cmd -err = common.err -log = common.log -check_dir_exists = common.check_dir_exists -check_file_exists = common.check_file_exists -check_if_root = common.check_if_root +from common import ( + exec_cmd, + log, + delete, +) class ExecutionEnvironment(object): @@ -51,7 +48,7 @@ class ExecutionEnvironment(object): exec_cmd('virsh destroy %s' % vm_name, False) exec_cmd('virsh undefine %s' % vm_name, False) for file in disk_files: - exec_cmd('rm -f %s' % file) + delete(file) def define_vm(self, vm_name, temp_vm_file, disk_path): log('Creating VM %s with disks %s' % (vm_name, disk_path)) diff --git a/fuel/deploy/environments/libvirt_environment.py b/fuel/deploy/environments/libvirt_environment.py index 785eeca7b..af2d3f8fb 100644 --- a/fuel/deploy/environments/libvirt_environment.py +++ b/fuel/deploy/environments/libvirt_environment.py @@ -10,16 +10,15 @@ from lxml import etree import glob - -import common from execution_environment import ExecutionEnvironment -exec_cmd = common.exec_cmd -err = common.err -log = common.log -check_dir_exists = common.check_dir_exists -check_file_exists = common.check_file_exists -check_if_root = common.check_if_root +from common import ( + exec_cmd, + log, + check_dir_exists, + check_file_exists, + delete, +) class LibvirtEnvironment(ExecutionEnvironment): @@ -56,7 +55,7 @@ class LibvirtEnvironment(ExecutionEnvironment): temp_vm_file = '%s/%s' % (temp_dir, vm_name) exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) self.define_vm(vm_name, temp_vm_file, disk_path) - exec_cmd('rm -fr %s' % temp_dir) + delete(temp_dir) def start_vms(self): for node_id in self.node_ids: @@ -95,6 +94,7 @@ class LibvirtEnvironment(ExecutionEnvironment): for node_id in self.node_ids: self.delete_vm(node_id) + def setup_environment(self): check_dir_exists(self.network_dir) self.cleanup_environment() diff --git a/fuel/deploy/environments/virtual_fuel.py b/fuel/deploy/environments/virtual_fuel.py index cb8be6371..705eee48b 100644 --- a/fuel/deploy/environments/virtual_fuel.py +++ b/fuel/deploy/environments/virtual_fuel.py @@ -9,14 +9,14 @@ from lxml import etree - -import common from execution_environment import ExecutionEnvironment -exec_cmd = common.exec_cmd -log = common.log -check_file_exists = common.check_file_exists -check_if_root = common.check_if_root +from common import ( + exec_cmd, + check_file_exists, + check_if_root, + delete, +) class VirtualFuel(ExecutionEnvironment): @@ -59,7 +59,7 @@ class VirtualFuel(ExecutionEnvironment): exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) self.set_vm_nic(temp_vm_file) self.define_vm(vm_name, temp_vm_file, disk_path) - exec_cmd('rm -fr %s' % temp_dir) + delete(temp_dir) def setup_environment(self): check_if_root() diff --git a/fuel/deploy/execution_environment.py b/fuel/deploy/execution_environment.py index cc6c33ea5..b2d268253 100644 --- a/fuel/deploy/execution_environment.py +++ b/fuel/deploy/execution_environment.py @@ -12,18 +12,9 @@ import yaml import io import os -import common from environments.libvirt_environment import LibvirtEnvironment from environments.virtual_fuel import VirtualFuel -exec_cmd = common.exec_cmd -err = common.err -log = common.log -check_dir_exists = common.check_dir_exists -check_file_exists = common.check_file_exists -check_if_root = common.check_if_root -ArgParser = common.ArgParser - class ExecutionEnvironment(object): diff --git a/fuel/deploy/install_fuel_master.py b/fuel/deploy/install_fuel_master.py index 0e3c1c044..1b82483eb 100644 --- a/fuel/deploy/install_fuel_master.py +++ b/fuel/deploy/install_fuel_master.py @@ -7,31 +7,33 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################### - -import common import time import os import glob from ssh_client import SSHClient from dha_adapters.libvirt_adapter import LibvirtAdapter -log = common.log -err = common.err -clean = common.clean -delete = common.delete +from common import ( + log, + err, + clean, + delete, +) TRANSPLANT_FUEL_SETTINGS = 'transplant_fuel_settings.py' BOOTSTRAP_ADMIN = '/usr/local/sbin/bootstrap_admin_node' FUEL_CLIENT_CONFIG = '/etc/fuel/client/config.yaml' PLUGINS_DIR = '~/plugins' LOCAL_PLUGIN_FOLDER = '/opt/opnfv' +IGNORABLE_FUEL_ERRORS = ['does not update installed package', + 'Couldn\'t resolve host'] class InstallFuelMaster(object): def __init__(self, dea_file, dha_file, fuel_ip, fuel_username, fuel_password, fuel_node_id, iso_file, work_dir, - fuel_plugins_dir): + fuel_plugins_dir, no_plugins): self.dea_file = dea_file self.dha = LibvirtAdapter(dha_file) self.fuel_ip = fuel_ip @@ -42,6 +44,7 @@ class InstallFuelMaster(object): self.iso_dir = os.path.dirname(self.iso_file) self.work_dir = work_dir self.fuel_plugins_dir = fuel_plugins_dir + self.no_plugins = no_plugins self.file_dir = os.path.dirname(os.path.realpath(__file__)) self.ssh = SSHClient(self.fuel_ip, self.fuel_username, self.fuel_password) @@ -90,11 +93,13 @@ class InstallFuelMaster(object): log('Waiting for one minute for Fuel to stabilize') time.sleep(60) - self.delete_deprecated_fuel_client_config_from_fuel_6_1() + self.delete_deprecated_fuel_client_config() + + if not self.no_plugins: - self.collect_plugin_files() + self.collect_plugin_files() - self.install_plugins() + self.install_plugins() self.post_install_cleanup() @@ -106,18 +111,21 @@ class InstallFuelMaster(object): if self.fuel_plugins_dir: for f in glob.glob('%s/*.rpm' % self.fuel_plugins_dir): s.scp_put(f, PLUGINS_DIR) - else: - s.exec_cmd('cp %s/*.rpm %s' % (LOCAL_PLUGIN_FOLDER, - PLUGINS_DIR)) def install_plugins(self): log('Installing Fuel Plugins') + plugin_files = [] with self.ssh as s: - r = s.exec_cmd('find %s -type f -name \'*.rpm\'' % PLUGINS_DIR) - for f in r.splitlines(): + for plugin_location in [PLUGINS_DIR, LOCAL_PLUGIN_FOLDER]: + r = s.exec_cmd('find %s -type f -name \'*.rpm\'' + % plugin_location) + plugin_files.extend(r.splitlines()) + for f in plugin_files: log('Found plugin %s, installing ...' % f) r, e = s.exec_cmd('fuel plugins --install %s' % f, False) - if e and 'does not update installed package' not in r: + printout = r + e if e else r + if e and all([err not in printout + for err in IGNORABLE_FUEL_ERRORS]): raise Exception('Installation of Fuel Plugin %s ' 'failed: %s' % (f, e)) @@ -130,7 +138,7 @@ class InstallFuelMaster(object): self.ssh.open() success = True break - except Exception as e: + except Exception: log('Trying to SSH into Fuel VM %s ... sleeping %s seconds' % (self.fuel_ip, SLEEP_TIME)) time.sleep(SLEEP_TIME) @@ -206,13 +214,11 @@ class InstallFuelMaster(object): log('Remove ISO directory %s' % self.iso_dir) delete(self.iso_dir) - def delete_deprecated_fuel_client_config_from_fuel_6_1(self): + def delete_deprecated_fuel_client_config(self): with self.ssh as s: response, error = s.exec_cmd('fuel -v', False) if (error and - 'DEPRECATION WARNING' in error and - '6.1.0' in error and - FUEL_CLIENT_CONFIG in error): + 'DEPRECATION WARNING' in error and FUEL_CLIENT_CONFIG in error): log('Delete deprecated fuel client config %s' % FUEL_CLIENT_CONFIG) with self.ssh as s: s.exec_cmd('rm %s' % FUEL_CLIENT_CONFIG, False) diff --git a/fuel/deploy/reap.py b/fuel/deploy/reap.py index c72b33cf9..b7080cdae 100644 --- a/fuel/deploy/reap.py +++ b/fuel/deploy/reap.py @@ -8,23 +8,24 @@ ############################################################################### -import common import time import os import yaml import glob import shutil -N = common.N -E = common.E -R = common.R -ArgParser = common.ArgParser -exec_cmd = common.exec_cmd -parse = common.parse -err = common.err -log = common.log -delete = common.delete -commafy = common.commafy +from common import ( + N, + E, + R, + ArgParser, + exec_cmd, + parse, + err, + log, + delete, + commafy, +) DEA_1 = ''' title: Deployment Environment Adapter (DEA) diff --git a/fuel/deploy/ssh_client.py b/fuel/deploy/ssh_client.py index 0f6b8c7ea..df780961f 100644 --- a/fuel/deploy/ssh_client.py +++ b/fuel/deploy/ssh_client.py @@ -9,13 +9,14 @@ import paramiko -import common import scp -TIMEOUT = 600 -log = common.log -err = common.err +from common import ( + log, + err, +) +TIMEOUT = 600 class SSHClient(object): @@ -58,7 +59,7 @@ class SSHClient(object): if check: if error: self.close() - err(error) + raise Exception(error) else: return response return response, error diff --git a/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/dea.yaml b/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/dea.yaml index 23b2809ae..b4e2f6bfb 100644 --- a/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/dea.yaml +++ b/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/dea.yaml @@ -557,58 +557,6 @@ settings: type: text value: '16' weight: 70 - opendaylight: - metadata: - enabled: true - label: OpenDaylight plugin - plugin_id: 1 - restrictions: - - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight - toggleable: true - weight: 70 - rest_api_port: - description: Port on which ODL REST API will be available. - label: Port number - regex: - error: Invalid port number - source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ - type: text - value: '8282' - weight: 40 - use_vxlan: - description: Configure neutron to use VXLAN tunneling - label: Use vxlan - restrictions: - - action: disable - condition: networking_parameters:segmentation_type == 'vlan' - message: Neutron with GRE segmentation required - type: checkbox - value: true - weight: 20 - vni_range_end: - description: VXLAN VNI IDs range end - label: VNI range end - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10000' - weight: 31 - vni_range_start: - description: VXLAN VNI IDs range start - label: VNI range start - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10' - weight: 30 provision: metadata: label: Provision diff --git a/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/plugins_conf/opendaylight.yaml b/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/plugins_conf/opendaylight.yaml new file mode 100644 index 000000000..1944814a6 --- /dev/null +++ b/fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/plugins_conf/opendaylight.yaml @@ -0,0 +1,52 @@ +opendaylight: + metadata: + enabled: true + label: OpenDaylight plugin + plugin_id: 1 + restrictions: + - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight + toggleable: true + weight: 70 + rest_api_port: + description: Port on which ODL REST API will be available. + label: Port number + regex: + error: Invalid port number + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '8282' + weight: 40 + use_vxlan: + description: Configure neutron to use VXLAN tunneling + label: Use vxlan + restrictions: + - action: disable + condition: networking_parameters:segmentation_type == 'vlan' + message: Neutron with GRE segmentation required + type: checkbox + value: true + weight: 20 + vni_range_end: + description: VXLAN VNI IDs range end + label: VNI range end + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10000' + weight: 31 + vni_range_start: + description: VXLAN VNI IDs range start + label: VNI range start + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10' + weight: 30 \ No newline at end of file diff --git a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/dea.yaml b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/dea.yaml index db29fe977..818030878 100644 --- a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/dea.yaml +++ b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/dea.yaml @@ -554,58 +554,6 @@ settings: type: text value: '16' weight: 70 - opendaylight: - metadata: - enabled: true - label: OpenDaylight plugin - plugin_id: 1 - restrictions: - - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight - toggleable: true - weight: 70 - rest_api_port: - description: Port on which ODL REST API will be available. - label: Port number - regex: - error: Invalid port number - source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ - type: text - value: '8282' - weight: 40 - use_vxlan: - description: Configure neutron to use VXLAN tunneling - label: Use vxlan - restrictions: - - action: disable - condition: networking_parameters:segmentation_type == 'vlan' - message: Neutron with GRE segmentation required - type: checkbox - value: true - weight: 20 - vni_range_end: - description: VXLAN VNI IDs range end - label: VNI range end - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10000' - weight: 31 - vni_range_start: - description: VXLAN VNI IDs range start - label: VNI range start - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10' - weight: 30 provision: metadata: label: Provision diff --git a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/plugins_conf/opendaylight.yaml b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/plugins_conf/opendaylight.yaml new file mode 100644 index 000000000..1944814a6 --- /dev/null +++ b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod1/plugins_conf/opendaylight.yaml @@ -0,0 +1,52 @@ +opendaylight: + metadata: + enabled: true + label: OpenDaylight plugin + plugin_id: 1 + restrictions: + - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight + toggleable: true + weight: 70 + rest_api_port: + description: Port on which ODL REST API will be available. + label: Port number + regex: + error: Invalid port number + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '8282' + weight: 40 + use_vxlan: + description: Configure neutron to use VXLAN tunneling + label: Use vxlan + restrictions: + - action: disable + condition: networking_parameters:segmentation_type == 'vlan' + message: Neutron with GRE segmentation required + type: checkbox + value: true + weight: 20 + vni_range_end: + description: VXLAN VNI IDs range end + label: VNI range end + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10000' + weight: 31 + vni_range_start: + description: VXLAN VNI IDs range start + label: VNI range start + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10' + weight: 30 \ No newline at end of file diff --git a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dea.yaml b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dea.yaml index 81cbcbf5f..dafce1051 100644 --- a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dea.yaml +++ b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/dea.yaml @@ -554,58 +554,6 @@ settings: type: text value: '16' weight: 70 - opendaylight: - metadata: - enabled: true - label: OpenDaylight plugin - plugin_id: 1 - restrictions: - - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight - toggleable: true - weight: 70 - rest_api_port: - description: Port on which ODL REST API will be available. - label: Port number - regex: - error: Invalid port number - source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ - type: text - value: '8282' - weight: 40 - use_vxlan: - description: Configure neutron to use VXLAN tunneling - label: Use vxlan - restrictions: - - action: disable - condition: networking_parameters:segmentation_type == 'vlan' - message: Neutron with GRE segmentation required - type: checkbox - value: true - weight: 20 - vni_range_end: - description: VXLAN VNI IDs range end - label: VNI range end - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10000' - weight: 31 - vni_range_start: - description: VXLAN VNI IDs range start - label: VNI range start - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10' - weight: 30 provision: metadata: label: Provision diff --git a/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/plugins_conf/opendaylight.yaml b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/plugins_conf/opendaylight.yaml new file mode 100644 index 000000000..183ef9ca9 --- /dev/null +++ b/fuel/deploy/templates/hardware_environment/conf/linux_foundation_lab/pod2/plugins_conf/opendaylight.yaml @@ -0,0 +1,52 @@ +opendaylight: + metadata: + enabled: true + label: OpenDaylight plugin + plugin_id: 1 + restrictions: + - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight + toggleable: true + weight: 70 + rest_api_port: + description: Port on which ODL REST API will be available. + label: Port number + regex: + error: Invalid port number + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '8282' + weight: 40 + use_vxlan: + description: Configure neutron to use VXLAN tunneling + label: Use vxlan + restrictions: + - action: disable + condition: networking_parameters:segmentation_type == 'vlan' + message: Neutron with GRE segmentation required + type: checkbox + value: true + weight: 20 + vni_range_end: + description: VXLAN VNI IDs range end + label: VNI range end + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10000' + weight: 31 + vni_range_start: + description: VXLAN VNI IDs range start + label: VNI range start + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10' + weight: 30 diff --git a/fuel/deploy/templates/hardware_environment/conf/opnfv_box/dea.yaml b/fuel/deploy/templates/hardware_environment/conf/opnfv_box/dea.yaml index 0895e4f1d..4966bf09e 100644 --- a/fuel/deploy/templates/hardware_environment/conf/opnfv_box/dea.yaml +++ b/fuel/deploy/templates/hardware_environment/conf/opnfv_box/dea.yaml @@ -555,58 +555,6 @@ settings: type: text value: '16' weight: 70 - opendaylight: - metadata: - enabled: true - label: OpenDaylight plugin - plugin_id: 1 - restrictions: - - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight - toggleable: true - weight: 70 - rest_api_port: - description: Port on which ODL REST API will be available. - label: Port number - regex: - error: Invalid port number - source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ - type: text - value: '8282' - weight: 40 - use_vxlan: - description: Configure neutron to use VXLAN tunneling - label: Use vxlan - restrictions: - - action: disable - condition: networking_parameters:segmentation_type == 'vlan' - message: Neutron with GRE segmentation required - type: checkbox - value: true - weight: 20 - vni_range_end: - description: VXLAN VNI IDs range end - label: VNI range end - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10000' - weight: 31 - vni_range_start: - description: VXLAN VNI IDs range start - label: VNI range start - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10' - weight: 30 provision: metadata: label: Provision diff --git a/fuel/deploy/templates/hardware_environment/conf/opnfv_box/plugins_conf/opendaylight.yaml b/fuel/deploy/templates/hardware_environment/conf/opnfv_box/plugins_conf/opendaylight.yaml new file mode 100644 index 000000000..183ef9ca9 --- /dev/null +++ b/fuel/deploy/templates/hardware_environment/conf/opnfv_box/plugins_conf/opendaylight.yaml @@ -0,0 +1,52 @@ +opendaylight: + metadata: + enabled: true + label: OpenDaylight plugin + plugin_id: 1 + restrictions: + - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight + toggleable: true + weight: 70 + rest_api_port: + description: Port on which ODL REST API will be available. + label: Port number + regex: + error: Invalid port number + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '8282' + weight: 40 + use_vxlan: + description: Configure neutron to use VXLAN tunneling + label: Use vxlan + restrictions: + - action: disable + condition: networking_parameters:segmentation_type == 'vlan' + message: Neutron with GRE segmentation required + type: checkbox + value: true + weight: 20 + vni_range_end: + description: VXLAN VNI IDs range end + label: VNI range end + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10000' + weight: 31 + vni_range_start: + description: VXLAN VNI IDs range start + label: VNI range start + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10' + weight: 30 diff --git a/fuel/deploy/templates/virtual_environment/conf/dea.yaml b/fuel/deploy/templates/virtual_environment/conf/dea.yaml index bc9a1f931..584a61e42 100644 --- a/fuel/deploy/templates/virtual_environment/conf/dea.yaml +++ b/fuel/deploy/templates/virtual_environment/conf/dea.yaml @@ -551,58 +551,6 @@ settings: type: text value: '16' weight: 70 - opendaylight: - metadata: - enabled: true - label: OpenDaylight plugin - plugin_id: 1 - restrictions: - - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight - toggleable: true - weight: 70 - rest_api_port: - description: Port on which ODL REST API will be available. - label: Port number - regex: - error: Invalid port number - source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ - type: text - value: '8282' - weight: 40 - use_vxlan: - description: Configure neutron to use VXLAN tunneling - label: Use vxlan - restrictions: - - action: disable - condition: networking_parameters:segmentation_type == 'vlan' - message: Neutron with GRE segmentation required - type: checkbox - value: true - weight: 20 - vni_range_end: - description: VXLAN VNI IDs range end - label: VNI range end - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10000' - weight: 31 - vni_range_start: - description: VXLAN VNI IDs range start - label: VNI range start - regex: - error: Invalid ID number - source: ^\d+$ - restrictions: - - action: hide - condition: networking_parameters:segmentation_type == 'vlan' - type: text - value: '10' - weight: 30 provision: metadata: label: Provision diff --git a/fuel/deploy/templates/virtual_environment/conf/plugins_conf/opendaylight.yaml b/fuel/deploy/templates/virtual_environment/conf/plugins_conf/opendaylight.yaml new file mode 100644 index 000000000..183ef9ca9 --- /dev/null +++ b/fuel/deploy/templates/virtual_environment/conf/plugins_conf/opendaylight.yaml @@ -0,0 +1,52 @@ +opendaylight: + metadata: + enabled: true + label: OpenDaylight plugin + plugin_id: 1 + restrictions: + - cluster:net_provider != 'neutron': Only neutron is supported by OpenDaylight + toggleable: true + weight: 70 + rest_api_port: + description: Port on which ODL REST API will be available. + label: Port number + regex: + error: Invalid port number + source: ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + type: text + value: '8282' + weight: 40 + use_vxlan: + description: Configure neutron to use VXLAN tunneling + label: Use vxlan + restrictions: + - action: disable + condition: networking_parameters:segmentation_type == 'vlan' + message: Neutron with GRE segmentation required + type: checkbox + value: true + weight: 20 + vni_range_end: + description: VXLAN VNI IDs range end + label: VNI range end + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10000' + weight: 31 + vni_range_start: + description: VXLAN VNI IDs range start + label: VNI range start + regex: + error: Invalid ID number + source: ^\d+$ + restrictions: + - action: hide + condition: networking_parameters:segmentation_type == 'vlan' + type: text + value: '10' + weight: 30 diff --git a/fuel/deploy/transplant_fuel_settings.py b/fuel/deploy/transplant_fuel_settings.py index d2aece87a..e57a4fbc6 100644 --- a/fuel/deploy/transplant_fuel_settings.py +++ b/fuel/deploy/transplant_fuel_settings.py @@ -9,12 +9,13 @@ import sys -import common import io import yaml from dea import DeploymentEnvironmentAdapter -check_file_exists = common.check_file_exists +from common import ( + check_file_exists, +) ASTUTE_YAML = '/etc/fuel/astute.yaml' -- 2.16.6