Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This is the configuration template for ansible-test network-integration tests.
#
# You do not need this template if you are:
#
# 1) Running integration tests without using ansible-test.
# 2) Using the `--platform` option to provision temporary network instances on EC2.
#
# If you do not want to use the automatically provisioned temporary network instances,
# fill in the @VAR placeholders below and save this file without the .template extension,
# into the tests/integration directory of the collection you're testing.
#
# NOTE: Automatic provisioning of network instances on EC2 requires an ansible-core-ci API key.
[junos]
local_test ansible_host=x.x.x.x ansible_connection=local ansible_network_os="junos" ansible_user=xyz ansible_ssh_pass=xyz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add PyEZ connection.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the ansible_connection=local


###
# Example
#
# [vyos]
# vyos01.example.net ansible_connection=local ansible_network_os="vyos" ansible_user=admin ansible_ssh_pass=mypassword
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
junos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
testcase: "*"
test_items: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- prepare_junos_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Collect netconf test cases
ansible.builtin.find:
paths: "{{ role_path }}/tests/local"
patterns: "{{ testcase }}.yml"
connection: local
register: test_cases

- name: Set test_items
ansible.builtin.set_fact:
test_items: "{{ test_cases.files | map(attribute='path') | list }}"

- name: Run test case (connection=local)
ansible.builtin.include_tasks: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
vars:
ansible_connection: local
tags:
- local
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Invoke netconf tasks
ansible.builtin.include_tasks: local.yml


- name: Invoke netconf tasks
ansible.builtin.include_tasks: pyez.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: Collect netconf test cases
ansible.builtin.find:
paths: "{{ role_path }}/tests/pyez"
patterns: "{{ testcase }}.yml"
connection: local
register: test_cases

- name: Set test_items
ansible.builtin.set_fact:
test_items: "{{ test_cases.files | map(attribute='path') | list }}"

- name: Run test case (connection=juniper.device.pyez)
ansible.builtin.include_tasks: "{{ test_case_to_run }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
vars:
ansible_connection: juniper.device.pyez
tags:
- pyez
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: TEST 1 - Gather Facts
juniper.device.facts:
ignore_errors: true
register: test1

- name: Check TEST 1
ansible.builtin.assert:
that:
- test1.facts.hostname
- test1.facts.serialnumber
- test1.facts.model
- test1.facts.fqdn

- name: TEST 2 - get facts in xml format
juniper.device.facts:
config_format: xml
register: test2

- name: Check TEST 2
ansible.builtin.assert:
that:
- "'<configuration' in test2.facts.config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: TEST 1 - Gather Facts
juniper.device.facts:
ignore_errors: true
register: test1

- name: Check TEST 1
ansible.builtin.assert:
that:
- test1.facts.hostname
- test1.facts.serialnumber
- test1.facts.model
- test1.facts.fqdn

- name: TEST 2 - get facts in xml format
juniper.device.facts:
config_format: xml
register: test2

- name: Check TEST 2
ansible.builtin.assert:
that:
- "'<configuration' in test2.facts.config"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
allow_duplicates: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Run the prepare steps if requested
ansible.builtin.include_tasks: prepare.yml
when: prepare_junos_tests_task | default(True) | bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Debug task
ansible.builtin.debug:
msg: "START prepare_junos_tests/main.yaml"

- name: Wait for netconf server to come up
delegate_to: localhost
tags: netconf
ansible.builtin.wait_for:
host: "{{ hostvars[item].ansible_host }}"
port: 830
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you load "netconf ssh" as pre-check validation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not supported
fatal: [junos_test]: FAILED! => {"msg": "to use the 'ssh' connection type with passwords or pkcs11_provider, you must install the sshpass program"}

with_inventory_hostnames: junos