Skip to content
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

New modules nxos_tms_global and nxos_tms_destgroup #58018

Closed
wants to merge 9 commits into from

Conversation

@mikewiebe
Copy link
Contributor

commented Jun 18, 2019

SUMMARY
  • Adds new nxos modules to manage telemetry feature configuration.
  • Adds device output caching to NX-OS CmdRef.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

nxos_tms_global
nxos_tms_destgroup

TESTING INFORMATION

This PR includes both unit and integration tests. Tests have been run against N9k.
A future PR will include support for other NX-OS platforms.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

@mikewiebe this PR contains more than one new module.

Please submit only one new module per pull request. For a detailed explanation, please read the grouped modules documentation

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

The test ansible-test sanity --test pylint [explain] failed with 12 errors:

lib/ansible/module_utils/network/nxos/nxos.py:921:4: dangerous-default-value Dangerous default value [] as argument
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: multiple-imports Multiple imports on one line (re, yaml)
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: multiple-imports Multiple imports on one line (re, yaml)
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Command "ansible-doc -t module nxos_aaa_server nxos_aaa_server_host nxos_acl nxos_acl_interface nxos_banner nxos_bfd_global nxos_bgp nxos_bgp_af nxos_bgp_neighbor nxos_bgp_neighbor_af nxos_command nxos_config nxos_evpn_global nxos_evpn_vni nxos_facts nxos_feature nxos_file_copy nxos_gir nxos_gir_profile_management nxos_hsrp nxos_igmp nxos_igmp_interface nxos_igmp_snooping nxos_install_os nxos_interface nxos_interface_ospf nxos_l2_interface nxos_l3_interface nxos_linkagg nxos_lldp nxos_logging nxos_ntp nxos_ntp_auth nxos_ntp_options nxos_nxapi nxos_ospf nxos_ospf_vrf nxos_overlay_global nxos_pim nxos_pim_interface nxos_pim_rp_address nxos_ping nxos_reboot nxos_rollback nxos_rpm nxos_smu nxos_snapshot nxos_snmp_community nxos_snmp_contact nxos_snmp_host nxos_snmp_location nxos_snmp_traps nxos_snmp_user nxos_static_route nxos_system nxos_tms_destgroup nxos_tms_global nxos_udld nxos_udld_interface nxos_user nxos_vlan nxos_vpc nxos_vpc_interface nxos_vrf nxos_vrf_af nxos_vrf_interface nxos_vrrp nxos_vtp_domain nxos_vtp_password nxos_vtp_version nxos_vxlan_vtep nxos_vxlan_vtep_vni" returned exit status 1.
>>> Standard Error
<unknown>:82: SyntaxWarning: invalid escape sequence \S
ERROR! module nxos_tms_destgroup missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/module_utils/network/nxos/nxos.py:1095:42: SyntaxError: dvalue = {k: v for k, v in dvalue.items() if v != 'None'}

The test ansible-test sanity --test import --python 2.6 [explain] failed with 73 errors:

