From cd30202e48ceedb3119d9d17b721840c54d0eb42 Mon Sep 17 00:00:00 2001 From: Yifei Xue Date: Tue, 6 Feb 2018 11:46:09 +0800 Subject: Update the odl_sfc plugin to use the latest version JIRA: - We have upgraded odl version to nitrogen SR1. So this patch we are going to update the odl_sfc plugin to satisfy the latest odl version. Change-Id: I7342fad58c0ae21f918e27e9d72deae214c2af4e Signed-off-by: Yifei Xue --- .../roles/setup-odl-sfc/files/opendaylight.service | 2 +- plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf | 2 +- .../roles/setup-odl-sfc/tasks/control-agents-1.yml | 2 +- .../roles/setup-odl-sfc/tasks/control-agents-2.yml | 8 +- .../roles/setup-odl-sfc/tasks/control-repos-1.yml | 4 +- .../setup-odl-sfc/tasks/control-servers-1.yml | 4 +- .../setup-odl-sfc/tasks/control-servers-2.yml | 2 +- .../setup-odl-sfc/tasks/control-servers-3.yml | 6 +- .../roles/setup-odl-sfc/tasks/control-tacker-1.yml | 3 +- .../roles/setup-odl-sfc/templates/odl_pkg.sh.j2 | 19 +++++ .../templates/org.apache.karaf.features.cfg | 6 +- plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml | 19 ++--- .../odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch | 90 ++++++++++++++++++++++ .../odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml | 32 +++----- 14 files changed, 143 insertions(+), 56 deletions(-) create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 create mode 100644 plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch 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 a6966d82..fe125ccf 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 -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 +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.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.jaas.boot-4.0.10.jar:/opt/opendaylight/lib/boot/org.apache.karaf.main-4.0.10.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/files/sfc.conf b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf index acf2e2f4..6621a212 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf @@ -1,6 +1,6 @@ [DEFAULT] -service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin +service_plugins = odl-router_v2,metering,trunk,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin [sfc] drivers = odl 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 684f314c..13b4c571 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,7 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: configure vsctl for dhcp agent shell: | diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml index 82a26005..39b501db 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml @@ -70,7 +70,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l2_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -78,7 +78,7 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig \ --datapath_type=system --bridge_mappings={{ contr_l3_mappings }} when: - inventory_hostname not in groups['nova_compute'] @@ -86,14 +86,14 @@ - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system when: - inventory_hostname in groups['nova_compute'] - odl_l3_agent == "Disable" - name: Set host OVS configurations command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-odl-ovs-hostconfig --datapath_type=system --bridge_mappings={{ compu_l3_mappings }} when: - inventory_hostname in groups['nova_compute'] 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 7b699a35..0eacde6e 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,7 +1,7 @@ --- - name: copy download script - copy: - src: odl_pkg.sh + template: + src: odl_pkg.sh.j2 dest: /opt/odl_pkg.sh mode: 0777 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 40149346..0269bb37 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,12 +8,12 @@ - name: install networking-odl pip: name: networking-odl - virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify + virtualenv: /openstack/venvs/neutron-{{ os_ver }} - name: install networking-sfc pip: name: networking-sfc - virtualenv: /openstack/venvs/neutron-15.1.4 + virtualenv: /openstack/venvs/neutron-{{ os_ver }} when: odl_sfc == "Enable" - name: turn off neutron-server on control node 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 d8bcf154..be45567a 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 @@ -3,7 +3,7 @@ - name: configure odl l3 driver shell: | crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; + odl-router_v2,metering,trunk; when: odl_l3_agent == "Enable" - name: configure opendaylight -> ml2 diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml index 0c11e36f..c4451ca2 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml @@ -2,7 +2,7 @@ - name: Perform a Neutron DB online upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --expand @@ -11,7 +11,7 @@ - name: Perform a Neutron DB offline upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade --contract @@ -20,7 +20,7 @@ - name: SFC DB upgrade command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + /openstack/venvs/neutron-{{ os_ver }}/bin/neutron-db-manage --subproject networking-sfc upgrade head become: "yes" 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 index c43b6dcc..8fd1109f 100644 --- 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 @@ -3,6 +3,5 @@ - name: upgrade networking-sfc pip: name: networking-sfc - extra_args: -U - virtualenv: /openstack/venvs/tacker-15.1.4 + virtualenv: /openstack/venvs/tacker-{{ os_ver }} when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 new file mode 100755 index 00000000..f8882b23 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/odl_pkg.sh.j2 @@ -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/{{ os_name }} +git clone https://github.com/openstack/networking-sfc.git -b stable/{{ os_name }} + +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/{{ os_ver }}/ubuntu-16.04-x86_64/ + +sleep 30 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 afb7e6b5..05f7a7cd 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 @@ -37,9 +37,9 @@ # Comma separated list of features repositories to register by default # 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 + mvn:org.opendaylight.integration/features-index/0.7.1/xml/features, \ + mvn:org.apache.karaf.features/framework/4.0.10/xml/features, \ + mvn:org.apache.karaf.features/standard/4.0.10/xml/features # # Comma separated list of features to install at startup 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 b3d71edb..014fc5b8 100755 --- a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml @@ -9,6 +9,9 @@ --- openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml +os_ver: 16.0.5 +os_name: pike + odl_username: admin odl_password: admin odl_api_port: 8181 @@ -18,8 +21,8 @@ sfc_plugins: src: sfc.conf dst: /opt/sfc.conf -odl_pkg_url: karaf-0.7.0.tar.gz -odl_pkg_name: karaf-0.7.0.tar.gz +odl_pkg_url: karaf-0.7.1.tar.gz +odl_pkg_name: karaf-0.7.1.tar.gz odl_home: "/opt/opendaylight/" odl_base_features: - config @@ -49,19 +52,9 @@ odl_extra_features: odl_features: "{{ odl_base_features + odl_extra_features }}" -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz - -# yamllint disable rule:line-length -networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz -# yamllint enable rule:line-length +sdn_package: http://artifacts.opnfv.org/compass4nfv/package/master/sdn_package.tar.gz jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz jdk8_script_name: install_jdk8.tar common_packages_noarch: [] - -odl_pip: networking-odl-3.2.0 - -networking_odl_version: 4.0.0 - -networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch new file mode 100644 index 00000000..9e25214a --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre-2/files/odl_sfc.patch @@ -0,0 +1,90 @@ +diff --git a/defaults/main.yml b/defaults/main.yml +index fd6fc37..3ae4bce 100644 +--- a/defaults/main.yml ++++ b/defaults/main.yml +@@ -381,3 +381,9 @@ dragonflow_ex_peer_patch_port: patch-int + dragonflow_int_peer_patch_port: patch-ex + dragonflow_external_network_bridge: br-ex + dragonflow_publisher_bind_address: "*" ++ ++# Install Openvswitch without NSH support ++ovs_nsh_support: True ++# ++# # Set higher priority to mardim PPA when ovs_nsh_support is True ++ovs_nsh_apt_pinned_packages: [{ package: "*", release: "LP-PPA-mardim-mardim-ppa"}] +diff --git a/meta/main.yml b/meta/main.yml +index 418b4a9..7a6739a 100644 +--- a/meta/main.yml ++++ b/meta/main.yml +@@ -39,7 +39,10 @@ galaxy_info: + - openstack + dependencies: + - pip_install +- - apt_package_pinning ++ - role: apt_package_pinning ++ apt_pinned_packages: "{{ ovs_nsh_support | ternary(ovs_nsh_apt_pinned_packages, omit) }}" ++ when: ++ - ansible_pkg_mgr == 'apt' + - galera_client + - openstack_openrc + - role: etcd +diff --git a/tasks/neutron_pre_install.yml b/tasks/neutron_pre_install.yml +index 59fd87f..1162a2b 100644 +--- a/tasks/neutron_pre_install.yml ++++ b/tasks/neutron_pre_install.yml +@@ -79,3 +79,12 @@ + mode: "0440" + owner: "root" + group: "root" ++ ++- name: add ovs-nsh repo ++ apt_repository: ++ repo: "ppa:mardim/mardim-ppa" ++ update_cache: True ++ state: present ++ when: ++ - ansible_pkg_mgr == 'apt' ++ - ovs_nsh_support | bool +diff --git a/vars/main.yml b/vars/main.yml +index dec0e36..afdff3f 100644 +--- a/vars/main.yml ++++ b/vars/main.yml +@@ -27,8 +27,12 @@ neutron_package_list: |- + {% if (neutron_services['neutron-openvswitch-agent']['group'] in group_names and neutron_services['neutron-openvswitch-agent'].service_en | bool) + or (neutron_services['dragonflow-controller-agent']['group'] in group_names and neutron_services['dragonflow-controller-agent'].service_en | bool) + or (neutron_services['dragonflow-l3-agent']['group'] in group_names and neutron_services['dragonflow-l3-agent'].service_en | bool) %} ++ {% if (ovs_nsh_support and ansible_pkg_mgr in ['apt', 'zypper']) %} ++ {% set _ = packages.extend(neutron_ovs_nsh_required_packages) %} ++ {% else %} + {% set _ = packages.extend(neutron_ovs_distro_packages) %} + {% endif %} ++ {% endif %} + {% if neutron_services['neutron-linuxbridge-agent']['group'] in group_names and neutron_services['neutron-linuxbridge-agent'].service_en | bool %} + {% set _ = packages.extend(neutron_lxb_distro_packages) %} + {% endif %} +@@ -50,6 +54,8 @@ calico_felix_bin: /usr/local/bin/calico-felix + ### Python code details + ### + ++neutron_ovs_nsh_distro_packages: [] ++ + neutron_requires_pip_packages: + - virtualenv + - virtualenv-tools +diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml +index eb52ebf..a2c6275 100644 +--- a/vars/ubuntu-16.04.yml ++++ b/vars/ubuntu-16.04.yml +@@ -25,6 +25,12 @@ neutron_vpnaas_service_provider: VPN:strongswan:neutron_vpnaas.services.vpn.serv + ## APT Cache options + cache_timeout: 600 + ++neutron_ovs_nsh_required_packages: ++ - openvswitch-datapath-dkms ++ - openvswitch-common ++ - openvswitch-switch ++ - python-openvswitch ++ + neutron_distro_packages: + - conntrack + - dnsmasq-base diff --git a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml index a80a81ef..039d5460 100644 --- a/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml +++ b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml @@ -7,28 +7,14 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertbefore: 'openvswitch-common' - line: ' - openvswitch-datapath-dkms' -- name: add ovs package in neutron - lineinfile: - dest: /etc/ansible/roles/os_neutron/vars/ubuntu-16.04.yml - insertafter: 'openvswitch-switch' - line: ' - python-openvswitch' +- name: copy patch file + copy: + src: odl_sfc.patch + dest: /opt/odl_sfc.patch -- name: modify ovs installation in neutron - blockinfile: - dest: /etc/ansible/roles/os_neutron/tasks/neutron_install.yml - insertafter: '^# limitations' - block: | - - name: add ovs-nsh repo - apt_repository: - repo: "ppa:mardim/mardim-ppa" - update_cache: True - state: present - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] +- name: apply odl_sfc patch to os_neutron + shell: | + cd /etc/ansible/roles/os_neutron; + patch -p1 < /opt/odl_sfc.patch; + cd - -- cgit 1.2.3-korg