summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/odl_cluster/tasks
diff options
context:
space:
mode:
authorchenshuai@huawei.com <chenshuai@huawei.com>2016-02-24 17:52:48 +0800
committerchenshuai@huawei.com <chenshuai@huawei.com>2016-02-24 17:58:17 +0800
commitbb0ee921be7b53609e3b942ad7aeee8b06f458d5 (patch)
treef5edc239fe11f404ea3d7784fb48265205a64935 /deploy/adapters/ansible/roles/odl_cluster/tasks
parente38c1a6d08b10ea81d208bd40b9df1a13d28db8c (diff)
support odl_l3_agent enable flag param
JIRA: COMPASS-318 Change-Id: I2c9d3d9143c1f3cc9c8a36c0eb55930ce7e3e2e3 Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/odl_cluster/tasks')
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml51
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml76
2 files changed, 81 insertions, 46 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
index 91e75dfe..846a71c7 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
@@ -19,6 +19,8 @@
- 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/
@@ -57,6 +59,8 @@
- 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 }}
@@ -74,6 +78,15 @@
dest: "{{ service_file.dst }}"
mode: 0644
+- 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
@@ -81,15 +94,11 @@
owner: odl
group: odl
mode: 0775
-# notify:
-# - restart odl service
- name: create tomcat config
template:
src: tomcat-server.xml
dest: "{{ odl_home }}/configuration/tomcat-server.xml"
-# notify:
-# - restart odl service
- name: install odl pip packages
pip: name={{ item }} state=present
@@ -177,12 +186,6 @@
- name: turn off keepalived on control node
service: name=keepalived state=stopped
-#- name: Install Crudini
-# apt: name={{ item }} state=present
-# with_items:
-# - crudini
-
-
- name: chown opendaylight directory and files
shell: >
chown -R odl:odl "{{ odl_home }}";
@@ -197,16 +200,6 @@
- name: run openvswitch script
include: openvswitch.yml
-#- name: add patch-port and normal flow table
-# shell: ovs-vsctl add-port br-int patch-br-prv;
-# ovs-vsctl set Interface patch-br-prv type=patch;
-# ovs-vsctl set Interface patch-br-prv options:peer=patch-int;
-# ovs-vsctl add-port br-prv patch-int;
-# ovs-vsctl set Interface patch-int type=patch;
-# ovs-vsctl set Interface patch-int options:peer=patch-br-prv;
-# ovs-ofctl -O OpenFlow13 add-flow br-int "table=0, priority=0 actions=NORMAL";
-# ignore_errors: True
-
#- name: Configure Neutron1
# shell: >
# crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight;
@@ -221,8 +214,20 @@
#- name: Execute ML2 Configuration File
# command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
-- name: configure l3 configuration
+
+- 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: drop and recreate neutron database
shell: mysql -e "drop database if exists neutron;";
@@ -235,8 +240,8 @@
service: name=neutron-server state=started
- name: add service daemon
- shell: >
- echo opendaylight >> /opt/service ;
+ shell: >
+ echo keepalived >> /opt/service ;
echo neutron-server >> /opt/service ;
- name: restart neutron-l3-agent server
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
index 0431d82a..72182462 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
@@ -23,25 +23,12 @@
- name: shut down and disable Neutron's openvswitch agent services
service: name=neutron-plugin-openvswitch-agent state=stopped
-#- name: Stop the Open vSwitch service and clear existing OVSDB
-# shell: >
-# ovs-ofctl del-flows br-int ;
-# ovs-vsctl del-br br-tun ;
-# ovs-vsctl del-port br-int patch-tun;
-# ovs-vsctl del-manager ;
-
-#- name: Restart OpenVSwitch
-# shell: service openvswitch-switch restart;
-
- name: remove Neutron's openvswitch agent services
shell: >
update-rc.d -f neutron-plugin-openvswitch-agent remove;
mv /etc/init.d/neutron-plugin-openvswitch-agent /home/neutron-plugin-openvswitch-agent;
mv /etc/init/neutron-plugin-openvswitch-agent.conf /home/neutron-plugin-openvswitch-agent.conf;
-- name: Check External network
- shell: ovs-vsctl list-br | grep br-prv
- register: extbr
- name: Stop the Open vSwitch service and clear existing OVSDB
shell: >
@@ -50,9 +37,6 @@
rm -rf /etc/openvswitch/conf.db ;
service openvswitch-switch start ;
-#- name: Set OpenDaylight as the manager
-# command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
-
- name: set opendaylight as the manager
command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
@@ -65,34 +49,80 @@
#'
##################################################################
-################ Recover External network #######################
+########### 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 extbr.rc == 0
+ 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 extbr.rc == 0
+ 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: extbr.rc == 0
+ when: odl_l3_agent == "Disable"
- name: recover external script
shell: python /opt/setup_networks/recover_network.py
- when: extbr.rc == 0
+ when: odl_l3_agent == "Disable"
+
+##################################################################
-- name: restart keepalived
+
+- name: restart keepalived to recover external IP
shell: service keepalived restart
- when: inventory_hostname in groups['odl'] and extbr.rc == 0
+ when: inventory_hostname in groups['odl']
ignore_errors: True
+
+
##################################################################
##################################################################
##################################################################