lib/ansible/module_utils/network/nxos/nxos.py:1095:42: SyntaxError: invalid syntax
lib/ansible/modules/network/nxos/nxos_aaa_server.py:114:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_aaa_server_host.py:138:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_acl.py:173:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_acl_interface.py:81:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_banner.py:90:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_bfd_global.py:143:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_bgp.py:237:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_bgp_af.py:217:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_bgp_neighbor.py:174:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_bgp_neighbor_af.py:235:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_command.py:131:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_config.py:309:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_evpn_global.py:56:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_evpn_vni.py:98:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_facts.py:189:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_feature.py:76:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_file_copy.py:164:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_gir.py:162:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_gir_profile_management.py:102:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_hsrp.py:134:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_igmp.py:84:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_igmp_interface.py:192:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_igmp_snooping.py:98:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_install_os.py:125:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_interface.py:204:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_interface_ospf.py:147:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_l2_interface.py:122:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_l3_interface.py:92:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_linkagg.py:130:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_lldp.py:56:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_logging.py:184:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ntp.py:110:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ntp_auth.py:89:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ntp_options.py:78:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_nxapi.py:165:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ospf.py:61:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ospf_vrf.py:128:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_overlay_global.py:58:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_pim.py:69:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_pim_interface.py:148:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_pim_rp_address.py:83:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_ping.py:109:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_reboot.py:61:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_rollback.py:78:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_rpm.py:84:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_smu.py:70:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snapshot.py:138:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_community.py:76:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_contact.py:69:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_host.py:106:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_location.py:73:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_traps.py:79:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_snmp_user.py:95:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_static_route.py:96:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_system.py:116:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ImportError: No module named yaml
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named yaml
lib/ansible/modules/network/nxos/nxos_udld.py:108:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_udld_interface.py:113:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_user.py:145:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vlan.py:159:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vpc.py:154:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vpc_interface.py:76:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vrf.py:177:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vrf_af.py:73:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vrf_interface.py:83:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vrrp.py:119:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vtp_domain.py:90:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vtp_password.py:102:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vtp_version.py:85:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vxlan_vtep.py:115:0: SyntaxError: invalid syntax (nxos.py, line 1095)
lib/ansible/modules/network/nxos/nxos_vxlan_vtep_vni.py:99:0: SyntaxError: invalid syntax (nxos.py, line 1095)

The test ansible-test sanity --test import --python 2.7 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ImportError: No module named yaml
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named yaml

The test ansible-test sanity --test import --python 3.5 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ImportError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.8 [explain] failed with 4 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: SyntaxWarning: invalid escape sequence \S
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:94:0: SyntaxWarning: invalid escape sequence \S

The test ansible-test sanity --test pep8 [explain] failed with 11 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:76:10: E401 multiple imports on one line
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:48: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:75: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:102: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:10: E401 multiple imports on one line
lib/ansible/modules/network/nxos/nxos_tms_global.py:111:31: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:111:49: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:120:28: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:130:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:138:20: W605 invalid escape sequence '\S'

The test ansible-test sanity --test validate-modules [explain] failed with 9 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E305 DOCUMENTATION.options.destination.description.1: expected str @ data['options']['destination']['description'][1]. Got {'Value must be a dict defining values for keys': 'ip, port, protocol, encoding.'}
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E322 Argument 'aggregate' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E324 Argument 'state' in argument_spec defines default as ('present') but documentation defines default as ("['present']")
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E337 Argument 'aggregate' in argument_spec defines type as 'list' but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E305 DOCUMENTATION.options.certificate.description.1: expected str @ data['options']['certificate']['description'][1]. Got {'Value must be a dict defining values for keys': 'key and hostname.'}
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E324 Argument 'state' in argument_spec defines default as ('present') but documentation defines default as ("['present']")
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E337 Argument 'destination_profile_compression' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type

click here for bot help

protocol = cmd_ref._ref['destination']['existing'][key]['protocol'].lower()
encoding = cmd_ref._ref['destination']['existing'][key]['encoding'].lower()
cmd_ref._ref['destination']['existing'][key]['protocol'] = protocol
cmd_ref._ref['destination']['existing'][key]['encoding'] = encoding

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

Consider this approach instead. It's a bit more readable.

    playval = cmd_ref._ref.get('destination').get('playval')
    existing = cmd_ref._ref.get('destination').get('existing')

    keys = ['protocol', 'encoding']
    if playval:
        for key in keys:
            playval[key] = playval[key].lower()
    if existing:
        for key in keys:
            existing[key] = existing[key].lower()

This comment has been minimized.

Copy link
@mikewiebe

mikewiebe Jun 19, 2019

Author Contributor

This code mostly worked as is but had to modify existing to account for the fact that each existing instance has an instance index.

cmd_ref._ref['destination']['existing'][key]['protocol'] = protocol
cmd_ref._ref['destination']['existing'][key]['encoding'] = encoding

return cmd_ref

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

