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"
|
||||
- "'<lacp/>' not in config.xml"
|
||||
|
||||
- name: Disable linkagg interface
|
||||
- name: Change device count
|
||||
net_linkagg:
|
||||
name: ae0
|
||||
state: down
|
||||
device_count: 2
|
||||
provider: "{{ netconf }}"
|
||||
register: result
|
||||
|
||||
|
@ -116,8 +116,19 @@
|
|||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "'<disable/>' in config.xml"
|
||||
- "'+ disable;' in result.diff.prepared"
|
||||
- "'<device-count>2</device-count>' in config.xml"
|
||||
|
||||
- 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
|
||||
net_linkagg:
|
||||
|
@ -126,6 +137,24 @@
|
|||
provider: "{{ netconf }}"
|
||||
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
|
||||
junos_rpc:
|
||||
rpc: get-configuration
|
||||
|
@ -135,7 +164,36 @@
|
|||
- assert:
|
||||
that:
|
||||
- "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
|
||||
net_linkagg:
|
||||
|
@ -178,3 +236,5 @@
|
|||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- debug: msg="END net_linkagg junos/basic.yaml"
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
name: bond0
|
||||
state: absent
|
||||
|
||||
- name: Remove linkagg
|
||||
net_linkagg:
|
||||
name: bond1
|
||||
state: absent
|
||||
|
||||
- name: Create linkagg
|
||||
net_linkagg:
|
||||
name: bond0
|
||||
members:
|
||||
- eth1
|
||||
- eth2
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -18,14 +22,12 @@
|
|||
- 'result.changed == true'
|
||||
- '"set interfaces bonding bond0 mode 802.3ad" 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)
|
||||
net_linkagg:
|
||||
name: bond0
|
||||
members:
|
||||
- eth1
|
||||
- eth2
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -37,20 +39,20 @@
|
|||
net_linkagg:
|
||||
name: bond0
|
||||
members:
|
||||
- eth3
|
||||
- eth2
|
||||
state: present
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '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)
|
||||
net_linkagg:
|
||||
name: bond0
|
||||
members:
|
||||
- eth3
|
||||
- eth2
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -111,7 +113,6 @@
|
|||
- 'result.changed == true'
|
||||
- '"delete interfaces ethernet eth1 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'
|
||||
|
||||
- name: Remove linkagg again (idempotent)
|
||||
|
@ -127,8 +128,8 @@
|
|||
- name: Create collection of linkagg definitions
|
||||
net_linkagg:
|
||||
aggregate:
|
||||
- { name: bond0, members: [eth1, eth2] }
|
||||
- { name: bond1, members: [eth3, eth4] }
|
||||
- { name: bond0, members: [eth1] }
|
||||
- { name: bond1, members: [eth2] }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -137,16 +138,14 @@
|
|||
- 'result.changed == true'
|
||||
- '"set interfaces bonding bond0 mode 802.3ad" 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 ethernet eth3 bond-group bond1" in result.commands'
|
||||
- '"set interfaces ethernet eth4 bond-group bond1" in result.commands'
|
||||
- '"set interfaces ethernet eth2 bond-group bond1" in result.commands'
|
||||
|
||||
- name: Create collection of linkagg definitions again (idempotent)
|
||||
net_linkagg:
|
||||
aggregate:
|
||||
- { name: bond0, members: [eth1, eth2] }
|
||||
- { name: bond1, members: [eth3, eth4] }
|
||||
- { name: bond0, members: [eth1] }
|
||||
- { name: bond1, members: [eth2] }
|
||||
state: present
|
||||
register: result
|
||||
|
||||
|
@ -157,8 +156,8 @@
|
|||
- name: Remove collection of linkagg definitions
|
||||
net_linkagg:
|
||||
aggregate:
|
||||
- { name: bond0 }
|
||||
- { name: bond1 }
|
||||
- name: bond0
|
||||
- name: bond1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
@ -166,17 +165,15 @@
|
|||
that:
|
||||
- 'result.changed == true'
|
||||
- '"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 ethernet eth1 bond-group" in result.commands'
|
||||
- '"delete interfaces ethernet eth2 bond-group" in result.commands'
|
||||
- '"delete interfaces bonding bond1" in result.commands'
|
||||
|
||||
- name: Remove collection of linkagg definitions again (idempotent)
|
||||
net_linkagg:
|
||||
aggregate:
|
||||
- { name: bond0 }
|
||||
- { name: bond1 }
|
||||
- name: bond0
|
||||
- name: bond1
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
|
|
@ -30,6 +30,32 @@
|
|||
that:
|
||||
- "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
|
||||
net_lldp_interface:
|
||||
name: ge-0/0/5
|
||||
|
@ -52,7 +78,7 @@
|
|||
- assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- result.diff.prepared | search("\+ *disable")
|
||||
- result.diff.prepared | search("\- *disable")
|
||||
|
||||
- name: Delete lldp on particular interface
|
||||
net_lldp_interface:
|
||||
|
@ -76,3 +102,5 @@
|
|||
- assert:
|
||||
that:
|
||||
- "result.changed == false"
|
||||
|
||||
- debug: msg="END net_lldp_interface junos/basic.yaml"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.chaned == true'
|
||||
- 'result.changed == true'
|
||||
- '"logging host 172.16.0.1" in result.commands'
|
||||
- '"logging facility local7" in result.commands'
|
||||
|
||||
|
|
Loading…
Reference in a new issue