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 commit0ac222d68b
) * 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 commitf1103a7a02
) * IT cases for nxos_logging (#39929) * IT cases for nxos_logging * review comment (cherry picked from commit2557c0662a
) * fix nxos_ping issues (#40028) (cherry picked from commit6fac574f17
) * Fix vxlan_vtep_vni tests (#39968) (cherry picked from commit0407c51447
) * ios cliconf plugin fix regex for version (#40066) Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commit5cf61d7401
) * update changelog Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * shippable Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
f6cbb45b39
commit
299047d963
10 changed files with 119 additions and 65 deletions
2
changelogs/fragments/ios_cliconf_plugin.yaml
Normal file
2
changelogs/fragments/ios_cliconf_plugin.yaml
Normal file
|
@ -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_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_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)
|
||||
|
|
2
changelogs/fragments/nxos_terminal_plugin.yaml
Normal file
2
changelogs/fragments/nxos_terminal_plugin.yaml
Normal file
|
@ -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.
|
||||
aggregate:
|
||||
description: List of logging definitions.
|
||||
purge:
|
||||
description:
|
||||
- Purge logging not defined in the aggregate parameter.
|
||||
default: no
|
||||
state:
|
||||
description:
|
||||
- State of the logging configuration.
|
||||
|
@ -295,8 +291,7 @@ def main():
|
|||
dest_level=dict(type='int', aliases=['level']),
|
||||
facility_level=dict(type='int'),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
aggregate=dict(type='list'),
|
||||
purge=dict(default=False, type='bool')
|
||||
aggregate=dict(type='list')
|
||||
)
|
||||
|
||||
argument_spec.update(nxos_argument_spec)
|
||||
|
|
|
@ -43,18 +43,13 @@ options:
|
|||
count:
|
||||
description:
|
||||
- Number of packets to send.
|
||||
required: false
|
||||
default: 2
|
||||
default: 5
|
||||
source:
|
||||
description:
|
||||
- Source IP Address.
|
||||
required: false
|
||||
default: null
|
||||
- Source IP Address or hostname (resolvable by switch)
|
||||
vrf:
|
||||
description:
|
||||
- Outgoing VRF.
|
||||
required: false
|
||||
default: null
|
||||
state:
|
||||
description:
|
||||
- Determines if the expected result is success or fail.
|
||||
|
@ -183,7 +178,7 @@ def get_ping_results(command, module):
|
|||
def main():
|
||||
argument_spec = dict(
|
||||
dest=dict(required=True),
|
||||
count=dict(required=False, default=2),
|
||||
count=dict(required=False, default=5),
|
||||
vrf=dict(required=False),
|
||||
source=dict(required=False),
|
||||
state=dict(required=False, choices=['present', 'absent'], default='present'),
|
||||
|
@ -200,9 +195,6 @@ def main():
|
|||
count = module.params['count']
|
||||
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)
|
||||
for command in ['count', 'source', 'vrf']:
|
||||
arg = module.params[command]
|
||||
|
|
|
@ -38,9 +38,9 @@ class Cliconf(CliconfBase):
|
|||
reply = self.get(b'show version')
|
||||
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:
|
||||
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)
|
||||
if match:
|
||||
|
|
|
@ -30,7 +30,7 @@ from ansible.module_utils._text import to_bytes, to_text
|
|||
class TerminalModule(TerminalBase):
|
||||
|
||||
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*)$')
|
||||
]
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
when: ansible_connection == "local"
|
||||
|
||||
- name: Set up console logging
|
||||
nxos_logging:
|
||||
nxos_logging: &clog
|
||||
dest: console
|
||||
dest_level: 0
|
||||
state: present
|
||||
|
@ -17,47 +17,18 @@
|
|||
- '"logging console 0" in result.commands'
|
||||
|
||||
- name: Set up console logging again (idempotent)
|
||||
nxos_logging:
|
||||
dest: console
|
||||
dest_level: 0
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
nxos_logging: *clog
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Delete/disable console logging
|
||||
nxos_logging:
|
||||
dest: console
|
||||
dest_level: 0
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"no logging console" in result.commands'
|
||||
|
||||
- name: Delete/disable console logging (idempotent)
|
||||
nxos_logging:
|
||||
dest: console
|
||||
dest_level: 0
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
- assert: &false
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: Logfile logging with level
|
||||
nxos_logging:
|
||||
nxos_logging: &llog
|
||||
dest: logfile
|
||||
name: test
|
||||
dest_level: 0
|
||||
dest_level: 1
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
@ -65,25 +36,77 @@
|
|||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"logging logfile test 0" in result.commands'
|
||||
- '"logging logfile test 1" in result.commands'
|
||||
|
||||
- name: Configure facility with level
|
||||
nxos_logging:
|
||||
facility: daemon
|
||||
facility_level: 0
|
||||
- name: Logfile logging with level (idempotent)
|
||||
nxos_logging: *llog
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure module with level
|
||||
nxos_logging: &molog
|
||||
dest: module
|
||||
dest_level: 2
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"logging level daemon 0" in result.commands'
|
||||
- '"logging module 2" in result.commands'
|
||||
|
||||
- name: Configure module with level (idempotent)
|
||||
nxos_logging: *molog
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure monitor with level
|
||||
nxos_logging: &mlog
|
||||
dest: monitor
|
||||
dest_level: 3
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"logging monitor 3" in result.commands'
|
||||
|
||||
- name: Configure monitor with level (idempotent)
|
||||
nxos_logging: *mlog
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure facility with level
|
||||
nxos_logging: &flog
|
||||
facility: daemon
|
||||
facility_level: 4
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"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
|
||||
nxos_logging:
|
||||
nxos_logging: &agg
|
||||
aggregate:
|
||||
- { dest: logfile, name: test, dest_level: 0, state: absent }
|
||||
- { facility: daemon, facility_level: 0, state: absent }
|
||||
- { dest: console, dest_level: 0 }
|
||||
- { 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 }}"
|
||||
register: result
|
||||
|
||||
|
@ -92,5 +115,13 @@
|
|||
- 'result.changed == true'
|
||||
- '"no logging logfile" 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"
|
||||
|
|
|
@ -123,12 +123,30 @@
|
|||
|
||||
- assert: *true
|
||||
|
||||
- name: "Conf 6 Idempotence"
|
||||
- name: check configure vxlan_vtep_vni ingress static idempotence check
|
||||
nxos_vxlan_vtep_vni: *conf6
|
||||
register: result
|
||||
|
||||
- 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
|
||||
nxos_vxlan_vtep_vni: &conf7
|
||||
interface: nve1
|
||||
|
@ -161,6 +179,18 @@
|
|||
|
||||
- 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
|
||||
nxos_vxlan_vtep_vni: &conf9
|
||||
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 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_options.py E325
|
||||
lib/ansible/modules/network/nxos/nxos_ntp_options.py E326
|
||||
|
|
Loading…
Reference in a new issue