Add NETCONF support for SROS devices (#40330)

* added NETCONF support for SROS devices

* corrected alu mapping

* fix pep8 in sros.py

* BOT META file updated
This commit is contained in:
wiso
2018-05-24 12:14:39 +02:00
committed by Ganesh Nalawade
parent 387a23c3d1
commit 160bf82544
8 changed files with 185 additions and 1 deletions

View File

@@ -2,3 +2,4 @@
dependencies:
- { role: prepare_junos_tests, when: ansible_network_os == 'junos' }
- { role: prepare_iosxr_tests, when: ansible_network_os == 'iosxr' }
- { role: prepare_sros_tests, when: ansible_network_os == 'sros' }

View File

@@ -1,3 +1,4 @@
---
- { include: junos.yaml, when: ansible_network_os == 'junos', tags: ['netconf'] }
- { include: iosxr.yaml, when: ansible_network_os == 'iosxr', tags: ['netconf'] }
- { include: sros.yaml, when: ansible_network_os == 'sros', tags: ['netconf'] }

View File

@@ -0,0 +1,16 @@
---
- name: collect all netconf test cases
find:
paths: "{{ role_path }}/tests/sros"
patterns: "{{ testcase }}.yaml"
register: test_cases
connection: local
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case (connection=netconf)
include: "{{ test_case_to_run }} ansible_connection=netconf"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View File

@@ -0,0 +1,56 @@
---
- debug: msg="START netconf_get sros/basic.yaml on connection={{ ansible_connection }}"
- name: Get complete configuration data (SROS)
netconf_get:
filter: <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"/>
register: result
- assert:
that:
- "'urn:nokia.com:sros:ns:yang:sr:conf' in result.stdout"
- "'urn:nokia.com:sros:ns:yang:sr:state' not in result.stdout"
- name: Get complete state data (SROS)
netconf_get:
filter: <state xmlns="urn:nokia.com:sros:ns:yang:sr:state"/>
register: result
- assert:
that:
- "'urn:nokia.com:sros:ns:yang:sr:state' in result.stdout"
- "'urn:nokia.com:sros:ns:yang:sr:conf' not in result.stdout"
- name: Get service configuration data from candidate datastore (SROS)
netconf_get:
source: candidate
filter: <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"><service/></configure>
display: json
register: result
- assert:
that:
- "'<service>' in result.stdout"
- name: Get system configuration data from running datastore (SROS)
netconf_get:
source: running
filter: <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"><system/></configure>
register: result
- assert:
that:
- "'<system>' in result.stdout"
- name: Get complete configuration and state data (SROS)
netconf_get:
register: result
- assert:
that:
- "'<service>' in result.stdout"
- "'<system>' in result.stdout"
- "'urn:nokia.com:sros:ns:yang:sr:conf' in result.stdout"
- "'urn:nokia.com:sros:ns:yang:sr:state' in result.stdout"
- debug: msg="END netconf_get sros/basic.yaml on connection={{ ansible_connection }}"

View File

@@ -0,0 +1,6 @@
---
- debug: msg="START prepare_sros_tests/main.yaml"
- name: wait until everything is ready to go
pause:
seconds: 1