HTTP(S) API connection plugin (#39224)

* HTTPAPI connection

* Punt run_commands to cliconf or httpapi

* Fake enable_mode on eapi

* Pull changes to nxos

* Move load_config to edit_config for future-preparedness

* Don't fail on lldp disabled

* Re-enable check_rc on nxos' run_commands

* Reorganize nxos httpapi plugin for compatibility

* draft docs for connection: httpapi

* restores docs for connection:local for eapi

* Add _remote_is_local to httpapi
This commit is contained in:
Nathaniel Case 2018-05-17 18:47:15 -04:00 committed by GitHub
commit e9d7fa0418
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
277 changed files with 1325 additions and 1676 deletions

View file

@ -1,5 +1,5 @@
---
- name: collect common nxapi test cases
- name: collect common test cases
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
@ -20,8 +20,8 @@
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
- name: run test cases (connection=httpapi)
include: "{{ test_case_to_run }} ansible_connection=httpapi"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -10,7 +10,6 @@
lines:
- "default interface {{ testint1 }}"
- "default interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes
- name: Check intent arguments
@ -19,7 +18,6 @@
admin_state: up
tx_rate: ge(0)
rx_rate: ge(0)
provider: "{{ connection }}"
register: result
- assert:
@ -32,7 +30,6 @@
admin_state: down
tx_rate: gt(0)
rx_rate: lt(0)
provider: "{{ connection }}"
ignore_errors: yes
register: result
@ -47,7 +44,6 @@
aggregate:
- { name: "{{ testint1 }}", description: "Test aggregation on first interface" }
- { name: "{{ testint2 }}", mode: layer3 }
provider: "{{ connection }}"
register: result
- assert:
@ -59,7 +55,6 @@
lines:
- "default interface {{ testint1 }}"
- "default interface {{ testint2 }}"
provider: "{{ connection }}"
ignore_errors: yes
- debug: msg="END connection={{ ansible_connection }} nxos_interface intent test"

View file

@ -9,14 +9,12 @@
nxos_feature:
feature: interface-vlan
state: enabled
provider: "{{ connection }}"
ignore_errors: yes
- name: "Setup: Put interface {{ testint }} into a default state"
nxos_config: &intcleanup
lines:
- "default interface {{ testint }}"
provider: "{{ connection }}"
ignore_errors: yes
- name: "Setup: Remove possibly existing vlan interfaces"
@ -26,7 +24,6 @@
- "no interface vlan 710"
- "no interface vlan 711"
- "no interface vlan 712"
provider: "{{ connection }}"
ignore_errors: yes
- block:
@ -37,7 +34,6 @@
description: 'Configured by Ansible - Layer3'
admin_state: up
state: present
provider: "{{ connection }}"
register: result
- assert: &true
@ -59,7 +55,6 @@
description: 'Configured by Ansible - Layer2'
admin_state: down
state: present
provider: "{{ connection }}"
register: result
- assert: *true
@ -74,7 +69,6 @@
nxos_interface: &createvlans
interface: "{{ item.os_svi_int }}"
description: "{{ item.os_svi_desc }}"
provider: "{{ connection }}"
with_items: &vlanitems
- {os_svi_int: vlan2, os_svi_desc: SVI_VLAN2}
- {os_svi_int: vlan710, os_svi_desc: SVI_VLAN710}
@ -90,7 +84,6 @@
addr: "{{ item.ipv4_addr }}"
mask: "{{ item.ipv4_mask }}"
version: "{{ item.ipv4_ver }}"
provider: "{{ connection }}"
with_items: &vlanips
- {os_svi_int: vlan2, ipv4_addr: 192.168.2.1, ipv4_mask: 24, ipv4_ver: v4}
- {os_svi_int: vlan710, ipv4_addr: 192.168.3.1, ipv4_mask: 24, ipv4_ver: v4}
@ -126,7 +119,6 @@
nxos_feature:
feature: interface-vlan
state: disabled
provider: "{{ connection }}"
ignore_errors: yes
always:

View file

@ -7,13 +7,11 @@
nxos_config:
lines:
- interface Loopback1
provider: "{{ connection }}"
- name: set state=absent
nxos_interface:
interface: Loopback1
state: absent
provider: "{{ connection }}"
register: result
- assert:
@ -24,7 +22,6 @@
nxos_interface:
interface: Loopback1
state: absent
provider: "{{ connection }}"
register: result
- assert:

View file

@ -7,7 +7,6 @@
nxos_config:
lines:
- no interface Loopback1
provider: "{{ connection }}"
ignore_errors: yes # Fails if the interface is already absent
- name: set state=present
@ -15,7 +14,6 @@
interface: Loopback1
state: present
description: 'Configured by Ansible - Layer3'
provider: "{{ connection }}"
register: result
- assert:
@ -27,7 +25,6 @@
interface: Loopback1
state: present
description: 'Configured by Ansible - Layer3'
provider: "{{ connection }}"
register: result
- assert:

View file

@ -22,7 +22,6 @@
description: "sub-interface Configured by Ansible"
admin_state: up
mtu: 800
provider: "{{ connection }}"
register: result
- assert:
@ -43,7 +42,6 @@
description: "sub-interface Configured by Ansible"
admin_state: down
mtu: 800
provider: "{{ connection }}"
register: result
- assert: