Jonathan Hart | 93956f5 | 2017-08-22 13:12:42 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 16 | --- |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 17 | - name: Generate DPID |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 18 | shell: ifconfig | grep HWaddr | head -1 | awk '{ print "0x0000"$5 }' | sed s/://g |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 19 | register: dpid |
| 20 | changed_when: false |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 21 | |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 22 | - name: Get switch OUI |
| 23 | shell: ifconfig | grep HWaddr | head -1 | awk '{ print $5 }' | sed s/://g | cut -c1-6 |
| 24 | register: oui |
| 25 | changed_when: false |
| 26 | |
| 27 | - name: Ensure OFDPA Config |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 28 | set_fact: |
| 29 | switch_id: "{{ dpid.stdout }}" |
| 30 | controller_ip: "onos-fabric" |
| 31 | |
| 32 | - name: Verify Openflow Agent |
Jonathan Hart | 1728fc8 | 2017-08-22 12:47:10 -0700 | [diff] [blame] | 33 | shell: which ofagentapp | wc -w |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 34 | register: ofdpa_exists |
| 35 | changed_when: false |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 36 | |
| 37 | - name: Openflow Agent Version |
Jonathan Hart | 1728fc8 | 2017-08-22 12:47:10 -0700 | [diff] [blame] | 38 | command: ofagentapp --version |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 39 | register: ofdpa_version |
| 40 | changed_when: false |
David K. Bainbridge | f418170 | 2016-06-17 14:44:03 -0700 | [diff] [blame] | 41 | when: ofdpa_exists.stdout != "0" |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 42 | |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 43 | - name: Install OFDPA commons steps |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 44 | include: ofdpa.yml |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 45 | when: ofdpa_exists.stdout == "0" or |
| 46 | (ofdpa_version.stdout.find('3.0.4.0') == -1 and ofdpa_version.stdout.find('3.0.5.0') == -1) |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 47 | |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 48 | - name: Install OFDPA for Accton switches |
| 49 | include: ofdpa-accton.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}" |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 50 | when: |
| 51 | - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.4.0') == -1 |
| 52 | # Accton related OUIs |
Luca Prete | c0eefef | 2017-12-19 11:00:06 -0800 | [diff] [blame] | 53 | - oui.stdout in switch_ouis['accton'] |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 54 | |
| 55 | - name: Install OFDPA for QCT switches |
| 56 | include: ofdpa-qct.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}" |
Luca Prete | 57e7627 | 2017-12-11 14:15:08 -0800 | [diff] [blame] | 57 | when: |
| 58 | - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.5.0') == -1 |
Luca Prete | c0eefef | 2017-12-19 11:00:06 -0800 | [diff] [blame] | 59 | # QCT related OUIs |
| 60 | - oui.stdout in switch_ouis['qct'] |
David K. Bainbridge | 317e7d7 | 2016-05-11 08:31:44 -0700 | [diff] [blame] | 61 | |
Charles Chan | aba1b56 | 2016-08-01 16:33:07 -0700 | [diff] [blame] | 62 | - name: Authorize SSH Key |
| 63 | become: yes |
| 64 | authorized_key: |
| 65 | key={{ pub_ssh_key }} |
| 66 | user=root |
| 67 | state=present |
| 68 | register: sshkey |