Decouple config and state check in vlan and vrf network modules (#36386)

* Decouple config and state check in {network_os }_vlan and { network_os }_vrf modules

Fixes #35567
Fixes #34754

`interfaces` option is used for configuration as well as operational state
check. If interface is configured to given vlan or vrf but if
operational state of interface is disabled it results in module failure.

Fix is to decouple same option usage for config and state.
With this fix `interfaces` is used as config option and a new
option named `associated_interfaces` will be used for intent check
for assigned interfaces.

* Fix CI failures

* Fix review comment

* Fixed integration test failure
This commit is contained in:
Ganesh Nalawade 2018-02-26 09:23:54 +05:30 committed by GitHub
commit 5a6b893240
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 457 additions and 100 deletions

View file

@ -118,13 +118,16 @@
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Add interfaces to vlan
- name: Add interfaces to vlan and check state
eos_vlan:
vlan_id: 4000
state: present
interfaces:
- Ethernet1
- Ethernet2
associated_interfaces:
- Ethernet1
- Ethernet2
authorize: yes
provider: "{{ cli }}"
become: yes
@ -160,6 +163,22 @@
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
- name: vlan interface intent fail
eos_vlan:
vlan_id: 4000
state: present
associated_interfaces:
- test
authorize: yes
provider: "{{ cli }}"
become: yes
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == True"
- name: Remove interface from vlan
eos_vlan:
vlan_id: 4000