Zack Williams | f6cc012 | 2018-03-30 16:00:49 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 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 | |
Andy Bavier | eb418af | 2018-01-29 11:32:31 -0700 | [diff] [blame] | 16 | - name: Generate fabric-network-cfg.json |
| 17 | shell: cord generate |
| 18 | register: cord_generate |
Andy Bavier | af2b8a6 | 2017-08-14 12:33:39 -0700 | [diff] [blame] | 19 | tags: |
Andy Bavier | eb418af | 2018-01-29 11:32:31 -0700 | [diff] [blame] | 20 | - skip_ansible_lint |
| 21 | |
| 22 | - name: Set cord_profile_src_dir |
| 23 | set_fact: |
| 24 | cord_profile_src_dir: "../../orchestration/profiles/{{ cord_use_case }}" |
| 25 | |
| 26 | - name: Set fabric_network_cfg_json |
| 27 | set_fact: |
| 28 | fabric_network_cfg_json: "{{ cord_generate.stdout }}" |
| 29 | |
| 30 | - name: Regenerate fabric-service.yaml |
| 31 | template: |
| 32 | src: "{{ cord_profile_src_dir }}/templates/fabric-service.yaml.j2" |
| 33 | dest: "{{ head_cord_profile_dir }}/fabric-service.yaml" |
| 34 | |
| 35 | - name: Slurp fabric-service.yaml |
| 36 | slurp: |
| 37 | src: "{{ head_cord_profile_dir }}/fabric-service.yaml" |
| 38 | register: slurpfile |
| 39 | |
| 40 | - name: Delete old ONOS fabric configuration |
| 41 | uri: |
| 42 | url: "http://onos-fabric:8181/onos/v1/network/configuration/" |
| 43 | method: DELETE |
| 44 | user: onos |
| 45 | password: rocks |
| 46 | status_code: 200, 204 |
| 47 | |
| 48 | - name: Upload new fabric configuration to XOS |
| 49 | uri: |
| 50 | url: "{{ xos_tosca_url }}/run" |
| 51 | method: POST |
| 52 | headers: |
| 53 | xos-username: "{{ xos_admin_user }}" |
| 54 | xos-password: "{{ xos_admin_pass }}" |
| 55 | body: "{{ slurpfile['content'] | b64decode }}" |
| 56 | status_code: 200 |
| 57 | register: result |
Zack Williams | f6cc012 | 2018-03-30 16:00:49 -0700 | [diff] [blame] | 58 | until: result is success |
Andy Bavier | eb418af | 2018-01-29 11:32:31 -0700 | [diff] [blame] | 59 | retries: 5 |
| 60 | delay: 5 |
| 61 | |
| 62 | - name: Re-activate ONOS apps |
| 63 | uri: |
| 64 | url: "{{ item }}" |
| 65 | method: POST |
| 66 | user: onos |
| 67 | password: rocks |
| 68 | status_code: 200 |
| 69 | with_items: |
| 70 | - "http://onos-fabric:8181/onos/v1/applications/org.onosproject.vrouter/active" |
| 71 | - "http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active" |