I don't think you need to return cmd_ref.

@ansibot ansibot removed the needs_triage label Jun 19, 2019


def get_aggregate_cmds(module):
''' Get list of commands from aggregate parameter '''

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

Nit: a little wordy. Consider:

    params = module.params
if 'protocol' in k:
module.params['destination']['protocol'] = v
if 'encoding' in k:
module.params['destination']['encoding'] = v

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

This is more terse:

             if 'destination' in k:
+                dest = {}
                 for k, v in v.items():
+                    dest[k] = v
+                params['destination'] = dest
-                    if 'ip' in k:
-                        module.params['destination']['ip'] = v
-                    if 'port' in k:
-                        module.params['destination']['port'] = v
-                    if 'protocol' in k:
-                        module.params['destination']['protocol'] = v
-                    if 'encoding' in k:
-                        module.params['destination']['encoding'] = v

This comment has been minimized.

Copy link
@mikewiebe

mikewiebe Jun 19, 2019

Author Contributor

Good refactor suggestion

cmd_ref.get_playvals()
cmd_ref = normalize_data(cmd_ref)
cmds = cmd_ref.get_proposed()
proposed_cmds.extend(cmds)

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

I'm okay with the code above, just wondering if it would be good to disambiguate the multi-instance cmd_ref objects in this method's for loop from the single-instance cmd_ref in main() ?
e.g. make these mi_cmd_ref, agg_cmd_ref, etc.

Your call.

This comment has been minimized.

Copy link
@mikewiebe

mikewiebe Jun 19, 2019

Author Contributor

Nah.. I plan to leave it as is. It's in a separate method so I think it's clear enough and besides the cmd_ref objects in get_aggregate_cmds are discarded and only the resulting command set is returned.

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

👍
yup, just discombobulating the combobulated.

# Normalize interface name.
int = module.params.get('destination_profile_source_interface')
if int:
module.params['destination_profile_source_interface'] = normalize_interface(int)

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

Or just:

    int = module.params.get('destination_profile_source_interface')
    module.params['destination_profile_source_interface'] = normalize_interface(int)

It's a nit. Keep it if you want.

@@ -0,0 +1,3 @@
dependencies:
# Uncomment in the future if needed.
# - prepare_nxos_tests

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

Why skip prepare_nxos_tests ?

This comment has been minimized.

Copy link
@mikewiebe

mikewiebe Jun 19, 2019

Author Contributor

We don't explicitly need it right now and it just adds runtime. That will likely change in the future if/when we add additional nxos platform support but decided to save the time for now.

This comment has been minimized.

Copy link
@chrisvanheuveln
@@ -0,0 +1,3 @@
dependencies:
# Uncomment in the future if needed.
# - prepare_nxos_tests

This comment has been minimized.

Copy link
@chrisvanheuveln

This comment has been minimized.

Copy link
@mikewiebe

mikewiebe Jun 19, 2019

Author Contributor

ditto

# Assumes feature telemetry is disabled
# TMS global config is not present.
# Configure only vrf
module_name = self.module.__name__.rsplit('.', 1)[1]

This comment has been minimized.

Copy link
@chrisvanheuveln

chrisvanheuveln Jun 19, 2019

Contributor

module_name isn't used anywhere else. Remove?

@trishnaguha trishnaguha self-assigned this Jun 19, 2019

@mikewiebe mikewiebe force-pushed the mikewiebe-ansible:nxos_telemetry branch from 274295f to c841370 Jun 19, 2019

