d3e5d30f7c
* Add aggregate for junos modules and sub spec validation * aggregate support of junos modules * aggregate sub spec validation * relevant changes to junos integration test * junos module boilerplate changes * Add new boilerplate for junos modules * Fix CI issues
260 lines
7.1 KiB
YAML
260 lines
7.1 KiB
YAML
---
|
|
- debug: msg="START junos_l3_interface netconf/basic.yaml"
|
|
|
|
- name: setup - remove interface address
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
|
|
- name: Configure interface address
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: present
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<name>1.1.1.1/32</name>' in config.xml"
|
|
- "'<name>fd5d:12c9:2201:1::1/128</name>' in config.xml"
|
|
- result.diff.prepared | search("\+ *address 1.1.1.1/32")
|
|
- result.diff.prepared | search("\+ *address fd5d:12c9:2201:1::1/128")
|
|
|
|
- name: Configure interface address (idempotent)
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: present
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: Deactivate interface address
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: present
|
|
active: False
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<address inactive=\"inactive\">' in config.xml"
|
|
- result.diff.prepared | search("! *inactive[:] address 1.1.1.1/32")
|
|
- result.diff.prepared | search("! *inactive[:] address fd5d:12c9:2201:1::1/128")
|
|
|
|
- name: Activate interface address
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: present
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- result.diff.prepared | search("! *active[:] address 1.1.1.1/32")
|
|
- result.diff.prepared | search("! *active[:] address fd5d:12c9:2201:1::1/128")
|
|
|
|
- name: Delete interface address
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result.diff.prepared | search("\- *address 1.1.1.1/32")
|
|
- result.diff.prepared | search("\- *address fd5d:12c9:2201:1::1/128")
|
|
|
|
- name: Delete interface address (idempotent)
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: Aggregate setup- delete interface ge-0/0/1
|
|
junos_l3_interface:
|
|
name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Aggregate setup- delete interface ge-0/0/2
|
|
junos_l3_interface:
|
|
name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Configure l3 interface in aggregate
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared"
|
|
- result.diff.prepared | search("\+ *address 1.1.1.1/32")
|
|
- "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared"
|
|
- result.diff.prepared | search("\+ *address fd5d:12c9:2201:1::1/128")
|
|
- "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared"
|
|
- result.diff.prepared | search("\+ *address 2.2.2.2/32")
|
|
- "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared"
|
|
- result.diff.prepared | search("\+ *address fd5d:12c9:2201:2::2/128")
|
|
|
|
- name: Configure l3 interface in aggregate (idempotent)
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
active: True
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
- name: Deactivate l3 interface configuration
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
active: False
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
active: False
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- result.diff.prepared | search("! *inactive[:] address 1.1.1.1/32")
|
|
- result.diff.prepared | search("! *inactive[:] address fd5d:12c9:2201:1::1/128")
|
|
- result.diff.prepared | search("! *inactive[:] address 2.2.2.2/32")
|
|
- result.diff.prepared | search("! *inactive[:] address fd5d:12c9:2201:2::2/128")
|
|
|
|
- name: Activate l3 interface configuration
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
active: True
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- result.diff.prepared | search("! *active[:] address 1.1.1.1/32")
|
|
- result.diff.prepared | search("! *active[:] address fd5d:12c9:2201:1::1/128")
|
|
- result.diff.prepared | search("! *active[:] address 2.2.2.2/32")
|
|
- result.diff.prepared | search("! *active[:] address fd5d:12c9:2201:2::2/128")
|
|
|
|
- name: Delete l3 interface configuration
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared"
|
|
- result.diff.prepared | search("\- *address 1.1.1.1/32")
|
|
- "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared"
|
|
- result.diff.prepared | search("\- *address fd5d:12c9:2201:1::1/128")
|
|
- "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared"
|
|
- result.diff.prepared | search("\- *address 2.2.2.2/32")
|
|
- "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared"
|
|
- result.diff.prepared | search("\- *address fd5d:12c9:2201:2::2/128")
|
|
|
|
- name: Delete l3 interface configuration (idempotent)
|
|
junos_l3_interface:
|
|
aggregate:
|
|
- name: ge-0/0/1
|
|
ipv4: 1.1.1.1
|
|
ipv6: fd5d:12c9:2201:1::1
|
|
state: absent
|
|
- name: ge-0/0/2
|
|
ipv4: 2.2.2.2
|
|
ipv6: fd5d:12c9:2201:2::2
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|