diff options
Diffstat (limited to 'plugins')
81 files changed, 2954 insertions, 0 deletions
diff --git a/plugins/moon/plugins.desc b/plugins/moon/plugins.desc new file mode 100644 index 00000000..2d0e56f6 --- /dev/null +++ b/plugins/moon/plugins.desc @@ -0,0 +1,55 @@ +# ############################################################## +# This is an example for add a plugin into Compass4nfv +# It illustrates how feature components can be integrated 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: moon + + description: plugin introduce and description + maintainers: + - ruan.he@orange.com + + # true: this plugin is deployed separately on a new node + # false: this plugin is deployed on controller or compute node + independent_hosts: true + + # artifact: packege download url for this plugin + artifacts: + url: + + # global_vars: + # define the parameters required by the plugin + # and its value will be defined and passed by compass4nfv + global_vars: + - xxx: yyy + - ntp_server: "pool.ntp.org" + + # 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: moon + phrase: post_openstack + inventory: + - moon diff --git a/plugins/moon/roles/moon/handlers/main.yml b/plugins/moon/roles/moon/handlers/main.yml new file mode 100755 index 00000000..ab2a090b --- /dev/null +++ b/plugins/moon/roles/moon/handlers/main.yml @@ -0,0 +1,15 @@ +############################################################################## +## 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 network service + shell: "ifconfig eth0 down && ifconfig eth0 up && \ + /sbin/ifdown -a && \ + /sbin/ifup --ignore-errors -a" + +- name: restart nfs service + service: name=nfs-kernel-server state=restarted diff --git a/plugins/moon/roles/moon/tasks/main.yml b/plugins/moon/roles/moon/tasks/main.yml new file mode 100644 index 00000000..91283129 --- /dev/null +++ b/plugins/moon/roles/moon/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: moon.yml + when: moon is defined and moon == "Enable" and ansible_os_family == "Debian" diff --git a/plugins/moon/roles/moon/tasks/moon.yml b/plugins/moon/roles/moon/tasks/moon.yml new file mode 100644 index 00000000..22327007 --- /dev/null +++ b/plugins/moon/roles/moon/tasks/moon.yml @@ -0,0 +1,230 @@ +############################################################################# +# 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: rm pip.conf + file: + path: /root/.pip/pip.conf + state: absent + +- name: configure network + template: + src: compute.j2 + dest: /etc/network/interfaces + notify: + - restart network service + +- meta: flush_handlers + +- name: check apt source + shell: "ping -c 2 {{ LOCAL_REPOSITORY_IP }} > /dev/null" + register: checkresult + ignore_errors: "true" + +- name: change sources list(apt) + template: + src: sources.list.lab + dest: /etc/apt/sources.list + when: checkresult.rc == 0 + +- name: change sources list(apt) + template: + src: sources.list.official + dest: /etc/apt/sources.list + when: checkresult.rc != 0 + +- name: check docker.list stat + stat: + path: /etc/apt/sources.list.d/docker.list + register: stat_result + +# [WARNING]: Consider using get_url or uri module rather than running wget +- name: install docker + remote_user: root + shell: wget -qO- https://get.docker.com/ | sh + when: stat_result.stat.exists == False + +- name: remove conflict packages + remote_user: root + action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent" + with_items: + - python3-pkg-resources + +- name: install dependent packages + remote_user: root + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - git + - python3-dev + - python3-pip + - python3-venv + - python3-setuptools + +- name: make ubuntu dir + file: + path: /home/ubuntu + state: directory + mode: 0755 + +- name: check moon code dir exists + stat: + path: /home/ubuntu/moon + register: stat_result + +- name: fetch moon source code + shell: git clone https://git.opnfv.org/moon /home/ubuntu/moon + when: stat_result.stat.exists == False + +- name: create moon etc conf + remote_user: root + file: + src: /home/ubuntu/moon/moonv4/moon_orchestrator/conf + dest: /etc/moon + state: link + +- name: configure moon.conf + lineinfile: + dest: /etc/moon/moon.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - regexp: '^dist_dir=.*' + line: 'dist_dir=/home/ubuntu/moon/moonv4/moon_orchestrator/dist' + - regexp: '^password=.*' + line: 'password={{ ADMIN_PASS }}' + +- name: configure moon.conf for moon slave + lineinfile: + dest: /etc/moon/moon.conf + regexp: '{{ item.regexp }}' + line: '{{ item.line }}' + with_items: + - regexp: '^slave_name=.*' + line: 'slave_name={{ moon_slave_name }}' + - regexp: '^master_url=.*' + line: 'master_url=rabbit://moon:p4sswOrd1@{{ moon_master_ip }}/moon' + - regexp: '^master_login.*' + line: 'master_login=moon' + - regexp: '^master_password=.*' + line: 'master_password=p4sswOrd1' + when: moon_slave == "Enable" + +- name: list container netwroks + shell: docker network ls --format \{\{.Name\}\} + register: result + +- name: dump template generated file content + debug: + msg: "{{ result.stdout }}" + +- name: create moon network + shell: docker network create -d bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 moon + when: result.stdout.find("moon") == -1 + +- name: list containers + shell: docker ps --format \{\{.Names\}\} + register: result + +- name: start rabbitmq + shell: | + docker run -dti \ + --net=moon \ + --hostname messenger \ + --name messenger \ + --link messenger:messenger \ + -e RABBITMQ_DEFAULT_USER=moon \ + -e RABBITMQ_DEFAULT_PASS=p4sswOrd1 \ + -e RABBITMQ_NODENAME=rabbit@messenger \ + -e RABBITMQ_DEFAULT_VHOST=moon \ + -p 5671:5671 \ + -p 5672:5672 \ + rabbitmq:3-management + when: result.stdout.find("messenger") == -1 + +- name: dump template generated file content + debug: + msg: "{{ result.stdout }}" + +- name: start mysql + shell: docker run -dti \ + --net=moon \ + --hostname db \ + --name db \ + -e MYSQL_ROOT_PASSWORD=p4sswOrd1 \ + -e MYSQL_DATABASE=moon \ + -e MYSQL_USER=moon \ + -e MYSQL_PASSWORD=p4sswOrd1 \ + -p 3306:3306 \ + mysql:latest + when: result.stdout.find("db") == -1 + +- name: set messenger and db hosts name + remote_user: root + lineinfile: + dest: /etc/hosts + regexp: 'messenger' + line: '127.0.0.1 messenger db' + +- name: set keystone hosts name + remote_user: root + lineinfile: + dest: /etc/hosts + regexp: 'keystone' + line: '{{ internal_vip.ip }} keystone' + +- name: update pip + remote_user: root + shell: pip3 install pip --upgrade + +- name: run moon build_all.sh + shell: | + export MOON_HOME=/home/ubuntu/moon/moonv4; + cd ${MOON_HOME}/bin; + source build_all.sh; + args: + executable: /bin/bash + +- name: modify moon start.sh + lineinfile: + dest: /home/ubuntu/moon/moonv4/bin/start.sh + state: absent + regexp: "{{ item }}" + with_items: + - "^sleep 20s" + - "^.*starting Keystone container.*" + - "^docker run .*keystone.*" + +- name: run moon start.sh + shell: | + export MOON_HOME=/home/ubuntu/moon/moonv4; + cd ${MOON_HOME}/moon_orchestrator; + if [ ! -d tests/venv ]; then + pyvenv tests/venv; + source tests/venv/bin/activate; + pip3 install -r requirements.txt --upgrade; + pip3 install dist/moon_db-0.1.0.tar.gz --upgrade; + pip3 install dist/moon_utilities-0.1.0.tar.gz --upgrade; + pip3 install . --upgrade; + cd ../moon_db/; + pip3 install -r requirements.txt --upgrade; + else + source tests/venv/bin/activate; + fi + killall -9 /home/ubuntu/moon/moonv4/moon_orchestrator/tests/venv/bin/python3.5 + sleep 3 + ( ( nohup ../bin/start.sh > /tmp/start.log 2>&1 ) & ); + args: + executable: /bin/bash + +- name: fetch template generated file content + shell: whoami + register: template_gen_out + +- name: dump template generated file content + debug: + msg: "{{ template_gen_out.stdout }}" diff --git a/plugins/moon/roles/moon/templates/compute.j2 b/plugins/moon/roles/moon/templates/compute.j2 new file mode 100755 index 00000000..7adfa12c --- /dev/null +++ b/plugins/moon/roles/moon/templates/compute.j2 @@ -0,0 +1,52 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + + +# Physical interface +auto eth0 +iface eth0 inet manual + + +# OpenStack Networking VXLAN (tunnel/overlay) VLAN interface +auto {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}} +iface {{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}} inet manual + vlan-raw-device {{sys_intf_mappings["mgmt"]["interface"]}} + +# Storage network VLAN interface (optional) +auto {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} +iface {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} inet manual + vlan-raw-device {{sys_intf_mappings["storage"]["interface"]}} + +# OpenStack Networking VLAN bridge +auto br-vlan +iface br-vlan inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports {{ network_cfg["provider_net_mappings"][0]["interface"] }} + address {{ip_settings[inventory_hostname]["br-prv"]["ip"]}} + netmask 255.255.255.0 + gateway {{ip_settings[inventory_hostname]["br-prv"]["gw"]}} + offload-sg off + # Create veth pair, don't bomb if already exists + pre-up ip link add br-vlan-veth type veth peer name eth12 || true + # Set both ends UP + pre-up ip link set br-vlan-veth up + pre-up ip link set eth12 up + # Delete veth pair on DOWN + post-down ip link del br-vlan-veth || true + bridge_ports br-vlan-veth + +# compute storage bridge +auto br-storage +iface br-storage inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports {{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} + address {{ip_settings[inventory_hostname]["storage"]["ip"]}} + netmask 255.255.252.0 diff --git a/plugins/moon/roles/moon/templates/ifcfg-br-mgmt b/plugins/moon/roles/moon/templates/ifcfg-br-mgmt new file mode 100755 index 00000000..7f1931c8 --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-br-mgmt @@ -0,0 +1,7 @@ +DEVICE=br-mgmt +TYPE=Bridge +IPADDR={{host_info[inventory_hostname].MGMT_IP}} +PREFIX=24 +BOOTPROTO=none +ONBOOT=yes +DELAY=0 diff --git a/plugins/moon/roles/moon/templates/ifcfg-br-storage b/plugins/moon/roles/moon/templates/ifcfg-br-storage new file mode 100755 index 00000000..3c1db126 --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-br-storage @@ -0,0 +1,8 @@ +DEVICE=br-storage +TYPE=Bridge +IPADDR={{ ip_settings[inventory_hostname]["storage"]["ip"] }} +NETMASK=255.255.255.0 +BOOTPROTO=none +DEFROUTE="no" +ONBOOT=yes +DELAY=0 diff --git a/plugins/moon/roles/moon/templates/ifcfg-br-vlan b/plugins/moon/roles/moon/templates/ifcfg-br-vlan new file mode 100755 index 00000000..4349a3f1 --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-br-vlan @@ -0,0 +1,11 @@ +DEVICE=br-vlan +TYPE=Bridge +IPADDR={{ ip_settings[inventory_hostname]["br-prv"]["ip"] }} +PREFIX=24 +GATEWAY={{ ip_settings[inventory_hostname]["br-prv"]["gw"] }} +BOOTPROTO=none +ONBOOT=yes +DELAY=0 +DEFROUTE="yes" +DNS1=8.8.8.8 +DNS2=8.8.4.4 diff --git a/plugins/moon/roles/moon/templates/ifcfg-br-vxlan b/plugins/moon/roles/moon/templates/ifcfg-br-vxlan new file mode 100755 index 00000000..d2a0cb86 --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-br-vxlan @@ -0,0 +1,8 @@ +DEVICE=br-vxlan +TYPE=Bridge +IPADDR={{host_info[inventory_hostname].VXLAN_IP}} +NETMASK=255.255.252.0 +BOOTPROTO=none +DEFROUTE="no" +ONBOOT=yes +DELAY=0 diff --git a/plugins/moon/roles/moon/templates/ifcfg-if.storage b/plugins/moon/roles/moon/templates/ifcfg-if.storage new file mode 100755 index 00000000..96afb1bd --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-if.storage @@ -0,0 +1,4 @@ +DEVICE={{sys_intf_mappings["storage"]["interface"]}}.{{sys_intf_mappings["storage"]["vlan_tag"]}} +BOOTPROTO=none +ONBOOT=yes +VLAN=yes diff --git a/plugins/moon/roles/moon/templates/ifcfg-if.vxlan b/plugins/moon/roles/moon/templates/ifcfg-if.vxlan new file mode 100755 index 00000000..9fb19b0c --- /dev/null +++ b/plugins/moon/roles/moon/templates/ifcfg-if.vxlan @@ -0,0 +1,4 @@ +DEVICE={{sys_intf_mappings["mgmt"]["interface"]}}.{{sys_intf_mappings["mgmt"]["vlan_tag"]}} +BOOTPROTO=none +ONBOOT=yes +VLAN=yes diff --git a/plugins/moon/roles/moon/templates/sources.list.lab b/plugins/moon/roles/moon/templates/sources.list.lab new file mode 100755 index 00000000..b1e00d05 --- /dev/null +++ b/plugins/moon/roles/moon/templates/sources.list.lab @@ -0,0 +1,7 @@ +deb [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial main restricted universe multiverse +deb [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial-security main restricted universe multiverse +deb [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial-updates main restricted universe multiverse + +deb-src [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial main restricted universe multiverse +deb-src [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial-security main restricted universe multiverse +deb-src [ arch=amd64 ] http://{{LOCAL_REPOSITORY_IP}}/ubuntu/ xenial-updates main restricted universe multiverse diff --git a/plugins/moon/roles/moon/templates/sources.list.official b/plugins/moon/roles/moon/templates/sources.list.official new file mode 100755 index 00000000..799e4b58 --- /dev/null +++ b/plugins/moon/roles/moon/templates/sources.list.official @@ -0,0 +1,36 @@ +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. + +deb http://archive.ubuntu.com/ubuntu/ xenial main restricted +deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted + +## Major bug fix updates produced after the final release of the +## distribution. +deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted +deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted + +## Uncomment the following two lines to add software from the 'universe' +## repository. +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team. Also, please note that software in universe WILL NOT receive any +## review or updates from the Ubuntu security team. +deb http://archive.ubuntu.com/ubuntu/ xenial universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial universe +deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates universe + +## N.B. software from this repository may not have been tested as +## extensively as that contained in the main release, although it includes +## newer versions of some applications which may provide useful features. +## Also, please note that software in backports WILL NOT receive any review +## or updates from the Ubuntu security team. +# deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted +# deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted +deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted +deb http://archive.ubuntu.com/ubuntu/ xenial-security universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial-security universe +# deb http://archive.ubuntu.com/ubuntu/ xenial-security multiverse +# deb-src http://archive.ubuntu.com/ubuntu/ xenial-security multiverse + diff --git a/plugins/moon/roles/moon/vars/main.yml b/plugins/moon/roles/moon/vars/main.yml new file mode 100755 index 00000000..783ea0d0 --- /dev/null +++ b/plugins/moon/roles/moon/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 +# ############################################################################# +--- +LOCAL_REPOSITORY_IP: "192.168.137.222" diff --git a/plugins/ntp/plugins.desc b/plugins/ntp/plugins.desc new file mode 100644 index 00000000..35666764 --- /dev/null +++ b/plugins/ntp/plugins.desc @@ -0,0 +1,58 @@ +# This is an example for add a plugin into Compass4nfv +# It illustrates how feature components can be integrated 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: ntp + + description: network time protocol + + maintainers: + - huangxiangyu5@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: http://archive.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb + + # global_vars: + # define the parameters required by the plugin + # and its value will be defined and passed by compass4nfv + global_vars: + - ntp_server: "0.ubuntu.pool.ntp.org" + + # 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: install ntp + phrase: pre_openstack + inventory: + - controller + - compute diff --git a/plugins/ntp/roles/ntp/handlers/main.yml b/plugins/ntp/roles/ntp/handlers/main.yml new file mode 100644 index 00000000..866f31c3 --- /dev/null +++ b/plugins/ntp/roles/ntp/handlers/main.yml @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## +--- +- name: restart ntp service + service: + name: ntp + state: restarted diff --git a/plugins/ntp/roles/ntp/tasks/main.yml b/plugins/ntp/roles/ntp/tasks/main.yml new file mode 100644 index 00000000..031fb36d --- /dev/null +++ b/plugins/ntp/roles/ntp/tasks/main.yml @@ -0,0 +1,32 @@ +############################################################################## +# 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 +############################################################################## +--- +- name: download packages + get_url: + url: "{{ ntp_url }}" + dest: "{{ workspace }}" + +- name: install dependent packages + apt: + name: "{{ item }}" + state: present + with_items: + - "{{ dependancy }}" + +- name: install ntp package + command: dpkg -i "{{ workspace }}/{{ ntp_pkg }}" + +- name: config ntp + template: + src: ntp.con.j2 + dest: /etc/ntp.conf + notify: + - restart ntp service + +- meta: flush_handlers diff --git a/plugins/ntp/roles/ntp/templates/ntp.conf.j2 b/plugins/ntp/roles/ntp/templates/ntp.conf.j2 new file mode 100644 index 00000000..697e4078 --- /dev/null +++ b/plugins/ntp/roles/ntp/templates/ntp.conf.j2 @@ -0,0 +1,21 @@ +driftfile /var/lib/ntp/ntp.drift + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + +pool 0.ubuntu.pool.ntp.org iburst +pool 1.ubuntu.pool.ntp.org iburst +pool 2.ubuntu.pool.ntp.org iburst +pool 3.ubuntu.pool.ntp.org iburst + +pool "{{ ntp_server }}" + +restrict -4 default kod notrap nomodify nopeer noquery limited +restrict -6 default kod notrap nomodify nopeer noquery limited + +restrict 127.0.0.1 +restrict ::1 + +restrict source notrap nomodify noquery diff --git a/plugins/ntp/roles/ntp/vars/main.yml b/plugins/ntp/roles/ntp/vars/main.yml new file mode 100644 index 00000000..708fa423 --- /dev/null +++ b/plugins/ntp/roles/ntp/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 +############################################################################## +--- +workspace: /tmp/plugin + +ntp_url: http://archive.ubuntu.com/ubuntu/pool/main/n/ntp/ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb + +ntp_pkg: ntp_4.2.8p4+dfsg-3ubuntu5.4_amd64.deb + +dependancy: + - libopts25 diff --git a/plugins/odl_cluster/plugins.desc b/plugins/odl_cluster/plugins.desc new file mode 100644 index 00000000..86413aef --- /dev/null +++ b/plugins/odl_cluster/plugins.desc @@ -0,0 +1,62 @@ +# ############################################################## +# This is an example for add a plugin into Compass4nfv +# It illustrates how feature components can be integrated 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: opendaylight + + description: plugin introduce and description + maintainers: + - xueyifei@huawei.com + + # 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: + # define the parameters required by the plugin + # and its value will be defined and passed by compass4nfv + global_vars: + - xxx: yyy + - ntp_server: "pool.ntp.org" + + # 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: setup_opendaylight + excute_after: setup_openvswitch + inventory: + - localhost + - role: odl_cluster + excute_in: setup_opendaylight + inventory: + - neutron_all + - galera_container + - network_hosts + - repo_container diff --git a/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service b/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service new file mode 100644 index 00000000..f4801a36 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service @@ -0,0 +1,20 @@ +[Unit] +Description=OpenDaylight +After= + + +[Service] +User=root +Group=root +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 +Restart=on-failure +LimitNOFILE=65535 +TimeoutStopSec=15 + +[Install] +WantedBy=multi-user.target + diff --git a/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml b/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml new file mode 100755 index 00000000..2650d072 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml @@ -0,0 +1,11 @@ +############################################################################## +# 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 odl service + service: name=opendaylight state=restarted diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml new file mode 100644 index 00000000..dc071cc7 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml @@ -0,0 +1,39 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- 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 + shell: | + crudini --set /etc/neutron/dhcp_agent.ini OVS \ + ovsdb_interface vsctl; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: configure vsctl for l3 agent + shell: | + crudini --set /etc/neutron/l3_agent.ini OVS \ + ovsdb_interface vsctl; + when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] + +- name: stop neutron l3 agent + service: name=neutron-l3-agent state=stopped enabled=no + when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] + +- name: shut down and disable Neutron's openvswitch agent services + service: name={{ service_ovs_agent_name }} state=stopped enabled=no + +- 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 ; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml new file mode 100644 index 00000000..f53a3ac8 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml @@ -0,0 +1,87 @@ +--- + +- name: set opendaylight as the manager + command: | + su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}: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 + +# yamllint disable rule:line-length +- name: set local ip in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '}; + when: inventory_hostname not in groups['nova_compute'] + +- name: set local ip in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '}; + when: inventory_hostname in groups['nova_compute'] +# yamllint enable rule:line-length + +- name: Setup br-provider + openvswitch_bridge: + bridge: br-provider + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: add ovs uplink + openvswitch_port: + bridge: br-provider + port: "eth12" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings=physnet:br-provider + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings=physnet:eth12 + when: + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings=physnet:br-provider + when: + - inventory_hostname not 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 + --datapath_type=system --bridge_mappings=physnet:eth12 + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/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 + --datapath_type=system --bridge_mappings=physnet:eth12 + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Enable" diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml new file mode 100644 index 00000000..68446a83 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml @@ -0,0 +1,42 @@ +--- + +- name: configure opendaylight -> ml2 + 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 --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 physnet:br-provider; + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; + when: odl_l3_agent == "Enable" + +- name: configure external bridge name for L2 + shell: | + crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: configure metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + enable_isolated_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: force metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + force_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml new file mode 100644 index 00000000..3cef9792 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml @@ -0,0 +1,8 @@ +--- + +- name: drop and recreate neutron database + shell: | + mysql -e "drop database if exists neutron;"; + mysql -e "create database neutron character set utf8;"; + mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ + '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml new file mode 100644 index 00000000..6879340e --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml @@ -0,0 +1,100 @@ +--- + +- name: check sdn_package cache + stat: + path=/opt/sdn_package.tar.gz + register: sdn_cache # Todo: remove hard code and add md5 check + +- name: debug + debug: msg="{{ sdn_cache }}" + +- name: get sdn_package + get_url: + url: "{{ sdn_package }}" + dest: /opt/ + when: sdn_cache.stat.exists != 'true' + +- name: create odl group + group: name=odl system=yes state=present + +- name: create odl user + user: + name: odl + group: odl + home: "{{ odl_home }}" + createhome: "yes" + system: "yes" + shell: "/bin/false" + +- name: clear sdn_package + command: su -s /bin/sh -c "rm -rf /opt/sdn_package" + +- name: clear jdk8 package + command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" + +- name: unarchive sdn_package + command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" + +- name: copy java package + command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" + +- name: unarchive java_install package + command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" + +- name: install java + command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" + +- name: clear odl package + command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" + +- name: extract odl package + command: | + su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ + --strip-components 1" odl + +- name: opendaylight system file + copy: + src: "{{ service_file.src }}" + dest: "{{ service_file.dst }}" + mode: 0755 + +- name: set l3 fwd enable in custom.properties + template: + src: custom.properties + dest: "{{ odl_home }}/etc/custom.properties" + owner: odl + group: odl + mode: 0775 + when: odl_l3_agent == "Enable" + +- name: create karaf config + template: + src: org.apache.karaf.features.cfg + dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" + owner: odl + group: odl + mode: 0775 + +- name: copy acl configuration script + template: + src: acl_conf.sh + dest: "/opt/acl_conf.sh" + mode: 0777 + +- name: execute acl configuration script + command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl + +- name: create jetty config + shell: > + sed -i 's/default="8181"/default="8081"/' + {{ odl_home }}etc/jetty.xml + +- name: create tomcat config + shell: > + sed -i 's/port="8282"/port="8081"/' + {{ odl_home }}configuration/tomcat-server.xml + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml new file mode 100644 index 00000000..b8d9403a --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml @@ -0,0 +1,23 @@ +--- + +- name: chown opendaylight directory and files + shell: > + chown -R odl:odl "{{ odl_home }}"; + chown odl:odl "{{ service_file.dst }}"; + +- name: start opendaylight + service: name=opendaylight state=started + when: ansible_os_family == "Debian" + +- name: set opendaylight autostart + shell: chkconfig opendaylight on + when: ansible_os_family == "RedHat" + +- name: start opendaylight + shell: service opendaylight start + when: ansible_os_family == "RedHat" + +- name: check if opendaylight running + shell: | + netstat -lpen --tcp | grep java | grep 6653; + while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml new file mode 100644 index 00000000..8427e4f0 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml @@ -0,0 +1,17 @@ +--- + +- 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 - diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml new file mode 100644 index 00000000..459c734a --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml @@ -0,0 +1,15 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- 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 + service: name=neutron-server state=stopped diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml new file mode 100644 index 00000000..59b3aa2f --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml @@ -0,0 +1,34 @@ +--- + +- name: configure odl l3 driver + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ + odl-router,metering; + when: odl_l3_agent == "Enable" + +- name: configure opendaylight -> ml2 + 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 --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 physnet:br-provider; + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; + when: odl_l3_agent == "Enable" + +- name: turn off l3 ha for odl l2 + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml new file mode 100644 index 00000000..3d5c307b --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml @@ -0,0 +1,19 @@ +--- + +- name: Perform a Neutron DB online upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --expand + become: "yes" + become_user: "neutron" + +- name: Perform a Neutron DB offline upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --contract + become: "yes" + become_user: "neutron" diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml new file mode 100644 index 00000000..44359056 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml @@ -0,0 +1,39 @@ +--- + +- include_vars: "{{ ansible_os_family }}.yml" + +- include: control-hosts-1.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-repos-1.yml + vars: + odl_pip: "{{ networking_odl_url }}" + when: inventory_hostname in groups['repo_container'] + +- include: control-servers-1.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-1.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-hosts-2.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-agents-2.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-servers-2.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-3.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-db-1.yml + when: inventory_hostname == groups['galera_container'][0] + +- include: control-servers-3.yml + when: + - inventory_hostname in groups['neutron_server'][0] + - inventory_hostname not in groups['network_hosts'] + +- include: odl-post.yml diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml new file mode 100644 index 00000000..9f1cb79e --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml @@ -0,0 +1,34 @@ +--- + +- name: restart neutron-server + service: name=neutron-server state=restarted enabled=yes + when: inventory_hostname in groups['neutron_server'] + +- name: restart neutron-l3-agent server + service: name=neutron-l3-agent state=restarted + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-dhcp-agent server + service: name=neutron-dhcp-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-metadata-agent server + service: name=neutron-metadata-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent + when: inventory_hostname in groups['network_hosts'] + +- name: restart opendaylight + shell: sleep 60; service opendaylight restart; sleep 60; + when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh b/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh new file mode 100755 index 00000000..4962a17c --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## +mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ +CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") +cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml +sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties b/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties new file mode 100755 index 00000000..f103c1b8 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties @@ -0,0 +1,105 @@ +# Extra packages to import from the boot class loader +org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound + +# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 +# Extend the framework to avoid the resources to be presented with +# a URL of type bundleresource: but to be presented as file: +osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator + +# Embedded Tomcat configuration File +org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml +org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + +# Use Equinox as default OSGi Framework Implementation +karaf.framework=equinox + +# Show a progress bar on startup and start the console when all bundles are up and running. +# (If you are in a hurry you can still type enter to start the shell faster.) +karaf.delay.console=true + +# Set security provider to BouncyCastle +org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider + +# We set this to false to disable the Aries BlueprintExtender from doing its orderly container +# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will +# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is +# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers +# and services already being shut down. This setting can be removed when/if CSS is removed +# completely from ODL. +org.apache.aries.blueprint.preemptiveShutdown=false + +netconf.config.persister.active=1 + +netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter +netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml +netconf.config.persister.1.properties.numberOfBackups=1 + +# logback configuration +logback.configurationFile=configuration/logback.xml + +# Container configuration +container.profile = Container + +# Connection manager configuration +connection.scheme = ANY_CONTROLLER_ONE_MASTER + +# OVSDB configuration +# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. +ovsdb.listenPort=6640 + +# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. +# default Openflow version = 1.0, we also support 1.3. +# ovsdb.of.version=1.3 + +# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is +# disabled by default. +ovsdb.l3.fwd.enabled=yes + +# ovsdb can be configured with ml2 to perform arp responder, enabled by default. +ovsdb.l3.arp.responder.disabled=no + +# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default +# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that +# specific arp/neighDiscovery lookup. +# ovsdb.l3gateway.mac=00:00:5E:00:02:01 + +# TLS configuration +# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. +# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate +# entries, including switches' Certification Authority (CA) certificates. For example, +# secureChannelEnabled=true +# controllerKeyStore=./configuration/ctlKeyStore +# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) +# controllerTrustStore=./configuration/ctlTrustStore +# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) + +secureChannelEnabled=false +controllerKeyStore= +controllerKeyStorePassword= +controllerTrustStore= +controllerTrustStorePassword= + +# User Manager configurations +enableStrongPasswordCheck = false + +#Jolokia configurations +#org.jolokia.listenForHttpService=false + +# Logging configuration for Tomcat-JUL logging +java.util.logging.config.file=configuration/tomcat-logging.properties + +#Hosttracker hostsdb key scheme setting +hosttracker.keyscheme=IP + +# LISP Flow Mapping configuration +# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) +lisp.mappingMerge = false +# Enable the Solicit-Map-Request (SMR) mechanism (default: true) +lisp.smr = true +# Choose policy for Explicit Locator Path (ELP) handling +# There are three options: +# default: don't add or remove locator records, return mapping as-is +# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority +# replace: remove the ELP, add the next hop as a standalone non-LCAF locator +lisp.elpPolicy = default + diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh b/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh new file mode 100755 index 00000000..0d42e48b --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh @@ -0,0 +1,14 @@ +############################################################################## +# 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 +############################################################################## +cat <<EOT>> /etc/neutron/plugins/ml2/ml2_conf.ini +[ml2_odl] +password = admin +username = admin +url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron +EOT diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg new file mode 100755 index 00000000..bc625cda --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg @@ -0,0 +1,54 @@ +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# +# Defines if the startlvl should be respected during feature startup. The default value is true. The default +# behavior for 2.x is false (!) for this property +# +# Be aware that this property is deprecated and will be removed in Karaf 4.0. So, if you need to +# set this to false, please use this only as a temporary solution! +# +#respectStartLvlDuringFeatureStartup=true + + +# +# Defines if the startlvl should be respected during feature uninstall. The default value is true. +# If true, means stop bundles respecting the descend order of start level in a certain feature. +# +#respectStartLvlDuringFeatureUninstall=true + +# +# 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 + +# +# 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 + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false + +# +# Store cfg file for config element in feature +# +#configCfgStore=true diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml b/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml new file mode 100755 index 00000000..c78c5221 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service + +# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml b/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml new file mode 100755 index 00000000..a2e6d01d --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/main.yml b/plugins/odl_cluster/roles/odl_cluster/vars/main.yml new file mode 100755 index 00000000..42e1acb1 --- /dev/null +++ b/plugins/odl_cluster/roles/odl_cluster/vars/main.yml @@ -0,0 +1,60 @@ +############################################################################## +# 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 +############################################################################## +--- +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_home: "/opt/opendaylight/" +odl_base_features: + - config + - standard + - region + - package + - kar + - ssh + - management + - odl-restconf + - odl-l2switch-switch + - odl-openflowplugin-all + - odl-mdsal-apidocs + - odl-dlux-all + - odl-adsal-northbound + - odl-nsf-all + - odl-ovsdb-openstack + - odl-ovsdb-northbound + - odl-dlux-core + +odl_extra_features: + - odl-restconf-all + - odl-mdsal-clustering + - odl-openflowplugin-flow-services + - http + - jolokia-osgi + +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 + +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_cluster/roles/setup-opendaylight/tasks/main.yml b/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml new file mode 100644 index 00000000..3abca829 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.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 +############################################################################## +--- + +- name: copy setup-odl.yml + template: + src: setup-odl.yml.j2 + dest: /opt/openstack-ansible/playbooks/setup-odl.yml + +- name: copy odl_cluster role + copy: + src: /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster + dest: /etc/ansible/roles/ + +- name: setup odl + shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ + cd /opt/openstack-ansible/playbooks; \ + openstack-ansible setup-odl.yml > /dev/null" + when: opendaylight is defined and opendaylight == "Enable" diff --git a/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 b/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 new file mode 100644 index 00000000..18446ce5 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 @@ -0,0 +1,12 @@ +--- + +- name: run opendaylight role + hosts: neutron_all | galera_container | network_hosts | repo_container + max_fail_percentage: 20 + user: root + roles: + - odl_cluster + vars: + - odl_l3_agent: "{{ odl_l3_agent }}" + tags: + - odl diff --git a/plugins/odl_sfc/plugins.desc b/plugins/odl_sfc/plugins.desc new file mode 100644 index 00000000..4658b3d2 --- /dev/null +++ b/plugins/odl_sfc/plugins.desc @@ -0,0 +1,63 @@ +# ############################################################## +# This is an example for add a plugin into Compass4nfv +# It illustrates how feature components can be integrated 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: odl_sfc + + description: plugin introduce and description + maintainers: + - xueyifei@huawei.com + + # 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: + # define the parameters required by the plugin + # and its value will be defined and passed by compass4nfv + global_vars: + - xxx: yyy + - ntp_server: "pool.ntp.org" + + # 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: sfc-pre + excute_after: rt_kvm + inventory: + - all + - role: sfc-pre-2 + excute_after: sfc-pre + inventory: + - localhost + - role: setup-sfc + excute_after: setup-openvswitch + inventory: + - localhost diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service b/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service new file mode 100644 index 00000000..f4801a36 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service @@ -0,0 +1,20 @@ +[Unit] +Description=OpenDaylight +After= + + +[Service] +User=root +Group=root +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 +Restart=on-failure +LimitNOFILE=65535 +TimeoutStopSec=15 + +[Install] +WantedBy=multi-user.target + diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf b/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf new file mode 100644 index 00000000..acf2e2f4 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf @@ -0,0 +1,9 @@ +[DEFAULT] + +service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin + +[sfc] +drivers = odl + +[flowclassifier] +drivers = odl diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml new file mode 100644 index 00000000..2650d072 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml @@ -0,0 +1,11 @@ +############################################################################## +# 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 odl service + service: name=opendaylight state=restarted diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml new file mode 100644 index 00000000..dc071cc7 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml @@ -0,0 +1,39 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- 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 + shell: | + crudini --set /etc/neutron/dhcp_agent.ini OVS \ + ovsdb_interface vsctl; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: configure vsctl for l3 agent + shell: | + crudini --set /etc/neutron/l3_agent.ini OVS \ + ovsdb_interface vsctl; + when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] + +- name: stop neutron l3 agent + service: name=neutron-l3-agent state=stopped enabled=no + when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] + +- name: shut down and disable Neutron's openvswitch agent services + service: name={{ service_ovs_agent_name }} state=stopped enabled=no + +- 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 ; diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml new file mode 100644 index 00000000..f53a3ac8 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml @@ -0,0 +1,87 @@ +--- + +- name: set opendaylight as the manager + command: | + su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}: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 + +# yamllint disable rule:line-length +- name: set local ip in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '}; + when: inventory_hostname not in groups['nova_compute'] + +- name: set local ip in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '}; + when: inventory_hostname in groups['nova_compute'] +# yamllint enable rule:line-length + +- name: Setup br-provider + openvswitch_bridge: + bridge: br-provider + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: add ovs uplink + openvswitch_port: + bridge: br-provider + port: "eth12" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings=physnet:br-provider + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings=physnet:eth12 + when: + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings=physnet:br-provider + when: + - inventory_hostname not 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 + --datapath_type=system --bridge_mappings=physnet:eth12 + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/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 + --datapath_type=system --bridge_mappings=physnet:eth12 + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml new file mode 100644 index 00000000..68446a83 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml @@ -0,0 +1,42 @@ +--- + +- name: configure opendaylight -> ml2 + 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 --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 physnet:br-provider; + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; + when: odl_l3_agent == "Enable" + +- name: configure external bridge name for L2 + shell: | + crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: configure metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + enable_isolated_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: force metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + force_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml new file mode 100644 index 00000000..3cef9792 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml @@ -0,0 +1,8 @@ +--- + +- name: drop and recreate neutron database + shell: | + mysql -e "drop database if exists neutron;"; + mysql -e "create database neutron character set utf8;"; + mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ + '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml new file mode 100644 index 00000000..6879340e --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml @@ -0,0 +1,100 @@ +--- + +- name: check sdn_package cache + stat: + path=/opt/sdn_package.tar.gz + register: sdn_cache # Todo: remove hard code and add md5 check + +- name: debug + debug: msg="{{ sdn_cache }}" + +- name: get sdn_package + get_url: + url: "{{ sdn_package }}" + dest: /opt/ + when: sdn_cache.stat.exists != 'true' + +- name: create odl group + group: name=odl system=yes state=present + +- name: create odl user + user: + name: odl + group: odl + home: "{{ odl_home }}" + createhome: "yes" + system: "yes" + shell: "/bin/false" + +- name: clear sdn_package + command: su -s /bin/sh -c "rm -rf /opt/sdn_package" + +- name: clear jdk8 package + command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" + +- name: unarchive sdn_package + command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" + +- name: copy java package + command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" + +- name: unarchive java_install package + command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" + +- name: install java + command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" + +- name: clear odl package + command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" + +- name: extract odl package + command: | + su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ + --strip-components 1" odl + +- name: opendaylight system file + copy: + src: "{{ service_file.src }}" + dest: "{{ service_file.dst }}" + mode: 0755 + +- name: set l3 fwd enable in custom.properties + template: + src: custom.properties + dest: "{{ odl_home }}/etc/custom.properties" + owner: odl + group: odl + mode: 0775 + when: odl_l3_agent == "Enable" + +- name: create karaf config + template: + src: org.apache.karaf.features.cfg + dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" + owner: odl + group: odl + mode: 0775 + +- name: copy acl configuration script + template: + src: acl_conf.sh + dest: "/opt/acl_conf.sh" + mode: 0777 + +- name: execute acl configuration script + command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl + +- name: create jetty config + shell: > + sed -i 's/default="8181"/default="8081"/' + {{ odl_home }}etc/jetty.xml + +- name: create tomcat config + shell: > + sed -i 's/port="8282"/port="8081"/' + {{ odl_home }}configuration/tomcat-server.xml + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml new file mode 100644 index 00000000..b8d9403a --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml @@ -0,0 +1,23 @@ +--- + +- name: chown opendaylight directory and files + shell: > + chown -R odl:odl "{{ odl_home }}"; + chown odl:odl "{{ service_file.dst }}"; + +- name: start opendaylight + service: name=opendaylight state=started + when: ansible_os_family == "Debian" + +- name: set opendaylight autostart + shell: chkconfig opendaylight on + when: ansible_os_family == "RedHat" + +- name: start opendaylight + shell: service opendaylight start + when: ansible_os_family == "RedHat" + +- name: check if opendaylight running + shell: | + netstat -lpen --tcp | grep java | grep 6653; + while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml new file mode 100644 index 00000000..2e58e141 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml @@ -0,0 +1,27 @@ +--- + +- 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 - diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml new file mode 100644 index 00000000..e2dd128d --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml @@ -0,0 +1,22 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- 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" + +- name: turn off neutron-server on control node + service: name=neutron-server state=stopped diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml new file mode 100644 index 00000000..5d743382 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml @@ -0,0 +1,49 @@ +--- + +- name: configure odl l3 driver + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ + odl-router,metering; + when: odl_l3_agent == "Enable" + +- name: configure opendaylight -> ml2 + 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 --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 physnet:br-provider; + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; + when: odl_l3_agent == "Enable" + +- name: turn off l3 ha for odl l2 + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: copy sfc.conf + copy: + src: "{{ sfc_plugins.src }}" + dest: "{{ sfc_plugins.dst }}" + mode: 0755 + when: odl_sfc == "Enable" + +- name: Configure SFC driver + shell: crudini --merge /etc/neutron/neutron.conf < /opt/sfc.conf + when: odl_sfc == "Enable" + +- name: delete sfc.conf + shell: rm -rf {{ sfc_plugins.dst }} + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml new file mode 100644 index 00000000..0c11e36f --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml @@ -0,0 +1,28 @@ +--- + +- name: Perform a Neutron DB online upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --expand + become: "yes" + become_user: "neutron" + +- name: Perform a Neutron DB offline upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --contract + become: "yes" + become_user: "neutron" + +- name: SFC DB upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --subproject networking-sfc + upgrade head + become: "yes" + become_user: "neutron" + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml new file mode 100644 index 00000000..613c796b --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml @@ -0,0 +1,7 @@ +--- + +- 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/odl_cluster_sfc/tasks/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml new file mode 100644 index 00000000..91fc71fa --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml @@ -0,0 +1,44 @@ +--- + +- include_vars: "{{ ansible_os_family }}.yml" + +- include: control-hosts-1.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-repos-1.yml + vars: + odl_pip: "{{ networking_odl_url }}" + when: inventory_hostname in groups['repo_container'] + +- include: control-servers-1.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-utility-1.yml + when: + - inventory_hostname in groups['utility'] + - odl_sfc == "Enable" + +- include: control-agents-1.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-hosts-2.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-agents-2.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-servers-2.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-3.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-db-1.yml + when: inventory_hostname == groups['galera_container'][0] + +- include: control-servers-3.yml + when: + - inventory_hostname in groups['neutron_server'][0] + - inventory_hostname not in groups['network_hosts'] + +- include: odl-post.yml diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml new file mode 100644 index 00000000..9f1cb79e --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml @@ -0,0 +1,34 @@ +--- + +- name: restart neutron-server + service: name=neutron-server state=restarted enabled=yes + when: inventory_hostname in groups['neutron_server'] + +- name: restart neutron-l3-agent server + service: name=neutron-l3-agent state=restarted + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-dhcp-agent server + service: name=neutron-dhcp-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-metadata-agent server + service: name=neutron-metadata-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent + when: inventory_hostname in groups['network_hosts'] + +- name: restart opendaylight + shell: sleep 60; service opendaylight restart; sleep 60; + when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh new file mode 100644 index 00000000..4962a17c --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## +mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ +CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") +cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml +sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties new file mode 100644 index 00000000..f103c1b8 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties @@ -0,0 +1,105 @@ +# Extra packages to import from the boot class loader +org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound + +# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 +# Extend the framework to avoid the resources to be presented with +# a URL of type bundleresource: but to be presented as file: +osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator + +# Embedded Tomcat configuration File +org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml +org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + +# Use Equinox as default OSGi Framework Implementation +karaf.framework=equinox + +# Show a progress bar on startup and start the console when all bundles are up and running. +# (If you are in a hurry you can still type enter to start the shell faster.) +karaf.delay.console=true + +# Set security provider to BouncyCastle +org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider + +# We set this to false to disable the Aries BlueprintExtender from doing its orderly container +# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will +# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is +# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers +# and services already being shut down. This setting can be removed when/if CSS is removed +# completely from ODL. +org.apache.aries.blueprint.preemptiveShutdown=false + +netconf.config.persister.active=1 + +netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter +netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml +netconf.config.persister.1.properties.numberOfBackups=1 + +# logback configuration +logback.configurationFile=configuration/logback.xml + +# Container configuration +container.profile = Container + +# Connection manager configuration +connection.scheme = ANY_CONTROLLER_ONE_MASTER + +# OVSDB configuration +# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. +ovsdb.listenPort=6640 + +# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. +# default Openflow version = 1.0, we also support 1.3. +# ovsdb.of.version=1.3 + +# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is +# disabled by default. +ovsdb.l3.fwd.enabled=yes + +# ovsdb can be configured with ml2 to perform arp responder, enabled by default. +ovsdb.l3.arp.responder.disabled=no + +# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default +# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that +# specific arp/neighDiscovery lookup. +# ovsdb.l3gateway.mac=00:00:5E:00:02:01 + +# TLS configuration +# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. +# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate +# entries, including switches' Certification Authority (CA) certificates. For example, +# secureChannelEnabled=true +# controllerKeyStore=./configuration/ctlKeyStore +# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) +# controllerTrustStore=./configuration/ctlTrustStore +# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) + +secureChannelEnabled=false +controllerKeyStore= +controllerKeyStorePassword= +controllerTrustStore= +controllerTrustStorePassword= + +# User Manager configurations +enableStrongPasswordCheck = false + +#Jolokia configurations +#org.jolokia.listenForHttpService=false + +# Logging configuration for Tomcat-JUL logging +java.util.logging.config.file=configuration/tomcat-logging.properties + +#Hosttracker hostsdb key scheme setting +hosttracker.keyscheme=IP + +# LISP Flow Mapping configuration +# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) +lisp.mappingMerge = false +# Enable the Solicit-Map-Request (SMR) mechanism (default: true) +lisp.smr = true +# Choose policy for Explicit Locator Path (ELP) handling +# There are three options: +# default: don't add or remove locator records, return mapping as-is +# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority +# replace: remove the ELP, add the next hop as a standalone non-LCAF locator +lisp.elpPolicy = default + diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh new file mode 100644 index 00000000..0d42e48b --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh @@ -0,0 +1,14 @@ +############################################################################## +# 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 +############################################################################## +cat <<EOT>> /etc/neutron/plugins/ml2/ml2_conf.ini +[ml2_odl] +password = admin +username = admin +url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron +EOT diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg new file mode 100755 index 00000000..b07e028f --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg @@ -0,0 +1,54 @@ +################################################################################ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# +# Defines if the startlvl should be respected during feature startup. The default value is true. The default +# behavior for 2.x is false (!) for this property +# +# Be aware that this property is deprecated and will be removed in Karaf 4.0. So, if you need to +# set this to false, please use this only as a temporary solution! +# +#respectStartLvlDuringFeatureStartup=true + + +# +# Defines if the startlvl should be respected during feature uninstall. The default value is true. +# If true, means stop bundles respecting the descend order of start level in a certain feature. +# +#respectStartLvlDuringFeatureUninstall=true + +# +# 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 + +# +# 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 + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false + +# +# Store cfg file for config element in feature +# +#configCfgStore=true diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml new file mode 100644 index 00000000..c78c5221 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service + +# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml new file mode 100644 index 00000000..a2e6d01d --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml new file mode 100644 index 00000000..a9466ea0 --- /dev/null +++ b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml @@ -0,0 +1,65 @@ +############################################################################## +# 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 +############################################################################## +--- +odl_username: admin +odl_password: admin +odl_api_port: 8181 + +# odl_sfc +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_home: "/opt/opendaylight/" +odl_base_features: + - config + - standard + - region + - package + - kar + - ssh + - management + - odl-restconf + - odl-l2switch-switch + - odl-openflowplugin-all + - odl-mdsal-apidocs + - odl-dlux-all + - odl-adsal-northbound + - odl-nsf-all + - odl-ovsdb-openstack + - odl-ovsdb-northbound + - odl-dlux-core + +odl_extra_features: + - odl-restconf-all + - odl-mdsal-clustering + - odl-openflowplugin-flow-services + - http + - jolokia-osgi + +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 + +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/setup-sfc/files/setup-odl.yml.j2 b/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 new file mode 100644 index 00000000..0d0cbe90 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 @@ -0,0 +1,13 @@ +--- + +- name: run opendaylight role + hosts: neutron_all | galera_container | network_hosts | repo_container | utility + max_fail_percentage: 20 + user: root + roles: + - odl_cluster + vars: + - odl_l3_agent: "{{ odl_l3_agent }}" + - odl_sfc: "{{ odl_sfc }}" + tags: + - odl diff --git a/plugins/odl_sfc/roles/setup-sfc/tasks/main.yml b/plugins/odl_sfc/roles/setup-sfc/tasks/main.yml new file mode 100644 index 00000000..c4c01987 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-sfc/tasks/main.yml @@ -0,0 +1,12 @@ +############################################################################## +# 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: setup_sfc.yml + when: odl_sfc is defined and odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml new file mode 100644 index 00000000..9fa9175f --- /dev/null +++ b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml @@ -0,0 +1,30 @@ +############################################################################## +# 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 +############################################################################## +--- +# yamllint disable rule:line-length +- name: clear setup-odl.yml.j2 + file: + path: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/setup-odl.yml.j2" + state: absent +# yamllint enable rule:line-length + +- name: override setup-odl.yml.j2 + copy: + src: setup-odl.yml.j2 + dest: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/" + +- name: clear odl_cluster for sfc + file: + path: "/var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster" + state: absent + +- name: copy odl_cluster role + shell: | + cp -r /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster_sfc \ + /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster diff --git a/plugins/odl_sfc/roles/sfc-pre-2/tasks/main.yml b/plugins/odl_sfc/roles/sfc-pre-2/tasks/main.yml new file mode 100644 index 00000000..c4c01987 --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre-2/tasks/main.yml @@ -0,0 +1,12 @@ +############################################################################## +# 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: setup_sfc.yml + when: odl_sfc is defined and odl_sfc == "Enable" 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 new file mode 100644 index 00000000..a80a81ef --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre-2/tasks/setup_sfc.yml @@ -0,0 +1,34 @@ +############################################################################## +# 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: 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: 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'] diff --git a/plugins/odl_sfc/roles/sfc-pre/handlers/main.yml b/plugins/odl_sfc/roles/sfc-pre/handlers/main.yml new file mode 100755 index 00000000..5356791a --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre/handlers/main.yml @@ -0,0 +1,8 @@ +############################################################################## +## 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 +############################################################################## +--- diff --git a/plugins/odl_sfc/roles/sfc-pre/tasks/Ubuntu.yml b/plugins/odl_sfc/roles/sfc-pre/tasks/Ubuntu.yml new file mode 100755 index 00000000..2a59c248 --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre/tasks/Ubuntu.yml @@ -0,0 +1,24 @@ +############################################################################## +# 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: add ovs-nsh repo + apt_repository: + repo: "ppa:mardim/mardim-ppa" + update_cache: "True" + state: "present" + +- name: install ovs packages + package: + name: "{{ item }}" + state: "present" + with_items: + - "openvswitch-datapath-dkms" + - "openvswitch-common" + - "openvswitch-switch" + - "python-openvswitch" diff --git a/plugins/odl_sfc/roles/sfc-pre/tasks/main.yml b/plugins/odl_sfc/roles/sfc-pre/tasks/main.yml new file mode 100755 index 00000000..cf14e372 --- /dev/null +++ b/plugins/odl_sfc/roles/sfc-pre/tasks/main.yml @@ -0,0 +1,18 @@ +############################################################################## +# 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: "{{ ansible_distribution }}.yml" + when: + - ansible_distribution == 'Ubuntu' + - odl_sfc is defined and odl_sfc == "Enable" + +- include: "{{ ansible_os_family }}.yml" + when: + - ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7' + - odl_sfc is defined and odl_sfc == "Enable" diff --git a/plugins/rt_kvm/plugins.desc b/plugins/rt_kvm/plugins.desc new file mode 100644 index 00000000..0dd2680b --- /dev/null +++ b/plugins/rt_kvm/plugins.desc @@ -0,0 +1,50 @@ +# This rt_kvm plugin adds real time kvm feature from kvmfornfv 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: rt_kvm + + description: real time kvm based on kvmfornfv + + maintainers: + - david.j.chou@intel.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: http://artifacts.opnfv.org/kvmfornfv/kvmfornfv-4bfeded9-kernel-4.4.50_rt62_ubuntu.x86_64.deb + + # 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: install real time kvm + phrase: pre_openstack + inventory: + - compute diff --git a/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml b/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml new file mode 100644 index 00000000..5d3ca7bc --- /dev/null +++ b/plugins/rt_kvm/roles/rt_kvm/tasks/kvm.yml @@ -0,0 +1,40 @@ +############################################################################## +# 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 +############################################################################## +--- +- name: create workspace directory + file: + path: "{{ workspace }}" + state: directory + mode: 0755 + +- name: download rt_kvm kernel package + get_url: + url: "{{ rt_kvm_url }}" + dest: "{{ workspace }}/{{ rt_kvm_pkg }}" + +- name: install rt_kvm kernel + command: dpkg -i "{{ workspace }}/{{ rt_kvm_pkg }}" + +- name: update the grub + command: grub-mkconfig -o /boot/grub/grub.cfg + +- name: wait a moment + command: sleep 5 + +- name: reboot the node + shell: sleep 2 && shutdown -r now 'Reboot required' + become: true + async: 1 + poll: 0 + ignore_errors: true + +- name: wait for reboot + local_action: + module: wait_for + host={{ ansible_eth0.ipv4.address }} port=22 delay=1 timeout=600 diff --git a/plugins/rt_kvm/roles/rt_kvm/tasks/main.yml b/plugins/rt_kvm/roles/rt_kvm/tasks/main.yml new file mode 100644 index 00000000..e79fe9ff --- /dev/null +++ b/plugins/rt_kvm/roles/rt_kvm/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: kvm.yml + when: rt_kvm is defined and rt_kvm == "Enable" diff --git a/plugins/rt_kvm/roles/rt_kvm/vars/main.yml b/plugins/rt_kvm/roles/rt_kvm/vars/main.yml new file mode 100644 index 00000000..9f32d13c --- /dev/null +++ b/plugins/rt_kvm/roles/rt_kvm/vars/main.yml @@ -0,0 +1,16 @@ +############################################################################## +# 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 +############################################################################## +--- +workspace: /tmp/plugin + +# yamllint disable rule:line-length +rt_kvm_url: http://artifacts.opnfv.org/kvmfornfv/kvmfornfv-4bfeded9-kernel-4.4.50_rt62_ubuntu.x86_64.deb +# yamllint enable rule:line-length + +rt_kvm_pkg: kvmfornfv-4bfeded9-kernel-4.4.50_rt62_ubuntu.x86_64.deb diff --git a/plugins/template/openstack-ansible.inventory b/plugins/template/openstack-ansible.inventory new file mode 100644 index 00000000..37a4b8e5 --- /dev/null +++ b/plugins/template/openstack-ansible.inventory @@ -0,0 +1,253 @@ +# ############################################################## +# This is OpenStack-ansible inventory list +# It is generated in runtime and located in "compass-tasks" +# container, the directory is: +# /etc/openstack_deploy/openstack_inventory.json +# +# The openstack_inventory.json includes hosts and lxc detailed +# information. +# ############################################################## +--- +aodh_alarm_evaluator +aodh_alarm_notifier +aodh_all +aodh_api +aodh_container +aodh_listener +barbican_all +barbican_api +barbican_container +ceilometer_agent_central +ceilometer_agent_compute +ceilometer_agent_notification +ceilometer_all +ceilometer_api +ceilometer_api_container +ceilometer_collector +ceilometer_collector_container +ceph-mon +ceph-mon_container +ceph-mon_containers +ceph-mon_hosts +ceph-osd +ceph-osd_container +ceph-osd_containers +ceph-osd_hosts +ceph_all +cinder_all +cinder_api +cinder_api_container +cinder_backup +cinder_scheduler +cinder_scheduler_container +cinder_volume +cinder_volumes_container +compute-infra_all +compute-infra_containers +compute-infra_hosts +compute_all +compute_containers +compute_hosts +dashboard_all +dashboard_containers +dashboard_hosts +database_containers +database_hosts +designate_all +designate_api +designate_central +designate_container +designate_mdns +designate_producer +designate_sink +designate_worker +dnsaas_containers +dnsaas_hosts +galera +galera_all +galera_container +glance_all +glance_api +glance_container +glance_registry +gnocchi_all +gnocchi_api +gnocchi_container +gnocchi_metricd +haproxy +haproxy_all +haproxy_container +haproxy_containers +haproxy_hosts +heat_all +heat_api +heat_api_cfn +heat_api_cloudwatch +heat_apis_container +heat_engine +heat_engine_container +horizon +horizon_all +horizon_container +host1-host_containers +host2-host_containers +host3-host_containers +hosts +identity_all +identity_containers +identity_hosts +image_all +image_containers +image_hosts +ironic-compute_containers +ironic-compute_hosts +ironic-infra_containers +ironic-infra_hosts +ironic-server_containers +ironic-server_hosts +ironic_all +ironic_api +ironic_api_container +ironic_compute +ironic_compute_container +ironic_conductor +ironic_conductor_container +ironic_server +ironic_server_container +ironic_servers +key-manager_containers +key-manager_hosts +keystone +keystone_all +keystone_container +log_containers +log_hosts +lxc_hosts +magnum +magnum-infra_containers +magnum-infra_hosts +magnum_all +magnum_container +memcached +memcached_all +memcached_container +memcaching_containers +memcaching_hosts +metering-alarm_all +metering-alarm_containers +metering-alarm_hosts +metering-compute_all +metering-compute_container +metering-compute_containers +metering-compute_hosts +metering-infra_all +metering-infra_containers +metering-infra_hosts +metrics_all +metrics_containers +metrics_hosts +mq_containers +mq_hosts +network_all +network_containers +network_hosts +neutron_agent +neutron_agents_container +neutron_all +neutron_bgp_dragent +neutron_dhcp_agent +neutron_l3_agent +neutron_lbaas_agent +neutron_linuxbridge_agent +neutron_metadata_agent +neutron_metering_agent +neutron_openvswitch_agent +neutron_server +neutron_server_container +neutron_sriov_nic_agent +nova_all +nova_api_metadata +nova_api_metadata_container +nova_api_os_compute +nova_api_os_compute_container +nova_api_placement +nova_api_placement_container +nova_compute +nova_compute_container +nova_conductor +nova_conductor_container +nova_console +nova_console_container +nova_scheduler +nova_scheduler_container +operator_containers +operator_hosts +orchestration_all +orchestration_containers +orchestration_hosts +os-infra_containers +os-infra_hosts +pkg_repo +rabbit_mq_container +rabbitmq +rabbitmq_all +remote +remote_containers +repo-infra_all +repo-infra_containers +repo-infra_hosts +repo_all +repo_container +rsyslog +rsyslog_all +rsyslog_container +sahara-infra_containers +sahara-infra_hosts +sahara_all +sahara_api +sahara_container +sahara_engine +shared-infra_all +shared-infra_containers +shared-infra_hosts +storage-infra_all +storage-infra_containers +storage-infra_hosts +storage_all +storage_containers +storage_hosts +swift-proxy_containers +swift-proxy_hosts +swift-remote_containers +swift-remote_hosts +swift_acc +swift_acc_container +swift_all +swift_cont +swift_cont_container +swift_containers +swift_hosts +swift_obj +swift_obj_container +swift_proxy +swift_proxy_container +swift_remote +swift_remote_all +swift_remote_container +trove-infra_containers +trove-infra_hosts +trove_all +trove_api +trove_api_container +trove_conductor +trove_conductor_container +trove_taskmanager +trove_taskmanager_container +unbound +unbound_all +unbound_container +unbound_containers +unbound_hosts +utility +utility_all +utility_container diff --git a/plugins/template/plugins.desc b/plugins/template/plugins.desc new file mode 100644 index 00000000..a7b93f65 --- /dev/null +++ b/plugins/template/plugins.desc @@ -0,0 +1,59 @@ +# ############################################################## +# This is an example for add a plugin into Compass4nfv +# It illustrates how feature components can be integrated 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: plugin_p1 + + description: plugin introduce and description + maintainers: + - name@company.com + + # 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: + # define the parameters required by the plugin + # and its value will be defined and passed by compass4nfv + global_vars: + - xxx: yyy + - ntp_server: "pool.ntp.org" + + # 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: add_interface + phrase: pre_openstack + inventory: + - controller + - compute + - role: add_flavor + phrase: post_openstack + inventory: |