@mikewiebe mikewiebe force-pushed the mikewiebe-ansible:nxos_telemetry branch from 1f727c7 to b815f5e Jun 19, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or buffer

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: missing documentation (or could not parse documentation): expected string or bytes-like object

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Command "ansible-doc -t module nxos_aaa_server nxos_aaa_server_host nxos_acl nxos_acl_interface nxos_banner nxos_bfd_global nxos_bgp nxos_bgp_af nxos_bgp_neighbor nxos_bgp_neighbor_af nxos_command nxos_config nxos_evpn_global nxos_evpn_vni nxos_facts nxos_feature nxos_file_copy nxos_gir nxos_gir_profile_management nxos_hsrp nxos_igmp nxos_igmp_interface nxos_igmp_snooping nxos_install_os nxos_interface nxos_interface_ospf nxos_l2_interface nxos_l3_interface nxos_linkagg nxos_lldp nxos_logging nxos_ntp nxos_ntp_auth nxos_ntp_options nxos_nxapi nxos_ospf nxos_ospf_vrf nxos_overlay_global nxos_pim nxos_pim_interface nxos_pim_rp_address nxos_ping nxos_reboot nxos_rollback nxos_rpm nxos_smu nxos_snapshot nxos_snmp_community nxos_snmp_contact nxos_snmp_host nxos_snmp_location nxos_snmp_traps nxos_snmp_user nxos_static_route nxos_system nxos_tms_destgroup nxos_tms_global nxos_udld nxos_udld_interface nxos_user nxos_vlan nxos_vpc nxos_vpc_interface nxos_vrf nxos_vrf_af nxos_vrf_interface nxos_vrrp nxos_vtp_domain nxos_vtp_password nxos_vtp_version nxos_vxlan_vtep nxos_vxlan_vtep_vni" returned exit status 1.
>>> Standard Error
<unknown>:84: SyntaxWarning: invalid escape sequence \S
ERROR! module nxos_tms_destgroup missing documentation (or could not parse documentation): expected string or bytes-like object

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module nxos_aaa_server nxos_aaa_server_host nxos_acl nxos_acl_interface nxos_banner nxos_bfd_global nxos_bgp nxos_bgp_af nxos_bgp_neighbor nxos_bgp_neighbor_af nxos_command nxos_config nxos_evpn_global nxos_evpn_vni nxos_facts nxos_feature nxos_file_copy nxos_gir nxos_gir_profile_management nxos_hsrp nxos_igmp nxos_igmp_interface nxos_igmp_snooping nxos_install_os nxos_interface nxos_interface_ospf nxos_l2_interface nxos_l3_interface nxos_linkagg nxos_lldp nxos_logging nxos_ntp nxos_ntp_auth nxos_ntp_options nxos_nxapi nxos_ospf nxos_ospf_vrf nxos_overlay_global nxos_pim nxos_pim_interface nxos_pim_rp_address nxos_ping nxos_reboot nxos_rollback nxos_rpm nxos_smu nxos_snapshot nxos_snmp_community nxos_snmp_contact nxos_snmp_host nxos_snmp_location nxos_snmp_traps nxos_snmp_user nxos_static_route nxos_system nxos_tms_destgroup nxos_tms_global nxos_udld nxos_udld_interface nxos_user nxos_vlan nxos_vpc nxos_vpc_interface nxos_vrf nxos_vrf_af nxos_vrf_interface nxos_vrrp nxos_vtp_domain nxos_vtp_password nxos_vtp_version nxos_vxlan_vtep nxos_vxlan_vtep_vni" returned exit status 0.
>>> Standard Error
<unknown>:82: SyntaxWarning: invalid escape sequence \S
<unknown>:95: SyntaxWarning: invalid escape sequence \S

The test ansible-test sanity --test import --python 2.6 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ImportError: No module named yaml
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named yaml

The test ansible-test sanity --test import --python 2.7 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ImportError: No module named yaml
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named yaml

The test ansible-test sanity --test import --python 3.5 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ImportError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ImportError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'

The test ansible-test sanity --test import --python 3.8 [explain] failed with 4 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:75:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:82:0: SyntaxWarning: invalid escape sequence \S
lib/ansible/modules/network/nxos/nxos_tms_global.py:87:0: ModuleNotFoundError: No module named 'yaml'
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: SyntaxWarning: invalid escape sequence \S

