diff options
author | Yifei Xue <xueyifei@huawei.com> | 2016-05-25 16:53:12 +0800 |
---|---|---|
committer | Yifei Xue <xueyifei@huawei.com> | 2016-05-25 16:59:20 +0800 |
commit | f5fd209ddd3c42ea7ef0d9f0b96dcc80efb136fb (patch) | |
tree | 20f96feb647d1e10faeb9eff7ccdf6e9b5d28971 /deploy/adapters/ansible/openstack_mitaka/roles | |
parent | 12d4586098effd082bc3f927c1a41cbc85301285 (diff) |
Update the service name of neutron-plugin-openvswitch-agent
JIRA: COMPASS-397
Change-Id: Iea9e63fc5e749aa43da122aef009926254c64586
Signed-off-by: Yifei Xue <xueyifei@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/openstack_mitaka/roles')
9 files changed, 481 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/ext-network/handlers/main.yml b/deploy/adapters/ansible/openstack_mitaka/roles/ext-network/handlers/main.yml new file mode 100644 index 00000000..36e39072 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/ext-network/handlers/main.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: restart neutron-plugin-openvswitch-agent + service: name=neutron-openvswitch-agent state=restarted enabled=yes + when: "'opendaylight' not in {{ NEUTRON_MECHANISM_DRIVERS }}" + +- name: restart neutron-l3-agent + service: name=neutron-l3-agent state=restarted enabled=yes + +- name: kill dnsmasq + command: killall dnsmasq + ignore_errors: True + +- name: restart neutron-dhcp-agent + service: name=neutron-dhcp-agent state=restarted enabled=yes + +- name: restart neutron-metadata-agent + service: name=neutron-metadata-agent state=restarted enabled=yes + +- name: restart xorp + service: name=xorp state=restarted enabled=yes sleep=10 + ignore_errors: True diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/neutron-compute/vars/Debian.yml b/deploy/adapters/ansible/openstack_mitaka/roles/neutron-compute/vars/Debian.yml new file mode 100644 index 00000000..6ae52f3b --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/neutron-compute/vars/Debian.yml @@ -0,0 +1,19 @@ +############################################################################## +# 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 +############################################################################## +--- + +packages: + - neutron-common + - neutron-plugin-ml2 + - openvswitch-datapath-dkms + - openvswitch-switch + - neutron-plugin-openvswitch-agent + +services: + - neutron-openvswitch-agent diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/neutron-network/vars/Debian.yml b/deploy/adapters/ansible/openstack_mitaka/roles/neutron-network/vars/Debian.yml new file mode 100644 index 00000000..c95d0265 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/neutron-network/vars/Debian.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 +############################################################################## +--- +packages: + - neutron-plugin-ml2 + - openvswitch-datapath-dkms + - openvswitch-switch + - neutron-l3-agent + - neutron-dhcp-agent + - neutron-plugin-openvswitch-agent + +services: + - openvswitch-switch + - neutron-openvswitch-agent + +openvswitch_agent: neutron-plugin-openvswitch-agent + +xorp_packages: + - xorp 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 new file mode 100755 index 00000000..33099104 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/tasks/openvswitch.yml @@ -0,0 +1,148 @@ +############################################################################## +# 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_mitaka/roles/odl_cluster/vars/Debian.yml b/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/vars/Debian.yml new file mode 100755 index 00000000..a3d5dd02 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/odl_cluster/vars/Debian.yml @@ -0,0 +1,23 @@ +############################################################################## +# 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 +############################################################################## +--- + +controller_packages: +# - openjdk-7-jdk + - crudini + +compute_packages: + - crudini + +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.conf + dst: /etc/init/opendaylight.conf diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/main.yml b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/main.yml new file mode 100755 index 00000000..c77a4c61 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/main.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 +############################################################################## +--- +- include_vars: "{{ ansible_os_family }}.yml" + +- name: remove neutron-openvswitch-agent auto start + shell: > + update-rc.d neutron-openvswitch-agent remove; + sed -i /neutron-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-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 ; + ip link delete onos_port1 type veth peer name onos_port2; + 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 +# when: groups['onos']|length !=0 and inventory_hostname not in groups['onos'] + diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/openvswitch.yml new file mode 100755 index 00000000..1db17329 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/tasks/openvswitch.yml @@ -0,0 +1,103 @@ +############################################################################## +# 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-plugin-openvswitch-agent auto start +# shell: > +# update-rc.d neutron-openvswitch-agent remove; +# sed -i /neutron-openvswitch-agent/d /opt/service + +#- name: shut down and disable Neutron's agent services +# service: name=neutron-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: set veth port + shell: > + ip link add onos_port1 type veth peer name onos_port2; + ifconfig onos_port1 up; + ifconfig onos_port2 up; + ignore_errors: True + +- name: set veth to ovs + shell: > + export externamMac=`ifconfig eth1 | grep -Eo '\<[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'`; + ifconfig onos_port2 hw ether $externamMac; + ovs-vsctl add-port br-prv onos_port1; + ignore_errors: True + +#- 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 in groups['onos'] + +- name: add openflow feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'"; + when: inventory_hostname in groups['onos'] + +- name: add vtn feature + command: su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'"; + when: inventory_hostname in groups['onos'] + +- name: set public eth card start + command: su -s /bin/sh -c "/opt/onos/bin/onos 'externalportname-set -n onos_port2'" + when: inventory_hostname in groups['onos'] + +- 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 {{ public_net_info.floating_ip_cidr }} --name ext-subnet --allocation-pool start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }}; + 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 in groups['onos'] + +- name: delete default gateway + shell: > + route delete default; + when: inventory_hostname not in groups['onos'] + ignore_errors: True diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/open-contrail/tasks/uninstall-openvswitch.yml b/deploy/adapters/ansible/openstack_mitaka/roles/open-contrail/tasks/uninstall-openvswitch.yml new file mode 100755 index 00000000..836cb78b --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/open-contrail/tasks/uninstall-openvswitch.yml @@ -0,0 +1,46 @@ +--- +- name: del ovs bridge + shell: ovs-vsctl del-br br-int; ovs-vsctl del-br br-tun; ovs-vsctl del-br br-prv; + +- name: remove ovs and ovs-plugin daeman + shell: > + sed -i '/neutron-openvswitch-agent/d' /opt/service ; + sed -i '/openvswitch-switch/d' /opt/service ; + +- name: stop ovs and ovs-plugin + shell: service openvswitch-switch stop; service neutron-openvswitch-agent stop; + +- name: remove ovs and ovs-plugin files + shell: > + update-rc.d -f neutron-openvswitch-agent remove; + mv /etc/init.d/neutron-openvswitch-agent /home/neutron-openvswitch-agent; + mv /etc/init/neutron-openvswitch-agent.conf /home/neutron-openvswitch-agent.conf; + update-rc.d -f openvswitch-switch remove ; + mv /etc/init.d/openvswitch-switch /home/openvswitch-switch ; + mv /etc/init/openvswitch-switch.conf /home/openvswitch-switch.conf ; + update-rc.d -f neutron-ovs-cleanup remove ; + mv /etc/init.d/neutron-ovs-cleanup /home/neutron-ovs-cleanup ; + mv /etc/init/neutron-ovs-cleanup.conf /home/neutron-ovs-cleanup.conf ; + +- name: remove ovs kernel module + shell: rmmod vport_vxlan; rmmod openvswitch; + ignore_errors: True + +- name: copy recovery script + copy: src={{ item }} dest=/opt/setup_networks + with_items: +# - recover_network_opencontrail.py + - setup_networks_opencontrail.py + +#- name: recover external script +# shell: python /opt/setup_networks/recover_network_opencontrail.py + +- name: modify net-init + shell: sed -i 's/setup_networks.py/setup_networks_opencontrail.py/g' /etc/init.d/net_init + +- name: resolve dual NIC problem + shell: > + echo "net.ipv4.conf.all.arp_ignore=1" >> /etc/sysctl.conf ; + /sbin/sysctl -p ; + echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore ; + diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/secgroup/vars/Debian.yml b/deploy/adapters/ansible/openstack_mitaka/roles/secgroup/vars/Debian.yml new file mode 100644 index 00000000..221a3d92 --- /dev/null +++ b/deploy/adapters/ansible/openstack_mitaka/roles/secgroup/vars/Debian.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 +############################################################################## +--- +configs_templates: + - src: nova.j2 + dest: + - /etc/nova/nova.conf + - src: neutron.j2 + dest: + - /etc/neutron/plugins/ml2/ml2_conf.ini + - /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini + - /etc/neutron/plugins/ml2/restproxy.ini + +controller_services: + - nova-api + - nova-cert + - nova-conductor + - nova-consoleauth + - nova-novncproxy + - nova-scheduler + - neutron-server + - neutron-openvswitch-agent + - neutron-l3-agent + - neutron-dhcp-agent + - neutron-metadata-agent + +compute_services: + - nova-compute + - neutron-openvswitch-agent |