mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add ios_linkagg DI module (#33215)
* Add ios_linkagg DI module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * pep8 fixes * update ios version * ios_linkagg integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix port-channel commands * update test * ios tests to network_cli Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * add required_together check in aggregate and update test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix pep8 issues * Add discovery of ios switch type Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
557716dc49
commit
2e76f04a9e
9 changed files with 723 additions and 180 deletions
|
@ -1,203 +1,213 @@
|
|||
#---
|
||||
#- name: setup - remove vlan used in test
|
||||
# ios_config:
|
||||
# lines:
|
||||
# - no vlan 100
|
||||
# - no vlan 200
|
||||
# - no vlan 300
|
||||
# authorize: yes
|
||||
---
|
||||
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
||||
#- name: setup - remove switchport settings on interfaces used in test
|
||||
# ios_config:
|
||||
# lines:
|
||||
# - switchport mode access
|
||||
# - no switchport access vlan 100
|
||||
# authorize: yes
|
||||
# parents: "{{ item }}"
|
||||
# with_items:
|
||||
# - interface GigabitEthernet0/1
|
||||
# - interface GigabitEthernet0/2
|
||||
- set_fact: switch_type="{{ switch_type }}"
|
||||
|
||||
#- name: create vlan
|
||||
# ios_vlan: &create
|
||||
# vlan_id: 100
|
||||
# name: test-vlan
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- block:
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'vlan 100' in result.commands"
|
||||
# - "'name test-vlan' in result.commands"
|
||||
- name: setup - remove vlan used in test
|
||||
ios_config:
|
||||
lines:
|
||||
- no vlan 100
|
||||
- no vlan 200
|
||||
- no vlan 300
|
||||
authorize: yes
|
||||
|
||||
#- name: create vlan(idempotence)
|
||||
# ios_vlan: *create
|
||||
# register: result
|
||||
- name: setup - remove switchport settings on interfaces used in test
|
||||
ios_config:
|
||||
lines:
|
||||
- switchport mode access
|
||||
- no switchport access vlan 100
|
||||
authorize: yes
|
||||
parents: "{{ item }}"
|
||||
loop:
|
||||
- interface GigabitEthernet0/1
|
||||
- interface GigabitEthernet0/2
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: create vlan
|
||||
ios_vlan: &create
|
||||
vlan_id: 100
|
||||
name: test-vlan
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: Add interfaces to vlan
|
||||
# ios_vlan: &interfaces
|
||||
# vlan_id: 100
|
||||
# interfaces:
|
||||
# - GigabitEthernet0/1
|
||||
# - GigabitEthernet0/2
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'vlan 100' in result.commands"
|
||||
- "'name test-vlan' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'interface GigabitEthernet0/1' in result.commands"
|
||||
# - "'switchport mode access' in result.commands"
|
||||
# - "'switchport access vlan 100' in result.commands"
|
||||
# - "'interface GigabitEthernet0/2' in result.commands"
|
||||
# - "'switchport mode access' in result.commands"
|
||||
# - "'switchport access vlan 100' in result.commands"
|
||||
- name: create vlan(idempotence)
|
||||
ios_vlan: *create
|
||||
register: result
|
||||
|
||||
#- name: Add interfaces to vlan(idempotence)
|
||||
# ios_vlan: *interfaces
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: Add interfaces to vlan
|
||||
ios_vlan: &interfaces
|
||||
vlan_id: 100
|
||||
interfaces:
|
||||
- GigabitEthernet0/1
|
||||
- GigabitEthernet0/2
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: Remove interface from vlan
|
||||
# ios_vlan: &single_int
|
||||
# vlan_id: 100
|
||||
# interfaces:
|
||||
# - GigabitEthernet0/1
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'interface GigabitEthernet0/1' in result.commands"
|
||||
- "'switchport mode access' in result.commands"
|
||||
- "'switchport access vlan 100' in result.commands"
|
||||
- "'interface GigabitEthernet0/2' in result.commands"
|
||||
- "'switchport mode access' in result.commands"
|
||||
- "'switchport access vlan 100' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'vlan 100' in result.commands"
|
||||
# - "'interface GigabitEthernet0/2' in result.commands"
|
||||
# - "'switchport mode access' in result.commands"
|
||||
# - "'no switchport access vlan 100' in result.commands"
|
||||
- name: Add interfaces to vlan(idempotence)
|
||||
ios_vlan: *interfaces
|
||||
register: result
|
||||
|
||||
#- name: Remove interface from vlan(idempotence)
|
||||
# ios_vlan: *single_int
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: Remove interface from vlan
|
||||
ios_vlan: &single_int
|
||||
vlan_id: 100
|
||||
interfaces:
|
||||
- GigabitEthernet0/1
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: Suspend vlan
|
||||
# ios_vlan:
|
||||
# vlan_id: 100
|
||||
# state: suspend
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'vlan 100' in result.commands"
|
||||
- "'interface GigabitEthernet0/2' in result.commands"
|
||||
- "'switchport mode access' in result.commands"
|
||||
- "'no switchport access vlan 100' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'vlan 100' in result.commands"
|
||||
# - "'state suspend' in result.commands"
|
||||
- name: Remove interface from vlan(idempotence)
|
||||
ios_vlan: *single_int
|
||||
register: result
|
||||
|
||||
#- name: Unsuspend vlan
|
||||
# ios_vlan:
|
||||
# vlan_id: 100
|
||||
# state: active
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'vlan 100' in result.commands"
|
||||
# - "'state active' in result.commands"
|
||||
- name: Suspend vlan
|
||||
ios_vlan:
|
||||
vlan_id: 100
|
||||
state: suspend
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: delete vlan
|
||||
# ios_vlan: &delete
|
||||
# vlan_id: 100
|
||||
# authorize: yes
|
||||
# state: absent
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'vlan 100' in result.commands"
|
||||
- "'state suspend' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'no vlan 100' in result.commands"
|
||||
- name: Unsuspend vlan
|
||||
ios_vlan:
|
||||
vlan_id: 100
|
||||
state: active
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: delete vlan(idempotence)
|
||||
# ios_vlan: *delete
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'vlan 100' in result.commands"
|
||||
- "'state active' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: delete vlan
|
||||
ios_vlan: &delete
|
||||
vlan_id: 100
|
||||
authorize: yes
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
#- name: create vlans using aggregate
|
||||
# ios_vlan: &create_aggregate
|
||||
# aggregate:
|
||||
# - { vlan_id: 200, name: vlan-200 }
|
||||
# - { vlan_id: 300, name: vlan-300 }
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'no vlan 100' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'vlan 200' in result.commands"
|
||||
# - "'name vlan-200' in result.commands"
|
||||
# - "'vlan 300' in result.commands"
|
||||
# - "'name vlan-300' in result.commands"
|
||||
- name: delete vlan(idempotence)
|
||||
ios_vlan: *delete
|
||||
register: result
|
||||
|
||||
#- name: create vlans using aggregate(idempotence)
|
||||
# ios_vlan: *create_aggregate
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: create vlans using aggregate
|
||||
ios_vlan: &create_aggregate
|
||||
aggregate:
|
||||
- { vlan_id: 200, name: vlan-200 }
|
||||
- { vlan_id: 300, name: vlan-300 }
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: delete vlans using aggregate
|
||||
# ios_vlan: &delete_aggregate
|
||||
# aggregate:
|
||||
# - { vlan_id: 200, name: vlan-200 }
|
||||
# - { vlan_id: 300, name: vlan-300 }
|
||||
# state: absent
|
||||
# authorize: yes
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'vlan 200' in result.commands"
|
||||
- "'name vlan-200' in result.commands"
|
||||
- "'vlan 300' in result.commands"
|
||||
- "'name vlan-300' in result.commands"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == true"
|
||||
# - "'no vlan 200' in result.commands"
|
||||
# - "'no vlan 300' in result.commands"
|
||||
- name: create vlans using aggregate(idempotence)
|
||||
ios_vlan: *create_aggregate
|
||||
register: result
|
||||
|
||||
#- name: delete vlans using aggregate(idempotence)
|
||||
# ios_vlan: *delete_aggregate
|
||||
# register: result
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
#- assert:
|
||||
# that:
|
||||
# - "result.changed == false"
|
||||
- name: delete vlans using aggregate
|
||||
ios_vlan: &delete_aggregate
|
||||
aggregate:
|
||||
- { vlan_id: 200, name: vlan-200 }
|
||||
- { vlan_id: 300, name: vlan-300 }
|
||||
state: absent
|
||||
authorize: yes
|
||||
register: result
|
||||
|
||||
#- name: teardown(part1)
|
||||
# ios_config:
|
||||
# lines:
|
||||
# - no vlan 100
|
||||
# - no vlan 200
|
||||
# - no vlan 300
|
||||
# authorize: yes
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'no vlan 200' in result.commands"
|
||||
- "'no vlan 300' in result.commands"
|
||||
|
||||
#- name: teardown(part2)
|
||||
# ios_config:
|
||||
# lines:
|
||||
# - switchport mode access
|
||||
# - no switchport access vlan 100
|
||||
# authorize: yes
|
||||
# parents: "{{ item }}"
|
||||
# with_items:
|
||||
# - interface GigabitEthernet0/1
|
||||
# - interface GigabitEthernet0/2
|
||||
- name: delete vlans using aggregate(idempotence)
|
||||
ios_vlan: *delete_aggregate
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- name: teardown(part1)
|
||||
ios_config:
|
||||
lines:
|
||||
- no vlan 100
|
||||
- no vlan 200
|
||||
- no vlan 300
|
||||
authorize: yes
|
||||
|
||||
- name: teardown(part2)
|
||||
ios_config:
|
||||
lines:
|
||||
- switchport mode access
|
||||
- no switchport access vlan 100
|
||||
authorize: yes
|
||||
parents: "{{ item }}"
|
||||
loop:
|
||||
- interface GigabitEthernet0/1
|
||||
- interface GigabitEthernet0/2
|
||||
|
||||
when: switch_type == 'L2'
|
||||
|
||||
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue