aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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 /plugins
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>
Diffstat (limited to 'plugins')
-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_cluster/roles/odl_cluster/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_sfc/roles/odl_cluster_sfc/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
53 files changed, 260 insertions, 127 deletions
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_cluster/roles/odl_cluster/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_cluster/roles/odl_cluster/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_sfc/roles/odl_cluster_sfc/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_sfc/roles/odl_cluster_sfc/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