ansible/test/integration/targets/netconf_get/tests/junos/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

126 lines
3.1 KiB
YAML

---
- debug: msg="START netconf_get junos/basic.yaml on connection={{ ansible_connection }}"
- name: Configure syslog file - setup
junos_config:
lines:
- set system syslog file test1 any any
register: result
- name: Get system configuration data from running datastore state
netconf_get:
source: running
filter: <configuration><system><syslog></syslog></system></configuration>
register: result
- assert:
that:
- "'<name>test1</name>' in result.stdout"
- "'<name>any</name>' in result.stdout"
- "'<any/>' in result.stdout"
- "'<login>' not in result.stdout"
- "'<interface>' not in result.stdout"
- name: Failure scenario, fetch config from startup
netconf_get:
source: startup
register: result
ignore_errors: True
- assert:
that:
- "'startup source is not supported' in result.msg"
- name: Failure scenario, fetch config from running with lock
netconf_get:
lock: always
source: running
register: result
ignore_errors: True
- assert:
that:
- "'syntax error' in result.msg"
- name: Get system configuration data from running datastore state and lock if-supported
netconf_get:
source: running
filter: <configuration><system><syslog></syslog></system></configuration>
lock: if-supported
register: result
- assert:
that:
- "'<name>test1</name>' in result.stdout"
- "'<name>any</name>' in result.stdout"
- "'<any/>' in result.stdout"
- "'<login>' not in result.stdout"
- "'<interface>' not in result.stdout"
- name: get configuration and state data in json format
netconf_get:
source: running
display: json
register: result
- assert:
that:
- "{{ result['output']['rpc-reply']['data']['configuration'] is defined}}"
- name: get configuration and state data in xml pretty format
netconf_get:
source: running
display: pretty
register: result
- assert:
that:
- "{{ result['output'] is defined}}"
- name: get configuration data in xml with namespace stripped
netconf_get:
source: running
display: xml
register: result
- assert:
that:
- "{{ result['output'] is defined}}"
- "{{ 'xmlns' not in result.output }}"
- name: get configuration and state data without datastore lock
netconf_get:
lock: never
register: result
- assert:
that:
- "'<database-status-information>' in result.stdout"
- "'</configuration>' in result.stdout"
- name: get configuration and state data and lock data-store if supported
netconf_get:
lock: if-supported
register: result
- assert:
that:
- "'<database-status-information>' in result.stdout"
- "'</configuration>' in result.stdout"
- name: Failure scenario, unsupported filter
netconf_get:
filter: configuration/state
register: result
ignore_errors: True
- assert:
that:
- "'filter value \\'configuration/state\\' of type xpath is not supported' in result.msg"
- name: Configure syslog file - teardown
junos_config:
lines:
- delete system syslog file test1 any any
- debug: msg="END netconf_get junos/basic.yaml on connection={{ ansible_connection }}"