From 3bc3a8828c3ceefedd08e1767ae6e3bf2df9ac22 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Wed, 23 Aug 2017 15:05:02 +0800 Subject: Support multiple physnet mapping JIRA: COMPASS-559 1. support multiple mapping in provider_net_mappings of network.yml and create corresponding ovs bridges 2. support seperate config in sys_intf_mappings of network.yml 3. remove linux bridges in compute nodes for ovs port binding convenience 4. support openstack vlan tenant network 5. modify odl and odl_sfc roles to use configurable provider mapping 6. remove some hard coding Change-Id: Ib57484ce60d029f89c647fd5baf2c7af37c85d0b Signed-off-by: Harry Huang --- .../config-osa/templates/create-flavor.yml.j2 | 15 ------ .../config-osa/templates/create-network.yml.j2 | 41 --------------- .../templates/openstack_user_config.yml.j2 | 58 +++++++++++++--------- .../config-osa/templates/user_variables.yml.j2 | 18 +++++-- 4 files changed, 48 insertions(+), 84 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 delete mode 100644 deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 (limited to 'deploy/adapters/ansible/roles/config-osa/templates') diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 deleted file mode 100644 index b33cd414..00000000 --- a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -############################################################################## ---- -- name: Create flavor - hosts: utility_container[0] - max_fail_percentage: 20 - user: root - roles: - - os-flavor diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 deleted file mode 100644 index 301bf9da..00000000 --- a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD 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 -############################################################################## ---- -- name: Create external network - hosts: utility_container[0] - max_fail_percentage: 20 - user: root - tasks: - - name: create external net - shell: | - . /root/openrc; - openstack network create --external \ - --provider-physical-network {{ public_net_info.provider_network }} \ - --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; - when: {{ public_net_info.enable }} == True - and "{{ public_net_info.type }}" == "flat" - - - name: create external net - shell: | - . /root/openrc; - openstack network create --external \ - --network-segment {{ public_net_info.segment_id }} \ - --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; - when: {{public_net_info.enable}} == True - and "{{ public_net_info.type }}" != "flat" - - - name: create external subnet - shell: | - . /root/openrc; - openstack subnet create --network "{{ public_net_info.network }}" \ - --allocation-pool \ - start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \ - --gateway "{{ public_net_info.external_gw }}" \ - --subnet-range "{{ public_net_info.floating_ip_cidr }}" \ - "{{ public_net_info.subnet }}" diff --git a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 index d69674f2..cadf5308 100644 --- a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 +++ b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 @@ -15,7 +15,23 @@ used_ips: {% endif %} {% endfor %} - "{{ internal_vip.ip }}" + - "{{ public_vip.ip }}" +{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} +{% set neutron_agent = "neutron_linuxbridge_agent" %} +{% else %} +{% set neutron_agent = "neutron_openvswitch_agent" %} +{% endif %} +{% set provider_net_mappings = network_cfg["provider_net_mappings"] %} +{% set public_net_info = network_cfg["public_net_info"] %} +{% set ext_physnet = public_net_info["provider_network"] %} +{% set ext_type = public_net_info["type"] %} +{% set ext_intf = [] %} +{% for item in provider_net_mappings %} +{% if item["network"] == ext_physnet %} +{% set _ = ext_intf.append(item["interface"]) %} +{% endif %} +{% endfor %} global_overrides: internal_lb_vip_address: {{ internal_vip.ip }} external_lb_vip_address: {{ public_vip.ip }} @@ -33,46 +49,40 @@ global_overrides: - hosts is_container_address: true is_ssh_address: true +{% if tenant_net_info["type"] == "vxlan" %} - network: container_bridge: "br-tenant" container_type: "veth" - container_interface: "eth10" + container_interface: "eth2" ip_from_q: "tunnel" type: "vxlan" - range: "1:1000" + range: "{{ tenant_net_info["range"] }}" net_name: "vxlan" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent + - {{ neutron_agent }} {% endif %} - network: container_bridge: "br-external" container_type: "veth" - container_interface: "eth12" - host_bind_override: "eth12" - type: "flat" - net_name: "{{ public_net_info.provider_network }}" + container_interface: "{{ ext_intf[0] }}" + host_bind_override: "{{ ext_intf[0] }}" + type: "{{ ext_type }}" + net_name: "{{ ext_physnet }}" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent -{% endif %} + - {{ neutron_agent }} +{% for item in provider_net_mappings %} +{% if item["network"] != ext_physnet and "controller" in item["role"] %} - network: - container_bridge: "br-external" + container_bridge: "br-tenant" container_type: "veth" - container_interface: "eth11" - type: "vlan" - range: "1:1" - net_name: "vlan" + container_interface: "{{ item["interface"] }}" + host_bind_override: "{{ item["interface"] }}" + type: "flat" + net_name: "{{ item["network"] }}" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent + - {{ neutron_agent }} {% endif %} +{% endfor %} - network: container_bridge: "br-storage" container_type: "veth" diff --git a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 index a6cefd71..e43aa22c 100644 --- a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 +++ b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 @@ -41,11 +41,21 @@ openstack_host_specific_kernel_modules: neutron_plugin_type: ml2.ovs -neutron_ml2_drivers_type: "local,flat,vlan,vxlan" +neutron_ml2_drivers_type: "local,flat,{{ tenant_net_info['type'] }}" neutron_provider_networks: network_flat_networks: "*" - network_types: "vxlan" - network_vxlan_ranges: "1:1000" - network_mappings: "physnet:br-provider" + network_types: "{{ tenant_net_info['type'] }}" +{% if tenant_net_info["type"] == "vxlan" %} + network_vxlan_ranges: "{{ tenant_net_info['range'] }}" +{% endif %} +{% if tenant_net_info["type"] == "vlan" %} + network_vlan_ranges: "{{tenant_net_info['provider_network']}}:{{tenant_net_info['range']}}" +{% endif %} +{% set controller_mappings = [] %} +{% for key, value in contr_prv_mappings.iteritems() %} +{% set mapping = key + ":" + value["bridge"] %} +{% set _ = controller_mappings.append(mapping) %} +{% endfor %} + network_mappings: "{{ ','.join(controller_mappings) }}" {% endif %} -- cgit 1.2.3-korg