| --- |
| # 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: Generate fabric-network-cfg.json |
| shell: cord generate |
| register: cord_generate |
| tags: |
| - skip_ansible_lint |
| |
| - name: Set cord_profile_src_dir |
| set_fact: |
| cord_profile_src_dir: "../../orchestration/profiles/{{ cord_use_case }}" |
| |
| - name: Set fabric_network_cfg_json |
| set_fact: |
| fabric_network_cfg_json: "{{ cord_generate.stdout }}" |
| |
| - name: Regenerate fabric-service.yaml |
| template: |
| src: "{{ cord_profile_src_dir }}/templates/fabric-service.yaml.j2" |
| dest: "{{ head_cord_profile_dir }}/fabric-service.yaml" |
| |
| - name: Slurp fabric-service.yaml |
| slurp: |
| src: "{{ head_cord_profile_dir }}/fabric-service.yaml" |
| register: slurpfile |
| |
| - name: Delete old ONOS fabric configuration |
| uri: |
| url: "http://onos-fabric:8181/onos/v1/network/configuration/" |
| method: DELETE |
| user: onos |
| password: rocks |
| status_code: 200, 204 |
| |
| - name: Upload new fabric configuration to XOS |
| uri: |
| url: "{{ xos_tosca_url }}/run" |
| method: POST |
| headers: |
| xos-username: "{{ xos_admin_user }}" |
| xos-password: "{{ xos_admin_pass }}" |
| body: "{{ slurpfile['content'] | b64decode }}" |
| status_code: 200 |
| register: result |
| until: result is success |
| retries: 5 |
| delay: 5 |
| |
| - name: Re-activate ONOS apps |
| uri: |
| url: "{{ item }}" |
| method: POST |
| user: onos |
| password: rocks |
| status_code: 200 |
| with_items: |
| - "http://onos-fabric:8181/onos/v1/applications/org.onosproject.vrouter/active" |
| - "http://onos-fabric:8181/onos/v1/applications/org.onosproject.segmentrouting/active" |