Matteo Scandolo | 1c049b0 | 2018-01-18 11:32:46 -0800 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | --- |
| 16 | - hosts: 127.0.0.1 |
| 17 | connection: local |
| 18 | vars: |
Matteo Scandolo | ad7f3b4 | 2018-01-30 16:41:19 -0800 | [diff] [blame] | 19 | - body: '{{ body }}' |
Matteo Scandolo | 1c049b0 | 2018-01-18 11:32:46 -0800 | [diff] [blame] | 20 | - endpoint: '{{ endpoint }}' |
| 21 | |
| 22 | tasks: |
| 23 | - debug: |
Matteo Scandolo | ad7f3b4 | 2018-01-30 16:41:19 -0800 | [diff] [blame] | 24 | msg: "{{ '{{' }} body {{ '}}' }}" |
Matteo Scandolo | 1c049b0 | 2018-01-18 11:32:46 -0800 | [diff] [blame] | 25 | # NOTE that the task has a generic name as it's planned to be used for all the requests |
| 26 | - name: Call onos Progran |
| 27 | uri: |
| 28 | url: "http://{{ onos_url }}:{{ onos_port }}/onos/progran/{{ '{{' }} endpoint {{ '}}' }}" |
| 29 | method: "{{ method }}" |
| 30 | user: "{{ onos_username }}" |
| 31 | password: "{{ onos_password }}" |
| 32 | force_basic_auth: yes |
| 33 | status_code: 200 |
| 34 | {% if method == "POST" or method == "PUT" -%} |
Matteo Scandolo | ad7f3b4 | 2018-01-30 16:41:19 -0800 | [diff] [blame] | 35 | body: "{{ '{{' }} body {{ '}}' }}" |
Matteo Scandolo | 1c049b0 | 2018-01-18 11:32:46 -0800 | [diff] [blame] | 36 | body_format: json |
| 37 | {%- endif -%} |