From b6896a9bbfd7d4825f6b68b594441a3e0be7b85f Mon Sep 17 00:00:00 2001 From: Feng Pan Date: Mon, 11 Sep 2017 15:58:49 -0400 Subject: re-enable support for fdio dvr scenario - Update FDIO scenarios to use master branch images - Update VPP/HC version to master for all fdio scenarios apex-os-net-config: Ie6aee86eaccad5fc98820a28f10adc7475cc5e33 apex-tripleo-heat-templates: Ie8b284f64bd6491c389129d8afdaeae8a399b607 apex-puppet-tripleo: I9954240529278e74d93fdf89d2ebc2536249245a Change-Id: I31740f97052947b5e4688cca47320bc49a902d7c Signed-off-by: Feng Pan (cherry picked from commit a3c2c8c746470c993d70d92d13415e2b4263cc25) --- apex/overcloud/overcloud_deploy.py | 77 +++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 21 deletions(-) (limited to 'apex/overcloud/overcloud_deploy.py') diff --git a/apex/overcloud/overcloud_deploy.py b/apex/overcloud/overcloud_deploy.py index a0a66701..ec07b33d 100644 --- a/apex/overcloud/overcloud_deploy.py +++ b/apex/overcloud/overcloud_deploy.py @@ -35,6 +35,7 @@ SDN_FILE_MAP = { 'gluon': 'gluon.yaml', 'vpp': { 'odl_vpp_netvirt': 'neutron-opendaylight-netvirt-vpp.yaml', + 'dvr': 'neutron-opendaylight-fdio-dvr.yaml', 'default': 'neutron-opendaylight-honeycomb.yaml' }, 'default': 'neutron-opendaylight.yaml', @@ -92,6 +93,34 @@ def build_sdn_env_list(ds, sdn_map, env_list=None): return env_list +def _get_node_counts(inventory): + """ + Return numbers of controller and compute nodes in inventory + + :param inventory: node inventory data structure + :return: number of controller and compute nodes in inventory + """ + if not inventory: + raise ApexDeployException("Empty inventory") + + nodes = inventory['nodes'] + num_control = 0 + num_compute = 0 + for node in nodes: + if node['capabilities'] == 'profile:control': + num_control += 1 + elif node['capabilities'] == 'profile:compute': + num_compute += 1 + else: + # TODO(trozet) do we want to allow capabilities to not exist? + logging.error("Every node must include a 'capabilities' key " + "tagged with either 'profile:control' or " + "'profile:compute'") + raise ApexDeployException("Node missing capabilities " + "key: {}".format(node)) + return num_control, num_compute + + def create_deploy_cmd(ds, ns, inv, tmp_dir, virtual, env_file='opnfv-environment.yaml'): @@ -117,21 +146,7 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir, else: deploy_options.append('baremetal-environment.yaml') - nodes = inv['nodes'] - num_control = 0 - num_compute = 0 - for node in nodes: - if 'profile:control' in node['capabilities']: - num_control += 1 - elif 'profile:compute' in node['capabilities']: - num_compute += 1 - else: - # TODO(trozet) do we want to allow capabilities to not exist? - logging.error("Every node must include a 'capabilities' key " - "tagged with either 'profile:control' or " - "'profile:compute'") - raise ApexDeployException("Node missing capabilities " - "key: {}".format(node)) + num_control, num_compute = _get_node_counts(inv) if num_control == 0 or num_compute == 0: logging.error("Detected 0 control or compute nodes. Control nodes: " "{}, compute nodes{}".format(num_control, num_compute)) @@ -234,13 +249,22 @@ def prep_image(ds, img, tmp_dir, root_pw=None): if ds_opts['odl_version'] != con.DEFAULT_ODL_VERSION: virt_cmds.extend([ {con.VIRT_RUN_CMD: "yum -y remove opendaylight"}, - {con.VIRT_RUN_CMD: "yum -y install /root/{}/*".format( - ds_opts['odl_version'])}, {con.VIRT_RUN_CMD: "rm -rf /etc/puppet/modules/opendaylight"}, {con.VIRT_RUN_CMD: "cd /etc/puppet/modules && tar xzf " "/root/puppet-opendaylight-" "{}.tar.gz".format(ds_opts['odl_version'])} ]) + if ds_opts['odl_version'] == 'master': + virt_cmds.extend([ + {con.VIRT_RUN_CMD: "rpm -ivh --nodeps /root/{}/*".format( + ds_opts['odl_version'])} + ]) + else: + virt_cmds.extend([ + {con.VIRT_RUN_CMD: "yum -y install /root/{}/*".format( + ds_opts['odl_version'])} + ]) + elif sdn == 'opendaylight' and 'odl_vpp_netvirt' in ds_opts \ and ds_opts['odl_vpp_netvirt']: virt_cmds.extend([ @@ -288,11 +312,12 @@ def make_ssh_key(): return private_key.decode('utf-8'), pub_key -def prep_env(ds, ns, opnfv_env, net_env, tmp_dir): +def prep_env(ds, ns, inv, opnfv_env, net_env, tmp_dir): """ Creates modified opnfv/network environments for deployment :param ds: deploy settings :param ns: network settings + :param inv: node inventory :param opnfv_env: file path for opnfv-environment file :param net_env: file path for network-environment file :param tmp_dir: Apex tmp dir @@ -350,10 +375,9 @@ def prep_env(ds, ns, opnfv_env, net_env, tmp_dir): output_line = " key: '{}'".format(public_key) if ds_opts['sdn_controller'] == 'opendaylight' and \ - 'odl_vpp_routing_node' in ds_opts and ds_opts[ - 'odl_vpp_routing_node'] != 'dvr': + 'odl_vpp_routing_node' in ds_opts: if 'opendaylight::vpp_routing_node' in line: - output_line = (" opendaylight::vpp_routing_node: ${}.${}" + output_line = (" opendaylight::vpp_routing_node: {}.{}" .format(ds_opts['odl_vpp_routing_node'], ns['domain_name'])) elif 'ControllerExtraConfig' in line: @@ -372,6 +396,17 @@ def prep_env(ds, ns, opnfv_env, net_env, tmp_dir): if 'NeutronVPPAgentPhysnets' in line: output_line = (" NeutronVPPAgentPhysnets: 'datacentre:{}'". format(tenant_ctrl_nic)) + elif ds_opts['sdn_controller'] == 'opendaylight' and ds_opts.get( + 'dvr') is True: + if 'OS::TripleO::Services::NeutronDhcpAgent' in line: + output_line = '' + elif 'NeutronDhcpAgentsPerNetwork' in line: + num_control, num_compute = _get_node_counts(inv) + output_line = (" NeutronDhcpAgentsPerNetwork: {}" + .format(num_compute)) + elif 'ComputeServices' in line: + output_line = (" ComputeServices:\n" + " - OS::TripleO::Services::NeutronDhcpAgent") if perf: for role in 'NovaCompute', 'Controller': -- cgit 1.2.3-korg