blob: 5d0f769564c1c9598831fc7d783d79bb62885fd8 [file] [log] [blame]
Jonathan Hart93956f52017-08-22 13:12:42 -07001
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. Bainbridge317e7d72016-05-11 08:31:44 -070016---
David K. Bainbridgef4181702016-06-17 14:44:03 -070017- name: Generate DPID
Luca Prete57e76272017-12-11 14:15:08 -080018 shell: ifconfig | grep HWaddr | head -1 | awk '{ print "0x0000"$5 }' | sed s/://g
David K. Bainbridgef4181702016-06-17 14:44:03 -070019 register: dpid
20 changed_when: false
David K. Bainbridge317e7d72016-05-11 08:31:44 -070021
Luca Prete57e76272017-12-11 14:15:08 -080022- 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. Bainbridgef4181702016-06-17 14:44:03 -070028 set_fact:
29 switch_id: "{{ dpid.stdout }}"
30 controller_ip: "onos-fabric"
31
32- name: Verify Openflow Agent
Jonathan Hart1728fc82017-08-22 12:47:10 -070033 shell: which ofagentapp | wc -w
David K. Bainbridgef4181702016-06-17 14:44:03 -070034 register: ofdpa_exists
35 changed_when: false
David K. Bainbridge317e7d72016-05-11 08:31:44 -070036
37- name: Openflow Agent Version
Jonathan Hart1728fc82017-08-22 12:47:10 -070038 command: ofagentapp --version
David K. Bainbridge317e7d72016-05-11 08:31:44 -070039 register: ofdpa_version
40 changed_when: false
David K. Bainbridgef4181702016-06-17 14:44:03 -070041 when: ofdpa_exists.stdout != "0"
David K. Bainbridge317e7d72016-05-11 08:31:44 -070042
Luca Prete57e76272017-12-11 14:15:08 -080043- name: Install OFDPA commons steps
David K. Bainbridge317e7d72016-05-11 08:31:44 -070044 include: ofdpa.yml
Luca Prete57e76272017-12-11 14:15:08 -080045 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. Bainbridge317e7d72016-05-11 08:31:44 -070047
Luca Prete57e76272017-12-11 14:15:08 -080048- name: Install OFDPA for Accton switches
49 include: ofdpa-accton.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
50 with_items: "{{ switch_ouis.accton|default([]) }}"
51 when:
52 - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.4.0') == -1
53 # Accton related OUIs
54 - oui.stdout == item
55
56- name: Install OFDPA for QCT switches
57 include: ofdpa-qct.yml lsb_stat="{{ lsb_stat }}" dist="{{ dist }}"
58 with_items: "{{ switch_ouis.qct|default([]) }}"
59 when:
60 - ofdpa_exists.stdout == "0" or ofdpa_version.stderr.find('3.0.5.0') == -1
61 # Accton related OUIs
62 - oui.stdout == item
David K. Bainbridge317e7d72016-05-11 08:31:44 -070063
Charles Chanaba1b562016-08-01 16:33:07 -070064- name: Authorize SSH Key
65 become: yes
66 authorized_key:
67 key={{ pub_ssh_key }}
68 user=root
69 state=present
70 register: sshkey