1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/junos_interface/tests/netconf/basic.yaml
Ganesh Nalawade 879acf378d junos implementation of net_lldp (#26872)
*  junos_lldp module
*  junos_lldp integration test
*  net_lldp integration test for junos
*  Other minor changes
2017-07-17 07:14:09 +05:30

174 lines
3.8 KiB
YAML

---
- debug: msg="START junos_interface netconf/basic.yaml"
- name: setup - remove interface
junos_interface:
name: ge-0/0/1
description: test-interface
state: absent
provider: "{{ netconf }}"
- name: Create interface
junos_interface:
name: ge-0/0/1
description: test-interface
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>ge-0/0/1</name>' in config.xml"
- "'<description>test-interface</description>' in config.xml"
- name: Create interface (idempotent)
junos_interface:
name: ge-0/0/1
description: test-interface
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Deactivate interface configuration
junos_interface:
name: ge-0/0/1
description: test-interface
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"
- "'<interface inactive=\"inactive\">' in config.xml"
- "'<name>ge-0/0/1</name>' in config.xml"
- name: Activate interface configuration
junos_interface:
name: ge-0/0/1
description: test-interface
state: present
active: True
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<interface>' in config.xml"
- "'<name>ge-0/0/1</name>' in config.xml"
- name: Configure interface attributes
junos_interface:
name: ge-0/0/1
description: test-interface
state: present
speed: 1g
mtu: 256
duplex: full
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<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"
- name: Disable interface
junos_interface:
name: ge-0/0/1
description: test-interface
state: down
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<disable/>' in config.xml"
- "'<name>ge-0/0/1</name>' in config.xml"
- name: Enable interface
junos_interface:
name: ge-0/0/1
description: test-interface
state: up
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'[edit interfaces ge-0/0/1]\n- disable;' in result.diff.prepared"
- "'<name>ge-0/0/1</name>' in config.xml"
- name: Delete interface
junos_interface:
name: ge-0/0/1
description: test-interface
state: absent
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<name>ge-0/0/1</name>' not in config.xml"