summaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rwxr-xr-xdeploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/tasks/openvswitch.yml148
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/00_odl_common.yml13
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_00_download_packages.yml34
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml21
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml18
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml53
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_04_install_pip_packages.yml26
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml14
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml22
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_07_start_check_odl.yml30
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_08_configure_neutron.yml35
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_odl_controller.yml43
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/02_odl_compute.yml12
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml21
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml16
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml25
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml41
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml27
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_recover_external_network.yml22
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_04_setup_ml2.yml24
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_openvswitch.yml24
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/main.yml24
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/moon-odl.yml10
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/odl_controller.yml294
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/openvswitch.yml158
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/Debian.yml6
-rwxr-xr-xdeploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/main.yml6
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/00_odl_common.yml13
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml29
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml21
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml18
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml46
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_04_install_pip_packages.yml15
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml12
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml42
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml29
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml34
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/01_odl_controller.yml39
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/02_odl_compute.yml12
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml22
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml16
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml21
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml40
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml29
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml22
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml24
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/03_openvswitch.yml24
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml (renamed from deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml)0
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/main.yml14
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml287
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml148
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml6
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml6
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/vars/main.yml3
-rwxr-xr-xdeploy/deploy_host.sh2
-rw-r--r--deploy/rename_nics.py20
56 files changed, 1092 insertions, 1069 deletions
diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/tasks/openvswitch.yml
deleted file mode 100755
index 33099104..00000000
--- a/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/tasks/openvswitch.yml
+++ /dev/null
@@ -1,148 +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: Install Crudini
-# apt: name={{ item }} state=present
-# with_items:
-# - crudini
-
-- name: install compute packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: compute_packages | union(compute_packages_noarch)
-
-- name: remove neutron-openvswitch-agent service daemon
- shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
-
-- name: shut down and disable Neutron's openvswitch agent services
- service: name={{ service_ovs_agent_name }} state=stopped enabled=no
-
-- name: remove Neutron's openvswitch agent services
- shell: >
- update-rc.d -f {{ service_ovs_agent_name }} remove;
- mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }};
- mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf;
- when: ansible_os_family == "Debian"
-
-
-- name: Stop the Open vSwitch service and clear existing OVSDB
- shell: >
- service {{ service_ovs_name }} stop ;
- rm -rf /var/log/openvswitch/* ;
- rm -rf /etc/openvswitch/conf.db ;
- service {{ service_ovs_name }} start ;
-
-- name: set opendaylight as the manager
- command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
-
-- name: check br-int
- shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
-
-- name: set local ip in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
-
-#'
-
-##################################################################
-########### Recover External network for odl l3 #################
-##################################################################
-
-- name: check br-ex
- shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done
- when: odl_l3_agent == "Enable"
-
-- name: add ovs uplink
- openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: wait 10 seconds
- shell: sleep 10
- when: odl_l3_agent == "Enable"
-
-- name: set external nic in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }}
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network_odl_l3.py
- - setup_networks_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: update keepalived info
- template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf
- when: inventory_hostname in groups['odl'] and odl_l3_agent == "Enable"
-
-- name: modify net-init
- shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init
- when: odl_l3_agent == "Enable"
-
-##################################################################
-########### Recover External network for odl l2 #################
-##################################################################
-
-- name: add ovs bridge
- openvswitch_bridge: bridge={{ item["name"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: add ovs uplink
- openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network.py
- when: odl_l3_agent == "Disable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network.py
- when: odl_l3_agent == "Disable"
-
-##################################################################
-
-
-- name: restart keepalived to recover external IP
- shell: service keepalived restart
- when: inventory_hostname in groups['odl']
- ignore_errors: True
-
-
-
-##################################################################
-##################################################################
-##################################################################
-- name: configure opendaylight -> ml2
- shell: >
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
- 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;
-
-#- name: Adjust Service Daemon
-# shell: >
-# sed -i '/neutron-openvswitch-agent/d' /opt/service ;
-# echo opendaylight >> /opt/service ;
-
-- name: copy ml2 configuration script
- template:
- src: ml2_conf.sh
- dest: "/opt/ml2_conf.sh"
- mode: 0777
-
-- name: execute ml2 configuration script
- command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/00_odl_common.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/00_odl_common.yml
new file mode 100755
index 00000000..1545314d
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/00_odl_common.yml
@@ -0,0 +1,13 @@
+##############################################################################
+# 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: install controller packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: common_packages | union(common_packages_noarch)
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_00_download_packages.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_00_download_packages.yml
new file mode 100644
index 00000000..efd359db
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_00_download_packages.yml
@@ -0,0 +1,34 @@
+##############################################################################
+# 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: get image http server
+ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+ register: http_server
+
+- name: download oracle-jdk8 package file
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }}
+
+#"
+
+- name: download oracle-jdk8 script file
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" dest=/opt/
+
+#"
+
+- name: download odl package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ odl_pkg_url }}" dest=/opt/{{ odl_pkg_name }}
+
+# "
+
+- name: download odl pip package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/pip/{{ networking_odl_pkg_name }}" dest=/opt/{{ networking_odl_pkg_name }}
+
+#"
+
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml
new file mode 100644
index 00000000..cd6e9751
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml
@@ -0,0 +1,21 @@
+##############################################################################
+# 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 odl group
+ group: name=odl system=yes state=present
+
+- name: create odl user
+ user:
+ name: odl
+ group: odl
+ home: "{{ odl_home }}"
+ createhome: "yes"
+ system: "yes"
+ shell: "/bin/false"
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml
new file mode 100644
index 00000000..ff82eba1
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml
@@ -0,0 +1,18 @@
+##############################################################################
+# 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: unarchive onos driver package
+ command: su -s /bin/sh -c "tar xvf /opt/install_jdk8.tar -C /opt/"
+
+- name: install install_jdk8 package
+ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
+
+- name: extract odl package
+ command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml
new file mode 100644
index 00000000..8d71606f
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml
@@ -0,0 +1,53 @@
+##############################################################################
+# 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: opendaylight system file
+ copy:
+ src: "{{ service_file.src }}"
+ dest: "{{ service_file.dst }}"
+ mode: 0755
+
+- name: set l3 fwd enable in custom.properties
+ template:
+ src: custom.properties
+ dest: "{{ odl_home }}/etc/custom.properties"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: odl_l3_agent == "Enable"
+
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg.Debian
+ dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: ansible_os_family == "Debian"
+
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg.Redhat
+ dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: ansible_os_family == "RedHat"
+
+- name: create tomcat config
+ template:
+ src: tomcat-server.xml
+ dest: "{{ odl_home }}/configuration/tomcat-server.xml"
+
+- name: create tomcat config
+ template:
+ src: jetty.xml
+ dest: "{{ odl_home }}/etc/jetty.xml"
+
+
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_04_install_pip_packages.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_04_install_pip_packages.yml
new file mode 100644
index 00000000..869d264a
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_04_install_pip_packages.yml
@@ -0,0 +1,26 @@
+##############################################################################
+# 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: patch odl pip package
+ shell: |
+ cd /opt
+ tar xf /opt/{{ networking_odl_pkg_name }}
+ rm -rf /opt/{{ networking_odl_pkg_name }}
+ sed -i 's/^neutron-lib.*/neutron-lib/' networking-odl-2.0.0/requirements.txt
+ tar zcf /opt/{{ networking_odl_pkg_name }} networking-odl-2.0.0
+ rm -rf networking-odl-2.0.0
+ cd -
+
+- name: odl pip package install
+ shell: |
+ cd /opt
+ pip install {{ networking_odl_pkg_name }}
+ rm -rf {{ networking_odl_pkg_name }}
+ cd -
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml
new file mode 100644
index 00000000..5e34a428
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml
@@ -0,0 +1,14 @@
+##############################################################################
+# 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: remove karaf data directory
+ shell: rm -rf {{ odl_home }}/data/*;
+
+
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml
new file mode 100644
index 00000000..f44b373b
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml
@@ -0,0 +1,22 @@
+##############################################################################
+# 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: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
+ shell: >
+ sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
+ sed -i '/neutron-server/d' /opt/service;
+ sed -i '/keepalived/d' /opt/service;
+
+- name: turn off neutron-server on control node
+ service: name=neutron-server state=stopped
+
+- name: turn off keepalived on control node
+ service: name=keepalived state=stopped
+ when: ansible_os_family == "Debian"
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_07_start_check_odl.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_07_start_check_odl.yml
new file mode 100644
index 00000000..5fa4b921
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_07_start_check_odl.yml
@@ -0,0 +1,30 @@
+##############################################################################
+# 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: chown opendaylight directory and files
+ shell: >
+ chown -R odl:odl "{{ odl_home }}";
+ chown odl:odl "{{ service_file.dst }}";
+
+- name: start opendaylight
+ service: name=opendaylight state=started
+ when: ansible_os_family == "Debian"
+
+- name: set opendaylight autostart
+ shell: chkconfig opendaylight on
+ when: ansible_os_family == "RedHat"
+
+- name: start opendaylight
+ shell: service opendaylight start
+ when: ansible_os_family == "RedHat"
+
+- name: check if opendaylight running
+ shell: netstat -lpen --tcp | grep java | grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done
+
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_08_configure_neutron.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_08_configure_neutron.yml
new file mode 100644
index 00000000..3d01a3a8
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_08_configure_neutron.yml
@@ -0,0 +1,35 @@
+##############################################################################
+# 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: configure l2 configuration
+ shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-prv;
+ when: odl_l3_agent == "Disable"
+
+- name: configure l3 configuration
+ shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-ex;
+ when: odl_l3_agent == "Enable"
+
+- name: configure odl l3 driver
+ shell: crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin;
+ when: odl_l3_agent == "Enable"
+
+- name: configure metadata for l3 configuration
+ shell: crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True;
+ when: odl_l3_agent == "Enable"
+
+- name: drop and recreate neutron database
+ shell: mysql -e "drop database if exists neutron;";
+ mysql -e "create database neutron character set utf8;";
+ mysql -e "grant all on neutron.* to 'neutron'@'%' identified by '{{ NEUTRON_DBPASS }}';";
+ su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+ tags:
+ - test_odl
+
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_odl_controller.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_odl_controller.yml
new file mode 100755
index 00000000..7d010d10
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/01_odl_controller.yml
@@ -0,0 +1,43 @@
+##############################################################################
+# 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: download packages
+ include: 01_00_download_packages.yml
+
+- name: create odl user and group
+ include: 01_01_create_odl_user_and_group.yml
+
+- name: unarchive odl and jdk
+ include: 01_02_unarchive_odl_and_jdk.yml
+
+- name: copy odl configuration files
+ include: 01_03_copy_odl_configuration_files.yml
+
+- name: install pip packages
+ include: 01_04_install_pip_packages.yml
+
+- name: clean up karaf data
+ include: 01_05_clean_up_karaf_data.yml
+
+- name: stop openstack services
+ include: 01_06_stop_openstack_services.yml
+
+- name: install moon
+ include: moon-odl.yml
+ when: moon == "Enable"
+
+- name: start and check odl
+ include: 01_07_start_check_odl.yml
+
+- name: run openswitch
+ include: 03_openvswitch.yml
+
+- name: configure neutron
+ include: 01_08_configure_neutron.yml
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/02_odl_compute.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/02_odl_compute.yml
new file mode 100755
index 00000000..7506200b
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/02_odl_compute.yml
@@ -0,0 +1,12 @@
+##############################################################################
+# 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: Provision ODL on Compute nodes
+ include: 03_openvswitch.yml
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml
new file mode 100644
index 00000000..50359df4
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml
@@ -0,0 +1,21 @@
+##############################################################################
+# 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: remove neutron-openvswitch-agent service daemon
+ shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
+
+- name: shut down and disable Neutron's openvswitch agent services
+ service: name={{ service_ovs_agent_name }} state=stopped enabled=no
+
+- name: remove Neutron's openvswitch agent services
+ shell: >
+ update-rc.d -f {{ service_ovs_agent_name }} remove;
+ mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }};
+ mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf;
+ when: ansible_os_family == "Debian"
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml
new file mode 100644
index 00000000..48287857
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml
@@ -0,0 +1,16 @@
+##############################################################################
+# 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: Stop the Open vSwitch service and clear existing OVSDB
+ shell: >
+ service {{ service_ovs_name }} stop ;
+ rm -rf /var/log/openvswitch/* ;
+ rm -rf /etc/openvswitch/conf.db ;
+ service {{ service_ovs_name }} start ;
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml
new file mode 100644
index 00000000..2c5332f9
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml
@@ -0,0 +1,25 @@
+##############################################################################
+# 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: set opendaylight as the manager
+ command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+
+- name: restart keepalived to recover external IP before check br-int
+ shell: service keepalived restart
+ when: inventory_hostname in groups['odl']
+ ignore_errors: True
+
+- name: check br-int
+ shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
+
+- name: set local ip in openvswitch
+ shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
+
+#'
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml
new file mode 100644
index 00000000..95b64eeb
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml
@@ -0,0 +1,41 @@
+##############################################################################
+# 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: check br-ex
+ shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done
+
+- name: add ovs uplink
+ openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: wait 10 seconds
+ shell: sleep 10
+
+- name: set external nic in openvswitch
+ shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }}
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: copy recovery script
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - recover_network_odl_l3.py
+ - setup_networks_odl_l3.py
+
+- name: recover external script
+ shell: python /opt/setup_networks/recover_network_odl_l3.py
+
+- name: update keepalived info
+ template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf
+ when: inventory_hostname in groups['odl']
+
+- name: modify net-init
+ shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml
new file mode 100644
index 00000000..4efe4339
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml
@@ -0,0 +1,27 @@
+##############################################################################
+# 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: add ovs bridge
+ openvswitch_bridge: bridge={{ item["name"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: add ovs uplink
+ openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: copy recovery script
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - recover_network.py
+
+- name: recover external script
+ shell: python /opt/setup_networks/recover_network.py
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_recover_external_network.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_recover_external_network.yml
new file mode 100644
index 00000000..40963260
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_03_recover_external_network.yml
@@ -0,0 +1,22 @@
+##############################################################################
+# 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: recover external network for L3
+ include: 03_03_00_recover_external_network_l3.yml
+ when: odl_l3_agent == "Enable"
+
+- name: recover external network for L2
+ include: 03_03_01_recover_external_network_l2.yml
+ when: odl_l3_agent == "Disable"
+
+- name: restart keepalived to recover external IP
+ shell: service keepalived restart
+ when: inventory_hostname in groups['odl']
+ ignore_errors: True
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_04_setup_ml2.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_04_setup_ml2.yml
new file mode 100644
index 00000000..24149735
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_04_setup_ml2.yml
@@ -0,0 +1,24 @@
+##############################################################################
+# 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: configure opendaylight -> ml2
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
+ 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;
+
+- name: copy ml2 configuration script
+ template:
+ src: ml2_conf.sh
+ dest: "/opt/ml2_conf.sh"
+ mode: 0777
+
+- name: execute ml2 configuration script
+ command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_openvswitch.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_openvswitch.yml
new file mode 100755
index 00000000..f5b2ef3c
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/03_openvswitch.yml
@@ -0,0 +1,24 @@
+##############################################################################
+# 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: switch off neutron-openvswitch-agent
+ include: 03_00_switch_off_neutron_openvswitch_agent.yml
+
+- name: clean up and restart openvswitch
+ include: 03_01_clean_up_and_restart_openvswitch.yml
+
+- name: openvswitch connect with opendaylight and check br-int
+ include: 03_02_openvswitch_connect_opendaylight.yml
+
+- name: recover external network
+ include: 03_03_recover_external_network.yml
+
+- name: set up ml2
+ include: 03_04_setup_ml2.yml
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/main.yml
new file mode 100644
index 00000000..32952c51
--- /dev/null
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/main.yml
@@ -0,0 +1,24 @@
+##############################################################################
+# 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
+##############################################################################
+---
+- include_vars: "{{ ansible_os_family }}.yml"
+ tags:
+ - test_odl
+
+- name: Provision Common on all nodes
+ include: 00_odl_common.yml
+ when: groups['odl']|length !=0
+
+- name: Provision ODL on Controller nodes
+ include: 01_odl_controller.yml
+ when: inventory_hostname in groups['odl']
+
+- name: Provision ODL on Compute nodes
+ include: 02_odl_compute.yml
+ when: groups['odl']|length !=0 and inventory_hostname not in groups['odl']
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/moon-odl.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/moon-odl.yml
index 25306059..b89b2823 100644
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/moon-odl.yml
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/moon-odl.yml
@@ -36,8 +36,14 @@
- name: copy settings.xml
template: src=settings.xml dest=/root/.m2/settings.xml
-- name: upload swift lib
- unarchive: src=odl-aaa-moon.tar.gz dest=/home/
+#- name: upload swift lib
+# unarchive: src=odl-aaa-moon.tar.gz dest=/home/
+
+- name: download odl-aaa-moon package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/moon/{{ odl_aaa_moon }}" dest=/home/
+
+- name: unarchive odl-aaa-moon package
+ command: su -s /bin/sh -c "tar xvf /home/{{ odl_aaa_moon }} -C /home/"
- name: install aaa
shell: >
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/odl_controller.yml
deleted file mode 100755
index 4cf7948a..00000000
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/odl_controller.yml
+++ /dev/null
@@ -1,294 +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: install controller packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: controller_packages | union(controller_packages_noarch)
-
-- name: get image http server
- shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
- register: http_server
-
-- name: download oracle-jdk8 package file
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }}
-
-#"
-
-- name: upload install_jdk8 scripts
- unarchive: src=install_jdk8.tar dest=/opt/
-
-- name: install install_jdk8 package
- command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
-
-#- name: install opendaylight packages
-# apt: name={{ item }} state=present
-# with_items:
-# - openjdk-8-jdk
-
-#- name: create odl directories
-# file:
-# path: /opt/opendaylight-0.2.2
-# state: "directory"
-# group: root
-# owner: root
-# mode: 0755
-
-- name: create odl group
- group: name=odl system=yes state=present
-
-- name: create odl user
- user:
- name: odl
- group: odl
- home: "{{ odl_home }}"
- createhome: "yes"
- system: "yes"
- shell: "/bin/false"
-
-#- name: get image http server
-# shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
-# register: http_server
-
-- name: download odl package
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ odl_pkg_url }}" dest=/opt/{{ odl_pkg_name }}
-
-# "
-
-#- name: download odl package
-# get_url: url={{ odl_pkg_url }} dest=/opt/{{ odl_pkg_name }}
-
-# TODO: unarchive doesn't support strip-component at the moment
-# TODO: switch to use untar after support is added.
-- name: extract odl package
-# unarchive: src=/opt/{{ odl_pkg_name }} dest={{ odl_home }} group=odl owner=odl mode=0775 copy=no
- command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
-# notify:
-# - restart odl service
-
-- name: opendaylight system file
- copy:
- src: "{{ service_file.src }}"
- dest: "{{ service_file.dst }}"
- mode: 0755
-
-- name: set l3 fwd enable in custom.properties
- template:
- src: custom.properties
- dest: "{{ odl_home }}/etc/custom.properties"
- owner: odl
- group: odl
- mode: 0775
- when: odl_l3_agent == "Enable"
-
-- name: create karaf config
- template:
- src: org.apache.karaf.features.cfg.Debian
- dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
- owner: odl
- group: odl
- mode: 0775
- when: ansible_os_family == "Debian"
-
-- name: create karaf config
- template:
- src: org.apache.karaf.features.cfg.Redhat
- dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
- owner: odl
- group: odl
- mode: 0775
- when: ansible_os_family == "RedHat"
-
-- name: create tomcat config
- template:
- src: tomcat-server.xml
- dest: "{{ odl_home }}/configuration/tomcat-server.xml"
-
-- name: create tomcat config
- template:
- src: jetty.xml
- dest: "{{ odl_home }}/etc/jetty.xml"
-
-- name: download odl pip package
- get_url: url="http://{{ http_server.stdout_lines[0] }}/pip/{{ networking_odl_pkg_name }}" dest=/opt/{{ networking_odl_pkg_name }}
-
-#"
-
-- name: patch odl pip package
- shell: |
- cd /opt
- tar xf /opt/{{ networking_odl_pkg_name }}
- rm -rf /opt/{{ networking_odl_pkg_name }}
- sed -i 's/^neutron-lib.*/neutron-lib/' networking-odl-2.0.0/requirements.txt
- tar zcf /opt/{{ networking_odl_pkg_name }} networking-odl-2.0.0
- rm -rf networking-odl-2.0.0
- cd -
-
-- name: odl pip package install
- shell: |
- cd /opt
- pip install {{ networking_odl_pkg_name }}
- rm -rf {{ networking_odl_pkg_name }}
- cd -
-
-#- name: restart odl service
-# service: name=opendaylight state=started pattern="opendaylight"
-
-##########################################################################################################
-################################# OpenDayLight Cluster Configuration #################################
-##########################################################################################################
-#- name: create initial directory
-# shell: >
-# mkdir -p {{ odl_home }}/configuration/initial;
-
-#- name: create akka config
-# template:
-# src: akka.conf
-# dest: "{{ odl_home }}/configuration/initial/akka.conf"
-# notify:
-# - restart odl service
-
-
-#- name: create module-shards config
-# template:
-# src: module-shards.conf
-# dest: "{{ odl_home }}/configuration/initial/module-shards.conf"
-# notify:
-# - restart odl service
-
-#- name: copy Jolokia-OSGi config
-# shell: >
-# cp -r jolokia {{ odl_home }}system/org/;
-
-#- name: copy Jolokia-OSGi config
-# template:
-# src: jolokia
-# dest: "{{ odl_home }}/system/org/"
-# notify:
-# - restart odl service
-
-
-#- name: mkdir Jolokia-OSGi directory
-# shell: >
-# mkdir -p {{ odl_home }}system/org/jolokia;
-# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi;
-# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi/1.1.5;
-
-
-#- name: copy Jolokia-OSGi config
-# template: src={{ item.src }} dest={{ item.dest }}
-# with_items:
-# - src: "jolokia-osgi-1.1.5-features.xml"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml"
-# - src: "jolokia-osgi-1.1.5.jar.sha1"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1"
-# - src: "jolokia-osgi-1.1.5.jar"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar"
-
-#- name: copy Jolokia-OSGi jar config
-# copy: src=roles/odl_cluster/templates/jolokia-osgi-1.1.5.jar dest="{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/"
-
-- name: remove karaf data directory
- shell: rm -rf {{ odl_home }}/data/*;
-
-#- name: chown OpenDaylight Directory and Files
-# shell: >
-# chown -R odl:odl "{{ odl_home }}";
-# chown odl:odl "{{ service_file.dst }}";
-
-
-##########################################################################################################
-################################ OpenDayLight connect with OpenStack ################################
-##########################################################################################################
-- name: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
- shell: >
- sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
- sed -i '/neutron-server/d' /opt/service;
- sed -i '/keepalived/d' /opt/service;
-
-- name: turn off neutron-server on control node
- service: name=neutron-server state=stopped
-
-- name: turn off keepalived on control node
- service: name=keepalived state=stopped
- when: ansible_os_family == "Debian"
-
-
-#################################################################
-########################### moon ################################
-#################################################################
-
-- include: moon-odl.yml
- when: moon == "Enable"
-
-#################################################################
-
-- name: chown opendaylight directory and files
- shell: >
- chown -R odl:odl "{{ odl_home }}";
- chown odl:odl "{{ service_file.dst }}";
-
-- name: start opendaylight
- service: name=opendaylight state=started
- when: ansible_os_family == "Debian"
-
-- name: set opendaylight autostart
- shell: chkconfig opendaylight on
- when: ansible_os_family == "RedHat"
-
-- name: start opendaylight
- shell: service opendaylight start
- when: ansible_os_family == "RedHat"
-
-- name: check if opendaylight running
- shell: netstat -lpen --tcp | grep java | grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done
-
-- name: run openvswitch script
- include: openvswitch.yml
-
-#- name: Configure Neutron1
-# shell: >
-# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
-# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
-
-#- name: Create ML2 Configuration File
-# template:
-# src: ml2_conf.sh
-# dest: "/opt/ml2_conf.sh"
-# mode: 0777
-
-#- name: Execute ML2 Configuration File
-# command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-
-
-- name: configure l2 configuration
- shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-prv;
- when: odl_l3_agent == "Disable"
-
-- name: configure l3 configuration
- shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-ex;
- when: odl_l3_agent == "Enable"
-
-- name: configure odl l3 driver
- shell: crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin;
- when: odl_l3_agent == "Enable"
-
-- name: configure metadata for l3 configuration
- shell: crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True;
- when: odl_l3_agent == "Enable"
-
-- name: drop and recreate neutron database
- shell: mysql -e "drop database if exists neutron;";
- mysql -e "create database neutron character set utf8;";
- mysql -e "grant all on neutron.* to 'neutron'@'%' identified by '{{ NEUTRON_DBPASS }}';";
- su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
- when: inventory_hostname == haproxy_hosts.keys()[0]
- tags:
- - test_odl
-
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/openvswitch.yml
deleted file mode 100755
index b8cb6c91..00000000
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/tasks/openvswitch.yml
+++ /dev/null
@@ -1,158 +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: Install Crudini
-# apt: name={{ item }} state=present
-# with_items:
-# - crudini
-
-- name: install compute packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: compute_packages | union(compute_packages_noarch)
-
-- name: remove neutron-openvswitch-agent service daemon
- shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
-
-- name: shut down and disable Neutron's openvswitch agent services
- service: name={{ service_ovs_agent_name }} state=stopped enabled=no
-
-- name: remove Neutron's openvswitch agent services
- shell: >
- update-rc.d -f {{ service_ovs_agent_name }} remove;
- mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }};
- mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf;
- when: ansible_os_family == "Debian"
-
-
-- name: Stop the Open vSwitch service and clear existing OVSDB
- shell: >
- service {{ service_ovs_name }} stop ;
- rm -rf /var/log/openvswitch/* ;
- rm -rf /etc/openvswitch/conf.db ;
- service {{ service_ovs_name }} start ;
-
-- name: set opendaylight as the manager
- command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
-
-- name: restart keepalived to recover external IP before check br-int
- shell: service keepalived restart
- when: inventory_hostname in groups['odl']
- ignore_errors: True
-
-- name: check br-int
- shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
-
-- name: set local ip in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
-
-#'
-
-##################################################################
-########### Recover External network for odl l3 #################
-##################################################################
-
-- name: check br-ex
- shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done
- when: odl_l3_agent == "Enable"
-
-- name: add ovs uplink
- openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: wait 10 seconds
- shell: sleep 10
- when: odl_l3_agent == "Enable"
-
-- name: set external nic in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }}
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network_odl_l3.py
- - setup_networks_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: update keepalived info
- template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf
- when: inventory_hostname in groups['odl'] and odl_l3_agent == "Enable"
-
-- name: modify net-init
- shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init
- when: odl_l3_agent == "Enable"
-
-##################################################################
-########### Recover External network for odl l2 #################
-##################################################################
-
-- name: add ovs bridge
- openvswitch_bridge: bridge={{ item["name"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: add ovs uplink
- openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network.py
- when: odl_l3_agent == "Disable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network.py
- when: odl_l3_agent == "Disable"
-
-##################################################################
-
-
-- name: restart keepalived to recover external IP
- shell: service keepalived restart
- when: inventory_hostname in groups['odl']
- ignore_errors: True
-
-
-
-##################################################################
-##################################################################
-##################################################################
-- name: configure opendaylight -> ml2
- shell: >
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
- 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;
-
-#- name: Adjust Service Daemon
-# shell: >
-# sed -i '/neutron-openvswitch-agent/d' /opt/service ;
-# echo opendaylight >> /opt/service ;
-
-- name: copy ml2 configuration script
- template:
- src: ml2_conf.sh
- dest: "/opt/ml2_conf.sh"
- mode: 0777
-
-- name: execute ml2 configuration script
- command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-
-#- name: change odl password for moon
-# shell: crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password {{ ADMIN_PASS }}
-# when: moon == "Enable"
-
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/Debian.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/Debian.yml
index 5e2a2e72..640a264a 100755
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/Debian.yml
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/Debian.yml
@@ -8,11 +8,7 @@
##############################################################################
---
-controller_packages:
-# - openjdk-7-jdk
- - crudini
-
-compute_packages:
+common_packages:
- crudini
service_ovs_name: openvswitch-switch
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/main.yml b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/main.yml
index da0c9efd..e5f52b42 100755
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/main.yml
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/odl_cluster/vars/main.yml
@@ -19,10 +19,12 @@ odl_base_features: ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'ma
odl_extra_features: ['odl-restconf-all','odl-mdsal-clustering','odl-openflowplugin-flow-services','http','jolokia-osgi']
odl_features: "{{ odl_base_features + odl_extra_features }}"
+odl_aaa_moon: odl-aaa-moon.tar.gz
+
jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz
+jdk8_script_name: install_jdk8.tar
-controller_packages_noarch: []
-compute_packages_noarch: []
+common_packages_noarch: []
odl_pip:
- networking_odl
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/00_odl_common.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/00_odl_common.yml
new file mode 100755
index 00000000..1545314d
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/00_odl_common.yml
@@ -0,0 +1,13 @@
+##############################################################################
+# 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: install controller packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: common_packages | union(common_packages_noarch)
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml
new file mode 100644
index 00000000..da7356dc
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_00_download_packages.yml
@@ -0,0 +1,29 @@
+##############################################################################
+# 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: get image http server
+ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+ register: http_server
+
+- name: download oracle-jdk8 package file
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }}
+
+#"
+
+- name: download oracle-jdk8 script file
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" dest=/opt/
+
+# "
+
+- name: download odl package
+ get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ odl_pkg_url }}" dest=/opt/{{ odl_pkg_name }}
+
+
+
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml
new file mode 100644
index 00000000..cd6e9751
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_01_create_odl_user_and_group.yml
@@ -0,0 +1,21 @@
+##############################################################################
+# 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 odl group
+ group: name=odl system=yes state=present
+
+- name: create odl user
+ user:
+ name: odl
+ group: odl
+ home: "{{ odl_home }}"
+ createhome: "yes"
+ system: "yes"
+ shell: "/bin/false"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml
new file mode 100644
index 00000000..ff82eba1
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_02_unarchive_odl_and_jdk.yml
@@ -0,0 +1,18 @@
+##############################################################################
+# 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: unarchive onos driver package
+ command: su -s /bin/sh -c "tar xvf /opt/install_jdk8.tar -C /opt/"
+
+- name: install install_jdk8 package
+ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
+
+- name: extract odl package
+ command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml
new file mode 100644
index 00000000..507d12ce
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_03_copy_odl_configuration_files.yml
@@ -0,0 +1,46 @@
+##############################################################################
+# 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: opendaylight system file
+ template:
+ src: "{{ service_file.src }}"
+ dest: "{{ service_file.dst }}"
+ mode: 0755
+
+- name: set l3 fwd enable in custom.properties
+ template:
+ src: custom.properties
+ dest: "{{ odl_home }}/etc/custom.properties"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: odl_l3_agent == "Enable"
+
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg.Debian
+ dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: ansible_os_family == "Debian"
+
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg.Redhat
+ dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
+ owner: odl
+ group: odl
+ mode: 0775
+ when: ansible_os_family == "RedHat"
+
+- name: create tomcat config
+ template:
+ src: tomcat-server.xml
+ dest: "{{ odl_home }}/configuration/tomcat-server.xml"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_04_install_pip_packages.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_04_install_pip_packages.yml
new file mode 100644
index 00000000..85bb534a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_04_install_pip_packages.yml
@@ -0,0 +1,15 @@
+##############################################################################
+# 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: install odl pip packages
+ pip: name={{ item }} state=present
+ with_items: odl_pip
+
+
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml
new file mode 100644
index 00000000..6ed317d6
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_05_clean_up_karaf_data.yml
@@ -0,0 +1,12 @@
+##############################################################################
+# 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: remove karaf data directory
+ shell: rm -rf {{ odl_home }}/data/*;
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml
new file mode 100644
index 00000000..8dfaf4df
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_06_stop_openstack_services.yml
@@ -0,0 +1,42 @@
+##############################################################################
+# 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: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
+ shell: >
+ sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
+ sed -i '/neutron-server/d' /opt/service;
+ sed -i '/keepalived/d' /opt/service;
+
+- name: turn off neutron-server on control node
+ service: name=neutron-server state=stopped
+
+- name: turn off keepalived on control node
+ service: name=keepalived state=stopped
+ when: ansible_os_family == "Debian"
+
+################ l3 agent remove ###################
+
+- name: turn off neutron-l3-agent on control node
+ service: name=neutron-l3-agent state=stopped
+ when: odl_l3_agent == "Enable"
+
+- name: remove neutron-l3-agent daemon
+ shell: >
+ sed -i 'neutron-l3-agent/d' /opt/service ;
+ mv /etc/init.d/neutron-l3-agent /home/ ;
+ mv /etc/init/neutron-l3-agent.conf /home/ ;
+ when: odl_l3_agent == "Enable" and ansible_os_family == "Debian"
+
+- name: remove neutron-l3-agent daemon
+ shell: >
+ sed -i 'neutron-l3-agent/d' /opt/service ;
+ mv /lib/systemd/system/neutron-l3-agent.service /home/ ;
+ when: odl_l3_agent == "Enable" and ansible_os_family == "RedHat"
+
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml
new file mode 100644
index 00000000..32fb885a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_07_start_check_odl.yml
@@ -0,0 +1,29 @@
+##############################################################################
+# 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: chown opendaylight directory and files
+ shell: >
+ chown -R odl:odl "{{ odl_home }}";
+ chown odl:odl "{{ service_file.dst }}";
+
+- name: start opendaylight
+ service: name=opendaylight state=started
+ when: ansible_os_family == "Debian"
+
+- name: set opendaylight autostart
+ shell: chkconfig opendaylight on
+ when: ansible_os_family == "RedHat"
+
+- name: start opendaylight
+ shell: service opendaylight start
+ when: ansible_os_family == "RedHat"
+
+- name: check if opendaylight running
+ shell: netstat -lpen --tcp | grep java | grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml
new file mode 100644
index 00000000..abb91c35
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_08_configure_neutron.yml
@@ -0,0 +1,34 @@
+##############################################################################
+# 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: configure l2 configuration
+ shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-prv;
+ when: odl_l3_agent == "Disable"
+
+- name: configure l3 configuration
+ shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-ex;
+ when: odl_l3_agent == "Enable"
+
+- name: configure odl l3 driver
+ shell: crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin;
+ when: odl_l3_agent == "Enable"
+
+- name: configure metadata for l3 configuration
+ shell: crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True;
+ when: odl_l3_agent == "Enable"
+
+- name: drop and recreate neutron database
+ shell: mysql -e "drop database if exists neutron;";
+ mysql -e "create database neutron character set utf8;";
+ mysql -e "grant all on neutron.* to 'neutron'@'%' identified by '{{ NEUTRON_DBPASS }}';";
+ su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+ tags:
+ - test_odl
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/01_odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_odl_controller.yml
new file mode 100755
index 00000000..7ca38f17
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/01_odl_controller.yml
@@ -0,0 +1,39 @@
+##############################################################################
+# 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: download packages
+ include: 01_00_download_packages.yml
+
+- name: create odl user and group
+ include: 01_01_create_odl_user_and_group.yml
+
+- name: unarchive odl and jdk
+ include: 01_02_unarchive_odl_and_jdk.yml
+
+- name: copy odl configuration files
+ include: 01_03_copy_odl_configuration_files.yml
+
+- name: install pip packages
+ include: 01_04_install_pip_packages.yml
+
+- name: clean up karaf data
+ include: 01_05_clean_up_karaf_data.yml
+
+- name: stop openstack services
+ include: 01_06_stop_openstack_services.yml
+
+- name: start and check odl
+ include: 01_07_start_check_odl.yml
+
+- name: run openswitch
+ include: 03_openvswitch.yml
+
+- name: configure neutron
+ include: 01_08_configure_neutron.yml
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/02_odl_compute.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/02_odl_compute.yml
new file mode 100755
index 00000000..7506200b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/02_odl_compute.yml
@@ -0,0 +1,12 @@
+##############################################################################
+# 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: Provision ODL on Compute nodes
+ include: 03_openvswitch.yml
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml
new file mode 100644
index 00000000..082d75d4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_00_switch_off_neutron_openvswitch_agent.yml
@@ -0,0 +1,22 @@
+##############################################################################
+# 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: remove neutron-openvswitch-agent service daemon
+ shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
+
+- name: shut down and disable Neutron's openvswitch agent services
+ service: name={{ service_ovs_agent_name }} state=stopped enabled=no
+
+- name: remove Neutron's openvswitch agent services
+ shell: >
+ update-rc.d -f {{ service_ovs_agent_name }} remove;
+ mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }};
+ mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf;
+ when: ansible_os_family == "Debian"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml
new file mode 100644
index 00000000..48287857
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_01_clean_up_and_restart_openvswitch.yml
@@ -0,0 +1,16 @@
+##############################################################################
+# 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: Stop the Open vSwitch service and clear existing OVSDB
+ shell: >
+ service {{ service_ovs_name }} stop ;
+ rm -rf /var/log/openvswitch/* ;
+ rm -rf /etc/openvswitch/conf.db ;
+ service {{ service_ovs_name }} start ;
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml
new file mode 100644
index 00000000..c312490b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_02_openvswitch_connect_opendaylight.yml
@@ -0,0 +1,21 @@
+##############################################################################
+# 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: set opendaylight as the manager
+ command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+
+- name: check br-int
+ shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
+
+- name: set local ip in openvswitch
+ shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
+
+#'
+
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml
new file mode 100644
index 00000000..7cf590a9
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_00_recover_external_network_l3.yml
@@ -0,0 +1,40 @@
+##############################################################################
+# 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: check br-ex
+ shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done
+
+- name: add ovs uplink
+ openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: wait 10 seconds
+ shell: sleep 10
+
+- name: set external nic in openvswitch
+ shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }}
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs"
+
+- name: copy recovery script
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - recover_network_odl_l3.py
+ - setup_networks_odl_l3.py
+
+- name: recover external script
+ shell: python /opt/setup_networks/recover_network_odl_l3.py
+
+- name: update keepalived info
+ template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf
+ when: inventory_hostname in groups['odl']
+
+- name: modify net-init
+ shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml
new file mode 100644
index 00000000..9531b4aa
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_01_recover_external_network_l2.yml
@@ -0,0 +1,29 @@
+##############################################################################
+# 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: add ovs bridge
+ openvswitch_bridge: bridge={{ item["name"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and odl_l3_agent == "Disable"
+
+- name: add ovs uplink
+ openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and odl_l3_agent == "Disable"
+
+- name: copy recovery script
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - recover_network.py
+ when: odl_l3_agent == "Disable"
+
+- name: recover external script
+ shell: python /opt/setup_networks/recover_network.py
+ when: odl_l3_agent == "Disable"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml
new file mode 100644
index 00000000..40963260
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_03_recover_external_network.yml
@@ -0,0 +1,22 @@
+##############################################################################
+# 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: recover external network for L3
+ include: 03_03_00_recover_external_network_l3.yml
+ when: odl_l3_agent == "Enable"
+
+- name: recover external network for L2
+ include: 03_03_01_recover_external_network_l2.yml
+ when: odl_l3_agent == "Disable"
+
+- name: restart keepalived to recover external IP
+ shell: service keepalived restart
+ when: inventory_hostname in groups['odl']
+ ignore_errors: True
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml
new file mode 100644
index 00000000..24149735
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_04_setup_ml2.yml
@@ -0,0 +1,24 @@
+##############################################################################
+# 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: configure opendaylight -> ml2
+ shell: >
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
+ 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;
+
+- name: copy ml2 configuration script
+ template:
+ src: ml2_conf.sh
+ dest: "/opt/ml2_conf.sh"
+ mode: 0777
+
+- name: execute ml2 configuration script
+ command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/03_openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_openvswitch.yml
new file mode 100644
index 00000000..5c24be0b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/03_openvswitch.yml
@@ -0,0 +1,24 @@
+##############################################################################
+# 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: switch off neutron-openvswitch-agent
+ include: 03_00_switch_off_neutron_openvswitch_agent.yml
+
+- name: clean up and restart openvswitch
+ include: 03_01_clean_up_and_restart_openvswitch.yml
+
+- name: openvswitch connect with opendaylight and check br-int
+ include: 03_02_openvswitch_connect_opendaylight.yml
+
+- name: recover external network
+ include: 03_03_recover_external_network.yml
+
+- name: set up ml2
+ include: 03_04_setup_ml2.yml
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml
index 4e53f4aa..4e53f4aa 100644
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_l3_nova.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/04_odl_l3_nova.yml
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
index a917a769..50f40db7 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
@@ -11,14 +11,18 @@
tags:
- test_odl
-- name: Install ODL Cluster on Controller
- include: odl_controller.yml
+- name: Provision Common on all nodes
+ include: 00_odl_common.yml
+ when: groups['odl']|length !=0
+
+- name: Provision ODL on Controller nodes
+ include: 01_odl_controller.yml
when: inventory_hostname in groups['odl']
-- name: Install ODL Cluster on Compute
- include: openvswitch.yml
+- name: Provision ODL on Compute nodes
+ include: 02_odl_compute.yml
when: groups['odl']|length !=0 and inventory_hostname not in groups['odl']
- name: Config nova
- include: odl_l3_nova.yml
+ include: 04_odl_l3_nova.yml
when: groups['odl']|length !=0 and odl_l3_agent == "Enable"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
deleted file mode 100755
index 1ea5e0d2..00000000
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
+++ /dev/null
@@ -1,287 +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: install controller packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: controller_packages | union(controller_packages_noarch)
-
-- name: get image http server
- shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
- register: http_server
-
-- name: download oracle-jdk8 package file
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}" dest=/opt/{{ jdk8_pkg_name }}
-
-#"
-
-- name: download oracle-jdk8 script file
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}" dest=/opt/
-
-- name: unarchive onos driver package
- command: su -s /bin/sh -c "tar xvf /opt/install_jdk8.tar -C /opt/"
-
-#- name: upload install_jdk8 scripts
-# unarchive: src=install_jdk8.tar dest=/opt/
-
-- name: install install_jdk8 package
- command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
-
-#- name: install opendaylight packages
-# apt: name={{ item }} state=present
-# with_items:
-# - openjdk-8-jdk
-
-#- name: create odl directories
-# file:
-# path: /opt/opendaylight-0.2.2
-# state: "directory"
-# group: root
-# owner: root
-# mode: 0755
-
-- name: create odl group
- group: name=odl system=yes state=present
-
-- name: create odl user
- user:
- name: odl
- group: odl
- home: "{{ odl_home }}"
- createhome: "yes"
- system: "yes"
- shell: "/bin/false"
-
-#- name: get image http server
-# shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
-# register: http_server
-
-- name: download odl package
- get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/odl/{{ odl_pkg_url }}" dest=/opt/{{ odl_pkg_name }}
-
-# "
-
-#- name: download odl package
-# get_url: url={{ odl_pkg_url }} dest=/opt/{{ odl_pkg_name }}
-
-# TODO: unarchive doesn't support strip-component at the moment
-# TODO: switch to use untar after support is added.
-- name: extract odl package
-# unarchive: src=/opt/{{ odl_pkg_name }} dest={{ odl_home }} group=odl owner=odl mode=0775 copy=no
- command: su -s /bin/sh -c "tar xzf /opt/{{ odl_pkg_name }} -C {{ odl_home }} --strip-components 1 --no-overwrite-dir -k --skip-old-files" odl
-# notify:
-# - restart odl service
-
-- name: opendaylight system file
- template:
- src: "{{ service_file.src }}"
- dest: "{{ service_file.dst }}"
- mode: 0755
-
-- name: set l3 fwd enable in custom.properties
- template:
- src: custom.properties
- dest: "{{ odl_home }}/etc/custom.properties"
- owner: odl
- group: odl
- mode: 0775
- when: odl_l3_agent == "Enable"
-
-- name: create karaf config
- template:
- src: org.apache.karaf.features.cfg.Debian
- dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
- owner: odl
- group: odl
- mode: 0775
- when: ansible_os_family == "Debian"
-
-- name: create karaf config
- template:
- src: org.apache.karaf.features.cfg.Redhat
- dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg"
- owner: odl
- group: odl
- mode: 0775
- when: ansible_os_family == "RedHat"
-
-- name: create tomcat config
- template:
- src: tomcat-server.xml
- dest: "{{ odl_home }}/configuration/tomcat-server.xml"
-
-- name: install odl pip packages
- pip: name={{ item }} state=present
- with_items: odl_pip
-
-
-#- name: restart odl service
-# service: name=opendaylight state=started pattern="opendaylight"
-
-##########################################################################################################
-################################# OpenDayLight Cluster Configuration #################################
-##########################################################################################################
-#- name: create initial directory
-# shell: >
-# mkdir -p {{ odl_home }}/configuration/initial;
-
-#- name: create akka config
-# template:
-# src: akka.conf
-# dest: "{{ odl_home }}/configuration/initial/akka.conf"
-# notify:
-# - restart odl service
-
-
-#- name: create module-shards config
-# template:
-# src: module-shards.conf
-# dest: "{{ odl_home }}/configuration/initial/module-shards.conf"
-# notify:
-# - restart odl service
-
-#- name: copy Jolokia-OSGi config
-# shell: >
-# cp -r jolokia {{ odl_home }}system/org/;
-
-#- name: copy Jolokia-OSGi config
-# template:
-# src: jolokia
-# dest: "{{ odl_home }}/system/org/"
-# notify:
-# - restart odl service
-
-
-#- name: mkdir Jolokia-OSGi directory
-# shell: >
-# mkdir -p {{ odl_home }}system/org/jolokia;
-# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi;
-# mkdir -p {{ odl_home }}system/org/jolokia/jolokia-osgi/1.1.5;
-
-
-#- name: copy Jolokia-OSGi config
-# template: src={{ item.src }} dest={{ item.dest }}
-# with_items:
-# - src: "jolokia-osgi-1.1.5-features.xml"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5-features.xml"
-# - src: "jolokia-osgi-1.1.5.jar.sha1"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar.sha1"
-# - src: "jolokia-osgi-1.1.5.jar"
-# dest: "{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/jolokia-osgi-1.1.5.jar"
-
-#- name: copy Jolokia-OSGi jar config
-# copy: src=roles/odl_cluster/templates/jolokia-osgi-1.1.5.jar dest="{{ odl_home }}/system/org/jolokia/jolokia-osgi/1.1.5/"
-
-- name: remove karaf data directory
- shell: rm -rf {{ odl_home }}/data/*;
-
-#- name: chown OpenDaylight Directory and Files
-# shell: >
-# chown -R odl:odl "{{ odl_home }}";
-# chown odl:odl "{{ service_file.dst }}";
-
-
-##########################################################################################################
-################################ OpenDayLight connect with OpenStack ################################
-##########################################################################################################
-- name: turn off neutron-server neutron-plugins-openvswitch-agent Daemon on control node
- shell: >
- sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
- sed -i '/neutron-server/d' /opt/service;
- sed -i '/keepalived/d' /opt/service;
-
-- name: turn off neutron-server on control node
- service: name=neutron-server state=stopped
-
-- name: turn off keepalived on control node
- service: name=keepalived state=stopped
- when: ansible_os_family == "Debian"
-
-################ l3 agent remove ###################
-- name: turn off neutron-l3-agent on control node
- service: name=neutron-l3-agent state=stopped
- when: odl_l3_agent == "Enable"
-
-- name: remove neutron-l3-agent daemon
- shell: >
- sed -i 'neutron-l3-agent/d' /opt/service ;
- mv /etc/init.d/neutron-l3-agent /home/ ;
- mv /etc/init/neutron-l3-agent.conf /home/ ;
- when: odl_l3_agent == "Enable" and ansible_os_family == "Debian"
-
-- name: remove neutron-l3-agent daemon
- shell: >
- sed -i 'neutron-l3-agent/d' /opt/service ;
- mv /lib/systemd/system/neutron-l3-agent.service /home/ ;
- when: odl_l3_agent == "Enable" and ansible_os_family == "RedHat"
-####################################################
-
-- name: chown opendaylight directory and files
- shell: >
- chown -R odl:odl "{{ odl_home }}";
- chown odl:odl "{{ service_file.dst }}";
-
-- name: start opendaylight
- service: name=opendaylight state=started
- when: ansible_os_family == "Debian"
-
-- name: set opendaylight autostart
- shell: chkconfig opendaylight on
- when: ansible_os_family == "RedHat"
-
-- name: start opendaylight
- shell: service opendaylight start
- when: ansible_os_family == "RedHat"
-
-- name: check if opendaylight running
- shell: netstat -lpen --tcp | grep java | grep 6653; while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done
-
-- name: run openvswitch script
- include: openvswitch.yml
-
-#- name: Configure Neutron1
-# shell: >
-# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
-# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
-
-#- name: Create ML2 Configuration File
-# template:
-# src: ml2_conf.sh
-# dest: "/opt/ml2_conf.sh"
-# mode: 0777
-
-#- name: Execute ML2 Configuration File
-# command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-
-
-- name: configure l2 configuration
- shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-prv;
- when: odl_l3_agent == "Disable"
-
-- name: configure l3 configuration
- shell: crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-ex;
- when: odl_l3_agent == "Enable"
-
-- name: configure odl l3 driver
- shell: crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin;
- when: odl_l3_agent == "Enable"
-
-- name: configure metadata for l3 configuration
- shell: crudini --set /etc/neutron/dhcp_agent.ini DEFAULT enable_isolated_metadata True;
- when: odl_l3_agent == "Enable"
-
-- name: drop and recreate neutron database
- shell: mysql -e "drop database if exists neutron;";
- mysql -e "create database neutron character set utf8;";
- mysql -e "grant all on neutron.* to 'neutron'@'%' identified by '{{ NEUTRON_DBPASS }}';";
- su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
- when: inventory_hostname == haproxy_hosts.keys()[0]
- tags:
- - test_odl
-
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
deleted file mode 100755
index 9c476bff..00000000
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
+++ /dev/null
@@ -1,148 +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: Install Crudini
-# apt: name={{ item }} state=present
-# with_items:
-# - crudini
-
-- name: install compute packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: compute_packages | union(compute_packages_noarch)
-
-- name: remove neutron-openvswitch-agent service daemon
- shell: sed -i '/{{ service_ovs_agent_name }}/d' /opt/service ;
-
-- name: shut down and disable Neutron's openvswitch agent services
- service: name={{ service_ovs_agent_name }} state=stopped enabled=no
-
-- name: remove Neutron's openvswitch agent services
- shell: >
- update-rc.d -f {{ service_ovs_agent_name }} remove;
- mv /etc/init.d/{{ service_ovs_agent_name }} /home/{{ service_ovs_agent_name }};
- mv /etc/init/{{ service_ovs_agent_name }}.conf /home/{{ service_ovs_agent_name }}.conf;
- when: ansible_os_family == "Debian"
-
-
-- name: Stop the Open vSwitch service and clear existing OVSDB
- shell: >
- service {{ service_ovs_name }} stop ;
- rm -rf /var/log/openvswitch/* ;
- rm -rf /etc/openvswitch/conf.db ;
- service {{ service_ovs_name }} start ;
-
-- name: set opendaylight as the manager
- command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
-
-- name: check br-int
- shell: ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-int; done
-
-- name: set local ip in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config={'local_ip'=' {{ internal_ip }} '};
-
-#'
-
-##################################################################
-########### Recover External network for odl l3 #################
-##################################################################
-
-- name: check br-ex
- shell: ovs-vsctl list-br | grep br-ex; while [ $? -ne 0 ]; do sleep 10; ovs-vsctl list-br | grep br-ex; done
- when: odl_l3_agent == "Enable"
-
-- name: add ovs uplink
- openvswitch_port: bridge=br-ex port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: wait 10 seconds
- shell: sleep 10
- when: odl_l3_agent == "Enable"
-
-- name: set external nic in openvswitch
- shell: ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) other_config:provider_mappings=br-ex:{{ item["interface"] }}
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Enable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network_odl_l3.py
- - setup_networks_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network_odl_l3.py
- when: odl_l3_agent == "Enable"
-
-- name: update keepalived info
- template: src=keepalived.conf dest=/etc/keepalived/keepalived.conf
- when: inventory_hostname in groups['odl'] and odl_l3_agent == "Enable"
-
-- name: modify net-init
- shell: sed -i 's/setup_networks.py/setup_networks_odl_l3.py/g' /etc/init.d/net_init
- when: odl_l3_agent == "Enable"
-
-##################################################################
-########### Recover External network for odl l2 #################
-##################################################################
-
-- name: add ovs bridge
- openvswitch_bridge: bridge={{ item["name"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: add ovs uplink
- openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
- with_items: "{{ network_cfg['provider_net_mappings'] }}"
- when: item["type"] == "ovs" and odl_l3_agent == "Disable"
-
-- name: copy recovery script
- copy: src={{ item }} dest=/opt/setup_networks
- with_items:
- - recover_network.py
- when: odl_l3_agent == "Disable"
-
-- name: recover external script
- shell: python /opt/setup_networks/recover_network.py
- when: odl_l3_agent == "Disable"
-
-##################################################################
-
-
-- name: restart keepalived to recover external IP
- shell: service keepalived restart
- when: inventory_hostname in groups['odl']
- ignore_errors: True
-
-
-
-##################################################################
-##################################################################
-##################################################################
-- name: configure opendaylight -> ml2
- shell: >
- crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
- 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;
-
-#- name: Adjust Service Daemon
-# shell: >
-# sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
-# echo opendaylight >> /opt/service ;
-
-- name: copy ml2 configuration script
- template:
- src: ml2_conf.sh
- dest: "/opt/ml2_conf.sh"
- mode: 0777
-
-- name: execute ml2 configuration script
- command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml
index a94d36c4..b44107e2 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/vars/Debian.yml
@@ -8,11 +8,7 @@
##############################################################################
---
-controller_packages:
-# - openjdk-7-jdk
- - crudini
-
-compute_packages:
+common_packages:
- crudini
service_ovs_name: openvswitch-switch
diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml
index 4446ebc6..1adadd5d 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/vars/RedHat.yml
@@ -8,11 +8,7 @@
##############################################################################
---
-controller_packages:
-# - java-1.7.0-openjdk
- - crudini
-
-compute_packages:
+common_packages:
- crudini
service_ovs_name: openvswitch
diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
index 0d6f356e..5b2676a8 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
@@ -23,8 +23,7 @@ odl_api_port: 8080
jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz
jdk8_script_name: install_jdk8.tar
-controller_packages_noarch: []
-compute_packages_noarch: []
+common_packages_noarch: []
odl_pip:
- networking_odl
diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh
index 031b56a2..5d2f1756 100755
--- a/deploy/deploy_host.sh
+++ b/deploy/deploy_host.sh
@@ -10,7 +10,7 @@
rsa_file=$compass_vm_dir/boot.rsa
function rename_nics(){
- python $COMPASS_DIR/deploy/rename_nics.py $DHA $rsa_file $MGMT_IP
+ python $COMPASS_DIR/deploy/rename_nics.py $DHA $rsa_file $MGMT_IP $OS_VERSION
}
function deploy_host(){
diff --git a/deploy/rename_nics.py b/deploy/rename_nics.py
index 6163188e..dcec51df 100644
--- a/deploy/rename_nics.py
+++ b/deploy/rename_nics.py
@@ -6,7 +6,7 @@ def exec_cmd(cmd):
print cmd
os.system(cmd)
-def rename_nics(dha_info, rsa_file, compass_ip):
+def rename_nics(dha_info, rsa_file, compass_ip, os_version):
for host in dha_info['hosts']:
host_name = host['name']
interfaces = host.get('interfaces')
@@ -15,15 +15,21 @@ def rename_nics(dha_info, rsa_file, compass_ip):
nic_name = interface.keys()[0]
mac = interface.values()[0]
- exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
- -i %s root@%s \
- 'cobbler system edit --name=%s --interface=%s --mac=%s --interface_type=static'" \
- % (rsa_file, compass_ip, host_name, nic_name, mac))
+ if os_version == 'xenial':
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler system edit --name=%s --interface=%s --mac=%s --interface_type=static'" \
+ % (rsa_file, compass_ip, host_name, nic_name, mac))
+ else:
+ exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -i %s root@%s \
+ 'cobbler system edit --name=%s --interface=%s --mac=%s'" \
+ % (rsa_file, compass_ip, host_name, nic_name, mac))
exec_cmd("ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
-i %s root@%s \
'cobbler sync'" % (rsa_file, compass_ip))
if __name__ == "__main__":
- assert(len(sys.argv) == 4)
- rename_nics(yaml.load(open(sys.argv[1])), sys.argv[2], sys.argv[3])
+ assert(len(sys.argv) == 5)
+ rename_nics(yaml.load(open(sys.argv[1])), sys.argv[2], sys.argv[3], sys.argv[4])