-
Couldn't load subscription status.
- Fork 167
ansible-test network-integration for junos_facts #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1ce6176
d96f585
92d44ec
a383b55
0d93f1b
33263b0
88859f4
cc760aa
83400dd
24e7bf5
8ccff0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
|
|
||
| ### | ||
| # 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you load "netconf ssh" as pre-check validation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not supported |
||
| with_inventory_hostnames: junos | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add PyEZ connection.
There was a problem hiding this comment.
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