cherry-pick stable-2.5 (#40177)

* Fix nxos terminal plugin regex (#39659)

Fix nxos terminal plugin regex to match
command prompt without newline character as prefix

(cherry picked from commit 0ac222d68b)

* remove purge from nxos_logging doc, argspec (#39947)

* remove purge from nxos_logging doc, argspec

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* shippable

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit f1103a7a02)

* IT cases for nxos_logging (#39929)

* IT cases for nxos_logging

* review comment

(cherry picked from commit 2557c0662a)

* fix nxos_ping issues (#40028)

(cherry picked from commit 6fac574f17)

* Fix vxlan_vtep_vni tests (#39968)

(cherry picked from commit 0407c51447)

* ios cliconf plugin fix regex for version (#40066)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 5cf61d7401)

* update changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* shippable

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
pull/40221/head
Trishna Guha 7 years ago committed by GitHub
parent f6cbb45b39
commit 299047d963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ios cliconf plugin fix regex for version (https://github.com/ansible/ansible/pull/40066)

@ -29,3 +29,6 @@ bugfixes:
- nxos_snmp_traps - Fix nxos_snmp_traps issues (https://github.com/ansible/ansible/pull/39444) - nxos_snmp_traps - Fix nxos_snmp_traps issues (https://github.com/ansible/ansible/pull/39444)
- nxos_linkagg - nxos_linkagg abbreviated form issue (https://github.com/ansible/ansible/pull/39591) - nxos_linkagg - nxos_linkagg abbreviated form issue (https://github.com/ansible/ansible/pull/39591)
- nxos_snmp_user - Fix nxos_snmp_user (https://github.com/ansible/ansible/pull/39760) - nxos_snmp_user - Fix nxos_snmp_user (https://github.com/ansible/ansible/pull/39760)
- nxos_logging - remove purge from nxos_logging doc, argspec (https://github.com/ansible/ansible/pull/39947)
- nxos_ping - Fix nxos_ping issues (https://github.com/ansible/ansible/pull/40028)
- nxos_vxlan_vtep_vni - Fix nxos_vxlan_vtep_vni test (https://github.com/ansible/ansible/pull/39968)

@ -0,0 +1,2 @@
bugfixes:
- Fix nxos terminal plugin regex (https://github.com/ansible/ansible/pull/39659)

@ -52,10 +52,6 @@ options:
- Set logging serverity levels for facility based log messages. - Set logging serverity levels for facility based log messages.
aggregate: aggregate:
description: List of logging definitions. description: List of logging definitions.
purge:
description:
- Purge logging not defined in the aggregate parameter.
default: no
state: state:
description: description:
- State of the logging configuration. - State of the logging configuration.
@ -295,8 +291,7 @@ def main():
dest_level=dict(type='int', aliases=['level']), dest_level=dict(type='int', aliases=['level']),
facility_level=dict(type='int'), facility_level=dict(type='int'),
state=dict(default='present', choices=['present', 'absent']), state=dict(default='present', choices=['present', 'absent']),
aggregate=dict(type='list'), aggregate=dict(type='list')
purge=dict(default=False, type='bool')
) )
argument_spec.update(nxos_argument_spec) argument_spec.update(nxos_argument_spec)

@ -43,18 +43,13 @@ options:
count: count:
description: description:
- Number of packets to send. - Number of packets to send.
required: false default: 5
default: 2
source: source:
description: description:
- Source IP Address. - Source IP Address or hostname (resolvable by switch)
required: false
default: null
vrf: vrf:
description: description:
- Outgoing VRF. - Outgoing VRF.
required: false
default: null
state: state:
description: description:
- Determines if the expected result is success or fail. - Determines if the expected result is success or fail.
@ -183,7 +178,7 @@ def get_ping_results(command, module):
def main(): def main():
argument_spec = dict( argument_spec = dict(
dest=dict(required=True), dest=dict(required=True),
count=dict(required=False, default=2), count=dict(required=False, default=5),
vrf=dict(required=False), vrf=dict(required=False),
source=dict(required=False), source=dict(required=False),
state=dict(required=False, choices=['present', 'absent'], default='present'), state=dict(required=False, choices=['present', 'absent'], default='present'),
@ -200,9 +195,6 @@ def main():
count = module.params['count'] count = module.params['count']
state = module.params['state'] state = module.params['state']
if count and not 1 <= int(count) <= 655350:
module.fail_json(msg="'count' must be an integer between 1 and 655350.", count=count)
ping_command = 'ping {0}'.format(destination) ping_command = 'ping {0}'.format(destination)
for command in ['count', 'source', 'vrf']: for command in ['count', 'source', 'vrf']:
arg = module.params[command] arg = module.params[command]

@ -38,9 +38,9 @@ class Cliconf(CliconfBase):
reply = self.get(b'show version') reply = self.get(b'show version')
data = to_text(reply, errors='surrogate_or_strict').strip() data = to_text(reply, errors='surrogate_or_strict').strip()
match = re.search(r'Version (\S+),', data) match = re.search(r'Version (\S+)', data)
if match: if match:
device_info['network_os_version'] = match.group(1) device_info['network_os_version'] = match.group(1).strip(',')
match = re.search(r'^Cisco (.+) \(revision', data, re.M) match = re.search(r'^Cisco (.+) \(revision', data, re.M)
if match: if match:

@ -30,7 +30,7 @@ from ansible.module_utils._text import to_bytes, to_text
class TerminalModule(TerminalBase): class TerminalModule(TerminalBase):
terminal_stdout_re = [ terminal_stdout_re = [
re.compile(br'[\r\n](?!\s*<)?(\x1b\S+)*[a-zA-Z_]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)*(\x1b\S+)*$'), re.compile(br'[\r\n]?(?!\s*<)?(\x1b\S+)*[a-zA-Z_]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)*(\x1b\S+)*$'),
re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$') re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$')
] ]

@ -4,7 +4,7 @@
when: ansible_connection == "local" when: ansible_connection == "local"
- name: Set up console logging - name: Set up console logging
nxos_logging: nxos_logging: &clog
dest: console dest: console
dest_level: 0 dest_level: 0
state: present state: present
@ -17,73 +17,96 @@
- '"logging console 0" in result.commands' - '"logging console 0" in result.commands'
- name: Set up console logging again (idempotent) - name: Set up console logging again (idempotent)
nxos_logging: nxos_logging: *clog
dest: console
dest_level: 0
state: present
provider: "{{ connection }}"
register: result register: result
- assert: - assert: &false
that: that:
- 'result.changed == false' - 'result.changed == false'
- name: Delete/disable console logging - name: Logfile logging with level
nxos_logging: nxos_logging: &llog
dest: console dest: logfile
dest_level: 0 name: test
state: absent dest_level: 1
state: present
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
- assert: - assert:
that: that:
- 'result.changed == true' - 'result.changed == true'
- '"no logging console" in result.commands' - '"logging logfile test 1" in result.commands'
- name: Delete/disable console logging (idempotent) - name: Logfile logging with level (idempotent)
nxos_logging: nxos_logging: *llog
dest: console register: result
dest_level: 0
state: absent - assert: *false
- name: Configure module with level
nxos_logging: &molog
dest: module
dest_level: 2
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
- assert: - assert:
that: that:
- 'result.changed == false' - 'result.changed == true'
- '"logging module 2" in result.commands'
- name: Logfile logging with level - name: Configure module with level (idempotent)
nxos_logging: nxos_logging: *molog
dest: logfile register: result
name: test
dest_level: 0 - assert: *false
state: present
- name: Configure monitor with level
nxos_logging: &mlog
dest: monitor
dest_level: 3
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
- assert: - assert:
that: that:
- 'result.changed == true' - 'result.changed == true'
- '"logging logfile test 0" in result.commands' - '"logging monitor 3" in result.commands'
- name: Configure monitor with level (idempotent)
nxos_logging: *mlog
register: result
- assert: *false
- name: Configure facility with level - name: Configure facility with level
nxos_logging: nxos_logging: &flog
facility: daemon facility: daemon
facility_level: 0 facility_level: 4
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
- assert: - assert:
that: that:
- 'result.changed == true' - 'result.changed == true'
- '"logging level daemon 0" in result.commands' - '"logging level daemon 4" in result.commands'
- name: Configure facility with level (idempotent)
nxos_logging: *flog
register: result
- assert: *false
- name: remove logging as collection tearDown - name: remove logging as collection tearDown
nxos_logging: nxos_logging: &agg
aggregate: aggregate:
- { dest: logfile, name: test, dest_level: 0, state: absent } - { dest: console, dest_level: 0 }
- { facility: daemon, facility_level: 0, state: absent } - { dest: module, dest_level: 2 }
- { dest: monitor, dest_level: 3 }
- { dest: logfile, dest_level: 1, name: test }
- { facility: daemon, facility_level: 4 }
state: absent
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
@ -92,5 +115,13 @@
- 'result.changed == true' - 'result.changed == true'
- '"no logging logfile" in result.commands' - '"no logging logfile" in result.commands'
- '"no logging level daemon" in result.commands' - '"no logging level daemon" in result.commands'
- '"no logging monitor" in result.commands'
- '"no logging module" in result.commands'
- name: remove aggregate logging (idempotent)
nxos_logging: *agg
register: result
- assert: *false
- debug: msg="END connection={{ ansible_connection }} nxos_logging basic test" - debug: msg="END connection={{ ansible_connection }} nxos_logging basic test"

@ -123,12 +123,30 @@
- assert: *true - assert: *true
- name: "Conf 6 Idempotence" - name: check configure vxlan_vtep_vni ingress static idempotence check
nxos_vxlan_vtep_vni: *conf6 nxos_vxlan_vtep_vni: *conf6
register: result register: result
- assert: *false - assert: *false
- name: Remove and reconfigure vxlan_vtep
nxos_vxlan_vtep: &remove_vtep
interface: nve1
state: absent
provider: "{{ connection }}"
- name: Configure vxlan_vtep with host reachability bgp
nxos_vxlan_vtep:
interface: nve1
host_reachability: True
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: &config_vni
interface: nve1
vni: 8000
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni ingress bgp - name: configure vxlan_vtep_vni ingress bgp
nxos_vxlan_vtep_vni: &conf7 nxos_vxlan_vtep_vni: &conf7
interface: nve1 interface: nve1
@ -161,6 +179,18 @@
- assert: *false - assert: *false
- name: Remove and reconfigure vxlan_vtep
nxos_vxlan_vtep: *remove_vtep
- name: Configure vxlan_vtep with host reachability static
nxos_vxlan_vtep:
interface: nve1
host_reachability: False
provider: "{{ connection }}"
- name: configure vxlan_vtep_vni
nxos_vxlan_vtep_vni: *config_vni
- name: configure vxlan_vtep_vni peer-list - name: configure vxlan_vtep_vni peer-list
nxos_vxlan_vtep_vni: &conf9 nxos_vxlan_vtep_vni: &conf9
interface: nve1 interface: nve1

@ -1730,7 +1730,6 @@ lib/ansible/modules/network/nxos/nxos_linkagg.py E324
lib/ansible/modules/network/nxos/nxos_linkagg.py E325 lib/ansible/modules/network/nxos/nxos_linkagg.py E325
lib/ansible/modules/network/nxos/nxos_linkagg.py E326 lib/ansible/modules/network/nxos/nxos_linkagg.py E326
lib/ansible/modules/network/nxos/nxos_lldp.py E326 lib/ansible/modules/network/nxos/nxos_lldp.py E326
lib/ansible/modules/network/nxos/nxos_logging.py E325
lib/ansible/modules/network/nxos/nxos_ntp_auth.py E324 lib/ansible/modules/network/nxos/nxos_ntp_auth.py E324
lib/ansible/modules/network/nxos/nxos_ntp_options.py E325 lib/ansible/modules/network/nxos/nxos_ntp_options.py E325
lib/ansible/modules/network/nxos/nxos_ntp_options.py E326 lib/ansible/modules/network/nxos/nxos_ntp_options.py E326

Loading…
Cancel
Save