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/netconf_get/tests/iosxr/basic.yaml
Ganesh Nalawade 30f992f260
Add netconf_get module (#39869)
* Add netconf_get module

Implements part-1 of proposal #104
https://github.com/ansible/proposals/issues/104

*  Add netconf_get module
*  Refactor `get`, `get_config`, `lock`, `unlock`
   and `discard_changes` netconf plugin api's
*  Add netconf module_utils file which netconf module
   related common functions
*  Refactor junos and iosxr netconf plugins

* Fix source option handling

* Fix review comments

* Update botmeta file

* Update review comments and add support for lock

* Lock update fix

* Fix CI issue

* Add integration test and minor fixes

* Fix review comments

* Fix CI failure

* Fix CI issues

* Fix CI issues

* Fix review comments and update integration test

* Fix review comments

* Fix review comments

* Fix review comments

Fix reveiw comments
2018-05-17 17:38:12 +05:30

163 lines
4.3 KiB
YAML

---
- debug: msg="START netconf_get iosxr/basic.yaml on connection={{ ansible_connection }}"
- name: setup interface
iosxr_config:
commands:
- description this is test interface Loopback999
- no shutdown
parents:
- interface Loopback999
match: none
connection: network_cli
- name: get running interface confiugration with filter
netconf_get:
source: running
filter: <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"></interface-configurations>
register: result
connection: netconf
- assert:
that:
- "'<description>this is test interface Loopback999</description>' in result.stdout"
- "'<usernames>' not in result.stdout"
- name: test lock=never, get-config, running interface confiugration with filter without lock
netconf_get:
source: running
lock: never
filter: <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"></interface-configurations>
register: result
connection: netconf
- assert:
that:
- "'<description>this is test interface Loopback999</description>' in result.stdout"
- "'<usernames>' not in result.stdout"
- name: test lock=if-supported, get-config, running interface confiugration with filter without lock
netconf_get:
source: running
lock: if-supported
filter: <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"></interface-configurations>
register: result
connection: netconf
- assert:
that:
- "'<description>this is test interface Loopback999</description>' in result.stdout"
- "'<usernames>' not in result.stdout"
- name: Failure scenario, get-config information with lock
netconf_get:
source: running
lock: always
register: result
ignore_errors: True
connection: netconf
- assert:
that:
- "'<bad-element>running</bad-element>' in result.msg"
- name: Failure scenario, fetch config from startup
netconf_get:
source: startup
register: result
ignore_errors: True
connection: netconf
- assert:
that:
- "'startup source is not supported' in result.msg"
- name: test get, information from running datastore without lock
netconf_get:
lock: never
filter: <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"></interface-configurations>
register: result
connection: netconf
- assert:
that:
- "'<description>this is test interface Loopback999</description>' in result.stdout"
- name: test get, information from running datastore with lock if supported
netconf_get:
lock: if-supported
filter: <interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg"></interface-configurations>
register: result
connection: netconf
- assert:
that:
- "'<description>this is test interface Loopback999</description>' in result.stdout"
- name: Failure scenario, get information from running with lock
netconf_get:
lock: always
register: result
ignore_errors: True
connection: netconf
- assert:
that:
- "'<bad-element>running</bad-element>' in result.msg"
- name: get configuration and state data in json format
netconf_get:
source: running
display: json
register: result
connection: netconf
- assert:
that:
- "{{ result['output']['rpc-reply']['data']['aaa'] is defined}}"
- name: get configuration data in xml pretty format
netconf_get:
source: running
display: pretty
register: result
connection: netconf
- assert:
that:
- "{{ result['output'] is defined}}"
- name: get configuration data in xml with namespace stripped
netconf_get:
source: running
display: xml
register: result
connection: netconf
- assert:
that:
- "{{ result['output'] is defined}}"
- "{{ 'xmlns' not in result.output }}"
- name: Failure scenario, unsupported filter
netconf_get:
filter: configuration/state
register: result
ignore_errors: True
connection: netconf
- assert:
that:
- "'filter value \\'configuration/state\\' of type xpath is not supported' in result.msg"
- name: setup - teardown
iosxr_config:
commands:
- no description
- shutdown
parents:
- interface Loopback999
match: none
connection: network_cli
- debug: msg="END netconf_get iosxr/basic.yaml on connection={{ ansible_connection }}"