mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -07:00
Fix net platform agnostic network module integration tests (#32489)
This commit is contained in:
parent
015baf5149
commit
6a0e8cae10
4 changed files with 112 additions and 27 deletions
|
@ -100,10 +100,10 @@
|
||||||
- "result.changed == true"
|
- "result.changed == true"
|
||||||
- "'<lacp/>' not in config.xml"
|
- "'<lacp/>' not in config.xml"
|
||||||
|
|
||||||
- name: Disable linkagg interface
|
- name: Change device count
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
name: ae0
|
name: ae0
|
||||||
state: down
|
device_count: 2
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -116,8 +116,19 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == true"
|
- "result.changed == true"
|
||||||
- "'<disable/>' in config.xml"
|
- "'<device-count>2</device-count>' in config.xml"
|
||||||
- "'+ disable;' in result.diff.prepared"
|
|
||||||
|
- name: Disable linkagg interface
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
state: down
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared | search("\+ *disable")
|
||||||
|
|
||||||
- name: Enable linkagg interface
|
- name: Enable linkagg interface
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
|
@ -126,6 +137,24 @@
|
||||||
provider: "{{ netconf }}"
|
provider: "{{ netconf }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared | search("\- *disable")
|
||||||
|
|
||||||
|
- name: Deactivate linkagg
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
members:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/7
|
||||||
|
mode: active
|
||||||
|
device_count: 4
|
||||||
|
state: present
|
||||||
|
active: False
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
- name: Get running configuration
|
- name: Get running configuration
|
||||||
junos_rpc:
|
junos_rpc:
|
||||||
rpc: get-configuration
|
rpc: get-configuration
|
||||||
|
@ -135,7 +164,36 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == true"
|
- "result.changed == true"
|
||||||
- "'<disable/>' not in config.xml"
|
- "'<bundle inactive=\"inactive\">ae0</bundle>' in config.xml"
|
||||||
|
- "'<device-count inactive=\"inactive\">4</device-count>' in config.xml"
|
||||||
|
- "'inactive: ae0' in result.diff.prepared"
|
||||||
|
|
||||||
|
- name: Activate linkagg
|
||||||
|
net_linkagg:
|
||||||
|
name: ae0
|
||||||
|
members:
|
||||||
|
- ge-0/0/6
|
||||||
|
- ge-0/0/7
|
||||||
|
mode: active
|
||||||
|
device_count: 4
|
||||||
|
state: present
|
||||||
|
active: True
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Get running configuration
|
||||||
|
junos_rpc:
|
||||||
|
rpc: get-configuration
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: config
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- "'<active/>' in config.xml"
|
||||||
|
- "'<bundle>ae0</bundle>' in config.xml"
|
||||||
|
- "'active: device-count 4' in result.diff.prepared"
|
||||||
|
- "'active: ae0' in result.diff.prepared"
|
||||||
|
|
||||||
- name: Delete linkagg
|
- name: Delete linkagg
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
|
@ -178,3 +236,5 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
|
|
||||||
|
- debug: msg="END net_linkagg junos/basic.yaml"
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
name: bond0
|
name: bond0
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
- name: Remove linkagg
|
||||||
|
net_linkagg:
|
||||||
|
name: bond1
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: Create linkagg
|
- name: Create linkagg
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
name: bond0
|
name: bond0
|
||||||
members:
|
members:
|
||||||
- eth1
|
- eth1
|
||||||
- eth2
|
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -18,14 +22,12 @@
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
||||||
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
||||||
- '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
|
|
||||||
|
|
||||||
- name: Create linkagg again (idempotent)
|
- name: Create linkagg again (idempotent)
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
name: bond0
|
name: bond0
|
||||||
members:
|
members:
|
||||||
- eth1
|
- eth1
|
||||||
- eth2
|
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -37,20 +39,20 @@
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
name: bond0
|
name: bond0
|
||||||
members:
|
members:
|
||||||
- eth3
|
- eth2
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
- '"set interfaces ethernet eth3 bond-group bond0" in result.commands'
|
- '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
|
||||||
|
|
||||||
- name: Add linkagg member again (idempotent)
|
- name: Add linkagg member again (idempotent)
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
name: bond0
|
name: bond0
|
||||||
members:
|
members:
|
||||||
- eth3
|
- eth2
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -111,7 +113,6 @@
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
||||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
||||||
- '"delete interfaces ethernet eth3 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces bonding bond0" in result.commands'
|
- '"delete interfaces bonding bond0" in result.commands'
|
||||||
|
|
||||||
- name: Remove linkagg again (idempotent)
|
- name: Remove linkagg again (idempotent)
|
||||||
|
@ -127,8 +128,8 @@
|
||||||
- name: Create collection of linkagg definitions
|
- name: Create collection of linkagg definitions
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
aggregate:
|
aggregate:
|
||||||
- { name: bond0, members: [eth1, eth2] }
|
- { name: bond0, members: [eth1] }
|
||||||
- { name: bond1, members: [eth3, eth4] }
|
- { name: bond1, members: [eth2] }
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -137,16 +138,14 @@
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
- '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
|
||||||
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
- '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
|
||||||
- '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
|
|
||||||
- '"set interfaces bonding bond1 mode 802.3ad" in result.commands'
|
- '"set interfaces bonding bond1 mode 802.3ad" in result.commands'
|
||||||
- '"set interfaces ethernet eth3 bond-group bond1" in result.commands'
|
- '"set interfaces ethernet eth2 bond-group bond1" in result.commands'
|
||||||
- '"set interfaces ethernet eth4 bond-group bond1" in result.commands'
|
|
||||||
|
|
||||||
- name: Create collection of linkagg definitions again (idempotent)
|
- name: Create collection of linkagg definitions again (idempotent)
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
aggregate:
|
aggregate:
|
||||||
- { name: bond0, members: [eth1, eth2] }
|
- { name: bond0, members: [eth1] }
|
||||||
- { name: bond1, members: [eth3, eth4] }
|
- { name: bond1, members: [eth2] }
|
||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -157,8 +156,8 @@
|
||||||
- name: Remove collection of linkagg definitions
|
- name: Remove collection of linkagg definitions
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
aggregate:
|
aggregate:
|
||||||
- { name: bond0 }
|
- name: bond0
|
||||||
- { name: bond1 }
|
- name: bond1
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -166,17 +165,15 @@
|
||||||
that:
|
that:
|
||||||
- 'result.changed == true'
|
- 'result.changed == true'
|
||||||
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
||||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces bonding bond0" in result.commands'
|
- '"delete interfaces bonding bond0" in result.commands'
|
||||||
- '"delete interfaces ethernet eth1 bond-group" in result.commands'
|
|
||||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
||||||
- '"delete interfaces bonding bond1" in result.commands'
|
- '"delete interfaces bonding bond1" in result.commands'
|
||||||
|
|
||||||
- name: Remove collection of linkagg definitions again (idempotent)
|
- name: Remove collection of linkagg definitions again (idempotent)
|
||||||
net_linkagg:
|
net_linkagg:
|
||||||
aggregate:
|
aggregate:
|
||||||
- { name: bond0 }
|
- name: bond0
|
||||||
- { name: bond1 }
|
- name: bond1
|
||||||
state: absent
|
state: absent
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,32 @@
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
|
|
||||||
|
- name: Deactivate lldp interface configuration
|
||||||
|
net_lldp_interface:
|
||||||
|
name: ge-0/0/5
|
||||||
|
state: present
|
||||||
|
active: False
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared | search("! *inactive[:] interface ge-0/0/5")
|
||||||
|
|
||||||
|
- name: Activate lldp interface configuration
|
||||||
|
net_lldp_interface:
|
||||||
|
name: ge-0/0/5
|
||||||
|
state: present
|
||||||
|
active: True
|
||||||
|
provider: "{{ netconf }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "result.changed == true"
|
||||||
|
- result.diff.prepared | search("! *active[:] interface ge-0/0/5")
|
||||||
|
|
||||||
- name: Disable lldp on particular interface
|
- name: Disable lldp on particular interface
|
||||||
net_lldp_interface:
|
net_lldp_interface:
|
||||||
name: ge-0/0/5
|
name: ge-0/0/5
|
||||||
|
@ -52,7 +78,7 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == true"
|
- "result.changed == true"
|
||||||
- result.diff.prepared | search("\+ *disable")
|
- result.diff.prepared | search("\- *disable")
|
||||||
|
|
||||||
- name: Delete lldp on particular interface
|
- name: Delete lldp on particular interface
|
||||||
net_lldp_interface:
|
net_lldp_interface:
|
||||||
|
@ -76,3 +102,5 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
|
|
||||||
|
- debug: msg="END net_lldp_interface junos/basic.yaml"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- 'result.chaned == true'
|
- 'result.changed == true'
|
||||||
- '"logging host 172.16.0.1" in result.commands'
|
- '"logging host 172.16.0.1" in result.commands'
|
||||||
- '"logging facility local7" in result.commands'
|
- '"logging facility local7" in result.commands'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue