Refactor junos modules to Use netconf and cliconf plugins (#32621)

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin

* Fix junos integration test fixes as per connection refactor (#33050)

Refactor netconf connection plugin to work with netconf plugin
Fix CI failure
Fix unit test failure
Fix review comments
This commit is contained in:
Ganesh Nalawade 2017-11-24 12:04:47 +05:30 committed by GitHub
commit 3d63ecb6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 543 additions and 320 deletions

View file

@ -29,4 +29,33 @@
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for single command with cli transport
junos_command:
commands: ['show version | display json']
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for multiple commands with cli transport
junos_command:
commands:
- show version
- show route
format: json
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_json/output.yaml"

View file

@ -29,4 +29,34 @@
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for single command with cli transport
junos_command:
commands: show version
display: text
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for multiple commands with cli transport
junos_command:
commands:
- show version
- show route
display: text
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_text/output.yaml"

View file

@ -29,4 +29,33 @@
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for single command with cli transport
junos_command:
commands: show version | display xml
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- name: get output for multiple commands with cli transport
junos_command:
commands:
- show version
- show route
display: xml
provider:
transport: cli
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout_lines is defined"
- debug: msg="END netconf_xml/output.yaml"

View file

@ -87,6 +87,13 @@
that:
- "result.changed == false"
- "'{{ inventory_hostname_short }}' == '{{ result['ansible_facts']['ansible_net_config']['configuration'][0]['system'][0]['host-name'][0]['data'] }}' "
when: ansible_net_version == "15.1X49-D15.4"
- assert:
that:
- "result.changed == false"
- "'{{ inventory_hostname_short }}' == '{{ result['ansible_facts']['ansible_net_config']['configuration']['system']['host-name'] }}' "
when: ansible_net_version == "17.3R1.10"
- name: Collect config facts from device in text format
junos_facts:

View file

@ -9,17 +9,22 @@
- name: Define interface name for vSRX
set_fact:
name: pp0
intf_name: pp0
when: result['ansible_facts']['ansible_net_model'] | search("vSRX*")
- name: Define interface name for vsrx
set_fact:
intf_name: pp0
when: result['ansible_facts']['ansible_net_model'] | search("vsrx")
- name: Define interface name for vQFX
set_fact:
name: gr-0/0/0
intf_name: gr-0/0/0
when: result['ansible_facts']['ansible_net_model'] | search("vqfx*")
- name: Check intent arguments
junos_interface:
name: "{{ name }}"
name: "{{ intf_name }}"
state: up
tx_rate: ge(0)
rx_rate: le(0)
@ -32,7 +37,7 @@
- name: Check intent arguments (failed condition)
junos_interface:
name: "{{ name }}"
name: "{{ intf_name }}"
state: down
tx_rate: gt(0)
rx_rate: lt(0)
@ -49,7 +54,7 @@
- name: Config + intent
junos_interface:
name: "{{ name }}"
name: "{{ intf_name }}"
enabled: False
state: down
provider: "{{ netconf }}"
@ -62,7 +67,7 @@
- name: Config + intent (fail)
junos_interface:
name: "{{ name }}"
name: "{{ intf_name }}"
enabled: False
state: up
provider: "{{ netconf }}"
@ -77,7 +82,7 @@
- name: Aggregate config + intent (pass)
junos_interface:
aggregate:
- name: "{{ name }}"
- name: "{{ intf_name }}"
enabled: True
state: up
provider: "{{ netconf }}"