configure ODL as BGP server 95/66195/10
authorPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
Mon, 4 Dec 2017 13:21:42 +0000 (14:21 +0100)
committerPeriyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
Mon, 19 Mar 2018 17:39:58 +0000 (17:39 +0000)
1. Quagga packages are kept as tar.gz package in remote location,
downloaded/extracted/configured as local distribution repository
(apt/yum/zypper) accordingly to install the Quagga and its dependent
packages seamlessly

2. Quagga to be installed on the neutron server nodes, but its configued
as BGP speaker for OpenDaylight in one of the neutron server node if it
is running in cluster environment.

Change-Id: If3907c76a57cb7d58e78ec0201c01b27baefb472
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
handlers/configure_odl_bgp.yml [new file with mode: 0644]
handlers/main.yml
tasks/configure_quagga.yml [new file with mode: 0644]
tasks/main.yml
vars/main.yml

diff --git a/handlers/configure_odl_bgp.yml b/handlers/configure_odl_bgp.yml
new file mode 100644 (file)
index 0000000..5ef8b90
--- /dev/null
@@ -0,0 +1,42 @@
+---
+# Copyright (c) 2017-2018 Ericsson AB and others.
+#
+# Licensed 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.
+
+- name: Start Quagga Zebra RPC service
+  service:
+    name: zrpcd
+    state: restarted
+    enabled: yes
+  when: inventory_hostname == odl_bgp_speaker_host
+  listen: "configure odl for bgp"
+
+- name: Wait for ODL and BGP Server port to become available on the host
+  wait_for:
+    port: "{{ bgp_config_server_port }}"
+    delay: 90
+    timeout: 120
+  when: inventory_hostname == odl_bgp_speaker_host
+  listen: "configure odl for bgp"
+
+- name: Connect OpenDaylight with Quagga
+  command: "/opt/opendaylight/bin/client -h {{ odl_bgp_speaker_host_ip_address }} 'bgp-connect --host {{ odl_bgp_speaker_host_ip_address }} --port {{ bgp_config_server_port }} add'"
+  when: inventory_hostname == odl_bgp_speaker_host
+  listen: "configure odl for bgp"
+  ignore_errors: True
+
+- name: Configure Opendaylight as BGP speaker
+  command: "/opt/opendaylight/bin/client -h {{ odl_bgp_speaker_host_ip_address }} 'odl:configure-bgp -op start-bgp-server --as-num 100 --router-id {{ odl_bgp_speaker_host_ip_address }}'"
+  when: inventory_hostname == odl_bgp_speaker_host
+  listen: "configure odl for bgp"
+  ignore_errors: True
index 6521e96efa82629c9fa744feb2297105567a6c79..b38ad331ec6d6c85a1fe736105608412f32a21c4 100644 (file)
@@ -2,3 +2,6 @@
 - include: stop_odl.yml
 - include: cleanup_karaf.yml
 - include: start_odl.yml
+- include: configure_odl_bgp.yml
+  when:
+    - quagga
diff --git a/tasks/configure_quagga.yml b/tasks/configure_quagga.yml
new file mode 100644 (file)
index 0000000..315735c
--- /dev/null
@@ -0,0 +1,71 @@
+---
+# Copyright (c) 2017-2018 Ericsson AB and others.
+#
+# Licensed 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.
+
+- name: Retrieve checksum for Quagga download
+  uri:
+    url: "{{ quagga_package_url | replace('tar.gz', 'checksum') }}"
+    return_content: yes
+  register: quagga_package_checksum
+
+- name: Attempt Quagga download
+  get_url:
+    url: "{{ quagga_package_url }}"
+    dest: "/var/cache/{{ quagga_package_url | basename }}"
+    checksum: "sha1:{{ quagga_package_checksum.content | trim }}"
+
+- name: Unarchive pre-built Quagga packages
+  unarchive:
+    src: "/var/cache/{{ quagga_package_url | basename }}"
+    dest: "{{ temp_quagga_dir | dirname }}"
+    copy: "no"
+
+- name: Add Debian Local Repository for Quagga Packages
+  apt_repository:
+    repo: deb [trusted=yes] file://{{ temp_quagga_dir }} ./
+    state: present
+    update_cache: yes
+  when:
+    - ansible_os_family == "Debian"
+
+- name: Add YUM Local Repository for Quagga Packages
+  copy:
+    src: "{{ temp_quagga_dir }}/quagga.repo"
+    dest: /etc/yum.repos.d/quagga.repo
+    owner: root
+    group: root
+    mode: 0644
+  when:
+    - ansible_os_family == "RedHat"
+
+- name: Add Zypper Local Repository for Quagga Packages
+  zypper_repository:
+    repo: -t YUM {{ temp_quagga_dir }} quagga.repo
+    state: present
+  when: ansible_os_family == "Suse"
+
+- name: Install Quagga packages
+  package:
+    name: "{{ quagga_dependencies }}"
+    state: present
+    update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
+    cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(600, omit) }}"
+
+- name: Create Symbolic link for Quagga Zebra RPC service Init script
+  file:
+    src: "/opt/quagga/etc/init.d/zrpcd"
+    dest: "/etc/init.d/zrpcd"
+    state: link
+  notify: "configure odl for bgp"
+  when: inventory_hostname == odl_bgp_speaker_host
index de73435aa9b0314bb789aced4581e2edcb2c0e6f..f92c6dde6e41b4169a7b8da04a55dc1856c6de19 100644 (file)
@@ -10,3 +10,6 @@
 - include: configure_genius_tunnels.yml
   when: "'odl-netvirt-sfc' in features"
 - include: start_odl.yml
+- include: configure_quagga.yml
+  when:
+    - quagga
index 8d219bb4cca50a5d59323c2d22230a431b3c5fe5..9ed431816b1ac7be353fec15e709af875417f19c 100755 (executable)
@@ -85,3 +85,43 @@ suse_rpm_path: "https://download.opensuse.org/repositories/Virtualization:/NFV/o
 #   See: http://docs.ansible.com/ansible/apt_module.html
 # This is used when `install_method` is "deb_path"
 deb_path: ""
+
+# Distro on which quagga packages to be installed
+quagga_install_method: "{{ (ansible_os_family=='Debian') | ternary('deb_repo', 'rpm_repo') }}"
+
+# Quagga deb packages repository location
+quagga_deb_repo: http://artifacts.opnfv.org/sdnvpn/quagga4/quagga-ubuntu-updated.tar.gz
+
+# Quagga rpm packages repository location
+quagga_rpm_repo: http://artifacts.opnfv.org/sdnvpn/quagga4/quagga.tar.gz
+
+# Find out correct quagga package url based on the
+# quagga install method
+quagga_package_url: "{% if quagga_install_method == 'deb_repo' %}{{ quagga_deb_repo }}{% else %}{{ quagga_rpm_repo }}{% endif %}"
+
+# Temporary location on which quagga packages to be
+# retrieved for the installation
+temp_quagga_dir: /tmp/quagga
+
+# The neutron server node on which OSA configures ODL
+# as the BGP speaker
+odl_bgp_speaker_host: "{{ inventory_hostname }}"
+
+# The neutron server node ip address (br-admin) on which OSA configures ODL
+# as the BGP speaker
+odl_bgp_speaker_host_ip_address: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
+
+# BGP Config Server Port at quagga side for ODL to establish
+# thrift connection.
+bgp_config_server_port: 7644
+
+# Quagga packages to be installed
+quagga_dependencies:
+  - thrift
+  - zmq
+  - c-capnproto
+  - quagga
+  - zrpc
+
+# Configure OpenDaylight with Quagga
+quagga: false