Merge "configure ODL as BGP server"
authorDaniel Farrell <dfarrell@redhat.com>
Mon, 19 Mar 2018 18:13:43 +0000 (18:13 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 19 Mar 2018 18:13:43 +0000 (18:13 +0000)
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 6f1916f08a846974c72a62554df5ca141f23fd7d..c4e503c6e9c4df87783865a20618b55d6695017b 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