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
|
|
|
|
|
|
|
|
- debug:
|
|
|
|
msg: "{{ result }}"
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<name>ge-0/0/1</name>' in result.rpc"
|
|
|
|
- "'<description>test-interface</description>' in result.rpc"
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<name>ge-0/0/1</name>' in result.rpc"
|
|
|
|
- "'<link-mode>full-duplex</link-mode>' in result.rpc"
|
|
|
|
- "'<mtu>256</mtu>' in result.rpc"
|
|
|
|
- "'<speed>1g</speed>' in result.rpc"
|
|
|
|
- "'<description>test-interface</description>' in result.rpc"
|
|
|
|
|
|
|
|
- name: Disable interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: present
|
|
|
|
enabled: False
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<disable />' in result.rpc"
|
|
|
|
- "'<name>ge-0/0/1</name>' in result.rpc"
|
|
|
|
|
|
|
|
- name: Enable interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: present
|
|
|
|
enabled: True
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'<disable delete=\"delete\" />' in result.rpc"
|
|
|
|
- "'<name>ge-0/0/1</name>' in result.rpc"
|
|
|
|
|
|
|
|
- name: Delete interface
|
|
|
|
net_interface:
|
|
|
|
name: ge-0/0/1
|
|
|
|
description: test-interface
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-06-17 22:02:48 +02:00
|
|
|
- "'<interface delete=\"delete\">' in result.rpc"
|
2017-06-16 18:42:50 +02:00
|
|
|
- "'<name>ge-0/0/1</name>' in result.rpc"
|