2017-07-15 07:08:44 +00:00
|
|
|
---
|
|
|
|
- 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"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\+ *address 1.1.1.1/32")
|
|
|
|
- result.diff.prepared | search("\+ *address fd5d:12c9:2201:1::1/128")
|
2017-07-15 07:08:44 +00:00
|
|
|
|
|
|
|
- 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"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *inactive[:] address 1.1.1.1/32")
|
|
|
|
- result.diff.prepared | search("! *inactive[:] address fd5d:12c9:2201:1::1/128")
|
2017-07-15 07:08:44 +00:00
|
|
|
|
|
|
|
- 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"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *active[:] address 1.1.1.1/32")
|
|
|
|
- result.diff.prepared | search("! *active[:] address fd5d:12c9:2201:1::1/128")
|
2017-07-15 07:08:44 +00:00
|
|
|
|
|
|
|
- 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:
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\- *address 1.1.1.1/32")
|
|
|
|
- result.diff.prepared | search("\- *address fd5d:12c9:2201:1::1/128")
|
2017-07-15 07:08:44 +00:00
|
|
|
|
|
|
|
- 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"
|