2017-06-16 18:42:50 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START net_interface junos/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Create interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
2017-06-16 18:42:50 +02:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>ge-0/0/1</name>' in config.xml"
|
|
|
|
- "'<description>test-interface</description>' in config.xml"
|
2017-06-16 18:42:50 +02:00
|
|
|
|
|
|
|
- name: Create interface (idempotent)
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Configure interface attributes
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: present
|
|
|
|
speed: 1g
|
|
|
|
mtu: 256
|
|
|
|
duplex: full
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-16 18:42:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>ge-0/0/1</name>' in config.xml"
|
|
|
|
- "'<link-mode>full-duplex</link-mode>' in config.xml"
|
|
|
|
- "'<mtu>256</mtu>' in config.xml"
|
|
|
|
- "'<speed>1g</speed>' in config.xml"
|
|
|
|
- "'<description>test-interface</description>' in config.xml"
|
2017-06-16 18:42:50 +02:00
|
|
|
|
|
|
|
- name: Disable interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
2017-06-29 06:48:35 +02:00
|
|
|
state: down
|
2017-06-16 18:42:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-16 18:42:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<disable/>' in config.xml"
|
|
|
|
- "'<name>ge-0/0/1</name>' in config.xml"
|
2017-06-16 18:42:50 +02:00
|
|
|
|
|
|
|
- name: Enable interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
2017-06-29 06:48:35 +02:00
|
|
|
state: up
|
2017-06-16 18:42:50 +02:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-16 18:42:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<disable/>' not in config.xml"
|
|
|
|
- "'<name>ge-0/0/1</name>' in config.xml"
|
2017-06-16 18:42:50 +02:00
|
|
|
|
|
|
|
- name: Delete interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
2017-06-29 06:48:35 +02:00
|
|
|
- name: Get running configuration
|
|
|
|
junos_rpc:
|
|
|
|
rpc: get-configuration
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: config
|
|
|
|
|
2017-06-16 18:42:50 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-29 06:48:35 +02:00
|
|
|
- "'<name>ge-0/0/1</name>' not in config.xml"
|