diff options
author | CNlucius <lukai1@huawei.com> | 2015-12-26 14:51:55 +0800 |
---|---|---|
committer | Justin chi <chigang@huawei.com> | 2015-12-29 01:03:36 +0000 |
commit | 6631c83492897c2b33e6144bd0832488a3c3218d (patch) | |
tree | 9be88871389fb216d27023529722f2c79043e3d1 /deploy/adapters/ansible/roles/onos_cluster/tasks | |
parent | 0ccb2434dc7bbafa2d5e60ec5777dd03b00bc258 (diff) |
Integration onos into compass installer
JIRA: ONOSFW-10
Change-Id: I7ce044f63bdf5e8930828d15d12e1630e5819889
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/onos_cluster/tasks')
3 files changed, 108 insertions, 26 deletions
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml index c3e7c7b7..3cd4421b 100755 --- a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml +++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml @@ -1,11 +1,44 @@ --- - include_vars: "{{ ansible_os_family }}.yml" +- name: remove neutron-plugin-openvswitch-agent auto start + shell: > + update-rc.d neutron-plugin-openvswitch-agent remove; + sed -i /neutron-plugin-openvswitch-agent/d /opt/service + when: groups['onos']|length !=0 + ignore_errors: True + +- name: shut down and disable Neutron's agent services + service: name=neutron-plugin-openvswitch-agent state=stopped + when: groups['onos']|length !=0 + ignore_errors: True + +- name: remove neutron-l3-agent auto start + shell: > + update-rc.d neutron-l3-agent remove; + sed -i /neutron-l3-agent/d /opt/service + when: inventory_hostname in groups['onos'] + ignore_errors: True + +- name: shut down and disable Neutron's l3 agent services + service: name=neutron-l3-agent state=stopped + when: inventory_hostname in groups['onos'] + ignore_errors: True + +- name: Stop the Open vSwitch service and clear existing OVSDB + shell: > + ovs-vsctl del-br br-int ; + ovs-vsctl del-br br-tun ; + ovs-vsctl del-manager ; + when: groups['onos']|length !=0 + ignore_errors: True + - name: Install ONOS Cluster on Controller include: onos_controller.yml when: inventory_hostname in groups['onos'] - name: Install ONOS Cluster on Compute include: openvswitch.yml - when: groups['onos']|length !=0 and inventory_hostname not in groups['onos'] + when: groups['onos']|length !=0 +# when: groups['onos']|length !=0 and inventory_hostname not in groups['onos'] diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml index 20691cc9..0606fad9 100755 --- a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml +++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml @@ -63,9 +63,9 @@ echo 'export ONOS_USER=root' >> {{ onos_home }}/options; mkdir {{ onos_home }}/var; mkdir {{ onos_home }}/config; - sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/debian/onos.conf; - cp -rf {{ onos_home }}/debian/onos.conf /etc/init/; - cp -rf {{ onos_home }}/debian/onos.conf /etc/init.d/; + sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/init/onos.conf; + cp -rf {{ onos_home }}/init/onos.conf /etc/init/; + cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/; # notify: # - restart onos service @@ -73,17 +73,17 @@ shell: > sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg; -- name: create cluster json - template: - src: cluster.json - dest: "{{ onos_home }}/config/cluster.json" +#- name: create cluster json +# template: +# src: cluster.json +# dest: "{{ onos_home }}/config/cluster.json" # notify: # - restart onos service -- name: create tablets json - template: - src: tablets.json - dest: "{{ onos_home }}/config/tablets.json" +#- name: create tablets json +# template: +# src: tablets.json +# dest: "{{ onos_home }}/config/tablets.json" # notify: # - restart onos service @@ -115,12 +115,13 @@ ########################################################################################################## ################################ ONOS connect with OpenStack ################################ ########################################################################################################## -- name: Run OpenVSwitch Script - include: openvswitch.yml +#- name: Run OpenVSwitch Script +# include: openvswitch.yml - name: Configure Neutron1 shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos; + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins onos_router; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos_ml2; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml index 5bea0ae2..77161a63 100755 --- a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml +++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml @@ -1,17 +1,17 @@ --- -- name: remove neutron-plugin-openvswitch-agent auto start - shell: > - update-rc.d neutron-plugin-openvswitch-agent remove; - sed -i /neutron-plugin-openvswitch-agent/d /opt/service +#- name: remove neutron-plugin-openvswitch-agent auto start +# shell: > +# update-rc.d neutron-plugin-openvswitch-agent remove; +# sed -i /neutron-plugin-openvswitch-agent/d /opt/service -- name: shut down and disable Neutron's agent services - service: name=neutron-plugin-openvswitch-agent state=stopped +#- name: shut down and disable Neutron's agent services +# service: name=neutron-plugin-openvswitch-agent state=stopped -- name: Stop the Open vSwitch service and clear existing OVSDB - shell: > - ovs-vsctl del-br br-int ; - ovs-vsctl del-br br-tun ; - ovs-vsctl del-manager ; +#- name: Stop the Open vSwitch service and clear existing OVSDB +# shell: > +# ovs-vsctl del-br br-int ; +# ovs-vsctl del-br br-tun ; +# ovs-vsctl del-manager ; #- name: get image http server # shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf @@ -28,6 +28,54 @@ # cd /opt/openvswitch; # dpkg -i openvswitch-common_2.3.0-1_amd64.deb; # dpkg -i openvswitch-switch_2.3.0-1_amd64.deb; + +- name: start up onos-external nic + command: su -s /bin/sh -c "ifconfig eth2 0 up" + +#- name: wait for onos start time +# shell: "sleep 200" + +- name: add ovsdatabase feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'"; + when: inventory_hostname == groups['onos'][0] + +- name: add openflow-base feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'"; + when: inventory_hostname == groups['onos'][0] + +- name: add openflow feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'"; + when: inventory_hostname == groups['onos'][0] + +- name: add vtn feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'"; + when: inventory_hostname == groups['onos'][0] + + +- name: set public eth card start + command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n eth2'" + when: inventory_hostname == groups['onos'][0] + - name: Set ONOS as the manager command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ ip_settings[groups['onos'][0]]['mgmt']['ip'] }}:6640;" +- name: create public network + shell: > + export OS_PASSWORD=console; + export OS_TENANT_NAME=admin; + export OS_AUTH_URL=http://{{ internal_vip.ip }}:35357/v2.0; + export OS_USERNAME=ADMIN; + neutron net-create ext-net --shared --router:external=True; + neutron subnet-create ext-net --name ext-subnet {{ ip_settings[haproxy_hosts.keys()[0]]['external']['cidr'] }}; + when: inventory_hostname == groups['controller'][0] + +- name: set gateway mac address + shell: > + ping -c 1 {{ ansible_default_ipv4.gateway }}; + gatewayMac=`arp -a {{ ansible_default_ipv4.gateway }} | awk '{print $4}'`; + /opt/onos/bin/onos "externalgateway-update -m $gatewayMac"; + when: inventory_hostname == groups['onos'][0] + +- name: delete default gateway + command: su -s /bin/sh -c "route delete dufault"; + ignore_errors: True |