summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan <dan.murarasu@gmail.com>2018-09-25 12:09:22 +0100
committerTrishna Guha <trishnaguha17@gmail.com>2018-09-25 16:39:22 +0530
commitf20938788aaa623e1574e7c68128812ca1156152 (patch)
tree36c5e18c56a88210b228b8da632503ea794a65cb
parentc11c3506cd997c32c04297328306909772b6aa78 (diff)
downloadansible-f20938788aaa623e1574e7c68128812ca1156152.tar.gz
fixed nxos_aaa_server_host issue with type 7 encrypt key (#46015)
* fixed nxos_aaa_server_host issue with type 7 encrypt and added test cases * added idempotence tests
-rw-r--r--lib/ansible/modules/network/nxos/nxos_aaa_server_host.py2
-rw-r--r--test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml24
-rw-r--r--test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml23
3 files changed, 49 insertions, 0 deletions
diff --git a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py
index 0c1d6bc6f4..c1a84814b6 100644
--- a/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py
+++ b/lib/ansible/modules/network/nxos/nxos_aaa_server_host.py
@@ -309,6 +309,8 @@ def main():
delta = proposed
else:
for key, value in proposed.items():
+ if key == 'encrypt_type':
+ delta[key] = value
if value != existing.get(key):
if value != 'default' or existing.get(key):
delta[key] = value
diff --git a/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml b/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml
index c00a43a4b1..1f73efde1b 100644
--- a/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml
+++ b/test/integration/targets/nxos_aaa_server_host/tests/common/radius.yaml
@@ -130,6 +130,30 @@
- assert: *false
+ - name: "Configure radius server with new type 7 encryption key"
+ nxos_aaa_server_host: &configure_radius_new_type7
+ server_type: radius
+ address: 8.8.8.8
+ host_timeout: 25
+ auth_port: 2083
+ acct_port: 2084
+ encrypt_type: 7
+ key: helloback
+ provider: "{{ connection }}"
+ state: present
+ register: result
+
+ - assert:
+ that:
+ - "result.changed == true"
+ - "'key 7' in result.updates[0]"
+
+ - name: "Check Idempotence"
+ nxos_aaa_server_host: *configure_radius_new_type7
+ register: result
+
+ - assert: *false
+
- name: "Configure radius server with default key"
nxos_aaa_server_host: &configure_radius_defkey
server_type: radius
diff --git a/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml b/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml
index c5ca89785a..d493fe19ca 100644
--- a/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml
+++ b/test/integration/targets/nxos_aaa_server_host/tests/common/tacacs.yaml
@@ -133,6 +133,29 @@
- assert: *false
+ - name: "Configure tacacs server with new type 7 encryption key"
+ nxos_aaa_server_host: &configure_tacacs_new_type7
+ server_type: tacacs
+ address: 8.8.8.8
+ host_timeout: 25
+ tacacs_port: 89
+ encrypt_type: 7
+ key: helloback
+ provider: "{{ connection }}"
+ state: present
+ register: result
+
+ - assert:
+ that:
+ - "result.changed == true"
+ - "'key 7' in result.updates[0]"
+
+ - name: "Check Idempotence"
+ nxos_aaa_server_host: *configure_tacacs_new_type7
+ register: result
+
+ - assert: *false
+
- name: "Configure tacacs server with default key"
nxos_aaa_server_host: &configure_tacacs_defkey
server_type: tacacs