From 5d28b35794d9bdd8def6dfdf0224420daaa05f11 Mon Sep 17 00:00:00 2001 From: CNlukai Date: Mon, 11 Jan 2016 16:08:46 +0800 Subject: ONOSFW-157 Add script of installer integration onos Change-Id: I5ef70148d51fef5a9b3113fc5a69df46429a968d Signed-off-by: CNlukai --- .../installer/onos_cluster/tasks/openvswitch.yml | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100755 framework/scripts/installer/onos_cluster/tasks/openvswitch.yml (limited to 'framework/scripts/installer/onos_cluster/tasks/openvswitch.yml') diff --git a/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml b/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml new file mode 100755 index 00000000..f8ed551f --- /dev/null +++ b/framework/scripts/installer/onos_cluster/tasks/openvswitch.yml @@ -0,0 +1,83 @@ +--- +#- 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: 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 +# register: http_server +# +#- name: download ovs +# get_url: url="http://{{ http_server.stdout_lines[0] }}/packages/onos/openvswitch.tar" dest=/opt/openvswitch.tar +# +#- name: extract ovs +# command: su -s /bin/sh -c "tar xvf /opt/openvswitch.tar -C /opt/" +# +#- name: update ovs +# shell: > +# 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 {{ public_net_info.floating_ip_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 + shell: > + route delete default; + when: inventory_hostname not in groups['onos'] + ignore_errors: True -- cgit 1.2.3-korg