1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/nxos_nxapi/tests/cli/configure.yaml
tstoner 2c3d418e53 Nxapi ssl (#42905)
* NXAPI ssl ciphers & protocols default values

* TLSv1, TLSv1.1, TLSv1.2 and weak cipher support

* NXOS NXAPI weak/strong cipher & TLSv 1.2, 1.1 & 1.0 support

* Version checking for strong/weak ciphers & TLS 1.2, 1.1 & 1.0 support

* Cleaned up erroneously committed changes.

* Specific NXOS platform checking for nxapi ssl ciphers & protocols

* Fixed ansibot reported errors.

* Resolved ansibot reported error.

* Added network_os_version to mocked up N7K unit test device_info

* Calling get_capabilities() once in main and passing results into methods.

* Removed raising exceptions when platform capabilities return None
per reviewers request. Skipping nxapi ssl options when capabilities
are None and generating a warning when these options are skipped

* Cleaned up explicit checks for None/not None
2018-07-27 22:10:39 +05:30

141 lines
4.1 KiB
YAML

---
- debug: msg="START cli/configure.yaml"
- set_fact: nxapi_sandbox_option="yes"
when: platform is search('N7K')
- name: Setup - put NXAPI in stopped state
nxos_nxapi:
state: absent
- block:
- name: Configure NXAPI HTTPS
nxos_nxapi: &configure_https
enable_http: no
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: yes
https_port: 9443
register: result
- nxos_command:
commands:
- show nxapi | json
register: result
- include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes_https.yaml
when: platform is match('N7K')
- include: targets/nxos_nxapi/tasks/platform/n5k/assert_changes_https.yaml
when: platform is match('N5K')
- include: targets/nxos_nxapi/tasks/platform/default/assert_changes_https.yaml
when: not ( platform is search('N7K')) and not (platform is search('N5K')) and not (platform is search('N35'))
- name: Configure NXAPI HTTPS again
nxos_nxapi: *configure_https
register: result
- name: Assert configuration is idempotent
assert: &assert_false
that:
- result.changed == false
- name: Configure NXAPI HTTPS & HTTP
nxos_nxapi: &configure_https_http
enable_http: yes
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: yes
https_port: 9443
register: result
- nxos_command:
commands:
- show nxapi | json
register: result
- include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes_https_http.yaml
when: platform is match('N7K')
- include: targets/nxos_nxapi/tasks/platform/n5k/assert_changes_https_http.yaml
when: platform is match('N5K')
- include: targets/nxos_nxapi/tasks/platform/default/assert_changes_https_http.yaml
when: not ( platform is search('N7K')) and not (platform is search('N5K')) and not (platform is search('N35'))
- name: Configure NXAPI HTTPS & HTTP again
nxos_nxapi: *configure_https_http
register: result
- name: Assert configuration is idempotent
assert: *assert_false
- name: Configure different NXAPI HTTPS & HTTP ports
nxos_nxapi: &configure_https_http_ports
enable_http: yes
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: yes
http_port: 99
https_port: 500
register: result
- nxos_command:
commands:
- show nxapi | json
register: result
- include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes_https_http_ports.yaml
when: platform is match('N7K')
- include: targets/nxos_nxapi/tasks/platform/n5k/assert_changes_https_http_ports.yaml
when: platform is match('N5K')
- include: targets/nxos_nxapi/tasks/platform/default/assert_changes_https_http_ports.yaml
when: not ( platform is search('N7K')) and not (platform is search('N5K')) and not (platform is search('N35'))
- name: Configure different NXAPI HTTPS & HTTP ports again
nxos_nxapi: *configure_https_http_ports
register: result
- name: Assert configuration is idempotent
assert: *assert_false
- name: Configure NXAPI HTTP
nxos_nxapi: &configure_http
enable_http: yes
enable_sandbox: "{{nxapi_sandbox_option|default(omit)}}"
enable_https: no
register: result
- nxos_command:
commands:
- show nxapi | json
register: result
- include: targets/nxos_nxapi/tasks/platform/n7k/assert_changes_http.yaml
when: platform is match('N7K')
- include: targets/nxos_nxapi/tasks/platform/n5k/assert_changes_http.yaml
when: platform is match('N5K')
- include: targets/nxos_nxapi/tasks/platform/default/assert_changes_http.yaml
when: not ( platform is search('N7K')) and not (platform is search('N5K')) and not (platform is search('N35'))
- name: Configure NXAPI HTTP again
nxos_nxapi: *configure_http
register: result
- name: Assert configuration is idempotent
assert: *assert_false
always:
- name: Cleanup - Disable NXAPI
nxos_nxapi:
state: absent
register: result
- name: Cleanup - Re-enable NXAPI
nxos_nxapi:
state: present
register: result
- debug: msg="END cli/configure.yaml"