aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-08-23 15:05:02 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2017-09-01 16:31:01 +0800
commit3bc3a8828c3ceefedd08e1767ae6e3bf2df9ac22 (patch)
tree7413e99b2d9ddbadc782a5e9f68a6f1ba35570b1
parent292985dab007c3ee1c3481c985871a3483d9f7bc (diff)
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 <huangxiangyu5@huawei.com>
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml42
-rw-r--r--deploy/adapters/ansible/roles/config-compute/templates/compute.j224
-rwxr-xr-xdeploy/adapters/ansible/roles/config-controller/templates/controller.j224
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml28
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml17
-rw-r--r--deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml64
-rwxr-xr-xdeploy/adapters/ansible/roles/config-osa/tasks/main.yml25
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j241
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j258
-rw-r--r--deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j218
-rw-r--r--deploy/adapters/ansible/roles/post-openstack/tasks/main.yml72
-rwxr-xr-xdeploy/adapters/ansible/roles/post-osa/handlers/main.yml11
-rw-r--r--deploy/adapters/ansible/roles/post-osa/tasks/main.yml12
-rwxr-xr-xdeploy/adapters/ansible/roles/post-osa/templates/compute.j262
-rw-r--r--deploy/adapters/ansible/roles/process-openrc/tasks/main.yml (renamed from deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml)49
-rw-r--r--deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml (renamed from deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2)17
-rw-r--r--deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml65
-rw-r--r--deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml49
-rw-r--r--deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml22
-rw-r--r--deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml12
-rwxr-xr-xdeploy/compass_conf/package_metadata/openstack.conf26
-rwxr-xr-xdeploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl59
-rw-r--r--deploy/conf/hardware_environment/huawei-pod1/network.yml12
-rw-r--r--deploy/conf/vm_environment/huawei-virtual1/network.yml12
-rw-r--r--deploy/conf/vm_environment/huawei-virtual2/network.yml12
-rw-r--r--deploy/conf/vm_environment/huawei-virtual8/network.yml12
-rw-r--r--deploy/conf/vm_environment/huawei-virtual9/network.yml12
-rw-r--r--deploy/conf/vm_environment/network.yml12
-rwxr-xr-xplugins/moon/roles/moon/templates/compute.j225
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/files/opendaylight.service (renamed from plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/handlers/main.yml (renamed from plugins/odl_cluster/roles/odl_cluster/handlers/main.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml)43
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml)37
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml)8
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/main.yml4
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/main.yml)7
-rwxr-xr-x[-rw-r--r--]plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml46
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh (renamed from plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/templates/custom.properties (renamed from plugins/odl_cluster/roles/odl_cluster/templates/custom.properties)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh (renamed from plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg (renamed from plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/vars/Debian.yml (renamed from plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/vars/RedHat.yml (renamed from plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml)0
-rwxr-xr-xplugins/odl_cluster/roles/setup-odl/vars/main.yml (renamed from plugins/odl_cluster/roles/odl_cluster/vars/main.yml)2
-rw-r--r--plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml25
-rw-r--r--plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j212
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml)43
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml (renamed from plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml)37
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml)8
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml)0
-rwxr-xr-xplugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml4
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml)7
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml)0
-rwxr-xr-xplugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml46
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh)0
-rwxr-xr-xplugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml)0
-rwxr-xr-x[-rw-r--r--]plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml (renamed from plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml)0
-rw-r--r--plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j213
-rw-r--r--plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml20
81 files changed, 779 insertions, 477 deletions
diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
index f253afcc..741c5bf1 100644
--- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
+++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
@@ -1,11 +1,11 @@
-# #############################################################################
+##############################################################################
# Copyright (c) 2017 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
-# #############################################################################
+##############################################################################
---
- hosts: all
remote_user: root
@@ -38,11 +38,47 @@
- setup-infrastructure
- setup-openstack
- sync-inventory
+
+- hosts: compute
+ remote_user: root
+ roles:
+ - post-osa
+
+- hosts: neutron_openvswitch_agent
+ remote_user: root
+ roles:
- setup-openvswitch
+
+- hosts: localhost
+ remote_user: root
+ roles:
- setup-sfc
- - setup-opendaylight
+ tags:
+ - sfc
+
+- hosts:
+ - localhost
+ - neutron_all
+ - galera_container
+ - network_hosts
+ - repo_container
+ - utility
+ remote_user: root
+ roles:
+ - setup-odl
+ tags:
+ - odl
+
+- hosts: utility_all[0]
+ remote_user: root
+ roles:
- post-openstack
+- hosts: localhost
+ remote_user: root
+ roles:
+ - process-openrc
+
- hosts: moon
remote_user: root
roles:
diff --git a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
index c53708ec..b23550f9 100644
--- a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
+++ b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2
@@ -10,35 +10,35 @@ auto eth0
iface eth0 inet manual
# external interface
-{% set intf_external = sys_intf_mappings["external"]["interface"] %}
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
-{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %}
+{% set intf_external = compu_sys_mappings["external"]["interface"] %}
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
+{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_external }}
iface {{ intf_external }} inet manual
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_external }}
{% endif %}
# tenant interface
-{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %}
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
-{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %}
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
+{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_tenant }}
iface {{ intf_tenant }} inet manual
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_tenant }}
{% endif %}
# storage interface
-{% set intf_storage = sys_intf_mappings["storage"]["interface"] %}
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
-{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %}
+{% set intf_storage = compu_sys_mappings["storage"]["interface"] %}
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
+{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_storage }}
iface {{ intf_storage }} inet manual
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_storage }}
{% endif %}
diff --git a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
index 2aeb9a04..4e444eca 100755
--- a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
+++ b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2
@@ -10,35 +10,35 @@ auto eth0
iface eth0 inet manual
# external interface
-{% set intf_external = sys_intf_mappings["external"]["interface"] %}
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
-{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %}
+{% set intf_external = contr_sys_mappings["external"]["interface"] %}
+{% if contr_sys_mappings["external"]["vlan_tag"] | int %}
+{% set intf_external = intf_external + '.' + contr_sys_mappings["external"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_external }}
iface {{ intf_external }} inet manual
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+{% if contr_sys_mappings["external"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_external }}
{% endif %}
# tenant interface
-{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %}
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
-{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+{% set intf_tenant = contr_sys_mappings["tenant"]["interface"] %}
+{% if contr_sys_mappings["tenant"]["vlan_tag"] | int %}
+{% set intf_tenant = intf_tenant + '.' + contr_sys_mappings["tenant"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_tenant }}
iface {{ intf_tenant }} inet manual
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+{% if contr_sys_mappings["tenant"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_tenant }}
{% endif %}
# storage interface
-{% set intf_storage = sys_intf_mappings["storage"]["interface"] %}
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
-{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %}
+{% set intf_storage = contr_sys_mappings["storage"]["interface"] %}
+{% if contr_sys_mappings["storage"]["vlan_tag"] | int %}
+{% set intf_storage = intf_storage + '.' + contr_sys_mappings["storage"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_storage }}
iface {{ intf_storage }} inet manual
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+{% if contr_sys_mappings["storage"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_storage }}
{% endif %}
diff --git a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml b/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml
deleted file mode 100644
index 346ef2fd..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# #############################################################################
-# Copyright (c) 2017 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: Fetch openrc
- hosts: utility_all[0]
- max_fail_percentage: 20
- user: root
- tasks:
- - fetch:
- src: /root/openrc
- dest: /opt/openrc
- flat: "yes"
-
-- name: Fetch haproxy.cert
- hosts: haproxy_hosts[0]
- max_fail_percentage: 20
- user: root
- tasks:
- - fetch:
- src: /etc/ssl/certs/haproxy.cert
- dest: /opt/os_cacert
- flat: "yes"
diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml
deleted file mode 100644
index 03b57120..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml
+++ /dev/null
@@ -1,17 +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 openstack flavors
- shell: |
- . /root/openrc;
- openstack flavor create {{ item.name }} \
- --id {{ item.id }} --ram {{ item.ram }} \
- --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true
- with_items: "{{ flavors }}"
diff --git a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml b/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
deleted file mode 100644
index ed631036..00000000
--- a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-# #############################################################################
-# Copyright (c) 2017 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: Installation and setup of Neutron
- hosts: neutron_openvswitch_agent
- gather_facts: "{{ gather_facts | default(True) }}"
- max_fail_percentage: 20
- user: root
- tasks:
- - name: stop neutron-openvswitch-agent
- service:
- name: neutron-openvswitch-agent
- state: stopped
-
- # yamllint disable rule:line-length
- - name: change the openvswitch_agent.ini
- lineinfile:
- dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
- insertafter: '^bridge_mappings'
- line: "local_ip = {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }}"
- when:
- - inventory_hostname not in groups['nova_compute']
-
- - name: change the openvswitch_agent.ini
- lineinfile:
- dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
- state: absent
- regexp: '^bridge_mappings'
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname in groups['nova_compute']
- # yamllint enable rule:line-length
-
- - name: Setup br-provider
- openvswitch_bridge:
- bridge: br-provider
- state: present
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname not in groups['nova_compute']
-
- - name: Add port to br-provider
- openvswitch_port:
- bridge: br-provider
- port: "eth12"
- state: present
- notify:
- - Restart neutron-openvswitch-agent
- when:
- - inventory_hostname not in groups['nova_compute']
-
- handlers:
- - name: Restart neutron-openvswitch-agent
- service:
- name: neutron-openvswitch-agent
- state: restarted
diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
index 2cb79a94..139b426f 100755
--- a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml
@@ -224,31 +224,6 @@
src: ansible.cfg
dest: /opt/openstack-ansible/playbooks/
-- name: copy setup-ovs.yml
- copy:
- src: setup-ovs.yml
- dest: /opt/openstack-ansible/playbooks
-
-- name: copy flavor roles
- copy:
- src: os-flavor
- dest: /etc/ansible/roles/
-
-- name: generate create-network.yml
- template:
- src: create-network.yml.j2
- dest: /opt/openstack-ansible/playbooks/create-network.yml
-
-- name: generate create-flavor.yml
- template:
- src: create-flavor.yml.j2
- dest: /opt/openstack-ansible/playbooks/create-flavor.yml
-
-- name: copy fetch-files.yml
- copy:
- src: fetch-files.yml
- dest: /opt/openstack-ansible/playbooks/fetch-files.yml
-
- name: copy user_ceph.yml
copy:
src: user_ceph.yml
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 %}
diff --git a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
index 6a8299d6..4e2da1e0 100644
--- a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml
@@ -1,4 +1,4 @@
-##############################################################################
+#############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
@@ -7,35 +7,53 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-- name: create network
- shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \
- cd /opt/openstack-ansible/playbooks; \
- openstack-ansible create-network.yml > /dev/null"
+- 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"
+ - public_net_info.type == "flat"
-- name: create flavor
- shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \
- cd /opt/openstack-ansible/playbooks; \
- openstack-ansible create-flavor.yml > /dev/null"
+- name: create external net
+ shell: |
+ . /root/openrc;
+ openstack network create --external \
+ --network-segment {{ public_net_info.segment_id }} \
+ --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"
+ - public_net_info.type == "vlan"
-- name: run ansible yml to fetch openrc
- shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \
- cd /opt/openstack-ansible/playbooks; \
- openstack-ansible fetch-files.yml > /dev/null"
+- 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 }}"
-- name: replace http with https in openrc
- replace:
- dest: /opt/openrc
- regexp: "http://"
- replace: "https://"
+- name: create openstack flavors
+ shell: |
+ . /root/openrc;
+ openstack flavor create {{ item.name }} \
+ --id {{ item.id }} --ram {{ item.ram }} \
+ --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true
+ with_items: "{{ flavors }}"
-- name: replace internalURL with publicURL in openrc
- replace:
+- name: fetch openrc
+ fetch:
+ src: /root/openrc
dest: /opt/openrc
- regexp: "{{ internal_vip['ip'] }}"
- replace: "{{ public_vip['ip'] }}"
+ flat: "yes"
-- name: change the endpoint type
- replace:
- dest: /opt/openrc
- regexp: "internalURL"
- replace: "publicURL"
+- name: fetch haproxy.cert
+ fetch:
+ src: /etc/ssl/certs/haproxy.cert
+ dest: /opt/os_cacert
+ flat: "yes"
diff --git a/deploy/adapters/ansible/roles/post-osa/handlers/main.yml b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml
new file mode 100755
index 00000000..3d979e6a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml
@@ -0,0 +1,11 @@
+##############################################################################
+## 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: restart network service
+ shell: "/sbin/ifconfig eth0 0 &&/sbin/ifdown -a && \
+ /sbin/ifup --ignore-errors -a"
diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml
new file mode 100644
index 00000000..cf157d74
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml
@@ -0,0 +1,12 @@
+---
+- name: remove bridge ubuntu
+ template:
+ src: compute.j2
+ dest: /etc/network/interfaces
+ notify:
+ - restart network service
+ when: ansible_distribution == 'Ubuntu'
+
+# TODO
+# - name: remove bridge centos
+# when: ansible_distribution == 'CentOS'
diff --git a/deploy/adapters/ansible/roles/post-osa/templates/compute.j2 b/deploy/adapters/ansible/roles/post-osa/templates/compute.j2
new file mode 100755
index 00000000..9e45fa90
--- /dev/null
+++ b/deploy/adapters/ansible/roles/post-osa/templates/compute.j2
@@ -0,0 +1,62 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# Physical interface
+auto eth0
+iface eth0 inet static
+ address {{ ip_settings[inventory_hostname]["mgmt"]["ip"] }}
+ netmask 255.255.255.0
+ pre-up ifconfig br-mgmt down || true
+ pre-up brctl delbr br-mgmt || true
+
+# external interface
+{% set intf_external = compu_sys_mappings["external"]["interface"] %}
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
+{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_external }}
+iface {{ intf_external }} inet static
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
+ vlan-raw-device {{ intf_external }}
+{% endif %}
+ address {{ ip_settings[inventory_hostname]["external"]["ip"] }}
+ netmask 255.255.255.0
+ gateway {{ ip_settings[inventory_hostname]["external"]["gw"] }}
+ pre-up ip link del br-vlan-veth || true
+ pre-up ifconfig br-external down || true
+ pre-up brctl delbr br-external || true
+
+# tenant interface
+{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %}
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
+{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_tenant }}
+iface {{ intf_tenant }} inet static
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
+ vlan-raw-device {{ intf_tenant }}
+{% endif %}
+ address {{ ip_settings[inventory_hostname]["tenant"]["ip"] }}
+ netmask 255.255.255.0
+ pre-up ifconfig br-tenant down || true
+ pre-up brctl delbr br-tenant || true
+
+# storage interface
+{% set intf_storage = compu_sys_mappings["storage"]["interface"] %}
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
+{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %}
+{% endif %}
+auto {{ intf_storage }}
+iface {{ intf_storage }} inet static
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
+ vlan-raw-device {{ intf_storage }}
+{% endif %}
+ address {{ ip_settings[inventory_hostname]["storage"]["ip"] }}
+ netmask 255.255.255.0
+ pre-up ifconfig br-storage down || true
+ pre-up brctl delbr br-storage || true
+
diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml b/deploy/adapters/ansible/roles/process-openrc/tasks/main.yml
index d9c36d42..aed68b88 100644
--- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml
+++ b/deploy/adapters/ansible/roles/process-openrc/tasks/main.yml
@@ -7,39 +7,20 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-flavors:
- - id: 0
- name: m1.nano
- vcpus: 1
- ram: 64
- disk: 1
+- name: replace http with https in openrc
+ replace:
+ dest: /opt/openrc
+ regexp: "http://"
+ replace: "https://"
- - id: 1
- name: m1.tiny
- vcpus: 1
- ram: 512
- disk: 1
+- name: replace internalURL with publicURL in openrc
+ replace:
+ dest: /opt/openrc
+ regexp: "{{ internal_vip['ip'] }}"
+ replace: "{{ public_vip['ip'] }}"
- - id: 2
- name: m1.small
- vcpus: 1
- ram: 2048
- disk: 20
-
- - id: 3
- name: m1.medium
- vcpus: 2
- ram: 4096
- disk: 40
-
- - id: 4
- name: m1.large
- vcpus: 4
- ram: 8192
- disk: 80
-
- - id: 5
- name: m1.xlarge
- vcpus: 8
- ram: 16384
- disk: 160
+- name: change the endpoint type
+ replace:
+ dest: /opt/openrc
+ regexp: "internalURL"
+ replace: "publicURL"
diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 b/deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml
index b33cd414..fb7814b7 100644
--- a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2
+++ b/deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml
@@ -1,15 +1,12 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
+############################################################################
+# Copyright (c) 2017 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
+- name: restart neutron-openvswitch-agent
+ service:
+ name: neutron-openvswitch-agent
+ state: restarted
diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml
new file mode 100644
index 00000000..62edd34b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml
@@ -0,0 +1,65 @@
+#############################################################################
+# Copyright (c) 2017 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: stop neutron-openvswitch-agent
+ service:
+ name: neutron-openvswitch-agent
+ state: stopped
+
+- name: remove tunnel_types when vlan
+ lineinfile:
+ dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ state: absent
+ regexp: '^tunnel_types'
+ when:
+ - tenant_net_info["type"] == "vlan"
+ notify:
+ - restart neutron-openvswitch-agent
+
+- name: fix mapping in compute
+ shell: |
+ {% set compute_mappings = [] %}
+ {% for key, value in compu_prv_mappings.iteritems() %}
+ {% set mapping = key + ":" + value["bridge"] %}
+ {% set _ = compute_mappings.append(mapping) %}
+ {% endfor %}
+ {% if compute_mappings | length != 0 %}
+ sed -i "s/^\(bridge_mappings\).*/\1 = {{ ','.join(compute_mappings) }}/g" \
+ /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ {% else %}
+ sed -i "/bridge_mappings/d" /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ {% endif %}
+ notify:
+ - restart neutron-openvswitch-agent
+
+- name: create compute bridges
+ openvswitch_bridge:
+ bridge: "{{ item['name'] }}"
+ state: present
+ with_items:
+ - "{{ provider_net_mappings }}"
+ when:
+ - compute in item["role"]
+ notify:
+ - restart neutron-openvswitch-agent
+
+- name: create compute bridge ports
+ openvswitch_port:
+ bridge: "{{ item['name'] }}"
+ port: "{{ item['interface'] }}"
+ state: present
+ with_items:
+ - "{{ provider_net_mappings }}"
+ when:
+ - compute in item["role"]
+
+- name: stop neutron-openvswitch-agent
+ service:
+ name: neutron-openvswitch-agent
+ state: started
diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml
new file mode 100644
index 00000000..258a39e2
--- /dev/null
+++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml
@@ -0,0 +1,49 @@
+#############################################################################
+# Copyright (c) 2017 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: stop neutron-openvswitch-agent
+ service:
+ name: neutron-openvswitch-agent
+ state: stopped
+
+- name: remove tunnel_types when vlan
+ lineinfile:
+ dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini
+ state: absent
+ regexp: '^tunnel_types'
+ when:
+ - tenant_net_info["type"] == "vlan"
+ notify:
+ - restart neutron-openvswitch-agent
+
+- name: create controller bridges
+ openvswitch_bridge:
+ bridge: "{{ item['name'] }}"
+ state: present
+ with_items:
+ - "{{ provider_net_mappings }}"
+ when:
+ - controller in item["role"]
+ notify:
+ - restart neutron-openvswitch-agent
+
+- name: create controller bridge ports
+ openvswitch_port:
+ bridge: "{{ item['name'] }}"
+ port: "{{ item['interface'] }}"
+ state: present
+ with_items:
+ - "{{ provider_net_mappings }}"
+ when:
+ - controller in item["role"]
+
+- name: stop neutron-openvswitch-agent
+ service:
+ name: neutron-openvswitch-agent
+ state: started
diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml
index a424f974..87e508ca 100644
--- a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml
@@ -1,16 +1,18 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#############################################################################
+# Copyright (c) 2017 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: setup openvswitch
- shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \
- cd /opt/openstack-ansible/playbooks; \
- openstack-ansible setup-ovs.yml \
- | tee -a /var/log/osa/ovs.log > /dev/null"
- when: NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or
- NEUTRON_MECHANISM_DRIVERS[0] == "opendaylight"
+- include: controller.yml
+ when:
+ - inventory_hostname not in groups['nova_compute']
+ - NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or "opendaylight"
+
+- include: compute.yml
+ when:
+ - inventory_hostname in groups['nova_compute']
+ - NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or "opendaylight"
diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml b/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml
new file mode 100644
index 00000000..69ce5ee9
--- /dev/null
+++ b/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml
@@ -0,0 +1,12 @@
+##############################################################################
+## Copyright (c) 2017 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
+##############################################################################
+---
+controller: "controller"
+
+compute: "compute"
diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf
index 9f079f9e..6027cb1a 100755
--- a/deploy/compass_conf/package_metadata/openstack.conf
+++ b/deploy/compass_conf/package_metadata/openstack.conf
@@ -268,36 +268,36 @@ METADATA = {
}
},
- 'openo_net': {
+ 'tenant_net_info': {
'_self': {
- 'mapping_to': 'openo_net',
- 'is_required': False
+ 'mapping_to': 'tenant_net_info',
+ 'is_required': True
},
- 'openo_ip': {
+ 'type': {
'_self': {
- 'mapping_to': 'openo_ip',
- 'is_required': False,
+ 'mapping_to': 'type',
+ 'is_required': True,
'field': 'general',
+ 'options': ['vxlan', 'vlan'],
}
},
- 'openo_docker_gw': {
+ 'range': {
'_self': {
- 'mapping_to': 'openo_docker_gw',
- 'is_required': False,
+ 'mapping_to': 'range',
+ 'is_required': True,
'field': 'general',
}
},
- 'openo_docker_cidr': {
+ 'provider_network': {
'_self': {
- 'mapping_to': 'openo_docker_cidr',
- 'is_required': False,
+ 'mapping_to': 'provider_network',
+ 'is_required': True,
'field': 'general',
}
}
},
-
'public_net_info': {
'_self': {
'mapping_to': 'public_net_info'
diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl
index 704c23fb..527f480a 100755
--- a/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl
+++ b/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl
@@ -3,13 +3,18 @@
#set network_cfg = $getVar('network_cfg', {})
#set ntp_server = $getVar('ntp_server', "")
#set ceph_disk = $getVar('ceph_disk',"")
-#set $sys_intf_mappings= {}
-#for $intf_info in $network_cfg.sys_intf_mappings
-#set $sys_intf_mappings[$intf_info["name"]] = $intf_info
-#end for
-
#set controllers = $getVar('controller', [])
#set computes = $getVar('compute', [])
+#set $contr_sys_mappings= {}
+#set $compu_sys_mappings= {}
+#for $intf_info in $network_cfg.sys_intf_mappings
+#if "controller" in $intf_info["role"]
+#set $contr_sys_mappings[$intf_info["name"]] = $intf_info
+#end if
+#if "compute" in $intf_info["role"]
+#set $compu_sys_mappings[$intf_info["name"]] = $intf_info
+#end if
+#end for
#set ip_settings={}
#for k,v in $getVar('ip_settings', {}).items()
@@ -35,6 +40,18 @@
#end if
#end for
+#set provider_net_mappings = $network_cfg["provider_net_mappings"]
+#set contr_prv_mappings = {}
+#set compu_prv_mappings = {}
+#for item in $provider_net_mappings
+#if "controller" in $item["role"]
+#set $contr_prv_mappings[$item["network"]] = {"bridge":$item["name"],"interface":$item["interface"]}
+#end if
+#if "compute" in $item["role"]
+#set $compu_prv_mappings[$item["network"]] = {"bridge":$item["name"],"interface":$item["interface"]}
+#end if
+#end for
+
#set neutron_cfg = $getVar('neutron_config', {})
#set ovs_config = $neutron_cfg.openvswitch
#set has = $getVar('ha', [])
@@ -51,7 +68,15 @@ onos_nic: $getVar('onos_nic', 'eth2')
onos_sfc: $getVar('onos_sfc', 'Disable')
ip_settings: $ip_settings
network_cfg: $network_cfg
-sys_intf_mappings: $sys_intf_mappings
+
+provider_net_mappings: $network_cfg["provider_net_mappings"]
+
+contr_sys_mappings: $contr_sys_mappings
+compu_sys_mappings: $compu_sys_mappings
+
+contr_prv_mappings: $contr_prv_mappings
+compu_prv_mappings: $compu_prv_mappings
+
deploy_type: $getVar('deploy_type', 'virtual')
mgmt_cidr: $mgmt_cfg["cidr"]
@@ -59,6 +84,7 @@ external_cidr: $external_cfg["cidr"]
tenant_cidr: $tenant_cfg["cidr"]
storage_cidr: $storage_cfg["cidr"]
+tenant_net_info: "{{ network_cfg.tenant_net_info }}"
public_net_info: "{{ network_cfg.public_net_info }}"
host_ip_settings: "{{ ip_settings[inventory_hostname] }}"
@@ -71,19 +97,19 @@ offline_repo_port: $getVar('offline_repo_port', '5151')
internal_vip:
ip: $network_cfg["internal_vip"]["ip"]
netmask: $network_cfg["internal_vip"]["netmask"]
-#if "vlan_tag" in $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]]
- interface: $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]]["name"]
+#if "vlan_tag" in $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]]
+ interface: $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]]["name"]
#else
- interface: $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]]["interface"]
+ interface: $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]]["interface"]
#end if
public_vip:
ip: $network_cfg["public_vip"]["ip"]
netmask: $network_cfg["public_vip"]["netmask"]
-#if "vlan_tag" in $sys_intf_mappings[$network_cfg["public_vip"]["interface"]]
- interface: $sys_intf_mappings[$network_cfg["public_vip"]["interface"]]["name"]
+#if "vlan_tag" in $contr_sys_mappings[$network_cfg["public_vip"]["interface"]]
+ interface: $contr_sys_mappings[$network_cfg["public_vip"]["interface"]]["name"]
#else
- interface: $sys_intf_mappings[$network_cfg["public_vip"]["interface"]]["interface"]
+ interface: $contr_sys_mappings[$network_cfg["public_vip"]["interface"]]["interface"]
#end if
db_host: "{{ internal_vip.ip }}"
@@ -182,12 +208,17 @@ CONGRESS_PASS: $congress_pass
DEMO_PASS: $demo_pass
ADMIN_PASS: $admin_pass
-#set neutron_service_plugins=['router']
+#set plugins = $getVar('plugins', [])
+#for item in plugins
+#set keys = $item.keys()
+#set values = $item.values()
+$keys[0]: $values[0]
+#end for
+#set neutron_service_plugins=['router']
#if $getVar('enable_fwaas', True)
#neutron_service_plugins.append('firewall')
#end if
-
#if $getVar('enable_vpnaas', True)
#neutron_service_plugins.append('vpnaas')
#end if
diff --git a/deploy/conf/hardware_environment/huawei-pod1/network.yml b/deploy/conf/hardware_environment/huawei-pod1/network.yml
index 8c45ed96..77160d69 100644
--- a/deploy/conf/hardware_environment/huawei-pod1/network.yml
+++ b/deploy/conf/hardware_environment/huawei-pod1/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/deploy/conf/vm_environment/huawei-virtual1/network.yml b/deploy/conf/vm_environment/huawei-virtual1/network.yml
index 924a4ea4..4359202e 100644
--- a/deploy/conf/vm_environment/huawei-virtual1/network.yml
+++ b/deploy/conf/vm_environment/huawei-virtual1/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/deploy/conf/vm_environment/huawei-virtual2/network.yml b/deploy/conf/vm_environment/huawei-virtual2/network.yml
index 924a4ea4..4359202e 100644
--- a/deploy/conf/vm_environment/huawei-virtual2/network.yml
+++ b/deploy/conf/vm_environment/huawei-virtual2/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/deploy/conf/vm_environment/huawei-virtual8/network.yml b/deploy/conf/vm_environment/huawei-virtual8/network.yml
index 924a4ea4..4359202e 100644
--- a/deploy/conf/vm_environment/huawei-virtual8/network.yml
+++ b/deploy/conf/vm_environment/huawei-virtual8/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/deploy/conf/vm_environment/huawei-virtual9/network.yml b/deploy/conf/vm_environment/huawei-virtual9/network.yml
index 924a4ea4..4359202e 100644
--- a/deploy/conf/vm_environment/huawei-virtual9/network.yml
+++ b/deploy/conf/vm_environment/huawei-virtual9/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/deploy/conf/vm_environment/network.yml b/deploy/conf/vm_environment/network.yml
index 924a4ea4..4359202e 100644
--- a/deploy/conf/vm_environment/network.yml
+++ b/deploy/conf/vm_environment/network.yml
@@ -14,15 +14,15 @@ bond_mappings: []
provider_net_mappings:
- name: br-provider
network: physnet
- interface: eth1
+ interface: eth10
type: ovs
role:
- controller
- - compute
sys_intf_mappings:
- name: mgmt
interface: eth0
+ type: normal
vlan_tag: None
role:
- controller
@@ -30,6 +30,7 @@ sys_intf_mappings:
- name: tenant
interface: eth1
+ type: normal
vlan_tag: 101
role:
- controller
@@ -37,6 +38,7 @@ sys_intf_mappings:
- name: storage
interface: eth1
+ type: normal
vlan_tag: 102
role:
- controller
@@ -44,6 +46,7 @@ sys_intf_mappings:
- name: external
interface: eth1
+ type: normal
vlan_tag: None
role:
- controller
@@ -102,6 +105,11 @@ public_vip:
interface: external
onos_nic: eth2
+tenant_net_info:
+ type: vxlan
+ range: "1:1000"
+ provider_network: None
+
public_net_info:
enable: "True"
network: ext-net
diff --git a/plugins/moon/roles/moon/templates/compute.j2 b/plugins/moon/roles/moon/templates/compute.j2
index 30355311..b23550f9 100755
--- a/plugins/moon/roles/moon/templates/compute.j2
+++ b/plugins/moon/roles/moon/templates/compute.j2
@@ -10,35 +10,35 @@ auto eth0
iface eth0 inet manual
# external interface
-{% set intf_external = sys_intf_mappings["external"]["interface"] %}
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
-{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %}
+{% set intf_external = compu_sys_mappings["external"]["interface"] %}
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
+{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_external }}
iface {{ intf_external }} inet manual
-{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %}
+{% if compu_sys_mappings["external"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_external }}
{% endif %}
# tenant interface
-{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %}
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
-{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %}
+{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %}
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
+{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_tenant }}
iface {{ intf_tenant }} inet manual
-{% if sys_intf_mappings["tenant"]["interface"] != "None" %}
+{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_tenant }}
{% endif %}
# storage interface
-{% set intf_storage = sys_intf_mappings["storage"]["interface"] %}
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
-{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %}
+{% set intf_storage = compu_sys_mappings["storage"]["interface"] %}
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
+{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %}
{% endif %}
auto {{ intf_storage }}
iface {{ intf_storage }} inet manual
-{% if sys_intf_mappings["storage"]["interface"] != "None" %}
+{% if compu_sys_mappings["storage"]["vlan_tag"] | int %}
vlan-raw-device {{ intf_storage }}
{% endif %}
@@ -91,4 +91,3 @@ iface br-storage inet static
bridge_ports {{ intf_storage }}
address {{ ip_settings[inventory_hostname]["storage"]["ip"] }}
netmask 255.255.255.0
-
diff --git a/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service
index f4801a36..f4801a36 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service
+++ b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service
diff --git a/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml b/plugins/odl_cluster/roles/setup-odl/handlers/main.yml
index 2650d072..2650d072 100755
--- a/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml
+++ b/plugins/odl_cluster/roles/setup-odl/handlers/main.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml
index dc071cc7..dc071cc7 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml
index f53a3ac8..82a26005 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml
@@ -11,21 +11,25 @@
# yamllint disable rule:line-length
- name: set local ip in openvswitch
- shell: |
- ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '};
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
when: inventory_hostname not in groups['nova_compute']
- name: set local ip in openvswitch
- shell: |
- ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '};
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
when: inventory_hostname in groups['nova_compute']
# yamllint enable rule:line-length
- name: Setup br-provider
openvswitch_bridge:
- bridge: br-provider
+ bridge: "{{ public_bridge }}"
state: present
when:
- inventory_hostname not in groups['nova_compute']
@@ -33,8 +37,8 @@
- name: add ovs uplink
openvswitch_port:
- bridge: br-provider
- port: "eth12"
+ bridge: "{{ public_bridge }}"
+ port: "{{ contr_public_intf }}"
state: present
when:
- inventory_hostname not in groups['nova_compute']
@@ -43,7 +47,7 @@
- name: set external nic in openvswitch
shell: |
ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config:provider_mappings=physnet:br-provider
+ other_config:provider_mappings={{ contr_l2_mappings }}
when:
- odl_l3_agent == "Disable"
- inventory_hostname not in groups['nova_compute']
@@ -51,22 +55,31 @@
- name: set external nic in openvswitch
shell: |
ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config:provider_mappings=physnet:eth12
+ other_config:provider_mappings={{ contr_l3_mappings }}
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: set external nic in openvswitch
+ shell: |
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
+ other_config:provider_mappings={{ compu_l3_mappings }}
when:
- odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
- name: Set host OVS configurations
command: |
/openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
- --datapath_type=system --bridge_mappings=physnet:br-provider
+ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }}
when:
- inventory_hostname not in groups['nova_compute']
- odl_l3_agent == "Disable"
- name: Set host OVS configurations
command: |
- /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig
- --datapath_type=system --bridge_mappings=physnet:eth12
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
+ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }}
when:
- inventory_hostname not in groups['nova_compute']
- odl_l3_agent == "Enable"
@@ -81,7 +94,7 @@
- name: Set host OVS configurations
command: |
/openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig
- --datapath_type=system --bridge_mappings=physnet:eth12
+ --datapath_type=system --bridge_mappings={{ compu_l3_mappings }}
when:
- inventory_hostname in groups['nova_compute']
- odl_l3_agent == "Enable"
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml
index 68446a83..2527852e 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml
@@ -1,21 +1,48 @@
---
- name: configure opendaylight -> ml2
- shell: >
+ shell: |
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True";
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider;
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname in groups['nova_compute']
- name: configure bridge_mappings for L3
shell: |
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12;
- when: odl_l3_agent == "Enable"
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings for L3
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
- name: configure external bridge name for L2
shell: |
- crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider;
+ crudini --set /etc/neutron/l3_agent.ini \
+ DEFAULT external_network_bridge "{{ public_bridge }}";
when: odl_l3_agent == "Disable"
- name: configure opendaylight in ml2
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml
index 3cef9792..3cef9792 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml
index 6879340e..6879340e 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml
index b8d9403a..b8d9403a 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml
index 8427e4f0..8427e4f0 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml
index 459c734a..459c734a 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml
index 59b3aa2f..a5d31d4c 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml
@@ -12,11 +12,13 @@
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True";
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l2_mappings }}";
- name: configure bridge_mappings for L3
- shell: |
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12;
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l3_mappings }}";
when: odl_l3_agent == "Enable"
- name: turn off l3 ha for odl l2
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml
index 3d5c307b..3d5c307b 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/main.yml b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml
new file mode 100755
index 00000000..e65be002
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+
+- include: odl-cluster.yml
+ when: opendaylight is defined and opendaylight == "Enable"
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml
index 44359056..5b57fb00 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml
@@ -2,6 +2,13 @@
- include_vars: "{{ ansible_os_family }}.yml"
+- include_vars: "{{ openstack_passwd_file }}"
+
+- include: odl-pre.yml
+ when: inventory_hostname == "localhost"
+
+- include_vars: /tmp/odl-extra-vars.yml
+
- include: control-hosts-1.yml
when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml
index 9f1cb79e..9f1cb79e 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml
diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml
new file mode 100755
index 00000000..64631663
--- /dev/null
+++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml
@@ -0,0 +1,46 @@
+---
+
+- name: set l2_mapping l3_mapping
+ copy:
+ dest: /tmp/odl-extra-vars.yml
+ content: |
+ {% set contr_l2_list = [] %}
+ {% set contr_l3_list = [] %}
+ {% set pub_l2_mapping = [] %}
+ {% set pub_l3_mapping = [] %}
+ {% set pub_intf = [] %}
+ {% set pub_bridge = [] %}
+ {% for key, value in contr_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = contr_l2_list.append(l2_mapping) %}
+ {% set _ = contr_l3_list.append(l3_mapping) %}
+ {% if key == public_net_info["provider_network"] %}
+ {% set _ = pub_l2_mapping.append(l2_mapping) %}
+ {% set _ = pub_l3_mapping.append(l3_mapping) %}
+ {% set _ = pub_intf.append(value["interface"]) %}
+ {% set _ = pub_bridge.append(value["bridge"]) %}
+ {% endif %}
+ {% endfor %}
+ {% set compu_l2_list = [] %}
+ {% set compu_l3_list = [] %}
+ {% set compu_pub_intf = compu_sys_mappings["external"]["interface"] %}
+ {% set compu_pub_vlan = compu_sys_mappings["external"]["vlan_tag"] %}
+ {% if compu_pub_vlan | int %}
+ {% set compu_pub_intf = compu_pub_intf + '.' + compu_pub_vlan|string %}
+ {% endif %}
+ {% for key, value in compu_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = compu_l2_list.append(l2_mapping) %}
+ {% set _ = compu_l3_list.append(l3_mapping) %}
+ {% endfor %}
+ {% set pub_l3_mapping = pub_l3_mapping[0].replace(pub_intf[0], compu_pub_intf) %}
+ {% set _ = compu_l2_list.append(pub_l2_mapping[0]) %}
+ {% set _ = compu_l3_list.append(pub_l3_mapping) %}
+ public_bridge: "{{ pub_bridge[0] }}"
+ contr_public_intf: "{{ pub_intf[0] }}"
+ contr_l2_mappings: "{{ ','.join(contr_l2_list) }}"
+ contr_l3_mappings: "{{ ','.join(contr_l3_list) }}"
+ compu_l2_mappings: "{{ ','.join(compu_l2_list) }}"
+ compu_l3_mappings: "{{ ','.join(compu_l3_list) }}"
diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh b/plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh
index 4962a17c..4962a17c 100755
--- a/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh
+++ b/plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh
diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties b/plugins/odl_cluster/roles/setup-odl/templates/custom.properties
index f103c1b8..f103c1b8 100755
--- a/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties
+++ b/plugins/odl_cluster/roles/setup-odl/templates/custom.properties
diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh b/plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh
index 0d42e48b..0d42e48b 100755
--- a/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh
+++ b/plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh
diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg
index bc625cda..bc625cda 100755
--- a/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg
+++ b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg
diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml b/plugins/odl_cluster/roles/setup-odl/vars/Debian.yml
index c78c5221..c78c5221 100755
--- a/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml
+++ b/plugins/odl_cluster/roles/setup-odl/vars/Debian.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml b/plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml
index a2e6d01d..a2e6d01d 100755
--- a/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml
+++ b/plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/main.yml b/plugins/odl_cluster/roles/setup-odl/vars/main.yml
index 42e1acb1..5e6325fb 100755
--- a/plugins/odl_cluster/roles/odl_cluster/vars/main.yml
+++ b/plugins/odl_cluster/roles/setup-odl/vars/main.yml
@@ -7,6 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
+openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml
+
odl_username: admin
odl_password: admin
odl_api_port: 8181
diff --git a/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml b/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml
deleted file mode 100644
index 3abca829..00000000
--- a/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml
+++ /dev/null
@@ -1,25 +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: copy setup-odl.yml
- template:
- src: setup-odl.yml.j2
- dest: /opt/openstack-ansible/playbooks/setup-odl.yml
-
-- name: copy odl_cluster role
- copy:
- src: /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster
- dest: /etc/ansible/roles/
-
-- name: setup odl
- shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \
- cd /opt/openstack-ansible/playbooks; \
- openstack-ansible setup-odl.yml > /dev/null"
- when: opendaylight is defined and opendaylight == "Enable"
diff --git a/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 b/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2
deleted file mode 100644
index 18446ce5..00000000
--- a/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2
+++ /dev/null
@@ -1,12 +0,0 @@
----
-
-- name: run opendaylight role
- hosts: neutron_all | galera_container | network_hosts | repo_container
- max_fail_percentage: 20
- user: root
- roles:
- - odl_cluster
- vars:
- - odl_l3_agent: "{{ odl_l3_agent }}"
- tags:
- - odl
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service
index f4801a36..f4801a36 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf
index acf2e2f4..acf2e2f4 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml
index 2650d072..2650d072 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml
index dc071cc7..dc071cc7 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml
index f53a3ac8..82a26005 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml
@@ -11,21 +11,25 @@
# yamllint disable rule:line-length
- name: set local ip in openvswitch
- shell: |
- ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '};
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
when: inventory_hostname not in groups['nova_compute']
- name: set local ip in openvswitch
- shell: |
- ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '};
+ shell: >
+ local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini |
+ sed 's/local_ip =//g');
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1)
+ other_config={'local_ip'="$local_ip"};
when: inventory_hostname in groups['nova_compute']
# yamllint enable rule:line-length
- name: Setup br-provider
openvswitch_bridge:
- bridge: br-provider
+ bridge: "{{ public_bridge }}"
state: present
when:
- inventory_hostname not in groups['nova_compute']
@@ -33,8 +37,8 @@
- name: add ovs uplink
openvswitch_port:
- bridge: br-provider
- port: "eth12"
+ bridge: "{{ public_bridge }}"
+ port: "{{ contr_public_intf }}"
state: present
when:
- inventory_hostname not in groups['nova_compute']
@@ -43,7 +47,7 @@
- name: set external nic in openvswitch
shell: |
ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config:provider_mappings=physnet:br-provider
+ other_config:provider_mappings={{ contr_l2_mappings }}
when:
- odl_l3_agent == "Disable"
- inventory_hostname not in groups['nova_compute']
@@ -51,22 +55,31 @@
- name: set external nic in openvswitch
shell: |
ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
- other_config:provider_mappings=physnet:eth12
+ other_config:provider_mappings={{ contr_l3_mappings }}
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: set external nic in openvswitch
+ shell: |
+ ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \
+ other_config:provider_mappings={{ compu_l3_mappings }}
when:
- odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
- name: Set host OVS configurations
command: |
/openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
- --datapath_type=system --bridge_mappings=physnet:br-provider
+ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }}
when:
- inventory_hostname not in groups['nova_compute']
- odl_l3_agent == "Disable"
- name: Set host OVS configurations
command: |
- /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig
- --datapath_type=system --bridge_mappings=physnet:eth12
+ /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \
+ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }}
when:
- inventory_hostname not in groups['nova_compute']
- odl_l3_agent == "Enable"
@@ -81,7 +94,7 @@
- name: Set host OVS configurations
command: |
/openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig
- --datapath_type=system --bridge_mappings=physnet:eth12
+ --datapath_type=system --bridge_mappings={{ compu_l3_mappings }}
when:
- inventory_hostname in groups['nova_compute']
- odl_l3_agent == "Enable"
diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml
index 68446a83..2527852e 100644..100755
--- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml
@@ -1,21 +1,48 @@
---
- name: configure opendaylight -> ml2
- shell: >
+ shell: |
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True";
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider;
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings -> ml2
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l2_mappings }}";
+ when:
+ - odl_l3_agent == "Disable"
+ - inventory_hostname in groups['nova_compute']
- name: configure bridge_mappings for L3
shell: |
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12;
- when: odl_l3_agent == "Enable"
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ contr_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname not in groups['nova_compute']
+
+- name: configure bridge_mappings for L3
+ shell: |
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \
+ ovs bridge_mappings "{{ compu_l3_mappings }}";
+ when:
+ - odl_l3_agent == "Enable"
+ - inventory_hostname in groups['nova_compute']
- name: configure external bridge name for L2
shell: |
- crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider;
+ crudini --set /etc/neutron/l3_agent.ini \
+ DEFAULT external_network_bridge "{{ public_bridge }}";
when: odl_l3_agent == "Disable"
- name: configure opendaylight in ml2
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml
index 3cef9792..3cef9792 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml
index 6879340e..6879340e 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml
index b8d9403a..b8d9403a 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml
index 2e58e141..2e58e141 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml
index e2dd128d..e2dd128d 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml
index 5d743382..b54fce22 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml
@@ -12,11 +12,13 @@
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True";
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security;
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l2_mappings }}";
- name: configure bridge_mappings for L3
- shell: |
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12;
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings
+ "{{ contr_l3_mappings }}";
when: odl_l3_agent == "Enable"
- name: turn off l3 ha for odl l2
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml
index 0c11e36f..0c11e36f 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml
index 613c796b..613c796b 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml
diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml
new file mode 100755
index 00000000..e65be002
--- /dev/null
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+
+- include: odl-cluster.yml
+ when: opendaylight is defined and opendaylight == "Enable"
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml
index 91fc71fa..a22e980f 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml
@@ -2,6 +2,13 @@
- include_vars: "{{ ansible_os_family }}.yml"
+- include_vars: "{{ openstack_passwd_file }}"
+
+- include_vars: odl-pre.yml
+ when: inventory_hostname == "localhost"
+
+- include_vars: /tmp/odl-extra-vars.yml
+
- include: control-hosts-1.yml
when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml
index 9f1cb79e..9f1cb79e 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml
diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml
new file mode 100755
index 00000000..64631663
--- /dev/null
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml
@@ -0,0 +1,46 @@
+---
+
+- name: set l2_mapping l3_mapping
+ copy:
+ dest: /tmp/odl-extra-vars.yml
+ content: |
+ {% set contr_l2_list = [] %}
+ {% set contr_l3_list = [] %}
+ {% set pub_l2_mapping = [] %}
+ {% set pub_l3_mapping = [] %}
+ {% set pub_intf = [] %}
+ {% set pub_bridge = [] %}
+ {% for key, value in contr_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = contr_l2_list.append(l2_mapping) %}
+ {% set _ = contr_l3_list.append(l3_mapping) %}
+ {% if key == public_net_info["provider_network"] %}
+ {% set _ = pub_l2_mapping.append(l2_mapping) %}
+ {% set _ = pub_l3_mapping.append(l3_mapping) %}
+ {% set _ = pub_intf.append(value["interface"]) %}
+ {% set _ = pub_bridge.append(value["bridge"]) %}
+ {% endif %}
+ {% endfor %}
+ {% set compu_l2_list = [] %}
+ {% set compu_l3_list = [] %}
+ {% set compu_pub_intf = compu_sys_mappings["external"]["interface"] %}
+ {% set compu_pub_vlan = compu_sys_mappings["external"]["vlan_tag"] %}
+ {% if compu_pub_vlan | int %}
+ {% set compu_pub_intf = compu_pub_intf + '.' + compu_pub_vlan|string %}
+ {% endif %}
+ {% for key, value in compu_prv_mappings.iteritems() %}
+ {% set l2_mapping = key + ":" + value["bridge"] %}
+ {% set l3_mapping = key + ":" + value["interface"] %}
+ {% set _ = compu_l2_list.append(l2_mapping) %}
+ {% set _ = compu_l3_list.append(l3_mapping) %}
+ {% endfor %}
+ {% set pub_l3_mapping = pub_l3_mapping[0].replace(pub_intf[0], compu_pub_intf) %}
+ {% set _ = compu_l2_list.append(pub_l2_mapping[0]) %}
+ {% set _ = compu_l3_list.append(pub_l3_mapping) %}
+ public_bridge: "{{ pub_bridge[0] }}"
+ contr_public_intf: "{{ pub_intf[0] }}"
+ contr_l2_mappings: "{{ ','.join(contr_l2_list) }}"
+ contr_l3_mappings: "{{ ','.join(contr_l3_list) }}"
+ compu_l2_mappings: "{{ ','.join(compu_l2_list) }}"
+ compu_l3_mappings: "{{ ','.join(compu_l3_list) }}"
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh b/plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh
index 4962a17c..4962a17c 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties b/plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties
index f103c1b8..f103c1b8 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh b/plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh
index 0d42e48b..0d42e48b 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg
index b07e028f..b07e028f 100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml
index c78c5221..c78c5221 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml
index a2e6d01d..a2e6d01d 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml
diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml
index a9466ea0..a9466ea0 100644..100755
--- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml
+++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml
diff --git a/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 b/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2
deleted file mode 100644
index 0d0cbe90..00000000
--- a/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2
+++ /dev/null
@@ -1,13 +0,0 @@
----
-
-- name: run opendaylight role
- hosts: neutron_all | galera_container | network_hosts | repo_container | utility
- max_fail_percentage: 20
- user: root
- roles:
- - odl_cluster
- vars:
- - odl_l3_agent: "{{ odl_l3_agent }}"
- - odl_sfc: "{{ odl_sfc }}"
- tags:
- - odl
diff --git a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml
index 9fa9175f..eb8b5aa6 100644
--- a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml
+++ b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml
@@ -7,24 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
-# yamllint disable rule:line-length
-- name: clear setup-odl.yml.j2
- file:
- path: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/setup-odl.yml.j2"
- state: absent
-# yamllint enable rule:line-length
-
-- name: override setup-odl.yml.j2
- copy:
- src: setup-odl.yml.j2
- dest: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/"
-
-- name: clear odl_cluster for sfc
- file:
- path: "/var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster"
- state: absent
- name: copy odl_cluster role
shell: |
- cp -r /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster_sfc \
- /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster
+ cp -rf /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl-sfc \
+ /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl