Refactoring switch provisioning: moving Accton to new ONL and OFDPA. Introducing support for OLTs provisioning
Change-Id: I6500be973b25510df5346d9140985f6487f2031d
diff --git a/roles/fabric-switch/defaults/main.yml b/roles/fabric-switch/defaults/main.yml
index 9b7ebc1..6d528ce 100644
--- a/roles/fabric-switch/defaults/main.yml
+++ b/roles/fabric-switch/defaults/main.yml
@@ -17,14 +17,25 @@
pub_ssh_key_file_location: "{{ pub_ssh_key_location | default ('/etc/maas/.ssh') }}"
pub_ssh_key: "{{ lookup('file', pub_ssh_key_file_location+'/cord_rsa.pub') }}"
-switch_ouis:
- accton:
- - "cc37ab"
- - "7072cf"
- - "c4393a"
- - "8cea1b"
- - "a82bb5"
- - "480fcf"
- qct:
- - "2c600c"
- - "54ab3a"
+deb_tmp_inst_dir: "/tmp/"
+
+platforms:
+ accton_olts:
+ file_url: "http://onos-fabric/voltha-bal.deb"
+ file_name: "voltha-bal.deb"
+ names:
+ - "x86-64-accton-asxvolt16-r0"
+ accton_switches:
+ file_url: "https://github.com/onfsdn/atrium-docs/blob/master/16A/ONOS/builds/ofdpa_3.0.5.5%2Baccton1.7-1_amd64.deb?raw=true"
+ file_name: "ofdpa_3.0.5.5+accton1.7-1_amd64.deb"
+ checksum: "sha256:db228b6e79fb15f77497b59689235606b60abc157e72fc3356071bcc8dc4c01f"
+ names:
+ - "x86-64-accton-as5712-32x-r0"
+ - "x86-64-accton-as5812-32x-r0"
+ - "x86-64-accton-as6712-32x-r0"
+ quanta_switches:
+ file_url: "https://github.com/onfsdn/atrium-docs/blob/master/16A/ONOS/builds/ofdpa-ly8_0.3.0.5.0-EA5-qct-01.01_amd64.deb?raw=true"
+ file_name: "ofdpa-ly8_0.3.0.5.0-EA5-qct-01.01_amd64.deb"
+ checksum: "sha256:f8201530b1452145c1a0956ea1d3c0402c3568d090553d0d7b3c91a79137da9e"
+ names:
+ - "x86-64-quanta-ly8-rangeley-r0"
diff --git a/roles/fabric-switch/tasks/main.yml b/roles/fabric-switch/tasks/main.yml
index 818828c..03cd283 100644
--- a/roles/fabric-switch/tasks/main.yml
+++ b/roles/fabric-switch/tasks/main.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,51 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
----
-- name: Generate DPID
- shell: ifconfig | grep HWaddr | head -1 | awk '{ print "0x0000"$5 }' | sed s/://g
- register: dpid
- changed_when: false
+- name: Get platform type
+ slurp:
+ src: /etc/onl/platform
+ register: etc_onl_platform
-- name: Get switch OUI
- shell: ifconfig | grep HWaddr | head -1 | awk '{ print $5 }' | sed s/://g | cut -c1-6
- register: oui
- changed_when: false
-
-- name: Ensure OFDPA Config
+- name: Set platform var
set_fact:
- switch_id: "{{ dpid.stdout }}"
- controller_ip: "onos-fabric"
+ platform: "{{ etc_onl_platform.content | b64decode | trim }}"
-- name: Verify Openflow Agent
- shell: which ofagentapp | wc -w
- register: ofdpa_exists
- changed_when: false
+- name: Manage OFDPA
+ include: ofdpa.yml platform="{{ platform }}"
+ when: platform in platforms.accton_switches.names or platform in platforms.quanta_switches.names
-- name: Openflow Agent Version
- command: ofagentapp --version
- register: ofdpa_version
- changed_when: false
- when: ofdpa_exists.stdout != "0"
-
-- name: Install OFDPA commons steps
- include: ofdpa.yml
- when: ofdpa_exists.stdout == "0" or
- (ofdpa_version.stdout.find('3.0.4.0') == -1 and ofdpa_version.stdout.find('3.0.5.0') == -1)
-
-- name: Install OFDPA for Accton switches
- include: ofdpa-accton.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
- when:
- - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.4.0') == -1
- # Accton related OUIs
- - oui.stdout in switch_ouis['accton']
-
-- name: Install OFDPA for QCT switches
- include: ofdpa-qct.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
- when:
- - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.5.0') == -1
- # QCT related OUIs
- - oui.stdout in switch_ouis['qct']
+- name: Manage Accton OLT
+ include: olt-accton.yml
+ when: platform in platforms.accton_olts.names
- name: Authorize SSH Key
become: yes
diff --git a/roles/fabric-switch/tasks/ofdpa-accton.yml b/roles/fabric-switch/tasks/ofdpa-accton.yml
index 598adcb..b569d94 100644
--- a/roles/fabric-switch/tasks/ofdpa-accton.yml
+++ b/roles/fabric-switch/tasks/ofdpa-accton.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,14 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
----
-- name: Openflow Accton Agent Debian Archive
+- name: Copy Accton OFDPA Debian Archive
get_url:
- url: https://github.com/onfsdn/atrium-docs/blob/master/16A/ONOS/builds/ofdpa_3.0.4.0+accton1.0~1-1_amd64.deb?raw=true
+ url: "{{ platforms.accton_switches.file_url }}"
validate_certs: false
- checksum: "sha256:e0b10051b2032454132c6634a0896883e1548e0c39b847ff10933e559b95a729"
- dest: /mnt/onl/data/ofdpa_3.0.4.0+accton1.0~1-1_amd64.deb
+ checksum: "{{ platforms.accton_switches.checksum }}"
+ dest: "{{ deb_tmp_inst_dir }}{{ platforms.accton_switches.file_name }}"
-- name: Openflow Agent Installed
- apt: deb="/mnt/onl/data/ofdpa_3.0.4.0+accton1.0~1-1_amd64.deb" force=true
- when: not lsb_stat.stat.exists or dist.stdout == "0"
+- name: Install Accton OFDPA
+ apt: deb="{{ deb_tmp_inst_dir }}{{ platforms.accton_switches.file_name }}" force=true
diff --git a/roles/fabric-switch/tasks/ofdpa-qct.yml b/roles/fabric-switch/tasks/ofdpa-qct.yml
deleted file mode 100644
index b25c62e..0000000
--- a/roles/fabric-switch/tasks/ofdpa-qct.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# 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: Openflow Quanta Agent Debian Archive
- get_url:
- url: https://github.com/onfsdn/atrium-docs/blob/master/16A/ONOS/builds/ofdpa-ly8_0.3.0.5.0-EA5-qct-01.01_amd64.deb?raw=true
- validate_certs: false
- checksum: "sha256:f8201530b1452145c1a0956ea1d3c0402c3568d090553d0d7b3c91a79137da9e"
- dest: /mnt/onl/data/ofdpa-ly8_0.3.0.5.0-EA5-qct-01.01_amd64.deb
-
-- name: Openflow Agent Installed
- apt: deb="/mnt/onl/data/ofdpa-ly8_0.3.0.5.0-EA5-qct-01.01_amd64.deb" force=true
- when: not lsb_stat.stat.exists or dist.stdout == "0"
diff --git a/roles/fabric-switch/tasks/ofdpa-quanta.yml b/roles/fabric-switch/tasks/ofdpa-quanta.yml
new file mode 100644
index 0000000..9df9446
--- /dev/null
+++ b/roles/fabric-switch/tasks/ofdpa-quanta.yml
@@ -0,0 +1,24 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Copy Quanta OFDPA Debian Archive
+ get_url:
+ url: "{{ platforms.quanta_switches.file_url }}"
+ validate_certs: false
+ checksum: "{{ platforms.quanta_switches.checksum }}"
+ dest: "{{ deb_tmp_inst_dir }}{{ platforms.quanta_switches.file_name }}"
+
+- name: Install Quanta OFDPA
+ apt: deb="{{ deb_tmp_inst_dir }}{{ platforms.quanta_switches.file_name }}" force=true
diff --git a/roles/fabric-switch/tasks/ofdpa.yml b/roles/fabric-switch/tasks/ofdpa.yml
index 9d8fb43..c367e18 100644
--- a/roles/fabric-switch/tasks/ofdpa.yml
+++ b/roles/fabric-switch/tasks/ofdpa.yml
@@ -1,4 +1,4 @@
-
+---
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,50 +13,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
----
-# We want to kill old agents and stop the old OFDPA service before removing
-- name: OpenFlow Agent Is Not Running
- command: killall ofagentapp
- failed_when: false
+- name: Verify Openflow Agent
+ shell: which ofagentapp | wc -w
+ register: ofdpa_exists
tags:
- - skip_ansible_lint # there's no harm to run killall if process is not running
+ - skip_ansible_lint # We're just gathering info
-- name: Old OFDPA Is Not Running
- command: killall -9 brcm-indigo-ofdpa-ofagent
- failed_when: false
+- name: Install OFDPA for Accton switches
+ include: ofdpa-accton.yml
+ when:
+ - platform in platforms.accton_switches.names
+ - ofdpa_exists.stdout == "0"
+
+- name: Install OFDPA for Quanta switches
+ include: ofdpa-quanta.yml
+ when:
+ - platform in platforms.quanta_switches.names
+ - ofdpa_exists.stdout == "0"
+
+- name: Generate DPID
+ shell: ifconfig | grep HWaddr | head -1 | awk '{ print "0x0000"$5 }' | sed s/://g
+ register: dpid
tags:
- - skip_ansible_lint # there's no harm to run killall if process is not running
+ - skip_ansible_lint # We're just gathering info
-- name: Verify Service Exists
- stat:
- path: /etc/init.d/ofdpa
- register: ofdpa_stat
- changed_when: false
- failed_when: false
-
-- name: OpenFlow Agent Stopped
- service: name=ofdpa state=stopped
- when: ofdpa_stat.stat.exists
-
-- name: OFDPA 3.0 EA0 Is Not Present
- apt:
- name: ofdpa-3.0-ea0
- state: absent
- force: yes
- purge: yes
-
-- name: Verify Distribution Release File
- stat:
- path: /etc/lsb-release
- register: lsb_stat
- changed_when: false
- failed_when: false
-
-- name: Verify Distribute Release Name
- shell: grep -i ubuntu /etc/lsb-release | wc -l
- register: dist
- changed_when: false
- failed_when: false
+- name: Ensure OFDPA Config
+ set_fact:
+ switch_id: "{{ dpid.stdout }}"
+ controller_ip: "onos-fabric"
- name: Utilities Scripts
template:
diff --git a/roles/fabric-switch/tasks/olt-accton.yml b/roles/fabric-switch/tasks/olt-accton.yml
new file mode 100644
index 0000000..f663ed1
--- /dev/null
+++ b/roles/fabric-switch/tasks/olt-accton.yml
@@ -0,0 +1,40 @@
+---
+# Copyright 2017-present Open Networking Foundation
+#
+# 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: Check that Voltha BAL driver Debian Archive exists
+ stat:
+ path: "{{ platforms.accton_olts.file_url }}"
+ register: bal_driver_on_server
+
+- name: Verify Voltha BAL Driver presence
+ command: dpkg --list | grep asfvolt16
+ register: bal
+ when:
+ - bal_driver_on_server.stat.exists
+
+- name: Copy Voltha BAL Driver Debian Archive
+ get_url:
+ url: "{{ platforms.accton_olts.file_url }}"
+ validate_certs: false
+ dest: "{{ deb_tmp_inst_dir }}{{ platforms.accton_olts.file_name }}"
+ when:
+ - bal.stdout.find('asfvolt16') == -1
+ - bal_driver_on_server.stat.exists
+
+- name: Install Voltha BAL Driver
+ apt: deb="{{ deb_tmp_inst_dir }}{{ platforms.accton_olts.file_name }}" force=true
+ when:
+ - bal.stdout.find('asfvolt16') == -1
+ - bal_driver_on_server.stat.exists
diff --git a/roles/maas/defaults/main.yml b/roles/maas/defaults/main.yml
index 57fa2f4..07987e6 100644
--- a/roles/maas/defaults/main.yml
+++ b/roles/maas/defaults/main.yml
@@ -17,9 +17,6 @@
# Add switch boot images to be downloaded to this list
switch_boot_images:
- - name: "ONL-2.0.0_ONL-OS_2017-01-04.0024-8d23df5_AMD64_INSTALLED_INSTALLER"
- url: 'https://github.com/opencord/OpenNetworkLinux/releases/download/2017-01-04.0024-8d23df5/ONL-2.0.0_ONL-OS_2017-01-04.0024-8d23df5_AMD64_INSTALLED_INSTALLER'
- checksum: "sha256:4ed90086cafc3899ddb10ab7bac8677d8ece27de3ed28ed385c12aba8d53c0a9"
- name: "ONL-2.0.0_ONL-OS_2018-01-24.0118-1303f20_AMD64_INSTALLED_INSTALLER"
url: 'https://github.com/opencord/OpenNetworkLinux/releases/download/20180124-olt-kernel-3.7.10/ONL-2.0.0_ONL-OS_2018-01-24.0118-1303f20_AMD64_INSTALLED_INSTALLER'
checksum: "sha256:1ac830d5636ef7a4a9cec52beb6cf3ac63dd959bb3dfd928ee526fbc52675364"
@@ -31,11 +28,11 @@
# name of an image in the switch_boot_images list given above
switch_models:
- name: "onie-installer-x86_64-accton_as5712_54x-r0"
- boot_image: "ONL-2.0.0_ONL-OS_2017-01-04.0024-8d23df5_AMD64_INSTALLED_INSTALLER"
+ boot_image: "ONL-2.0.0_ONL-OS_2017-10-19.2200-1211610_AMD64_INSTALLED_INSTALLER"
- name: "onie-installer-x86_64-accton_as5812_54x-r0"
- boot_image: "ONL-2.0.0_ONL-OS_2017-01-04.0024-8d23df5_AMD64_INSTALLED_INSTALLER"
+ boot_image: "ONL-2.0.0_ONL-OS_2017-10-19.2200-1211610_AMD64_INSTALLED_INSTALLER"
- name: "onie-installer-x86_64-accton_as6712_32x-r0"
- boot_image: "ONL-2.0.0_ONL-OS_2017-01-04.0024-8d23df5_AMD64_INSTALLED_INSTALLER"
+ boot_image: "ONL-2.0.0_ONL-OS_2017-10-19.2200-1211610_AMD64_INSTALLED_INSTALLER"
- name: "onie-installer-x86_64-accton_asxvolt16-r0"
boot_image: "ONL-2.0.0_ONL-OS_2018-01-24.0118-1303f20_AMD64_INSTALLED_INSTALLER"
- name: "onie-installer-x86_64-quanta_ly8_rangeley-r0"