The test ansible-test sanity --test pep8 [explain] failed with 9 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:48: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:75: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:100:102: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:112:31: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:112:49: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:121:28: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:131:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:139:20: W605 invalid escape sequence '\S'

The test ansible-test sanity --test validate-modules [explain] failed with 7 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E322 Argument 'aggregate' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E324 Argument 'state' in argument_spec defines default as ('present') but documentation defines default as ("['present']")
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E337 Argument 'aggregate' in argument_spec defines type as 'list' but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E324 Argument 'state' in argument_spec defines default as ('present') but documentation defines default as ("['present']")
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E337 Argument 'destination_profile_compression' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/network/nxos/nxos_tms_global.py:0:0: E338 Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type

click here for bot help

mikewiebe added some commits Jun 19, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

The test ansible-test sanity --test pylint [explain] failed with 6 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:97:0: bad-option-value Bad option value 'W605'
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: anomalous-backslash-in-string Anomalous backslash in string: '\S'. String constant might be missing an r prefix.

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module nxos_aaa_server nxos_aaa_server_host nxos_acl nxos_acl_interface nxos_banner nxos_bfd_global nxos_bgp nxos_bgp_af nxos_bgp_neighbor nxos_bgp_neighbor_af nxos_command nxos_config nxos_evpn_global nxos_evpn_vni nxos_facts nxos_feature nxos_file_copy nxos_gir nxos_gir_profile_management nxos_hsrp nxos_igmp nxos_igmp_interface nxos_igmp_snooping nxos_install_os nxos_interface nxos_interface_ospf nxos_l2_interface nxos_l3_interface nxos_linkagg nxos_lldp nxos_logging nxos_ntp nxos_ntp_auth nxos_ntp_options nxos_nxapi nxos_ospf nxos_ospf_vrf nxos_overlay_global nxos_pim nxos_pim_interface nxos_pim_rp_address nxos_ping nxos_reboot nxos_rollback nxos_rpm nxos_smu nxos_snapshot nxos_snmp_community nxos_snmp_contact nxos_snmp_host nxos_snmp_location nxos_snmp_traps nxos_snmp_user nxos_static_route nxos_system nxos_tms_destgroup nxos_tms_global nxos_udld nxos_udld_interface nxos_user nxos_vlan nxos_vpc nxos_vpc_interface nxos_vrf nxos_vrf_af nxos_vrf_interface nxos_vrrp nxos_vtp_domain nxos_vtp_password nxos_vtp_version nxos_vxlan_vtep nxos_vxlan_vtep_vni" returned exit status 0.
>>> Standard Error
<unknown>:98: SyntaxWarning: invalid escape sequence \S
<unknown>:95: SyntaxWarning: invalid escape sequence \S

The test ansible-test sanity --test import --python 3.8 [explain] failed with 2 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:98:0: SyntaxWarning: invalid escape sequence \S
lib/ansible/modules/network/nxos/nxos_tms_global.py:95:0: SyntaxWarning: invalid escape sequence \S

The test ansible-test sanity --test pep8 [explain] failed with 9 errors:

lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:116:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:116:48: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:116:75: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_destgroup.py:116:102: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:112:31: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:112:49: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:121:28: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:131:29: W605 invalid escape sequence '\S'
lib/ansible/modules/network/nxos/nxos_tms_global.py:139:20: W605 invalid escape sequence '\S'

click here for bot help

@mikewiebe

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2019

@trishnaguha This one is ready for review and merge. @chrisvanheuveln Reviewed it and I finished addressing all of his comments.

@mikewiebe mikewiebe changed the title [WIP] New modules nxos_tms_global and nxos_tms_destgroup New modules nxos_tms_global and nxos_tms_destgroup Jun 19, 2019

@ansibot ansibot added needs_revision and removed WIP labels Jun 19, 2019

@chrisvanheuveln

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

shipit

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

@ansibot ansibot added the stale_ci label Jul 4, 2019

@mikewiebe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 16, 2019

Closing. Redundant with #59126

@mikewiebe mikewiebe closed this Jul 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.