7f5d1ab2b7
* Eh, 2.10 is close enough * drop top-level authorize * Remove from documentation * Remove load_params * Centralize this junos thing * Fixup user modules * I'm 95% sure this did not do what it was supposed to * nxos_hsrp: I don't think this is an actual module parameter * Try to fix junos_package tests * Move local params to provider * Promote 'timeout' to a real parameter for eos_eapi * Don't assume provider exists? * move another timeout * Provider now always has auth_pass * Fix junos tests to avoid NameErrors
282 lines
6.9 KiB
YAML
282 lines
6.9 KiB
YAML
---
|
|
|
|
- name: setup - remove vlans used in test
|
|
eos_config:
|
|
lines:
|
|
- no vlan 4000
|
|
- no vlan 4001
|
|
- no vlan 4002
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
|
|
- name: setup - remove switchport settings on interface Ethernet1 used in test
|
|
eos_config:
|
|
lines:
|
|
- switchport
|
|
- no switchport access vlan 4000
|
|
parents: interface Ethernet1
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
|
|
- name: setup - remove switchport settings on interface Ethernet2 used in test
|
|
eos_config:
|
|
lines:
|
|
- switchport
|
|
- no switchport access vlan 4000
|
|
parents: interface Ethernet2
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
|
|
- name: Create vlan
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
name: vlan-4000
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'vlan 4000' in result.commands"
|
|
- "'name vlan-4000' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Create vlan again (idempotent)
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
name: vlan-4000
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "result.session_name is not defined"
|
|
|
|
- name: Change vlan name and state
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
name: vlan-4000-new
|
|
state: suspend
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'vlan 4000' in result.commands"
|
|
- "'name vlan-4000-new' in result.commands"
|
|
- "'state suspend' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Change vlan name and state again (idempotent)
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
name: vlan-4000-new
|
|
state: suspend
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "result.session_name is not defined"
|
|
|
|
- name: Unsuspend vlan
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
state: active
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'vlan 4000' in result.commands"
|
|
- "'state active' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Add interfaces to vlan and check state
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
state: present
|
|
interfaces:
|
|
- Ethernet1
|
|
- Ethernet2
|
|
associated_interfaces:
|
|
- Ethernet1
|
|
- Ethernet2
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'vlan 4000' in result.commands"
|
|
- "'interface Ethernet1' in result.commands"
|
|
- "'switchport access vlan 4000' in result.commands"
|
|
- "'interface Ethernet2' in result.commands"
|
|
- "'switchport access vlan 4000' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Add interfaces to vlan again (idempotent)
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
state: present
|
|
interfaces:
|
|
- Ethernet 1 # interface name space scenario
|
|
- Ethernet 2 # interface name space scenario
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# 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
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
ignore_errors: yes
|
|
|
|
- assert:
|
|
that:
|
|
- "result.failed == True"
|
|
|
|
- name: Remove interface from vlan
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
state: present
|
|
interfaces:
|
|
- Ethernet1
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'vlan 4000' in result.commands"
|
|
- "'interface Ethernet2' in result.commands"
|
|
- "'no switchport access vlan 4000' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Remove interface from vlan again (idempotent)
|
|
eos_vlan:
|
|
vlan_id: 4000
|
|
state: present
|
|
interfaces:
|
|
- Ethernet 1 # space scenario
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "result.session_name is not defined"
|
|
|
|
- name: Create aggregate of vlans
|
|
eos_vlan:
|
|
aggregate:
|
|
- {vlan_id: 4000, state: absent}
|
|
- {vlan_id: 4001, name: vlan-4001}
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'no vlan 4000' in result.commands"
|
|
- "'vlan 4001' in result.commands"
|
|
- "'name vlan-4001' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Create aggregate of vlans again (idempotent)
|
|
eos_vlan:
|
|
aggregate:
|
|
- {vlan_id: 4000, state: absent}
|
|
- {vlan_id: 4001, name: vlan-4001}
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "result.session_name is not defined"
|
|
|
|
- name: Create vlan with purge
|
|
eos_vlan:
|
|
aggregate:
|
|
- {vlan_id: 4002, name: vlan-4002}
|
|
name: vlan-4002
|
|
state: present
|
|
purge: yes
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'no vlan 4001' in result.commands"
|
|
- "'vlan 4002' in result.commands"
|
|
- "'name vlan-4002' in result.commands"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
- name: Create vlan with purge
|
|
eos_vlan:
|
|
aggregate:
|
|
- {vlan_id: 4002, name: vlan-4002}
|
|
name: vlan-4002
|
|
state: present
|
|
purge: yes
|
|
provider: "{{ cli }}"
|
|
become: yes
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands | length == 0"
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
- "result.session_name is not defined"
|
|
# FIXME add in tests for everything defined in docs
|
|
# FIXME Test state:absent + test:
|
|
# FIXME Without powers ensure "privileged mode required"
|