def create_l2_agent_manifests(config, messages): global network_hosts, compute_hosts agent = config["CONFIG_NEUTRON_L2_AGENT"] # CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS will be available only for ML2 # plugin deployment, but we need CONFIG_NEUTRON_USE_L2POPULATION also # for other plugin template generation if ('l2population' in config.get('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS', [])): config['CONFIG_NEUTRON_USE_L2POPULATION'] = True else: config['CONFIG_NEUTRON_USE_L2POPULATION'] = False if agent == "openvswitch": ovs_type = 'CONFIG_NEUTRON_ML2_TYPE_DRIVERS' ovs_type = config.get(ovs_type, 'local') tunnel = use_openvswitch_vxlan(config) or use_openvswitch_gre(config) config["CONFIG_NEUTRON_OVS_TUNNELING"] = tunnel tunnel_types = set(ovs_type) & set(['gre', 'vxlan']) config["CONFIG_NEUTRON_OVS_TUNNEL_TYPES"] = list(tunnel_types) template_name = "neutron_ovs_agent" bm_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"]) iface_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"]) # The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a # comma-separated list of bridge mappings. Since the puppet module # expects this parameter to be an array, this parameter must be # properly formatted by packstack, then consumed by the puppet module. # For example, the input string 'A, B' should formatted as '['A','B']'. config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = bm_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = [] # Bridge configuration and mappings for compute nodes can be different. # Parameter CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE contains the list of # bridge names, included in bridge mappings and bridge interfaces, that # must be created in compute nodes. brd_arr_cmp = get_values(config["CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE"]) if_arr_cmp = [] mapp_arr_cmp = [] for brd in brd_arr_cmp: if_arr_cmp.append(common.find_pair_with(iface_arr, brd, 0)) mapp_arr_cmp.append(common.find_pair_with(bm_arr, brd, 1)) config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE"] = mapp_arr_cmp config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = [] elif agent == "linuxbridge": host_var = 'CONFIG_NEUTRON_LB_HOST' template_name = 'neutron_lb_agent' else: raise KeyError("Unknown layer2 agent") no_local_types = set(ovs_type) & set(['gre', 'vxlan', 'vlan', 'flat']) no_tunnel_types = set(ovs_type) & set(['vlan', 'flat']) for host in network_hosts | compute_hosts: manifestfile = "%s_neutron.pp" % (host,) manifestdata = "$cfg_neutron_ovs_host = '%s'\n" % host # NICs connected to OVS bridges can be required in network nodes if # vlan, flat, vxlan or gre are enabled. For compute nodes, they are # only required if vlan or flat are enabled. if ( agent == "openvswitch" and ( (host in network_hosts and no_local_types) or no_tunnel_types) ): if config['CONFIG_USE_SUBNETS'] == 'y': iface_arr = [ common.cidr_to_ifname(i, host, config) for i in iface_arr ] if_arr_cmp = [ common.cidr_to_ifname(i, host, config) for i in if_arr_cmp ] config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = iface_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = if_arr_cmp manifestdata += "$create_bridges = true\n" else: manifestdata += "$create_bridges = false\n" is_network_host = str(host in network_hosts).lower() manifestdata += "$network_host = %s\n" % is_network_host manifestdata += getManifestTemplate(template_name) appendManifestFile(manifestfile, manifestdata + "\n") # Additional configurations required for compute hosts and # network hosts. manifestdata = getManifestTemplate('neutron_bridge_module') appendManifestFile(manifestfile, manifestdata + '\n')
def create_l2_agent_manifests(config, messages): global network_hosts, compute_hosts agent = config["CONFIG_NEUTRON_L2_AGENT"] # CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS will be available only for ML2 # plugin deployment, but we need CONFIG_NEUTRON_USE_L2POPULATION also # for other plugin template generation if ('l2population' in config.get('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS', [])): config['CONFIG_NEUTRON_USE_L2POPULATION'] = True else: config['CONFIG_NEUTRON_USE_L2POPULATION'] = False if agent == "openvswitch": ovs_type = 'CONFIG_NEUTRON_ML2_TYPE_DRIVERS' ovs_type = config.get(ovs_type, 'local') tunnel = use_openvswitch_vxlan(config) or use_openvswitch_gre(config) config["CONFIG_NEUTRON_OVS_TUNNELING"] = tunnel tunnel_types = set(ovs_type) & set(['gre', 'vxlan']) config["CONFIG_NEUTRON_OVS_TUNNEL_TYPES"] = list(tunnel_types) template_name = "neutron_ovs_agent" bm_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"]) iface_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"]) # The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a # comma-separated list of bridge mappings. Since the puppet module # expects this parameter to be an array, this parameter must be # properly formatted by packstack, then consumed by the puppet module. # For example, the input string 'A, B' should formatted as '['A','B']'. config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = bm_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = [] # Bridge configuration and mappings for compute nodes can be different. # Parameter CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE contains the list of # bridge names, included in bridge mappings and bridge interfaces, that # must be created in compute nodes. brd_arr_cmp = get_values(config["CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE"]) if_arr_cmp = [] mapp_arr_cmp = [] for brd in brd_arr_cmp: if_arr_cmp.append(common.find_pair_with(iface_arr, brd, 0)) mapp_arr_cmp.append(common.find_pair_with(bm_arr, brd, 1)) config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE"] = mapp_arr_cmp config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = [] elif agent == "linuxbridge": host_var = 'CONFIG_NEUTRON_LB_HOST' template_name = 'neutron_lb_agent' else: raise KeyError("Unknown layer2 agent") no_local_types = set(ovs_type) & set(['gre', 'vxlan', 'vlan', 'flat']) no_tunnel_types = set(ovs_type) & set(['vlan', 'flat']) for host in network_hosts | compute_hosts: manifestfile = "%s_neutron.pp" % (host, ) manifestdata = "$cfg_neutron_ovs_host = '%s'\n" % host # NICs connected to OVS bridges can be required in network nodes if # vlan, flat, vxlan or gre are enabled. For compute nodes, they are # only required if vlan or flat are enabled. if (agent == "openvswitch" and ((host in network_hosts and no_local_types) or no_tunnel_types)): if config['CONFIG_USE_SUBNETS'] == 'y': iface_arr = [ common.cidr_to_ifname(i, host, config) for i in iface_arr ] if_arr_cmp = [ common.cidr_to_ifname(i, host, config) for i in if_arr_cmp ] config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = iface_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = if_arr_cmp manifestdata += "$create_bridges = true\n" else: manifestdata += "$create_bridges = false\n" is_network_host = str(host in network_hosts).lower() manifestdata += "$network_host = %s\n" % is_network_host manifestdata += getManifestTemplate(template_name) appendManifestFile(manifestfile, manifestdata + "\n") # Additional configurations required for compute hosts and # network hosts. manifestdata = getManifestTemplate('neutron_bridge_module') appendManifestFile(manifestfile, manifestdata + '\n')
def create_l2_agent_manifests(config, messages): global network_hosts, compute_hosts agent = config["CONFIG_NEUTRON_L2_AGENT"] # CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS will be available only for ML2 # plugin deployment, but we need CONFIG_NEUTRON_USE_L2POPULATION also # for other plugin template generation if ('l2population' in config.get('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS', [])): config['CONFIG_NEUTRON_USE_L2POPULATION'] = True else: config['CONFIG_NEUTRON_USE_L2POPULATION'] = False if agent in ["openvswitch", "ovn"]: ovs_type = 'CONFIG_NEUTRON_ML2_TYPE_DRIVERS' ovs_type = config.get(ovs_type, 'local') tunnel_types = set(ovs_type) & set(['gre', 'vxlan']) config["CONFIG_NEUTRON_OVS_TUNNEL_TYPES"] = list(tunnel_types) bm_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"]) iface_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"]) # The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a # comma-separated list of bridge mappings. Since the puppet module # expects this parameter to be an array, this parameter must be # properly formatted by packstack, then consumed by the puppet module. # For example, the input string 'A, B' should formatted as '['A','B']'. config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = bm_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = [] # Bridge configuration and mappings for compute nodes can be different. # Parameter CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE contains the list of # bridge names, included in bridge mappings and bridge interfaces, that # must be created in compute nodes. brd_arr_cmp = get_values(config["CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE"]) if_arr_cmp = [] mapp_arr_cmp = [] for brd in brd_arr_cmp: if_arr_cmp.append(common.find_pair_with(iface_arr, brd, 0)) mapp_arr_cmp.append(common.find_pair_with(bm_arr, brd, 1)) config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE"] = mapp_arr_cmp config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = [] no_local_types = set(ovs_type) & set(['gre', 'vxlan', 'vlan', 'flat']) no_tunnel_types = set(ovs_type) & set(['vlan', 'flat']) elif agent == "linuxbridge": host_var = 'CONFIG_NEUTRON_LB_HOST' else: raise KeyError("Unknown layer2 agent") for host in network_hosts | compute_hosts: # NICs connected to OVS bridges can be required in network nodes if # vlan, flat, vxlan or gre are enabled. For compute nodes, they are # only required if vlan or flat are enabled. if (agent in ["openvswitch", "ovn"] and ((host in network_hosts and no_local_types) or no_tunnel_types)): if config['CONFIG_USE_SUBNETS'] == 'y': iface_arr = [ common.cidr_to_ifname(i, host, config) for i in iface_arr ] if_arr_cmp = [ common.cidr_to_ifname(i, host, config) for i in if_arr_cmp ] config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = iface_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = if_arr_cmp config['CREATE_BRIDGES'] = 'y' else: config['CREATE_BRIDGES'] = 'n'
def create_l2_agent_manifests(config, messages): global network_hosts, compute_hosts agent = config["CONFIG_NEUTRON_L2_AGENT"] # CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS will be available only for ML2 # plugin deployment, but we need CONFIG_NEUTRON_USE_L2POPULATION also # for other plugin template generation if ('l2population' in config.get('CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS', [])): config['CONFIG_NEUTRON_USE_L2POPULATION'] = True else: config['CONFIG_NEUTRON_USE_L2POPULATION'] = False if agent in ["openvswitch", "ovn"]: ovs_type = 'CONFIG_NEUTRON_ML2_TYPE_DRIVERS' ovs_type = config.get(ovs_type, 'local') tunnel_types = set(ovs_type) & set(['gre', 'vxlan']) config["CONFIG_NEUTRON_OVS_TUNNEL_TYPES"] = list(tunnel_types) bm_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"]) iface_arr = get_values(config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"]) # The CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS parameter contains a # comma-separated list of bridge mappings. Since the puppet module # expects this parameter to be an array, this parameter must be # properly formatted by packstack, then consumed by the puppet module. # For example, the input string 'A, B' should formatted as '['A','B']'. config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"] = bm_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = [] # Bridge configuration and mappings for compute nodes can be different. # Parameter CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE contains the list of # bridge names, included in bridge mappings and bridge interfaces, that # must be created in compute nodes. brd_arr_cmp = get_values(config["CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE"]) if_arr_cmp = [] mapp_arr_cmp = [] for brd in brd_arr_cmp: if_arr_cmp.append(common.find_pair_with(iface_arr, brd, 0)) mapp_arr_cmp.append(common.find_pair_with(bm_arr, brd, 1)) config["CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS_COMPUTE"] = mapp_arr_cmp config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = [] no_local_types = set(ovs_type) & set(['gre', 'vxlan', 'vlan', 'flat']) no_tunnel_types = set(ovs_type) & set(['vlan', 'flat']) elif agent == "linuxbridge": host_var = 'CONFIG_NEUTRON_LB_HOST' else: raise KeyError("Unknown layer2 agent") for host in network_hosts | compute_hosts: # NICs connected to OVS bridges can be required in network nodes if # vlan, flat, vxlan or gre are enabled. For compute nodes, they are # only required if vlan or flat are enabled. if ( agent in ["openvswitch", "ovn"] and ( (host in network_hosts and no_local_types) or no_tunnel_types) ): if config['CONFIG_USE_SUBNETS'] == 'y': iface_arr = [ common.cidr_to_ifname(i, host, config) for i in iface_arr ] if_arr_cmp = [ common.cidr_to_ifname(i, host, config) for i in if_arr_cmp ] config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES"] = iface_arr config["CONFIG_NEUTRON_OVS_BRIDGE_IFACES_COMPUTE"] = if_arr_cmp config['CREATE_BRIDGES'] = 'y' else: config['CREATE_BRIDGES'] = 'n'