diff options
Diffstat (limited to 'plugins')
47 files changed, 671 insertions, 152 deletions
diff --git a/plugins/dpdk/plugins.desc b/plugins/dpdk/plugins.desc new file mode 100644 index 00000000..9989af5e --- /dev/null +++ b/plugins/dpdk/plugins.desc @@ -0,0 +1,67 @@ +# This dpdk plugin adds ovs-dpdk and dpdk features from ovsnfv project +# into Compass4nfv together with scenarios. +# +# +# More details can be found in the development document. +# ############################################################## +--- +plugin: + # plugin name,it is also as the switch to enable/disable plugin in scenario + # files + name: dpdk + + description: ovs-dpdk and dpdk based on ovsnfv + + maintainers: + - david.j.chou@intel.com + - chigang@huawei.com + + # host os type: ubuntu/centos + os_version: ubuntu + + # true: this plugin is deployed separately on a new node + # false: this plugin is deployed on controller or compute node + independent_hosts: false + + # artifact: packege download url for this plugin + artifacts: + url: + + global_vars: + - dpdk_repo: https://github.com/dpdk/dpdk.git + - dpdk_version: v16.11 + - ovs_repo: https://github.com/openvswitch/ovs.git + - ovs_version: v2.7.2 + + # orchestration + # A plugin can have mutiple components, each component may need to be + # installed on different inventory or have its own configuration. + # due to Compass4nfv currently only supports ansible, so each component + # of the installation and configuration script need to be use ansible. + # cm : congfiguration management tool : only ansible support + # role: each component corresponds to ansible script that locates in the same + # directory as plugin.desc. + # phrase: pre_openstack -- the component is installed after the OS + # provisioning, before the OpenStack deployment. + # phrase: post_openstack -- the component is installed before the OpenStack + # deployment. + # inventory: if the phrase is pre_openstack, inventory can be controller and + # compute. if the phrase is post_openstack, inventory can be get from the file + # openstack-ansible.inventory + orchestration: + cm: ansible + roles: + - role: ins_dpdk + phrase: pre_openstack + inventory: + - compute + + - role: ins_ovs + phrase: pre_openstack + inventory: + - compute + + - role: dpdk_config + phrase: post_openstack + inventory: + - neutron_agents_container diff --git a/plugins/dpdk/roles/config-dpdk/files/openvswitch-switch.service b/plugins/dpdk/roles/config-dpdk/files/openvswitch-switch.service new file mode 100644 index 00000000..cb46c341 --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/files/openvswitch-switch.service @@ -0,0 +1,17 @@ +[Unit] +Description=openvswitch-switch + +[Service] +User=root +Group=root +Type=oneshot +RemainAfterExit=yes +ExecStart=/opt/start_ovs_vswitchd.sh + +TimeoutSec=120 +#Restart=on-failure +#RestartSec=2 + +[Install] +WantedBy=multi-user.target + diff --git a/plugins/dpdk/roles/config-dpdk/handlers/main.yml b/plugins/dpdk/roles/config-dpdk/handlers/main.yml new file mode 100644 index 00000000..b1a62327 --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/handlers/main.yml @@ -0,0 +1,28 @@ +############################################################################## +# Copyright (c) 2017 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: service openvswitch restart + systemd: + name: "{{ item }}" + state: restarted + daemon_reload: "yes" + enabled: "yes" + with_items: "{{ openvswitch_service }}" + +- name: service libvirtd restart + service: + name: "{{ item }}" + state: restarted + with_items: "{{ libvirtd_service }}" + +- name: service neutron-openvswitch-agent restart + service: + name: "{{ item }}" + state: restarted + with_items: "{{ ovs_agent_service }}" diff --git a/plugins/dpdk/roles/config-dpdk/tasks/compute.yml b/plugins/dpdk/roles/config-dpdk/tasks/compute.yml new file mode 100644 index 00000000..b5285d79 --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/tasks/compute.yml @@ -0,0 +1,82 @@ +############################################################################# +# Copyright (c) 2017 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 dpdk interface device name + command: echo "{{ compu_sys_mappings['tenant']['interface'] }}" + register: dpdk_device_name + +- name: get dpdk interface ip + shell: > + ip a show "{{ dpdk_device_name.stdout }}" | grep -E "\<inet\>" | + awk '{print $2}' + register: dpdk_device_ip + +- debug: + msg: "{{ dpdk_device_ip.stdout }}" + +- name: get dpdk interface device pci + shell: > + {{ devbind_script }} -s | grep {{ dpdk_device_name.stdout }} | + awk '{print $1}' + register: dpdk_device_pci + +- name: switch dpdk interface driver + shell: "{{ switch_driver_script }}" + notify: service openvswitch restart + +- name: kill ovs process + shell: > + ps aux | grep ovs | grep -v grep | awk '{print $2}' | xargs kill -9 | + true + notify: service openvswitch restart + +- name: copy service file + copy: + src: openvswitch-switch.service + dest: /lib/systemd/system/openvswitch-switch.service + notify: service openvswitch restart + +- name: config libvirtd + shell: echo 'user = "root"' >> /etc/libvirt/qemu.conf + notify: service libvirtd restart + +- meta: flush_handlers + +- name: config neutron-openvswitch-agent + blockinfile: + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + insertafter: '^\[ovs\]' + block: | + datapath_type=netdev + vhostuser_socket_dir=/usr/local/var/run/openvswitch + +- name: set ovs manager + shell: ovs-vsctl set-manager ptcp:6640:127.0.0.1 + notify: service neutron-openvswitch-agent restart + +- name: config ovs to dpdk + shell: | + ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true + ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="{{ dpdk_memory }}" + notify: service neutron-openvswitch-agent restart + +- name: add dpdk bridge + shell: | + ovs-vsctl add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev + ovs-vsctl add-port br-dpdk dpdk0 -- set Interface dpdk0 \ + type=dpdk options:dpdk-devargs="{{ dpdk_device_pci.stdout }}" + notify: service neutron-openvswitch-agent restart + +- name: bind ip on dpdk bridge + shell: | + ifconfig br-dpdk "{{ dpdk_device_ip.stdout }}" + ifconfig br-dpdk up + notify: service neutron-openvswitch-agent restart + +- meta: flush_handlers diff --git a/plugins/dpdk/roles/config-dpdk/tasks/config-dpdk.yml b/plugins/dpdk/roles/config-dpdk/tasks/config-dpdk.yml new file mode 100644 index 00000000..b0e1a1ed --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/tasks/config-dpdk.yml @@ -0,0 +1,16 @@ +############################################################################# +# Copyright (c) 2017 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_distribution }}.yml" + +- include: neutron_agent.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: compute.yml + when: inventory_hostname in groups['compute'] diff --git a/plugins/dpdk/roles/config-dpdk/tasks/main.yml b/plugins/dpdk/roles/config-dpdk/tasks/main.yml new file mode 100644 index 00000000..19fc66b7 --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/tasks/main.yml @@ -0,0 +1,11 @@ +############################################################################## +# Copyright (c) 2017 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: config-dpdk.yml + when: dpdk is defined and dpdk == "Enable" diff --git a/plugins/dpdk/roles/config-dpdk/tasks/neutron_agent.yml b/plugins/dpdk/roles/config-dpdk/tasks/neutron_agent.yml new file mode 100644 index 00000000..aa65142b --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/tasks/neutron_agent.yml @@ -0,0 +1,15 @@ +############################################################################# +# Copyright (c) 2017 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: config neutron-openvswitch-agent + lineinfile: + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + regexp: '^firewall_driver' + line: "firewall_driver = openvswitch" + notify: service neutron-openvswitch-agent restart diff --git a/plugins/dpdk/roles/config-dpdk/vars/Ubuntu.yml b/plugins/dpdk/roles/config-dpdk/vars/Ubuntu.yml new file mode 100644 index 00000000..697785ad --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/vars/Ubuntu.yml @@ -0,0 +1,14 @@ +######################################################################### +# Copyright (c) 2017 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 +########################################################################## +--- +devbind_script: /root/dpdk/tools/dpdk-devbind.py +switch_driver_script: /root/dpdk_uio.sh +openvswitch_service: openvswitch-switch +ovs_agent_service: neutron-openvswitch-agent +libvirtd_service: libvirtd diff --git a/plugins/dpdk/roles/config-dpdk/vars/main.yml b/plugins/dpdk/roles/config-dpdk/vars/main.yml new file mode 100644 index 00000000..f6115b62 --- /dev/null +++ b/plugins/dpdk/roles/config-dpdk/vars/main.yml @@ -0,0 +1,10 @@ +########################################################################## +# Copyright (c) 2017 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 +########################################################################## +--- +dpdk_memory: 128 diff --git a/plugins/dpdk/roles/ins_dpdk/tasks/dpdk.yml b/plugins/dpdk/roles/ins_dpdk/tasks/dpdk.yml new file mode 100644 index 00000000..6a08386f --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/tasks/dpdk.yml @@ -0,0 +1,81 @@ +# ############################################################################# +# Copyright (c) 2017 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 prerequisites package + apt: + name: "{{ item }}" + state: present + with_items: + - git + - gcc + - make + - cmake + - libpcap0.8 + - libpcap0.8-dev + +- name: git clone DPDK code + git: + repo: "{{ dpdk_repo }}" + dest: "{{ dpdk_dir }}" + version: "{{ dpdk_version }}" + +- name: Configure DPDK + lineinfile: + dest: "{{ dpdk_dir }}/config/common_linuxapp" + regexp: '^{{ item.key }}=' + line: "{{ item.key }}={{ item.value }}" + with_items: + - key: CONFIG_RTE_BUILD_COMBINE_LIBS + value: y + register: dpdk_config_change + +- name: make config DPDK + command: make config T=x86_64-native-linuxapp-gcc chdir={{ dpdk_dir }} + +- name: Configure PMD + lineinfile: + dest: "{{ dpdk_dir }}/build/.config" + regexp: '^{{ item.key }}=' + line: "{{ item.key }}={{ item.value }}" + with_items: + - key: PMD_PCAP + value: y + +- name: Check if DPDK build exists + stat: path={{ dpdk_build }} + register: dpdk_build_status + +- name: Build DPDK + command: make install T=x86_64-native-linuxapp-gcc chdir={{ dpdk_dir }} + when: (dpdk_build_status.stat.isdir is not defined) or + (dpdk_rebuild is defined) or + dpdk_config_change.changed or dpdk_changed.changed + +- name: Get dpdk interface device name + command: echo "{{ compu_sys_mappings['tenant']['interface'] }}" + register: dpdk_device_name + when: compu_sys_mappings["tenant"]["type"] == "dpdk" + +- debug: + msg: "{{ dpdk_device_name }}" + +- name: Create DPDK scripts + template: + src: "templates/{{ item.name }}.j2" + dest: "/root/{{ item.name }}" + mode: 0755 + with_items: + - name: dpdk_uio.sh + dpdk_build: '{{ dpdk_build }}' + dpdk_dir: '{{ dpdk_dir }}' + device_name: '{{ dpdk_device_name.stdout | default("eth2") }}' + - name: dpdk_vfio.sh + dpdk_build: '{{ dpdk_build }}' + dpdk_dir: '{{ dpdk_dir }}' + device_name: '{{ dpdk_device_name.stdout | default("eth2") }}' diff --git a/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml b/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml new file mode 100644 index 00000000..3f41cf03 --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml @@ -0,0 +1,45 @@ +# ############################################################################# +# Copyright (c) 2017 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 +# ############################################################################# +--- +# yamllint disable rule:truthy +- name: Check hugepages + shell: grep -q intel_iommu /etc/default/grub + register: check_result + ignore_errors: True +# yamllint enable rule:truthy + +- name: Config grub + lineinfile: + dest: /etc/default/grub + regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=""' + line: "{{ grub_cmdline }}" + state: present + when: check_result.rc == 1 + +- name: Update grub + shell: update-grub + when: check_result.rc == 1 + +- name: wait a moment + command: sleep 5 + when: check_result.rc == 1 + +- name: Reboot + shell: sleep 2 && shutdown -r now 'Reboot required' + become: true + async: 1 + poll: 0 + when: check_result.rc == 1 + ignore_errors: true + +- name: Wait for reboot + local_action: + module: wait_for + host={{ ansible_eth0.ipv4.address }} port=22 delay=1 timeout=300 + when: check_result.rc == 1 diff --git a/plugins/dpdk/roles/ins_dpdk/tasks/main.yml b/plugins/dpdk/roles/ins_dpdk/tasks/main.yml new file mode 100644 index 00000000..923dc3b4 --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/tasks/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2016-2017 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: hugepages.yml + when: dpdk is defined and dpdk == "Enable" + +- include: dpdk.yml + when: dpdk is defined and dpdk == "Enable" diff --git a/plugins/dpdk/roles/ins_dpdk/templates/dpdk_uio.sh.j2 b/plugins/dpdk/roles/ins_dpdk/templates/dpdk_uio.sh.j2 new file mode 100644 index 00000000..560d30ca --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/templates/dpdk_uio.sh.j2 @@ -0,0 +1,9 @@ +#!/bin/bash +ifdown {{ item.device_name }} +modprobe uio +lsmod |grep igb_uio +if [ $? == 0 ];then + rmmod igb_uio +fi +insmod {{ item.dpdk_build }}/kmod/igb_uio.ko +{{ item.dpdk_dir }}/tools/dpdk-devbind.py --bind=igb_uio {{ item.device_name }} diff --git a/plugins/dpdk/roles/ins_dpdk/templates/dpdk_vfio.sh.j2 b/plugins/dpdk/roles/ins_dpdk/templates/dpdk_vfio.sh.j2 new file mode 100644 index 00000000..58839342 --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/templates/dpdk_vfio.sh.j2 @@ -0,0 +1,6 @@ +#!/bin/bash +ifdown {{ item.device_name }} +modprobe vfio-pci +chmod a+x /dev/vfio +chmod 0666 /dev/vfio/* +{{ item.dpdk_dir }}/tools/dpdk-devbind.py --bind=vfio-pci {{ item.device_name }} diff --git a/plugins/dpdk/roles/ins_dpdk/vars/main.yml b/plugins/dpdk/roles/ins_dpdk/vars/main.yml new file mode 100644 index 00000000..4bd4076e --- /dev/null +++ b/plugins/dpdk/roles/ins_dpdk/vars/main.yml @@ -0,0 +1,17 @@ +############################################################################## +# Copyright (c) 2016-2017 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 +############################################################################## +--- +# yamllint disable rule:line-length +grub_cmdline: GRUB_CMDLINE_LINUX_DEFAULT="hugepagesz=2M hugepages=2048 iommu=pt intel_iommu=on" +# yamllint enable rule:line-length + +dpdk_dir: /root/dpdk +dpdk_build: '{{ dpdk_dir }}/x86_64-native-linuxapp-gcc' +dpdk_repo: https://github.com/dpdk/dpdk.git +dpdk_version: v16.11 diff --git a/plugins/dpdk/roles/ins_ovs/tasks/main.yml b/plugins/dpdk/roles/ins_ovs/tasks/main.yml new file mode 100644 index 00000000..6570d06c --- /dev/null +++ b/plugins/dpdk/roles/ins_ovs/tasks/main.yml @@ -0,0 +1,11 @@ +# ############################################################################# +# Copyright (c) 2016-2017 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: ovs.yml + when: dpdk is defined and dpdk == "Enable" diff --git a/plugins/dpdk/roles/ins_ovs/tasks/ovs.yml b/plugins/dpdk/roles/ins_ovs/tasks/ovs.yml new file mode 100644 index 00000000..64475c6a --- /dev/null +++ b/plugins/dpdk/roles/ins_ovs/tasks/ovs.yml @@ -0,0 +1,93 @@ +############################################################################## +# Copyright (c) 2017 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 prerequisites package + apt: + name: "{{ item }}" + state: present + with_items: + - git + - libnuma-dev + - dh-autoreconf + - python-pip + +- name: git clone open-vswitch code + git: + repo: "{{ ovs_repo }}" + dest: "{{ ovs_dir }}" + version: "{{ ovs_version }}" + +- name: install prerequisites package + pip: + name: six + +- name: Check if OVS configure script exists + stat: path={{ ovs_dir }}/configure + register: ovs_config_status + +- name: Bootstrap OVS if required + command: ./boot.sh chdir={{ ovs_dir }} + when: ovs_config_status.stat.exists == false or (ovs_rebuild is defined) or ovs_changed.changed + +- name: Check if OVS Makefile exists + stat: path={{ ovs_dir }}/Makefile + register: ovs_makefile_status + +# yamllint disable rule:line-length +- name: Configure OVS + command: ./configure --with-dpdk={{ dpdk_build }} CFLAGS="-g -O2 -Wno-cast-align" chdir={{ ovs_dir }} + when: ovs_makefile_status.stat.exists == false or (ovs_rebuild is defined) or ovs_changed.changed +# yamllint enable rule:line-length + +- name: Check if OVS distribution files exists + stat: path={{ ovs_dir }}/distfiles + register: ovs_distfiles_status + +- name: Build OVS + command: make CFLAGS='-O3 -march=native' chdir={{ ovs_dir }} + when: ovs_distfiles_status.stat.exists == false or (ovs_rebuild is defined) or ovs_changed.changed + +- name: Check if OVS tools are installed + stat: path=/usr/local/bin/ovsdb-tool + register: ovs_tools_status + +- name: Install OVS tools + command: make install chdir={{ ovs_dir }} + when: ovs_tools_status.stat.exists == false or (ovs_rebuild is defined) or ovs_changed.changed + +- name: Create OVS scripts + template: + src: "templates/{{ item }}.j2" + dest: "/opt/{{ item }}" + mode: 0755 + with_items: + - start_ovs_vswitchd.sh + +- name: Create folders + file: path={{ item }} state=directory + with_items: + - /usr/local/etc/openvswitch + - /usr/local/var/run/openvswitch + +- name: Clear database configuration if required + file: path=/usr/local/etc/openvswitch/conf.db state=absent + when: ovs_rebuild is defined or ovs_changed.changed + +- name: Check if database configuration exists + stat: path=/usr/local/etc/openvswitch/conf.db + register: ovs_dbconfig_status + +# yamllint disable rule:line-length +- name: Create database configuration + command: ovsdb-tool create /usr/local/etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema + when: ovs_dbconfig_status.stat.exists == false +# yamllint enable rule:line-length + +- name: Start OVS vswitchd with DPDK support enabled + command: /opt/start_ovs_vswitchd.sh diff --git a/plugins/dpdk/roles/ins_ovs/templates/start_ovs_vswitchd.sh.j2 b/plugins/dpdk/roles/ins_ovs/templates/start_ovs_vswitchd.sh.j2 new file mode 100644 index 00000000..a96c8721 --- /dev/null +++ b/plugins/dpdk/roles/ins_ovs/templates/start_ovs_vswitchd.sh.j2 @@ -0,0 +1,8 @@ +#!/bin/bash +ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \ + --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ + --pidfile --detach + +export DB_SOCK=/usr/local/var/run/openvswitch/db.sock +sudo ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true +sudo ovs-vswitchd unix:$DB_SOCK --pidfile --detach diff --git a/plugins/dpdk/roles/ins_ovs/vars/main.yml b/plugins/dpdk/roles/ins_ovs/vars/main.yml new file mode 100644 index 00000000..c5f14d4e --- /dev/null +++ b/plugins/dpdk/roles/ins_ovs/vars/main.yml @@ -0,0 +1,14 @@ +############################################################################## +# Copyright (c) 2016-2017 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 +############################################################################## +--- +dpdk_dir: /root/dpdk +dpdk_build: '{{ dpdk_dir }}/x86_64-native-linuxapp-gcc' +ovs_dir: /root/ovs +ovs_repo: https://github.com/openvswitch/ovs.git +ovs_version: v2.7.2 diff --git a/plugins/moon/roles/moon/handlers/main.yml b/plugins/moon/roles/moon/handlers/main.yml index ab2a090b..5029d378 100755 --- a/plugins/moon/roles/moon/handlers/main.yml +++ b/plugins/moon/roles/moon/handlers/main.yml @@ -7,9 +7,5 @@ ############################################################################## --- - name: restart network service - shell: "ifconfig eth0 down && ifconfig eth0 up && \ - /sbin/ifdown -a && \ + shell: "ifconfig eth0 0 && /sbin/ifdown -a && \ /sbin/ifup --ignore-errors -a" - -- name: restart nfs service - service: name=nfs-kernel-server state=restarted diff --git a/plugins/odl_cluster/roles/setup-odl/files/odl_pkg.sh b/plugins/odl_cluster/roles/setup-odl/files/odl_pkg.sh new file mode 100755 index 00000000..55639907 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/files/odl_pkg.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +rm -rf /home/networking +rm -rf /home/tmp + +mkdir -p /home/networking +mkdir -p /home/tmp + +cd /home/networking + +git clone https://github.com/openstack/networking-odl.git -b stable/ocata + +sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' /home/networking/networking-odl/requirements.txt + +pip wheel /home/networking/networking-odl/ -w /home/tmp/ + +cp /home/tmp/networking* /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ + +sleep 30 diff --git a/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service index f4801a36..a6966d82 100755 --- a/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service +++ b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service @@ -10,7 +10,7 @@ Type=simple WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.9.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml index dc071cc7..684f314c 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml @@ -8,7 +8,6 @@ - name: install networking-odl pip: name: networking-odl - version: "{{ networking_odl_version }}" virtualenv: /openstack/venvs/neutron-15.1.4 - name: configure vsctl for dhcp agent diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml index 2527852e..e0a9088f 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml @@ -4,41 +4,10 @@ shell: | crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; 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"; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini ovs; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; -- name: configure bridge_mappings -> ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ contr_l2_mappings }}"; - when: - - odl_l3_agent == "Disable" - - inventory_hostname not in groups['nova_compute'] - -- name: configure bridge_mappings -> ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ compu_l2_mappings }}"; - when: - - odl_l3_agent == "Disable" - - inventory_hostname in groups['nova_compute'] - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ contr_l3_mappings }}"; - when: - - odl_l3_agent == "Enable" - - inventory_hostname not in groups['nova_compute'] - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ compu_l3_mappings }}"; - when: - - odl_l3_agent == "Enable" - - inventory_hostname in groups['nova_compute'] - - name: configure external bridge name for L2 shell: | crudini --set /etc/neutron/l3_agent.ini \ diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml index 6879340e..9ca27e0a 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml @@ -94,6 +94,11 @@ sed -i 's/port="8282"/port="8081"/' {{ odl_home }}configuration/tomcat-server.xml +- name: modify 8181 to 8081 + shell: > + sed -i 's/8181/8081/' + {{ odl_home }}etc/org.ops4j.pax.web.cfg + - name: remove karaf data directory file: path: "{{ odl_home }}data" diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml index 8427e4f0..7b699a35 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml @@ -1,17 +1,9 @@ --- +- name: copy download script + copy: + src: odl_pkg.sh + dest: /opt/odl_pkg.sh + mode: 0777 -- name: download networking-odl - get_url: - url: "{{ odl_pip }}" - dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 - -- name: patch networking-odl to fix a bug - shell: | - cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify - rm -rf networking-odl-4.0.0.tar.gz - sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt - tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ - rm -rf networking-odl-4.0.0/ - pip install networking-odl-4.0.0.tar.gz -d ./ - cd - +- name: download networking sfc and odl + command: su -s /bin/sh -c "/opt/odl_pkg.sh" diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml index 459c734a..f6f73684 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml @@ -8,7 +8,6 @@ - name: install networking-odl pip: name: networking-odl - version: "{{ networking_odl_version }}" virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify - name: turn off neutron-server on control node diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml index a5d31d4c..39d0312f 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml @@ -10,16 +10,9 @@ shell: > crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; 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"; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini ovs; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings - "{{ contr_l2_mappings }}"; - -- name: configure bridge_mappings for L3 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings - "{{ contr_l3_mappings }}"; - when: odl_l3_agent == "Enable" - name: turn off l3 ha for odl l2 shell: | diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/main.yml b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml index e65be002..96ca2f96 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/main.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml @@ -1,4 +1,6 @@ --- - include: odl-cluster.yml - when: opendaylight is defined and opendaylight == "Enable" + when: + - opendaylight is defined and opendaylight == "Enable" + - odl_sfc is not defined diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml index 5b57fb00..8cd12da8 100755 --- a/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml +++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml @@ -15,7 +15,7 @@ - include: control-repos-1.yml vars: odl_pip: "{{ networking_odl_url }}" - when: inventory_hostname in groups['repo_container'] + when: inventory_hostname == groups['repo_container'][0] - include: control-servers-1.yml when: inventory_hostname in groups['neutron_server'] diff --git a/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg index bc625cda..86b2baec 100755 --- a/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg +++ b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg @@ -36,12 +36,15 @@ # # Comma separated list of features repositories to register by default # -featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features +featuresRepositories = \ + mvn:org.opendaylight.integration/features-index/0.7.0/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.9/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.9/xml/features # # Comma separated list of features to install at startup # -featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger +featuresBoot=config,standard,wrap,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-netvirt-ui # # Defines if the boot features are started in asynchronous mode (in a dedicated thread) diff --git a/plugins/odl_cluster/roles/setup-odl/vars/main.yml b/plugins/odl_cluster/roles/setup-odl/vars/main.yml index 5e6325fb..37881880 100755 --- a/plugins/odl_cluster/roles/setup-odl/vars/main.yml +++ b/plugins/odl_cluster/roles/setup-odl/vars/main.yml @@ -13,8 +13,8 @@ odl_username: admin odl_password: admin odl_api_port: 8181 -odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz -odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz +odl_pkg_url: karaf-0.7.0.tar.gz +odl_pkg_name: karaf-0.7.0.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/odl_pkg.sh b/plugins/odl_sfc/roles/setup-odl-sfc/files/odl_pkg.sh new file mode 100755 index 00000000..d93da3fd --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/odl_pkg.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +rm -rf /home/networking +rm -rf /home/tmp + +mkdir -p /home/networking +mkdir -p /home/tmp + +cd /home/networking + +git clone https://github.com/openstack/networking-odl.git -b stable/ocata +git clone https://github.com/openstack/networking-sfc.git -b stable/ocata + +sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' /home/networking/networking-odl/requirements.txt + +pip wheel /home/networking/networking-odl/ -w /home/tmp/ +pip wheel /home/networking/networking-sfc/ -w /home/tmp/ + +cp /home/tmp/networking* /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ + +sleep 30 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service index f4801a36..a6966d82 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service @@ -10,7 +10,7 @@ Type=simple WorkingDirectory=/opt/opendaylight PermissionsStartOnly=true ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/boot/org.apache.karaf.diagnostic.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.9.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.9.jar:/opt/opendaylight/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main Restart=on-failure LimitNOFILE=65535 TimeoutStopSec=15 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml index dc071cc7..684f314c 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml @@ -8,7 +8,6 @@ - name: install networking-odl pip: name: networking-odl - version: "{{ networking_odl_version }}" virtualenv: /openstack/venvs/neutron-15.1.4 - name: configure vsctl for dhcp agent diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml index 2527852e..e0a9088f 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml @@ -4,41 +4,10 @@ shell: | crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; 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"; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini ovs; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; -- name: configure bridge_mappings -> ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ contr_l2_mappings }}"; - when: - - odl_l3_agent == "Disable" - - inventory_hostname not in groups['nova_compute'] - -- name: configure bridge_mappings -> ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ compu_l2_mappings }}"; - when: - - odl_l3_agent == "Disable" - - inventory_hostname in groups['nova_compute'] - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ contr_l3_mappings }}"; - when: - - odl_l3_agent == "Enable" - - inventory_hostname not in groups['nova_compute'] - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ - ovs bridge_mappings "{{ compu_l3_mappings }}"; - when: - - odl_l3_agent == "Enable" - - inventory_hostname in groups['nova_compute'] - - name: configure external bridge name for L2 shell: | crudini --set /etc/neutron/l3_agent.ini \ diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml index 6879340e..9ca27e0a 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml @@ -94,6 +94,11 @@ sed -i 's/port="8282"/port="8081"/' {{ odl_home }}configuration/tomcat-server.xml +- name: modify 8181 to 8081 + shell: > + sed -i 's/8181/8081/' + {{ odl_home }}etc/org.ops4j.pax.web.cfg + - name: remove karaf data directory file: path: "{{ odl_home }}data" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml index 2e58e141..7b699a35 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml @@ -1,27 +1,9 @@ --- +- name: copy download script + copy: + src: odl_pkg.sh + dest: /opt/odl_pkg.sh + mode: 0777 -- name: download networking-odl - get_url: - url: "{{ odl_pip }}" - dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 - -- name: download networking-sfc - shell: | - mkdir -p /opt/tmp - pip install networking-sfc==4.0.0 -d /opt/tmp/ - cp /opt/tmp/networking* /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - rm -rf /opt/tmp - when: - - odl_sfc == "Enable" - - inventory_hostname in groups['repo_container'][0] - -- name: patch networking-odl to fix a bug - shell: | - cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify - rm -rf networking-odl-4.0.0.tar.gz - sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt - tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ - rm -rf networking-odl-4.0.0/ - pip install networking-odl-4.0.0.tar.gz -d ./ - cd - +- name: download networking sfc and odl + command: su -s /bin/sh -c "/opt/odl_pkg.sh" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml index e2dd128d..40149346 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml @@ -8,13 +8,11 @@ - name: install networking-odl pip: name: networking-odl - version: "{{ networking_odl_version }}" virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify - name: install networking-sfc pip: name: networking-sfc - version: "4.0.0" virtualenv: /openstack/venvs/neutron-15.1.4 when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml index b54fce22..d8bcf154 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml @@ -10,16 +10,9 @@ shell: > crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; 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"; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini ovs; + crudini --del /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup firewall_driver; crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings - "{{ contr_l2_mappings }}"; - -- name: configure bridge_mappings for L3 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings - "{{ contr_l3_mappings }}"; - when: odl_l3_agent == "Enable" - name: turn off l3 ha for odl l2 shell: | diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml new file mode 100644 index 00000000..c43b6dcc --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-tacker-1.yml @@ -0,0 +1,8 @@ +--- + +- name: upgrade networking-sfc + pip: + name: networking-sfc + extra_args: -U + virtualenv: /openstack/venvs/tacker-15.1.4 + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml index 613c796b..d10634fa 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml @@ -3,5 +3,4 @@ - name: Install networking-sfc for CLI pip: name: networking-sfc - version: "4.0.0" when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml index e65be002..6b226688 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml @@ -1,4 +1,6 @@ --- - include: odl-cluster.yml - when: opendaylight is defined and opendaylight == "Enable" + when: + - opendaylight is defined and opendaylight == "Enable" + - odl_sfc is defined and odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml index a22e980f..ee2ee32a 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml @@ -4,7 +4,7 @@ - include_vars: "{{ openstack_passwd_file }}" -- include_vars: odl-pre.yml +- include: odl-pre.yml when: inventory_hostname == "localhost" - include_vars: /tmp/odl-extra-vars.yml @@ -15,7 +15,7 @@ - include: control-repos-1.yml vars: odl_pip: "{{ networking_odl_url }}" - when: inventory_hostname in groups['repo_container'] + when: inventory_hostname == groups['repo_container'][0] - include: control-servers-1.yml when: inventory_hostname in groups['neutron_server'] @@ -48,4 +48,7 @@ - inventory_hostname in groups['neutron_server'][0] - inventory_hostname not in groups['network_hosts'] +- include: control-tacker-1.yml + when: inventory_hostname in groups['tacker_all'] + - include: odl-post.yml diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg index b07e028f..afb7e6b5 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg @@ -36,12 +36,15 @@ # # Comma separated list of features repositories to register by default # -featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features +featuresRepositories = \ + mvn:org.opendaylight.integration/features-index/0.7.0/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.9/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.9/xml/features # # Comma separated list of features to install at startup # -featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger,odl-netvirt-sfc +featuresBoot=config,standard,wrap,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-netvirt-ui,odl-netvirt-sfc # # Defines if the boot features are started in asynchronous mode (in a dedicated thread) diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml index a9466ea0..b3d71edb 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml @@ -7,6 +7,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- +openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml + odl_username: admin odl_password: admin odl_api_port: 8181 @@ -16,8 +18,8 @@ sfc_plugins: src: sfc.conf dst: /opt/sfc.conf -odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz -odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz +odl_pkg_url: karaf-0.7.0.tar.gz +odl_pkg_name: karaf-0.7.0.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config diff --git a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml index eb8b5aa6..cb33d59e 100644 --- a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml +++ b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml @@ -10,5 +10,5 @@ - name: copy odl_cluster role shell: | - cp -rf /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl-sfc \ - /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl + cp -rf /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl-sfc/* \ + /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl/ |