diff --git a/.github/BOTMETA.yml b/.github/BOTMETA.yml index c4d373b0..052b1f87 100644 --- a/.github/BOTMETA.yml +++ b/.github/BOTMETA.yml @@ -10,9 +10,6 @@ files: labels: ironware networking $actions/nos_config.py: labels: nos - $actions/onyx_config.py: - maintainers: $team_onyx - labels: networking onyx_config $actions/sros.py: maintainers: $team_networking labels: networking sros @@ -39,9 +36,6 @@ files: $cliconfs/nos.py: maintainers: $team_extreme labels: networking nos - $cliconfs/onyx.py: - maintainers: $team_onyx - labels: networking onyx $cliconfs/routeros.py: maintainers: heuels labels: networking routeros @@ -125,9 +119,6 @@ files: $module_utils/network/nso/nso.py: maintainers: $team_nso labels: cisco networking - $module_utils/network/onyx/onyx.py: - maintainers: $team_onyx - labels: networking $module_utils/network/ordnance/ordnance.py: maintainers: alexanderturner djh00t labels: networking @@ -344,38 +335,6 @@ files: labels: cisco networking $modules/network/nuage/nuage_vspk.py: authors: pdellaert - $modules/network/onyx/: - authors: anass - maintainers: $team_onyx - $modules/network/onyx/onyx_bgp.py: - authors: anasb samerd - maintainers: anasbadaha - $modules/network/onyx/onyx_buffer_pool.py: - authors: anasb - $modules/network/onyx/onyx_command.py: - authors: samerd - maintainers: anasbadaha - $modules/network/onyx/onyx_config.py: - authors: atabachnik samerd - maintainers: anasbadaha - $modules/network/onyx/onyx_facts.py: - authors: samerd waleedym - maintainers: anasbadaha - $modules/network/onyx/onyx_igmp.py: - authors: samerd - maintainers: anasbadaha - $modules/network/onyx/onyx_igmp_interface.py: - authors: anasb - $modules/network/onyx/onyx_igmp_vlan.py: - authors: anasbadaha - maintainers: samerd - $modules/network/onyx/onyx_traffic_class.py: - authors: anasb - $modules/network/onyx/onyx_vlan.py: - authors: atabachnik samerd - maintainers: anasbadaha - $modules/network/onyx/onyx_vxlan.py: - authors: anasb $modules/network/opx/opx_cps.py: authors: skg-net $modules/network/ordnance/: @@ -452,9 +411,6 @@ files: $terminals/nos.py: maintainers: $team_extreme labels: networking nos - $terminals/onyx.py: - maintainers: $team_onyx - labels: networking onyx $terminals/routeros.py: maintainers: heuels labels: networking routeros @@ -492,5 +448,4 @@ macros: team_netvisor: Qalthos amitsi csharpe-pn pdam preetiparasar team_networking: NilashishC Qalthos danielmellado ganeshrn justjais trishnaguha team_nso: cmoberg cnasten tbjurman - team_onyx: anasbadaha samerd team_scaleway: DenBeke QuentinBrosse abarbare jerome-quere kindermoumoute remyleo diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 00000000..4564429c --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,97 @@ +=============================== +Community Network Release Notes +=============================== + +.. contents:: Topics + + +v0.2.0 +====== + +Release Summary +--------------- + +This is the first proper release of the ``community.network`` collection on 2020-06-20. +The changelog describes all changes made to the modules and plugins included in this +collection since Ansible 2.9.0. + + +Minor Changes +------------- + +- ce_bgp_neighbor_af - Rename the parameter ``redirect_ip_vaildation`` to ``redirect_ip_validation`` (https://github.com/ansible/ansible/pull/62403). + +Breaking Changes / Porting Guide +-------------------------------- + +- routeros_facts - allow multiple addresses and neighbors per interface. This makes ``ansible_net_neighbors`` a list instead of a dict (https://github.com/ansible-collections/community.network/pull/6). + +Bugfixes +-------- + +- Cloudengine module_utils - the ``set-id`` (RPC-REPLY XML attribute) may change over the time althougth ``set-id`` is the identity of the next RPC packet. +- Cloudengine netconf plugin - add a dispatch RPC function,just return original RPC-REPLY, the function is used by ``Cloudengine module_utils``. +- Fixes in network action plugins to work in network connection plugin and modules in collection +- Make netconf plugin configurable to set ncclient device handler name in netconf plugin (https://github.com/ansible/ansible/pull/65718) +- Some cloudengine modules have options which should have been removed for Ansible 2.9. see https://github.com/ansible/ansible/issues/67020 and https://github.com/ansible-collections/community.network/pull/68 +- Some cloudengine modules were missing ``import __future__`` and ``metaclass``. (https://github.com/ansible/ansible/pull/67634). +- Some cloudengine modules were missing ``import __future__`` and ``metaclass``. (https://github.com/ansible/ansible/pull/67635). +- action/ce - fix a bug, some new version os will not discard uncommitted configure with a return directly.(https://github.com/ansible/ansible/pull/63513). +- ce - Modify exception handling method to make display information more obvious (https://github.com/ansible-collections/community.network/pull/51). +- ce - Modify the way of parsing NETCONF XML message in ce.py (https://github.com/ansible-collections/community.network/pull/39). +- ce_config - fixed issue - Re-building commands(config src) by replacing '#' with 'quit','quit' commands may close connection (https://github.com/ansible/ansible/issues/62872) +- ce_is_is_interface - fix compile error for Python 3.9 (https://github.com/ansible-collections/community.network/pull/36). +- edgeos_config - fix issue where module would silently filter out encrypted passwords +- edgeos_config - fixed issue of handling single quotation marks. Now fails when unmatched (odd numbers) +- edgeos_config - fixed issue where any change in check mode would cause all subsequent tasks to be treated as changes +- netscaler_nitro_request - use all filters for get_filtered instead of only the first one (https://github.com/ansible-collections/community.network/issues/48). +- plugins-netconf-ce - Fix failed to get version information. +- plugins-netconf-ce - to get attribute 'set-id' from rpc-reply. +- routeros module_utils - created a ``try``/``except`` block on the function ``get_capabilities`` (https://github.com/ansible-collections/community.network/pull/27). +- routeros_facts - Prevent crash of module when ``ipv6`` package is not installed + +New Modules +----------- + +Network +~~~~~~~ + +apconos +^^^^^^^ + +- apconos_command - Run arbitrary commands on APCON devices + +cloudengine +^^^^^^^^^^^ + +- ce_is_is_instance - Manages isis process id configuration on HUAWEI CloudEngine devices. +- ce_is_is_interface - Manages isis interface configuration on HUAWEI CloudEngine devices. +- ce_is_is_view - Manages isis view configuration on HUAWEI CloudEngine devices. +- ce_lacp - Manages Eth-Trunk interfaces on HUAWEI CloudEngine switches +- ce_lldp - Manages LLDP configuration on HUAWEI CloudEngine switches. +- ce_lldp_interface - Manages INTERFACE LLDP configuration on HUAWEI CloudEngine switches. +- ce_mdn_interface - Manages MDN configuration on HUAWEI CloudEngine switches. +- ce_multicast_global - Manages multicast global configuration on HUAWEI CloudEngine switches. +- ce_multicast_igmp_enable - Manages multicast igmp enable configuration on HUAWEI CloudEngine switches. +- ce_static_route_bfd - Manages static route configuration on HUAWEI CloudEngine switches. + +exos +^^^^ + +- exos_l2_interfaces - Manage L2 interfaces on Extreme Networks EXOS devices. +- exos_lldp_interfaces - Manage link layer discovery protocol (LLDP) attributes of interfaces on EXOS platforms. +- exos_vlans - Manage VLANs on Extreme Networks EXOS devices. + +onyx +^^^^ + +- onyx_aaa - Configures AAA parameters +- onyx_bfd - Configures BFD parameters +- onyx_ntp - Manage NTP general configurations and ntp keys configurations on Mellanox ONYX network devices +- onyx_ntp_servers_peers - Configures NTP peers and servers parameters +- onyx_snmp - Manages SNMP general configurations on Mellanox ONYX network devices +- onyx_snmp_hosts - Configures SNMP host parameters +- onyx_snmp_users - Configures SNMP User parameters +- onyx_syslog_files - Configure file management syslog module +- onyx_syslog_remote - Configure remote syslog module +- onyx_username - Configure username module diff --git a/README.md b/README.md index 9441a296..8a1170d1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,8 @@ See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/commun ## Changelogs - + +See [here](https://github.com/ansible-collections/community.network/tree/master/CHANGELOG.rst). ## Roadmap diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 00000000..13dbf389 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,155 @@ +ancestor: null +releases: + 0.2.0: + changes: + breaking_changes: + - routeros_facts - allow multiple addresses and neighbors per interface. This + makes ``ansible_net_neighbors`` a list instead of a dict (https://github.com/ansible-collections/community.network/pull/6). + bugfixes: + - Cloudengine module_utils - the ``set-id`` (RPC-REPLY XML attribute) may change + over the time althougth ``set-id`` is the identity of the next RPC packet. + - Cloudengine netconf plugin - add a dispatch RPC function,just return original + RPC-REPLY, the function is used by ``Cloudengine module_utils``. + - Fixes in network action plugins to work in network connection plugin and modules + in collection + - Make netconf plugin configurable to set ncclient device handler name in netconf + plugin (https://github.com/ansible/ansible/pull/65718) + - Some cloudengine modules have options which should have been removed for Ansible + 2.9. see https://github.com/ansible/ansible/issues/67020 and https://github.com/ansible-collections/community.network/pull/68 + - Some cloudengine modules were missing ``import __future__`` and ``metaclass``. + (https://github.com/ansible/ansible/pull/67634). + - Some cloudengine modules were missing ``import __future__`` and ``metaclass``. + (https://github.com/ansible/ansible/pull/67635). + - action/ce - fix a bug, some new version os will not discard uncommitted configure + with a return directly.(https://github.com/ansible/ansible/pull/63513). + - ce - Modify exception handling method to make display information more obvious + (https://github.com/ansible-collections/community.network/pull/51). + - ce - Modify the way of parsing NETCONF XML message in ce.py (https://github.com/ansible-collections/community.network/pull/39). + - ce_config - fixed issue - Re-building commands(config src) by replacing '#' + with 'quit','quit' commands may close connection (https://github.com/ansible/ansible/issues/62872) + - ce_is_is_interface - fix compile error for Python 3.9 (https://github.com/ansible-collections/community.network/pull/36). + - edgeos_config - fix issue where module would silently filter out encrypted + passwords + - edgeos_config - fixed issue of handling single quotation marks. Now fails + when unmatched (odd numbers) + - edgeos_config - fixed issue where any change in check mode would cause all + subsequent tasks to be treated as changes + - netscaler_nitro_request - use all filters for get_filtered instead of only + the first one (https://github.com/ansible-collections/community.network/issues/48). + - plugins-netconf-ce - Fix failed to get version information. + - plugins-netconf-ce - to get attribute 'set-id' from rpc-reply. + - routeros module_utils - created a ``try``/``except`` block on the function + ``get_capabilities`` (https://github.com/ansible-collections/community.network/pull/27). + - routeros_facts - Prevent crash of module when ``ipv6`` package is not installed + minor_changes: + - ce_bgp_neighbor_af - Rename the parameter ``redirect_ip_vaildation`` to ``redirect_ip_validation`` + (https://github.com/ansible/ansible/pull/62403). + release_summary: 'This is the first proper release of the ``community.network`` + collection on 2020-06-20. + + The changelog describes all changes made to the modules and plugins included + in this + + collection since Ansible 2.9.0. + + ' + fragments: + - 0.2.0.yml + - 27-routeros-exception-catching.yml + - 34-fix-edgeos_config-false-positives-in-check-mode.yml + - 36-ce_is_is_interface-python-3.9.yml + - 39-ce_modify_the_parse_mode.yml + - 51-ce_modify_exception_handling_method.yml + - 52-netscaler_nitro_request-use-all-filters.yaml + - 6-routeros_facts-multiple-entries-per-iface.yml + - 60569-plugins-netconf-ce.yml + - 62403-ce_bgp_neighbor_af_fix_parameter_name.yml + - 62587-module_utils-network-cloudengine.yml + - 62872-ce_config_too_many_quit_close_connection.yml + - 63362-remove-edgeos-filtering.yaml + - 63513-ce_action_wait_prompt_trigger_time_out.yaml + - 65065-plugins-netconf-ce-fix.yaml + - 67500-fix-edgeos-config-single-quote-stripping.yaml + - 67634-Update-to-add-missing-import.yml + - 67635-Update-to-add-missing-import.yml + - 68-cloudengine_module_utils_remove_deprecated_version_2.9.yml + - netconf_plugin_device_handler.yml + - network_action_plugin_fixes.yml + - routeros_facts-ipv6-crash.yml + modules: + - description: Run arbitrary commands on APCON devices + name: apconos_command + namespace: network.apconos + - description: Manages isis process id configuration on HUAWEI CloudEngine devices. + name: ce_is_is_instance + namespace: network.cloudengine + - description: Manages isis interface configuration on HUAWEI CloudEngine devices. + name: ce_is_is_interface + namespace: network.cloudengine + - description: Manages isis view configuration on HUAWEI CloudEngine devices. + name: ce_is_is_view + namespace: network.cloudengine + - description: Manages Eth-Trunk interfaces on HUAWEI CloudEngine switches + name: ce_lacp + namespace: network.cloudengine + - description: Manages LLDP configuration on HUAWEI CloudEngine switches. + name: ce_lldp + namespace: network.cloudengine + - description: Manages INTERFACE LLDP configuration on HUAWEI CloudEngine switches. + name: ce_lldp_interface + namespace: network.cloudengine + - description: Manages MDN configuration on HUAWEI CloudEngine switches. + name: ce_mdn_interface + namespace: network.cloudengine + - description: Manages multicast global configuration on HUAWEI CloudEngine switches. + name: ce_multicast_global + namespace: network.cloudengine + - description: Manages multicast igmp enable configuration on HUAWEI CloudEngine + switches. + name: ce_multicast_igmp_enable + namespace: network.cloudengine + - description: Manages static route configuration on HUAWEI CloudEngine switches. + name: ce_static_route_bfd + namespace: network.cloudengine + - description: Manage L2 interfaces on Extreme Networks EXOS devices. + name: exos_l2_interfaces + namespace: network.exos + - description: Manage link layer discovery protocol (LLDP) attributes of interfaces + on EXOS platforms. + name: exos_lldp_interfaces + namespace: network.exos + - description: Manage VLANs on Extreme Networks EXOS devices. + name: exos_vlans + namespace: network.exos + - description: Configures AAA parameters + name: onyx_aaa + namespace: network.onyx + - description: Configures BFD parameters + name: onyx_bfd + namespace: network.onyx + - description: Manage NTP general configurations and ntp keys configurations on + Mellanox ONYX network devices + name: onyx_ntp + namespace: network.onyx + - description: Configures NTP peers and servers parameters + name: onyx_ntp_servers_peers + namespace: network.onyx + - description: Manages SNMP general configurations on Mellanox ONYX network devices + name: onyx_snmp + namespace: network.onyx + - description: Configures SNMP host parameters + name: onyx_snmp_hosts + namespace: network.onyx + - description: Configures SNMP User parameters + name: onyx_snmp_users + namespace: network.onyx + - description: Configure file management syslog module + name: onyx_syslog_files + namespace: network.onyx + - description: Configure remote syslog module + name: onyx_syslog_remote + namespace: network.onyx + - description: Configure username module + name: onyx_username + namespace: network.onyx + release_date: '2020-06-20' diff --git a/changelogs/config.yaml b/changelogs/config.yaml index 1e2130fa..1846d73f 100644 --- a/changelogs/config.yaml +++ b/changelogs/config.yaml @@ -1,9 +1,10 @@ -changelog_filename_template: CHANGELOG.rst +changelog_filename_template: ../CHANGELOG.rst changelog_filename_version_depth: 0 changes_file: changelog.yaml changes_format: combined keep_fragments: false mention_ancestor: true +flatmap: true new_plugins_after_name: removed_features notesdir: fragments prelude_section_name: release_summary diff --git a/changelogs/fragments/27-routeros-exception-catching.yml b/changelogs/fragments/27-routeros-exception-catching.yml deleted file mode 100644 index 70563fbf..00000000 --- a/changelogs/fragments/27-routeros-exception-catching.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - routeros module_utils - created a ``try``/``except`` block on the function ``get_capabilities`` (https://github.com/ansible-collections/community.network/pull/27). diff --git a/changelogs/fragments/34-fix-edgeos_config-false-positives-in-check-mode.yml b/changelogs/fragments/34-fix-edgeos_config-false-positives-in-check-mode.yml deleted file mode 100644 index 82b2d801..00000000 --- a/changelogs/fragments/34-fix-edgeos_config-false-positives-in-check-mode.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - edgeos_config - fixed issue where any change in check mode would cause all subsequent tasks to be treated as changes diff --git a/changelogs/fragments/36-ce_is_is_interface-python-3.9.yml b/changelogs/fragments/36-ce_is_is_interface-python-3.9.yml deleted file mode 100644 index 065b02b8..00000000 --- a/changelogs/fragments/36-ce_is_is_interface-python-3.9.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: -- "ce_is_is_interface - fix compile error for Python 3.9 (https://github.com/ansible-collections/community.network/pull/36)." diff --git a/changelogs/fragments/39-ce_modify_the_parse_mode.yml b/changelogs/fragments/39-ce_modify_the_parse_mode.yml deleted file mode 100644 index fd4e9506..00000000 --- a/changelogs/fragments/39-ce_modify_the_parse_mode.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: -- "ce - Modify the way of parsing NETCONF XML message in ce.py (https://github.com/ansible-collections/community.network/pull/39)." diff --git a/changelogs/fragments/51-ce_modify_exception_handling_method.yml b/changelogs/fragments/51-ce_modify_exception_handling_method.yml deleted file mode 100644 index c1205cc1..00000000 --- a/changelogs/fragments/51-ce_modify_exception_handling_method.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: -- "ce - Modify exception handling method to make display information more obvious (https://github.com/ansible-collections/community.network/pull/51)." diff --git a/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml b/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml deleted file mode 100644 index 183d38f7..00000000 --- a/changelogs/fragments/52-netscaler_nitro_request-use-all-filters.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - netscaler_nitro_request - use all filters for get_filtered instead of only the first one (https://github.com/ansible-collections/community.network/issues/48). diff --git a/changelogs/fragments/6-routeros_facts-multiple-entries-per-iface.yml b/changelogs/fragments/6-routeros_facts-multiple-entries-per-iface.yml deleted file mode 100644 index 97ccc292..00000000 --- a/changelogs/fragments/6-routeros_facts-multiple-entries-per-iface.yml +++ /dev/null @@ -1,2 +0,0 @@ -breaking_changes: -- "routeros_facts - allow multiple addresses and neighbors per interface. This makes ``ansible_net_neighbors`` a list instead of a dict (https://github.com/ansible-collections/community.network/pull/6)." diff --git a/changelogs/fragments/60569-plugins-netconf-ce.yml b/changelogs/fragments/60569-plugins-netconf-ce.yml deleted file mode 100644 index 9d6ce194..00000000 --- a/changelogs/fragments/60569-plugins-netconf-ce.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - plugins-netconf-ce - to get attribute 'set-id' from rpc-reply. diff --git a/changelogs/fragments/62403-ce_bgp_neighbor_af_fix_parameter_name.yml b/changelogs/fragments/62403-ce_bgp_neighbor_af_fix_parameter_name.yml deleted file mode 100644 index 48cdb518..00000000 --- a/changelogs/fragments/62403-ce_bgp_neighbor_af_fix_parameter_name.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: -- ce_bgp_neighbor_af - Rename the parameter ``redirect_ip_vaildation`` to ``redirect_ip_validation`` (https://github.com/ansible/ansible/pull/62403). diff --git a/changelogs/fragments/62587-module_utils-network-cloudengine.yml b/changelogs/fragments/62587-module_utils-network-cloudengine.yml deleted file mode 100644 index 708128ca..00000000 --- a/changelogs/fragments/62587-module_utils-network-cloudengine.yml +++ /dev/null @@ -1,3 +0,0 @@ -bugfixes: - - "Cloudengine module_utils - the ``set-id`` (RPC-REPLY XML attribute) may change over the time althougth ``set-id`` is the identity of the next RPC packet." - - "Cloudengine netconf plugin - add a dispatch RPC function,just return original RPC-REPLY, the function is used by ``Cloudengine module_utils``." diff --git a/changelogs/fragments/62872-ce_config_too_many_quit_close_connection.yml b/changelogs/fragments/62872-ce_config_too_many_quit_close_connection.yml deleted file mode 100644 index cb5dd6a0..00000000 --- a/changelogs/fragments/62872-ce_config_too_many_quit_close_connection.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - ce_config - fixed issue - Re-building commands(config src) by replacing '#' with 'quit','quit' commands may close connection (https://github.com/ansible/ansible/issues/62872) diff --git a/changelogs/fragments/63362-remove-edgeos-filtering.yaml b/changelogs/fragments/63362-remove-edgeos-filtering.yaml deleted file mode 100644 index 9ed91ff4..00000000 --- a/changelogs/fragments/63362-remove-edgeos-filtering.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - edgeos_config - fix issue where module would silently filter out encrypted passwords diff --git a/changelogs/fragments/63513-ce_action_wait_prompt_trigger_time_out.yaml b/changelogs/fragments/63513-ce_action_wait_prompt_trigger_time_out.yaml deleted file mode 100644 index bd4ac9c6..00000000 --- a/changelogs/fragments/63513-ce_action_wait_prompt_trigger_time_out.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - action/ce - fix a bug, some new version os will not discard uncommitted configure with a return directly.(https://github.com/ansible/ansible/pull/63513). diff --git a/changelogs/fragments/65065-plugins-netconf-ce-fix.yaml b/changelogs/fragments/65065-plugins-netconf-ce-fix.yaml deleted file mode 100644 index 591fb38b..00000000 --- a/changelogs/fragments/65065-plugins-netconf-ce-fix.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - plugins-netconf-ce - Fix failed to get version information. diff --git a/changelogs/fragments/67500-fix-edgeos-config-single-quote-stripping.yaml b/changelogs/fragments/67500-fix-edgeos-config-single-quote-stripping.yaml deleted file mode 100644 index ae12f4d9..00000000 --- a/changelogs/fragments/67500-fix-edgeos-config-single-quote-stripping.yaml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - edgeos_config - fixed issue of handling single quotation marks. Now fails when unmatched (odd numbers) diff --git a/changelogs/fragments/67634-Update-to-add-missing-import.yml b/changelogs/fragments/67634-Update-to-add-missing-import.yml deleted file mode 100644 index c13cfd15..00000000 --- a/changelogs/fragments/67634-Update-to-add-missing-import.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - Some cloudengine modules were missing ``import __future__`` and ``metaclass``. (https://github.com/ansible/ansible/pull/67634). diff --git a/changelogs/fragments/67635-Update-to-add-missing-import.yml b/changelogs/fragments/67635-Update-to-add-missing-import.yml deleted file mode 100644 index 1c7d720e..00000000 --- a/changelogs/fragments/67635-Update-to-add-missing-import.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - Some cloudengine modules were missing ``import __future__`` and ``metaclass``. (https://github.com/ansible/ansible/pull/67635). diff --git a/changelogs/fragments/68-cloudengine_module_utils_remove_deprecated_version_2.9.yml b/changelogs/fragments/68-cloudengine_module_utils_remove_deprecated_version_2.9.yml deleted file mode 100644 index 51af4fd8..00000000 --- a/changelogs/fragments/68-cloudengine_module_utils_remove_deprecated_version_2.9.yml +++ /dev/null @@ -1,3 +0,0 @@ -bugfixes: - - Some cloudengine modules have options which should have been removed for Ansible 2.9. - see https://github.com/ansible/ansible/issues/67020 and https://github.com/ansible-collections/community.network/pull/68 diff --git a/changelogs/fragments/netconf_plugin_device_handler.yml b/changelogs/fragments/netconf_plugin_device_handler.yml deleted file mode 100644 index 8cde051a..00000000 --- a/changelogs/fragments/netconf_plugin_device_handler.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: -- Make netconf plugin configurable to set ncclient device handler name in netconf plugin (https://github.com/ansible/ansible/pull/65718) diff --git a/changelogs/fragments/network_action_plugin_fixes.yml b/changelogs/fragments/network_action_plugin_fixes.yml deleted file mode 100644 index 5f58ed7e..00000000 --- a/changelogs/fragments/network_action_plugin_fixes.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - Fixes in network action plugins to work in network connection plugin and modules in collection diff --git a/changelogs/fragments/routeros_facts-ipv6-crash.yml b/changelogs/fragments/routeros_facts-ipv6-crash.yml deleted file mode 100644 index ba83f7bf..00000000 --- a/changelogs/fragments/routeros_facts-ipv6-crash.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: -- "routeros_facts - Prevent crash of module when ``ipv6`` package is not installed" diff --git a/galaxy.yml b/galaxy.yml index 75bd3e34..97b38416 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -14,8 +14,7 @@ dependencies: cisco.aci: '>=0.0.1' check_point.mgmt: '>=0.1.0' fortinet.fortios: '>=0.1.0' -# f5networks.f5_modules: '>=0.1.0' repository: https://github.com/ansible-collections/community.network -documentation: https://github.com/ansible-collection-migration/community.network/tree/master/docs +#documentation: https://github.com/ansible-collection-migration/community.network/tree/master/docs homepage: https://github.com/ansible-collections/community.network issues: https://github.com/ansible-collections/community.network/issues diff --git a/meta/runtime.yml b/meta/runtime.yml index a11abdcd..3e4fa392 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,3 +1,4 @@ +requires_ansible: '>=2.9.10' plugin_routing: modules: pn_cluster: @@ -132,3 +133,188 @@ plugin_routing: deprecation: removal_version: 2.0.0 warning_text: see plugin documentation for details + onyx_aaa: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_aaa module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_aaa + onyx_bfd: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_bfd module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_bfd + onyx_bgp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_bgp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_bgp + onyx_buffer_pool: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_buffer_pool module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_buffer_pool + onyx_command: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_command module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_command + onyx_config: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_config module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_config + onyx_facts: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_facts module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_facts + onyx_igmp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_igmp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_igmp + onyx_igmp_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_igmp_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_igmp_interface + onyx_igmp_vlan: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_igmp_vlan module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_igmp_vlan + onyx_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_interface + onyx_l2_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_l2_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_l2_interface + onyx_l3_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_l3_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_l3_interface + onyx_linkagg: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_linkagg module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_linkagg + onyx_lldp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_lldp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_lldp + onyx_lldp_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_lldp_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_lldp_interface + onyx_magp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_magp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_magp + onyx_mlag_ipl: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_mlag_ipl module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_mlag_ipl + onyx_mlag_vip: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_mlag_vip module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_mlag_vip + onyx_ntp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_ntp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_ntp + onyx_ntp_servers_peers: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_ntp_servers_peers module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_ntp_servers_peers + onyx_ospf: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_ospf module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_ospf + onyx_pfc_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_pfc_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_pfc_interface + onyx_protocol: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_protocol module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_protocol + onyx_ptp_global: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_ptp_global module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_ptp_global + onyx_ptp_interface: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_ptp_interface module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_ptp_interface + onyx_qos: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_qos module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_qos + onyx_snmp: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_snmp module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_snmp + onyx_snmp_hosts: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_snmp_hosts module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_snmp_hosts + onyx_snmp_users: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_snmp_users module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_snmp_users + onyx_syslog_files: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_syslog_files module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_syslog_files + onyx_syslog_remote: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_syslog_remote module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_syslog_remote + onyx_traffic_class: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_traffic_class module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_traffic_class + onyx_username: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_username module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_username + onyx_vlan: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_vlan module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_vlan + onyx_vxlan: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_vxlan module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_vxlan + onyx_wjh: + deprecation: + removal_version: 2.0.0 + warning_text: The onyx_wjh module has been moved to the mellanox.onyx collection + redirect: mellanox.onyx.onyx_wjh diff --git a/plugins/action/onyx_config.py b/plugins/action/onyx_config.py deleted file mode 100644 index b1c9089b..00000000 --- a/plugins/action/onyx_config.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# (c) 2017, Red Hat, Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.ansible.netcommon.plugins.action.network import ActionModule as ActionNetworkModule - - -class ActionModule(ActionNetworkModule): - - def run(self, tmp=None, task_vars=None): - del tmp # tmp no longer has any effect - - self._config_module = True - return super(ActionModule, self).run(task_vars=task_vars) diff --git a/plugins/cliconf/onyx.py b/plugins/cliconf/onyx.py deleted file mode 100644 index af7690ef..00000000 --- a/plugins/cliconf/onyx.py +++ /dev/null @@ -1,77 +0,0 @@ -# -# (c) 2017 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -DOCUMENTATION = ''' ---- -cliconf: onyx -short_description: Use onyx cliconf to run command on Mellanox ONYX platform -description: - - This onyx plugin provides low level abstraction apis for - sending and receiving CLI commands from Mellanox ONYX network devices. -''' - -import json - -from itertools import chain - -from ansible.module_utils._text import to_text -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list -from ansible.plugins.cliconf import CliconfBase, enable_mode - - -class Cliconf(CliconfBase): - - def get_device_info(self): - device_info = {} - - reply = self.get('show version | json-print') - data = json.loads(reply) - device_info['network_os'] = data['Product name'] - device_info['network_os_version'] = data['Product release'] - device_info['network_os_version_summary'] = data['Version summary'] - device_info['network_os_model'] = data['Product model'] - - reply = self.get('show hosts | include Hostname') - data = to_text(reply, errors='surrogate_or_strict').strip() - hostname = data.split(':')[1] - hostname = hostname.strip() - device_info['network_os_hostname'] = hostname - - return device_info - - @enable_mode - def get_config(self, source='running', format='text', flags=None): - if source not in ('running',): - return self.invalid_params("fetching configuration from %s is not supported" % source) - cmd = 'show running-config' - return self.send_command(cmd) - - @enable_mode - def edit_config(self, command): - for cmd in chain(['configure terminal'], to_list(command), ['exit']): - self.send_command(cmd) - - def get(self, command, prompt=None, answer=None, sendonly=False, newline=True, check_all=False): - return self.send_command(command=command, prompt=prompt, answer=answer, sendonly=sendonly, newline=newline, check_all=check_all) - - def get_capabilities(self): - result = super(Cliconf, self).get_capabilities() - return json.dumps(result) diff --git a/plugins/doc_fragments/_f5.py b/plugins/doc_fragments/_f5.py deleted file mode 100644 index 3e43f013..00000000 --- a/plugins/doc_fragments/_f5.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - - -class ModuleDocFragment(object): - # Standard F5 documentation fragment - DOCUMENTATION = r''' -options: - provider: - description: - - A dict object containing connection details. - type: dict - suboptions: - password: - description: - - The password for the user account used to connect to the BIG-IP. - - You may omit this option by setting the environment variable C(F5_PASSWORD). - type: str - required: true - aliases: [ pass, pwd ] - server: - description: - - The BIG-IP host. - - You may omit this option by setting the environment variable C(F5_SERVER). - type: str - required: true - server_port: - description: - - The BIG-IP server port. - - You may omit this option by setting the environment variable C(F5_SERVER_PORT). - type: int - default: 443 - user: - description: - - The username to connect to the BIG-IP with. This user must have - administrative privileges on the device. - - You may omit this option by setting the environment variable C(F5_USER). - type: str - required: true - validate_certs: - description: - - If C(no), SSL certificates are not validated. Use this only - on personally controlled sites using self-signed certificates. - - You may omit this option by setting the environment variable C(F5_VALIDATE_CERTS). - type: bool - default: yes - timeout: - description: - - Specifies the timeout in seconds for communicating with the network device - for either connecting or sending commands. If the timeout is - exceeded before the operation is completed, the module will error. - type: int - ssh_keyfile: - description: - - Specifies the SSH keyfile to use to authenticate the connection to - the remote device. This argument is only used for I(cli) transports. - - You may omit this option by setting the environment variable C(ANSIBLE_NET_SSH_KEYFILE). - type: path - transport: - description: - - Configures the transport connection to use when connecting to the - remote device. - type: str - choices: [ cli, rest ] - default: rest - auth_provider: - description: - - Configures the auth provider for to obtain authentication tokens from the remote device. - - This option is really used when working with BIG-IQ devices. - type: str -notes: - - For more information on using Ansible to manage F5 Networks devices see U(https://www.ansible.com/integrations/networks/f5). - - Requires BIG-IP software version >= 12. - - The F5 modules only manipulate the running configuration of the F5 product. To ensure that BIG-IP - specific configuration persists to disk, be sure to include at least one task that uses the - M(bigip_config) module to save the running configuration. Refer to the module's documentation for - the correct usage of the module to save your running configuration. -''' diff --git a/plugins/doc_fragments/onyx.py b/plugins/doc_fragments/onyx.py deleted file mode 100644 index 86bc5435..00000000 --- a/plugins/doc_fragments/onyx.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -class ModuleDocFragment(object): - - # Standard files documentation fragment - DOCUMENTATION = r''' -options: - provider: - description: - - A dict object containing connection details. - type: dict - suboptions: - host: - description: - - Specifies the DNS host name or address for connecting to the remote - device over the specified transport. The value of host is used as - the destination address for the transport. - type: str - required: true - port: - description: - - Specifies the port to use when building the connection to the remote device. - type: int - default: 22 - username: - description: - - Configures the username to use to authenticate the connection to - the remote device. This value is used to authenticate - the SSH session. If the value is not specified in the task, the - value of environment variable C(ANSIBLE_NET_USERNAME) will be used instead. - type: str - password: - description: - - Specifies the password to use to authenticate the connection to - the remote device. This value is used to authenticate - the SSH session. If the value is not specified in the task, the - value of environment variable C(ANSIBLE_NET_PASSWORD) will be used instead. - type: str - timeout: - description: - - Specifies the timeout in seconds for communicating with the network device - for either connecting or sending commands. If the timeout is - exceeded before the operation is completed, the module will error. - type: int - default: 10 - ssh_keyfile: - description: - - Specifies the SSH key to use to authenticate the connection to - the remote device. This value is the path to the - key used to authenticate the SSH session. If the value is not specified - in the task, the value of environment variable C(ANSIBLE_NET_SSH_KEYFILE) - will be used instead. - type: path - authorize: - description: - - Instructs the module to enter privileged mode on the remote device - before sending any commands. If not specified, the device will - attempt to execute all commands in non-privileged mode. If the value - is not specified in the task, the value of environment variable - C(ANSIBLE_NET_AUTHORIZE) will be used instead. - type: bool - default: no - auth_pass: - description: - - Specifies the password to use if required to enter privileged mode - on the remote device. If I(authorize) is false, then this argument - does nothing. If the value is not specified in the task, the value of - environment variable C(ANSIBLE_NET_AUTH_PASS) will be used instead. - type: str -''' diff --git a/plugins/module_utils/f5_utils.py b/plugins/module_utils/f5_utils.py deleted file mode 100644 index 17994f99..00000000 --- a/plugins/module_utils/f5_utils.py +++ /dev/null @@ -1,383 +0,0 @@ -# -# Copyright 2016 F5 Networks Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - - -# Legacy - -try: - import bigsuds - bigsuds_found = True -except ImportError: - bigsuds_found = False - - -from ansible.module_utils.basic import env_fallback - - -def f5_argument_spec(): - return dict( - server=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_SERVER']) - ), - user=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_USER']) - ), - password=dict( - type='str', - aliases=['pass', 'pwd'], - required=True, - no_log=True, - fallback=(env_fallback, ['F5_PASSWORD']) - ), - validate_certs=dict( - default='yes', - type='bool', - fallback=(env_fallback, ['F5_VALIDATE_CERTS']) - ), - server_port=dict( - type='int', - default=443, - fallback=(env_fallback, ['F5_SERVER_PORT']) - ), - state=dict( - type='str', - default='present', - choices=['present', 'absent'] - ), - partition=dict( - type='str', - default='Common', - fallback=(env_fallback, ['F5_PARTITION']) - ) - ) - - -def f5_parse_arguments(module): - if not bigsuds_found: - module.fail_json(msg="the python bigsuds module is required") - - if module.params['validate_certs']: - import ssl - if not hasattr(ssl, 'SSLContext'): - module.fail_json( - msg="bigsuds does not support verifying certificates with python < 2.7.9." - "Either update python or set validate_certs=False on the task'") - - return ( - module.params['server'], - module.params['user'], - module.params['password'], - module.params['state'], - module.params['partition'], - module.params['validate_certs'], - module.params['server_port'] - ) - - -def bigip_api(bigip, user, password, validate_certs, port=443): - try: - if bigsuds.__version__ >= '1.0.4': - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password, verify=validate_certs, port=port) - elif bigsuds.__version__ == '1.0.3': - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password, verify=validate_certs) - else: - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - except TypeError: - # bigsuds < 1.0.3, no verify param - if validate_certs: - # Note: verified we have SSLContext when we parsed params - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - else: - import ssl - if hasattr(ssl, 'SSLContext'): - # Really, you should never do this. It disables certificate - # verification *globally*. But since older bigip libraries - # don't give us a way to toggle verification we need to - # disable it at the global level. - # From https://www.python.org/dev/peps/pep-0476/#id29 - ssl._create_default_https_context = ssl._create_unverified_context - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - - return api - - -# Fully Qualified name (with the partition) -def fq_name(partition, name): - if name is not None and not name.startswith('/'): - return '/%s/%s' % (partition, name) - return name - - -# Fully Qualified name (with partition) for a list -def fq_list_names(partition, list_names): - if list_names is None: - return None - return map(lambda x: fq_name(partition, x), list_names) - - -def to_commands(module, commands): - spec = { - 'command': dict(key=True), - 'prompt': dict(), - 'answer': dict() - } - transform = ComplexList(spec, module) - return transform(commands) - - -def run_commands(module, commands, check_rc=True): - responses = list() - commands = to_commands(module, to_list(commands)) - for cmd in commands: - cmd = module.jsonify(cmd) - rc, out, err = exec_command(module, cmd) - if check_rc and rc != 0: - module.fail_json(msg=to_text(err, errors='surrogate_then_replace'), rc=rc) - responses.append(to_text(out, errors='surrogate_then_replace')) - return responses - - -# New style - -from abc import ABCMeta, abstractproperty -from collections import defaultdict - -try: - from f5.bigip import ManagementRoot as BigIpMgmt - from f5.bigip.contexts import TransactionContextManager as BigIpTxContext - - from f5.bigiq import ManagementRoot as BigIqMgmt - - from f5.iworkflow import ManagementRoot as iWorkflowMgmt - from icontrol.exceptions import iControlUnexpectedHTTPError - HAS_F5SDK = True -except ImportError: - HAS_F5SDK = False - - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems, with_metaclass -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list, ComplexList -from ansible.module_utils.connection import exec_command -from ansible.module_utils._text import to_text - - -F5_COMMON_ARGS = dict( - server=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_SERVER']) - ), - user=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_USER']) - ), - password=dict( - type='str', - aliases=['pass', 'pwd'], - required=True, - no_log=True, - fallback=(env_fallback, ['F5_PASSWORD']) - ), - validate_certs=dict( - default='yes', - type='bool', - fallback=(env_fallback, ['F5_VALIDATE_CERTS']) - ), - server_port=dict( - type='int', - default=443, - fallback=(env_fallback, ['F5_SERVER_PORT']) - ), - state=dict( - type='str', - default='present', - choices=['present', 'absent'] - ), - partition=dict( - type='str', - default='Common', - fallback=(env_fallback, ['F5_PARTITION']) - ) -) - - -class AnsibleF5Client(object): - def __init__(self, argument_spec=None, supports_check_mode=False, - mutually_exclusive=None, required_together=None, - required_if=None, required_one_of=None, add_file_common_args=False, - f5_product_name='bigip', sans_state=False, sans_partition=False): - - self.f5_product_name = f5_product_name - - merged_arg_spec = dict() - merged_arg_spec.update(F5_COMMON_ARGS) - if argument_spec: - merged_arg_spec.update(argument_spec) - if sans_state: - del merged_arg_spec['state'] - if sans_partition: - del merged_arg_spec['partition'] - self.arg_spec = merged_arg_spec - - mutually_exclusive_params = [] - if mutually_exclusive: - mutually_exclusive_params += mutually_exclusive - - required_together_params = [] - if required_together: - required_together_params += required_together - - self.module = AnsibleModule( - argument_spec=merged_arg_spec, - supports_check_mode=supports_check_mode, - mutually_exclusive=mutually_exclusive_params, - required_together=required_together_params, - required_if=required_if, - required_one_of=required_one_of, - add_file_common_args=add_file_common_args - ) - - self.check_mode = self.module.check_mode - self._connect_params = self._get_connect_params() - - if 'transport' not in self.module.params or self.module.params['transport'] != 'cli': - try: - self.api = self._get_mgmt_root( - f5_product_name, **self._connect_params - ) - except iControlUnexpectedHTTPError as exc: - self.fail(str(exc)) - - def fail(self, msg): - self.module.fail_json(msg=msg) - - def _get_connect_params(self): - params = dict( - user=self.module.params['user'], - password=self.module.params['password'], - server=self.module.params['server'], - server_port=self.module.params['server_port'], - validate_certs=self.module.params['validate_certs'] - ) - return params - - def _get_mgmt_root(self, type, **kwargs): - if type == 'bigip': - return BigIpMgmt( - kwargs['server'], - kwargs['user'], - kwargs['password'], - port=kwargs['server_port'], - token='tmos' - ) - elif type == 'iworkflow': - return iWorkflowMgmt( - kwargs['server'], - kwargs['user'], - kwargs['password'], - port=kwargs['server_port'], - token='local' - ) - elif type == 'bigiq': - return BigIqMgmt( - kwargs['server'], - kwargs['user'], - kwargs['password'], - port=kwargs['server_port'], - auth_provider='local' - ) - - def reconnect(self): - """Attempts to reconnect to a device - - The existing token from a ManagementRoot can become invalid if you, - for example, upgrade the device (such as is done in the *_software - module. - - This method can be used to reconnect to a remote device without - having to re-instantiate the ArgumentSpec and AnsibleF5Client classes - it will use the same values that were initially provided to those - classes - - :return: - :raises iControlUnexpectedHTTPError - """ - self.api = self._get_mgmt_root( - self.f5_product_name, **self._connect_params - ) - - -class AnsibleF5Parameters(object): - def __init__(self, params=None): - self._values = defaultdict(lambda: None) - self._values['__warnings'] = [] - if params: - self.update(params=params) - - def update(self, params=None): - if params: - for k, v in iteritems(params): - if self.api_map is not None and k in self.api_map: - dict_to_use = self.api_map - map_key = self.api_map[k] - else: - dict_to_use = self._values - map_key = k - - # Handle weird API parameters like `dns.proxy.__iter__` by - # using a map provided by the module developer - class_attr = getattr(type(self), map_key, None) - if isinstance(class_attr, property): - # There is a mapped value for the api_map key - if class_attr.fset is None: - # If the mapped value does not have an associated setter - self._values[map_key] = v - else: - # The mapped value has a setter - setattr(self, map_key, v) - else: - # If the mapped value is not a @property - self._values[map_key] = v - - def __getattr__(self, item): - # Ensures that properties that weren't defined, and therefore stashed - # in the `_values` dict, will be retrievable. - return self._values[item] - - @property - def partition(self): - if self._values['partition'] is None: - return 'Common' - return self._values['partition'].strip('/') - - @partition.setter - def partition(self, value): - self._values['partition'] = value - - def _filter_params(self, params): - return dict((k, v) for k, v in iteritems(params) if v is not None) - - -class F5ModuleError(Exception): - pass diff --git a/plugins/module_utils/network/f5/__init__.py b/plugins/module_utils/network/f5/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/module_utils/network/f5/_common.py b/plugins/module_utils/network/f5/_common.py deleted file mode 100644 index ea18e661..00000000 --- a/plugins/module_utils/network/f5/_common.py +++ /dev/null @@ -1,573 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017 F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -import copy -import os -import re -import datetime - -from ansible.module_utils._text import to_text -from ansible.module_utils.basic import env_fallback -from ansible.module_utils.connection import exec_command -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ComplexList -from ansible.module_utils.six import iteritems -from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE -from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE -from collections import defaultdict - - -MANAGED_BY_ANNOTATION_VERSION = 'f5-ansible.version' -MANAGED_BY_ANNOTATION_MODIFIED = 'f5-ansible.last_modified' - - -f5_provider_spec = { - 'server': dict( - fallback=(env_fallback, ['F5_SERVER']) - ), - 'server_port': dict( - type='int', - default=443, - fallback=(env_fallback, ['F5_SERVER_PORT']) - ), - 'user': dict( - fallback=(env_fallback, ['F5_USER', 'ANSIBLE_NET_USERNAME']) - ), - 'password': dict( - no_log=True, - aliases=['pass', 'pwd'], - fallback=(env_fallback, ['F5_PASSWORD', 'ANSIBLE_NET_PASSWORD']) - ), - 'ssh_keyfile': dict( - type='path' - ), - 'validate_certs': dict( - type='bool', - default='yes', - fallback=(env_fallback, ['F5_VALIDATE_CERTS']) - ), - 'transport': dict( - choices=['cli', 'rest'], - default='rest' - ), - 'timeout': dict(type='int'), - 'auth_provider': dict(), -} - -f5_argument_spec = { - 'provider': dict(type='dict', options=f5_provider_spec), -} - - -def get_provider_argspec(): - return f5_provider_spec - - -def load_params(params): - provider = params.get('provider') or dict() - for key, value in iteritems(provider): - if key in f5_argument_spec: - if params.get(key) is None and value is not None: - params[key] = value - - -def is_empty_list(seq): - if len(seq) == 1: - if seq[0] == '' or seq[0] == 'none': - return True - return False - - -def fq_name(partition, value, sub_path=''): - """Returns a 'Fully Qualified' name - - A BIG-IP expects most names of resources to be in a fully-qualified - form. This means that both the simple name, and the partition need - to be combined. - - The Ansible modules, however, can accept (as names for several - resources) their name in the FQ format. This becomes an issue when - the FQ name and the partition are both specified as separate values. - - Consider the following examples. - - # Name not FQ - name: foo - partition: Common - - # Name FQ - name: /Common/foo - partition: Common - - This method will rectify the above situation and will, in both cases, - return the following for name. - - /Common/foo - - Args: - partition (string): The partition that you would want attached to - the name if the name has no partition. - value (string): The name that you want to attach a partition to. - This value will be returned unchanged if it has a partition - attached to it already. - sub_path (string): The sub path element. If defined the sub_path - will be inserted between partition and value. - This will also work on FQ names. - Returns: - string: The fully qualified name, given the input parameters. - """ - if value is not None and sub_path == '': - try: - int(value) - return '/{0}/{1}'.format(partition, value) - except (ValueError, TypeError): - if not value.startswith('/'): - return '/{0}/{1}'.format(partition, value) - if value is not None and sub_path != '': - try: - int(value) - return '/{0}/{1}/{2}'.format(partition, sub_path, value) - except (ValueError, TypeError): - if value.startswith('/'): - dummy, partition, name = value.split('/') - return '/{0}/{1}/{2}'.format(partition, sub_path, name) - if not value.startswith('/'): - return '/{0}/{1}/{2}'.format(partition, sub_path, value) - return value - - -# Fully Qualified name (with partition) for a list -def fq_list_names(partition, list_names): - if list_names is None: - return None - return map(lambda x: fq_name(partition, x), list_names) - - -def to_commands(module, commands): - spec = { - 'command': dict(key=True), - 'prompt': dict(), - 'answer': dict() - } - transform = ComplexList(spec, module) - return transform(commands) - - -def run_commands(module, commands, check_rc=True): - responses = list() - commands = to_commands(module, to_list(commands)) - for cmd in commands: - cmd = module.jsonify(cmd) - rc, out, err = exec_command(module, cmd) - if check_rc and rc != 0: - raise F5ModuleError(to_text(err, errors='surrogate_then_replace')) - result = to_text(out, errors='surrogate_then_replace') - responses.append(result) - return responses - - -def flatten_boolean(value): - truthy = list(BOOLEANS_TRUE) + ['enabled', 'True', 'true'] - falsey = list(BOOLEANS_FALSE) + ['disabled', 'False', 'false'] - if value is None: - return None - elif value in truthy: - return 'yes' - elif value in falsey: - return 'no' - - -def is_cli(module): - transport = module.params['transport'] - provider_transport = (module.params['provider'] or {}).get('transport') - result = 'cli' in (transport, provider_transport) - return result - - -def is_valid_hostname(host): - """Reasonable attempt at validating a hostname - - Compiled from various paragraphs outlined here - https://tools.ietf.org/html/rfc3696#section-2 - https://tools.ietf.org/html/rfc1123 - - Notably, - * Host software MUST handle host names of up to 63 characters and - SHOULD handle host names of up to 255 characters. - * The "LDH rule", after the characters that it permits. (letters, digits, hyphen) - * If the hyphen is used, it is not permitted to appear at - either the beginning or end of a label - - :param host: - :return: - """ - if len(host) > 255: - return False - host = host.rstrip(".") - allowed = re.compile(r'(?!-)[A-Z0-9-]{1,63}(? 255: - return False - host = host.rstrip(".") - allowed = re.compile(r'(?!-)[A-Z0-9-]{1,63}(? 1: - return True - return False - - -def transform_name(partition='', name='', sub_path=''): - if partition != '': - if name.startswith(partition + '/'): - name = name.replace(partition + '/', '') - if name.startswith('/' + partition + '/'): - name = name.replace('/' + partition + '/', '') - - if name: - name = name.replace('/', '~') - name = name.replace('%', '%25') - - if partition: - partition = partition.replace('/', '~') - if not partition.startswith('~'): - partition = '~' + partition - else: - if sub_path: - raise F5ModuleError( - 'When giving the subPath component include partition as well.' - ) - - if sub_path and partition: - sub_path = '~' + sub_path - - if name and partition: - name = '~' + name - - result = partition + sub_path + name - return result - - -def is_ansible_debug(module): - if module._debug and module._verbosity >= 4: - return True - return False - - -def is_uuid(uuid=None): - """Check to see if value is an F5 UUID - - UUIDs are used in BIG-IQ and in select areas of BIG-IP (notably ASM). This method - will check to see if the provided value matches a UUID as known by these products. - - Args: - uuid (string): The value to check for UUID-ness - - Returns: - bool: - """ - if uuid is None: - return False - pattern = r'[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}' - if re.match(pattern, uuid): - return True - return False - - -def on_bigip(): - if os.path.exists('/usr/bin/tmsh'): - return True - return False - - -def mark_managed_by(ansible_version, params): - metadata = [] - result = copy.deepcopy(params) - found1 = False - found2 = False - mark1 = dict( - name=MANAGED_BY_ANNOTATION_VERSION, - value=ansible_version, - persist='true' - ) - mark2 = dict( - name=MANAGED_BY_ANNOTATION_MODIFIED, - value=str(datetime.datetime.utcnow()), - persist='true' - ) - - if 'metadata' not in result: - result['metadata'] = [mark1, mark2] - return result - - for x in params['metadata']: - if x['name'] == MANAGED_BY_ANNOTATION_VERSION: - found1 = True - metadata.append(mark1) - if x['name'] == MANAGED_BY_ANNOTATION_MODIFIED: - found2 = True - metadata.append(mark1) - else: - metadata.append(x) - if not found1: - metadata.append(mark1) - if not found2: - metadata.append(mark2) - - result['metadata'] = metadata - return result - - -def only_has_managed_metadata(metadata): - managed = [ - MANAGED_BY_ANNOTATION_MODIFIED, - MANAGED_BY_ANNOTATION_VERSION, - ] - - for x in metadata: - if x['name'] not in managed: - return False - return True - - -class Noop(object): - """Represent no-operation required - - This class is used in the Difference engine to specify when an attribute - has not changed. Difference attributes may return an instance of this - class as a means to indicate when the attribute has not changed. - - The Noop object allows attributes to be set to None when sending updates - to the API. `None` is technically a valid value in some cases (it indicates - that the attribute should be removed from the resource). - """ - pass - - -class F5BaseClient(object): - def __init__(self, *args, **kwargs): - self.params = kwargs - self.module = kwargs.get('module', None) - load_params(self.params) - self._client = None - - @property - def api(self): - raise F5ModuleError("Management root must be used from the concrete product classes.") - - def reconnect(self): - """Attempts to reconnect to a device - - The existing token from a ManagementRoot can become invalid if you, - for example, upgrade the device (such as is done in the *_software - module. - - This method can be used to reconnect to a remote device without - having to re-instantiate the ArgumentSpec and AnsibleF5Client classes - it will use the same values that were initially provided to those - classes - - :return: - :raises iControlUnexpectedHTTPError - """ - self._client = None - - @staticmethod - def validate_params(key, store): - if key in store and store[key] is not None: - return True - else: - return False - - def merge_provider_params(self): - result = dict() - provider = self.params.get('provider', None) - if not provider: - provider = {} - - self.merge_provider_server_param(result, provider) - self.merge_provider_server_port_param(result, provider) - self.merge_provider_validate_certs_param(result, provider) - self.merge_provider_auth_provider_param(result, provider) - self.merge_provider_user_param(result, provider) - self.merge_provider_password_param(result, provider) - - return result - - def merge_provider_server_param(self, result, provider): - if self.validate_params('server', provider): - result['server'] = provider['server'] - elif self.validate_params('F5_SERVER', os.environ): - result['server'] = os.environ['F5_SERVER'] - else: - raise F5ModuleError('Server parameter cannot be None or missing, please provide a valid value') - - def merge_provider_server_port_param(self, result, provider): - if self.validate_params('server_port', provider): - result['server_port'] = provider['server_port'] - elif self.validate_params('F5_SERVER_PORT', os.environ): - result['server_port'] = os.environ['F5_SERVER_PORT'] - else: - result['server_port'] = 443 - - def merge_provider_validate_certs_param(self, result, provider): - if self.validate_params('validate_certs', provider): - result['validate_certs'] = provider['validate_certs'] - elif self.validate_params('F5_VALIDATE_CERTS', os.environ): - result['validate_certs'] = os.environ['F5_VALIDATE_CERTS'] - else: - result['validate_certs'] = True - if result['validate_certs'] in BOOLEANS_TRUE: - result['validate_certs'] = True - else: - result['validate_certs'] = False - - def merge_provider_auth_provider_param(self, result, provider): - if self.validate_params('auth_provider', provider): - result['auth_provider'] = provider['auth_provider'] - elif self.validate_params('F5_AUTH_PROVIDER', os.environ): - result['auth_provider'] = os.environ['F5_AUTH_PROVIDER'] - else: - result['auth_provider'] = None - - # Handle a specific case of the user specifying ``|default(omit)`` - # as the value to the auth_provider. - # - # In this case, Ansible will inject the omit-placeholder value - # and the module params incorrectly interpret this. This case - # can occur when specifying ``|default(omit)`` for a variable - # value defined in the ``environment`` section of a Play. - # - # An example of the omit placeholder is shown below. - # - # __omit_place_holder__11bd71a2840bff144594b9cc2149db814256f253 - # - if result['auth_provider'] is not None and '__omit_place_holder__' in result['auth_provider']: - result['auth_provider'] = None - - def merge_provider_user_param(self, result, provider): - if self.validate_params('user', provider): - result['user'] = provider['user'] - elif self.validate_params('F5_USER', os.environ): - result['user'] = os.environ.get('F5_USER') - elif self.validate_params('ANSIBLE_NET_USERNAME', os.environ): - result['user'] = os.environ.get('ANSIBLE_NET_USERNAME') - else: - result['user'] = None - - def merge_provider_password_param(self, result, provider): - if self.validate_params('password', provider): - result['password'] = provider['password'] - elif self.validate_params('F5_PASSWORD', os.environ): - result['password'] = os.environ.get('F5_PASSWORD') - elif self.validate_params('ANSIBLE_NET_PASSWORD', os.environ): - result['password'] = os.environ.get('ANSIBLE_NET_PASSWORD') - else: - result['password'] = None - - -class AnsibleF5Parameters(object): - def __init__(self, *args, **kwargs): - self._values = defaultdict(lambda: None) - self._values['__warnings'] = [] - self.client = kwargs.pop('client', None) - self._module = kwargs.pop('module', None) - self._params = {} - - params = kwargs.pop('params', None) - if params: - self.update(params=params) - self._params.update(params) - - def update(self, params=None): - if params: - self._params.update(params) - for k, v in iteritems(params): - # Adding this here because ``username`` is a connection parameter - # and in cases where it is also an API parameter, we run the risk - # of overriding the specified parameter with the connection parameter. - # - # Since this is a problem, and since "username" is never a valid - # parameter outside its usage in connection params (where we do not - # use the ApiParameter or ModuleParameters classes) it is safe to - # skip over it if it is provided. - if k == 'password': - continue - if self.api_map is not None and k in self.api_map: - map_key = self.api_map[k] - else: - map_key = k - - # Handle weird API parameters like `dns.proxy.__iter__` by - # using a map provided by the module developer - class_attr = getattr(type(self), map_key, None) - if isinstance(class_attr, property): - # There is a mapped value for the api_map key - if class_attr.fset is None: - # If the mapped value does not have - # an associated setter - self._values[map_key] = v - else: - # The mapped value has a setter - setattr(self, map_key, v) - else: - # If the mapped value is not a @property - self._values[map_key] = v - - def api_params(self): - result = {} - for api_attribute in self.api_attributes: - if self.api_map is not None and api_attribute in self.api_map: - result[api_attribute] = getattr(self, self.api_map[api_attribute]) - else: - result[api_attribute] = getattr(self, api_attribute) - result = self._filter_params(result) - return result - - def __getattr__(self, item): - # Ensures that properties that weren't defined, and therefore stashed - # in the `_values` dict, will be retrievable. - return self._values[item] - - @property - def partition(self): - if self._values['partition'] is None: - return 'Common' - return self._values['partition'].strip('/') - - @partition.setter - def partition(self, value): - self._values['partition'] = value - - def _filter_params(self, params): - return dict((k, v) for k, v in iteritems(params) if v is not None) - - -class F5ModuleError(Exception): - pass diff --git a/plugins/module_utils/network/f5/_compare.py b/plugins/module_utils/network/f5/_compare.py deleted file mode 100644 index f45dabe9..00000000 --- a/plugins/module_utils/network/f5/_compare.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017 F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -from ansible.module_utils.six import iteritems - - -def cmp_simple_list(want, have): - if want is None: - return None - if have is None and want in ['', 'none']: - return None - if have is not None and want in ['', 'none']: - return [] - if have is None: - return want - if set(want) != set(have): - return want - return None - - -def cmp_str_with_none(want, have): - if want is None: - return None - if have is None and want == '': - return None - if want != have: - return want - - -def compare_complex_list(want, have): - """Performs a complex list comparison - - A complex list is a list of dictionaries - - Args: - want (list): List of dictionaries to compare with second parameter. - have (list): List of dictionaries compare with first parameter. - - Returns: - bool: - """ - if want == [] and have is None: - return None - if want is None: - return None - w = [] - h = [] - for x in want: - tmp = [(str(k), str(v)) for k, v in iteritems(x)] - w += tmp - for x in have: - tmp = [(str(k), str(v)) for k, v in iteritems(x)] - h += tmp - if set(w) == set(h): - return None - else: - return want - - -def compare_dictionary(want, have): - """Performs a dictionary comparison - - Args: - want (dict): Dictionary to compare with second parameter. - have (dict): Dictionary to compare with first parameter. - - Returns: - bool: - """ - if want == {} and have is None: - return None - if want is None: - return None - w = [(str(k), str(v)) for k, v in iteritems(want)] - h = [(str(k), str(v)) for k, v in iteritems(have)] - if set(w) == set(h): - return None - else: - return want diff --git a/plugins/module_utils/network/f5/_icontrol.py b/plugins/module_utils/network/f5/_icontrol.py deleted file mode 100644 index e38db2b4..00000000 --- a/plugins/module_utils/network/f5/_icontrol.py +++ /dev/null @@ -1,612 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -import os - -try: - from StringIO import StringIO -except ImportError: - from io import StringIO - -try: - from BytesIO import BytesIO -except ImportError: - from io import BytesIO - -from ansible.module_utils.urls import urlparse -from ansible.module_utils.urls import generic_urlparse -from ansible.module_utils.urls import Request - -try: - import json as _json -except ImportError: - import simplejson as _json - -try: - from library.module_utils.network.f5.common import F5ModuleError -except ImportError: - from ansible_collections.community.network.plugins.module_utils.network.f5._common import F5ModuleError - - -"""An F5 REST API URI handler. - -Use this module to make calls to an F5 REST server. It is influenced by the same -API that the Python ``requests`` tool uses, but the two are not the same, as the -library here is **much** more simple and targeted specifically to F5's needs. - -The ``requests`` design was chosen due to familiarity with the tool. Internally, -the classes contained herein use Ansible native libraries. - -The means by which you should use it are similar to ``requests`` basic usage. - -Authentication is not handled for you automatically by this library, however it *is* -handled automatically for you in the supporting F5 module_utils code; specifically the -different product module_util files (bigip.py, bigiq.py, etc). - -Internal (non-module) usage of this library looks like this. - -``` -# Create a session instance -mgmt = iControlRestSession() -mgmt.verify = False - -server = '1.1.1.1' -port = 443 - -# Payload used for getting an initial authentication token -payload = { - 'username': 'admin', - 'password': 'secret', - 'loginProviderName': 'tmos' -} - -# Create URL to call, injecting server and port -url = f"https://{server}:{port}/mgmt/shared/authn/login" - -# Call the API -resp = session.post(url, json=payload) - -# View the response -print(resp.json()) - -# Update the session with the authentication token -session.headers['X-F5-Auth-Token'] = resp.json()['token']['token'] - -# Create another URL to call, injecting server and port -url = f"https://{server}:{port}/mgmt/tm/ltm/virtual/~Common~virtual1" - -# Call the API -resp = session.get(url) - -# View the details of a virtual payload -print(resp.json()) -``` -""" - -from ansible.module_utils.six.moves.urllib.error import HTTPError - - -class Response(object): - def __init__(self): - self._content = None - self.status = None - self.headers = dict() - self.url = None - self.reason = None - self.request = None - self.msg = None - - @property - def content(self): - return self._content - - @property - def raw_content(self): - return self._content - - def json(self): - return _json.loads(self._content or 'null') - - @property - def ok(self): - if self.status is not None and int(self.status) > 400: - return False - try: - response = self.json() - if 'code' in response and response['code'] > 400: - return False - except ValueError: - pass - return True - - -class iControlRestSession(object): - """Represents a session that communicates with a BigIP. - - This acts as a loose wrapper around Ansible's ``Request`` class. We're doing - this as interim work until we move to the httpapi connector. - """ - def __init__(self, headers=None, use_proxy=True, force=False, timeout=120, - validate_certs=True, url_username=None, url_password=None, - http_agent=None, force_basic_auth=False, follow_redirects='urllib2', - client_cert=None, client_key=None, cookies=None): - self.request = Request( - headers=headers, - use_proxy=use_proxy, - force=force, - timeout=timeout, - validate_certs=validate_certs, - url_username=url_username, - url_password=url_password, - http_agent=http_agent, - force_basic_auth=force_basic_auth, - follow_redirects=follow_redirects, - client_cert=client_cert, - client_key=client_key, - cookies=cookies - ) - self.last_url = None - - def get_headers(self, result): - try: - return dict(result.getheaders()) - except AttributeError: - return result.headers - - def update_response(self, response, result): - response.headers = self.get_headers(result) - response._content = result.read() - response.status = result.getcode() - response.url = result.geturl() - response.msg = "OK (%s bytes)" % response.headers.get('Content-Length', 'unknown') - - def send(self, method, url, **kwargs): - response = Response() - - # Set the last_url called - # - # This is used by the object destructor to erase the token when the - # ModuleManager exits and destroys the iControlRestSession object - self.last_url = url - - body = None - data = kwargs.pop('data', None) - json = kwargs.pop('json', None) - - if not data and json is not None: - self.request.headers['Content-Type'] = 'application/json' - body = _json.dumps(json) - if not isinstance(body, bytes): - body = body.encode('utf-8') - if data: - body = data - if body: - kwargs['data'] = body - - try: - result = self.request.open(method, url, **kwargs) - except HTTPError as e: - # Catch HTTPError delivered from Ansible - # - # The structure of this object, in Ansible 2.8 is - # - # HttpError { - # args - # characters_written - # close - # code - # delete - # errno - # file - # filename - # filename2 - # fp - # getcode - # geturl - # hdrs - # headers - # info - # msg - # name - # reason - # strerror - # url - # with_traceback - # } - self.update_response(response, e) - return response - - self.update_response(response, result) - return response - - def delete(self, url, **kwargs): - return self.send('DELETE', url, **kwargs) - - def get(self, url, **kwargs): - return self.send('GET', url, **kwargs) - - def patch(self, url, data=None, **kwargs): - return self.send('PATCH', url, data=data, **kwargs) - - def post(self, url, data=None, **kwargs): - return self.send('POST', url, data=data, **kwargs) - - def put(self, url, data=None, **kwargs): - return self.send('PUT', url, data=data, **kwargs) - - def __del__(self): - if self.last_url is None: - return - token = self.request.headers.get('X-F5-Auth-Token', None) - if not token: - return - try: - p = generic_urlparse(urlparse(self.last_url)) - uri = "https://{0}:{1}/mgmt/shared/authz/tokens/{2}".format( - p['hostname'], p['port'], token - ) - self.delete(uri) - except ValueError: - pass - - -class TransactionContextManager(object): - def __init__(self, client, validate_only=False): - self.client = client - self.validate_only = validate_only - self.transid = None - - def __enter__(self): - uri = "https://{0}:{1}/mgmt/tm/transaction/".format( - self.client.provider['server'], - self.client.provider['server_port'] - ) - resp = self.client.api.post(uri, json={}) - if resp.status not in [200]: - raise Exception - try: - response = resp.json() - except ValueError as ex: - raise F5ModuleError(str(ex)) - - self.transid = response['transId'] - self.client.api.request.headers['X-F5-REST-Coordination-Id'] = self.transid - return self.client - - def __exit__(self, exc_type, exc_value, exc_tb): - self.client.api.request.headers.pop('X-F5-REST-Coordination-Id') - if exc_tb is None: - uri = "https://{0}:{1}/mgmt/tm/transaction/{2}".format( - self.client.provider['server'], - self.client.provider['server_port'], - self.transid - ) - params = dict( - state="VALIDATING", - validateOnly=self.validate_only - ) - resp = self.client.api.patch(uri, json=params) - if resp.status not in [200]: - raise Exception - - -def download_asm_file(client, url, dest): - """Download an ASM file from the remote device - - This method handles issues with ASM file endpoints that allow - downloads of ASM objects on the BIG-IP. - - Arguments: - client (object): The F5RestClient connection object. - url (string): The URL to download. - dest (string): The location on (Ansible controller) disk to store the file. - - Returns: - bool: True on success. False otherwise. - """ - - with open(dest, 'wb') as fileobj: - headers = { - 'Content-Type': 'application/json' - } - data = {'headers': headers, - 'verify': False - } - - response = client.api.get(url, headers=headers, json=data) - if response.status == 200: - if 'Content-Length' not in response.headers: - error_message = "The Content-Length header is not present." - raise F5ModuleError(error_message) - - length = response.headers['Content-Length'] - - if int(length) > 0: - fileobj.write(response.content) - else: - error = "Invalid Content-Length value returned: %s ," \ - "the value should be greater than 0" % length - raise F5ModuleError(error) - - -def download_file(client, url, dest): - """Download a file from the remote device - - This method handles the chunking needed to download a file from - a given URL on the BIG-IP. - - Arguments: - client (object): The F5RestClient connection object. - url (string): The URL to download. - dest (string): The location on (Ansible controller) disk to store the file. - - Returns: - bool: True on success. False otherwise. - """ - with open(dest, 'wb') as fileobj: - chunk_size = 512 * 1024 - start = 0 - end = chunk_size - 1 - size = 0 - current_bytes = 0 - - while True: - content_range = "%s-%s/%s" % (start, end, size) - headers = { - 'Content-Range': content_range, - 'Content-Type': 'application/octet-stream' - } - data = { - 'headers': headers, - 'verify': False, - 'stream': False - } - response = client.api.get(url, headers=headers, json=data) - if response.status == 200: - # If the size is zero, then this is the first time through - # the loop and we don't want to write data because we - # haven't yet figured out the total size of the file. - if size > 0: - current_bytes += chunk_size - fileobj.write(response.raw_content) - # Once we've downloaded the entire file, we can break out of - # the loop - if end == size: - break - crange = response.headers['Content-Range'] - # Determine the total number of bytes to read. - if size == 0: - size = int(crange.split('/')[-1]) - 1 - # If the file is smaller than the chunk_size, the BigIP - # will return an HTTP 400. Adjust the chunk_size down to - # the total file size... - if chunk_size > size: - end = size - # ...and pass on the rest of the code. - continue - start += chunk_size - if (current_bytes + chunk_size) > size: - end = size - else: - end = start + chunk_size - 1 - return True - - -def upload_file(client, url, src, dest=None): - """Upload a file to an arbitrary URL. - - This method is responsible for correctly chunking an upload request to an - arbitrary file worker URL. - - Arguments: - client (object): The F5RestClient connection object. - url (string): The URL to upload a file to. - src (string): The file to be uploaded. - dest (string): The file name to create on the remote device. - - Examples: - The ``dest`` may be either an absolute or relative path. The basename - of the path is used as the remote file name upon upload. For instance, - in the example below, ``BIGIP-13.1.0.8-0.0.3.iso`` would be the name - of the remote file. - - The specified URL should be the full URL to where you want to upload a - file. BIG-IP has many different URLs that can be used to handle different - types of files. This is why a full URL is required. - - >>> from ansible_collections.community.network.plugins.module_utils.network.f5._icontrol import upload_client - >>> url = 'https://{0}:{1}/mgmt/cm/autodeploy/software-image-uploads'.format( - ... self.client.provider['server'], - ... self.client.provider['server_port'] - ... ) - >>> dest = '/path/to/BIGIP-13.1.0.8-0.0.3.iso' - >>> upload_file(self.client, url, dest) - True - - Returns: - bool: True on success. False otherwise. - - Raises: - F5ModuleError: Raised if ``retries`` limit is exceeded. - """ - if isinstance(src, StringIO) or isinstance(src, BytesIO): - fileobj = src - else: - fileobj = open(src, 'rb') - - try: - size = os.stat(src).st_size - is_file = True - except TypeError: - src.seek(0, os.SEEK_END) - size = src.tell() - src.seek(0) - is_file = False - - # This appears to be the largest chunk size that iControlREST can handle. - # - # The trade-off you are making by choosing a chunk size is speed, over size of - # transmission. A lower chunk size will be slower because a smaller amount of - # data is read from disk and sent via HTTP. Lots of disk reads are slower and - # There is overhead in sending the request to the BIG-IP. - # - # Larger chunk sizes are faster because more data is read from disk in one - # go, and therefore more data is transmitted to the BIG-IP in one HTTP request. - # - # If you are transmitting over a slow link though, it may be more reliable to - # transmit many small chunks that fewer large chunks. It will clearly take - # longer, but it may be more robust. - chunk_size = 1024 * 7168 - start = 0 - retries = 0 - if dest is None and is_file: - basename = os.path.basename(src) - else: - basename = dest - url = '{0}/{1}'.format(url.rstrip('/'), basename) - - while True: - if retries == 3: - # Retries are used here to allow the REST API to recover if you kill - # an upload mid-transfer. - # - # There exists a case where retrying a new upload will result in the - # API returning the POSTed payload (in bytes) with a non-200 response - # code. - # - # Retrying (after seeking back to 0) seems to resolve this problem. - raise F5ModuleError( - "Failed to upload file too many times." - ) - try: - file_slice = fileobj.read(chunk_size) - if not file_slice: - break - - current_bytes = len(file_slice) - if current_bytes < chunk_size: - end = size - else: - end = start + current_bytes - headers = { - 'Content-Range': '%s-%s/%s' % (start, end - 1, size), - 'Content-Type': 'application/octet-stream' - } - - # Data should always be sent using the ``data`` keyword and not the - # ``json`` keyword. This allows bytes to be sent (such as in the case - # of uploading ISO files. - response = client.api.post(url, headers=headers, data=file_slice) - - if response.status != 200: - # When this fails, the output is usually the body of whatever you - # POSTed. This is almost always unreadable because it is a series - # of bytes. - # - # Therefore, including an empty exception here. - raise F5ModuleError() - start += current_bytes - except F5ModuleError: - # You must seek back to the beginning of the file upon exception. - # - # If this is not done, then you risk uploading a partial file. - fileobj.seek(0) - retries += 1 - return True - - -def tmos_version(client): - uri = "https://{0}:{1}/mgmt/tm/sys/".format( - client.provider['server'], - client.provider['server_port'], - ) - resp = client.api.get(uri) - - try: - response = resp.json() - except ValueError as ex: - raise F5ModuleError(str(ex)) - - if 'code' in response and response['code'] in [400, 403]: - if 'message' in response: - raise F5ModuleError(response['message']) - else: - raise F5ModuleError(resp.content) - - to_parse = urlparse(response['selfLink']) - query = to_parse.query - version = query.split('=')[1] - return version - - -def bigiq_version(client): - uri = "https://{0}:{1}/mgmt/shared/resolver/device-groups/cm-shared-all-big-iqs/devices".format( - client.provider['server'], - client.provider['server_port'], - ) - query = "?$select=version" - - resp = client.api.get(uri + query) - - try: - response = resp.json() - except ValueError as ex: - raise F5ModuleError(str(ex)) - - if 'code' in response and response['code'] in [400, 403]: - if 'message' in response: - raise F5ModuleError(response['message']) - else: - raise F5ModuleError(resp.content) - - if 'items' in response: - version = response['items'][0]['version'] - return version - - raise F5ModuleError( - 'Failed to retrieve BIGIQ version information.' - ) - - -def module_provisioned(client, module_name): - provisioned = modules_provisioned(client) - if module_name in provisioned: - return True - return False - - -def modules_provisioned(client): - """Returns a list of all provisioned modules - - Args: - client: Client connection to the BIG-IP - - Returns: - A list of provisioned modules in their short name for. - For example, ['afm', 'asm', 'ltm'] - """ - uri = "https://{0}:{1}/mgmt/tm/sys/provision".format( - client.provider['server'], - client.provider['server_port'] - ) - resp = client.api.get(uri) - - try: - response = resp.json() - except ValueError as ex: - raise F5ModuleError(str(ex)) - - if 'code' in response and response['code'] in [400, 403]: - if 'message' in response: - raise F5ModuleError(response['message']) - else: - raise F5ModuleError(resp.content) - if 'items' not in response: - return [] - return [x['name'] for x in response['items'] if x['level'] != 'none'] diff --git a/plugins/module_utils/network/f5/_ipaddress.py b/plugins/module_utils/network/f5/_ipaddress.py deleted file mode 100644 index 0ee9baf4..00000000 --- a/plugins/module_utils/network/f5/_ipaddress.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2018 F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import validate_ip_address - -try: - # Ansible 2.6 and later - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import validate_ip_v6_address -except ImportError: - import socket - - # Ansible 2.5 and earlier - # - # This method is simply backported from the 2.6 source code. - def validate_ip_v6_address(address): - try: - socket.inet_pton(socket.AF_INET6, address) - except socket.error: - return False - return True - - -try: - from library.module_utils.compat.ipaddress import ip_interface - from library.module_utils.compat.ipaddress import ip_network -except ImportError: - from ansible_collections.ansible.netcommon.plugins.module_utils.compat.ipaddress import ip_interface - from ansible_collections.ansible.netcommon.plugins.module_utils.compat.ipaddress import ip_network - - -def is_valid_ip(addr, type='all'): - if type in ['all', 'ipv4']: - if validate_ip_address(addr): - return True - if type in ['all', 'ipv6']: - if validate_ip_v6_address(addr): - return True - return False - - -def ipv6_netmask_to_cidr(mask): - """converts an IPv6 netmask to CIDR form - - According to the link below, CIDR is the only official way to specify - a subset of IPv6. With that said, the same link provides a way to - loosely convert an netmask to a CIDR. - - Arguments: - mask (string): The IPv6 netmask to convert to CIDR - - Returns: - int: The CIDR representation of the netmask - - References: - https://stackoverflow.com/a/33533007 - http://v6decode.com/ - """ - bit_masks = [ - 0, 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, - 0xfc00, 0xfe00, 0xff00, 0xff80, 0xffc0, - 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, - 0xffff - ] - count = 0 - try: - for w in mask.split(':'): - if not w or int(w, 16) == 0: - break - count += bit_masks.index(int(w, 16)) - return count - except Exception: - return -1 - - -def is_valid_ip_network(address): - try: - ip_network(u'{0}'.format(address)) - return True - except ValueError: - return False - - -def is_valid_ip_interface(address): - try: - ip_interface(u'{0}'.format(address)) - return True - except ValueError: - return False - - -def get_netmask(address): - addr = ip_network(u'{0}'.format(address)) - netmask = addr.netmask.compressed - return netmask - - -def compress_address(address): - addr = ip_network(u'{0}'.format(address)) - result = addr.compressed.split('/')[0] - return result diff --git a/plugins/module_utils/network/f5/iworkflow.py b/plugins/module_utils/network/f5/iworkflow.py deleted file mode 100644 index a44e5874..00000000 --- a/plugins/module_utils/network/f5/iworkflow.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017 F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -import time - -try: - from f5.iworkflow import ManagementRoot - from icontrol.exceptions import iControlUnexpectedHTTPError - HAS_F5SDK = True -except ImportError: - HAS_F5SDK = False - -try: - from library.module_utils.network.f5.common import F5BaseClient - from library.module_utils.network.f5.common import F5ModuleError -except ImportError: - from ansible_collections.community.network.plugins.module_utils.network.f5._common import F5BaseClient - from ansible_collections.community.network.plugins.module_utils.network.f5._common import F5ModuleError - - -class F5Client(F5BaseClient): - @property - def api(self): - exc = None - if self._client: - return self._client - for x in range(0, 3): - try: - server = self.params['provider']['server'] or self.params['server'] - user = self.params['provider']['user'] or self.params['user'] - password = self.params['provider']['password'] or self.params['password'] - server_port = self.params['provider']['server_port'] or self.params['server_port'] or 443 - validate_certs = self.params['provider']['validate_certs'] or self.params['validate_certs'] - - result = ManagementRoot( - server, - user, - password, - port=server_port, - verify=validate_certs, - token='local' - ) - self._client = result - return self._client - except Exception as ex: - exc = ex - time.sleep(3) - error = 'Unable to connect to {0} on port {1}.'.format(self.params['server'], self.params['server_port']) - if exc is not None: - error += ' The reported error was "{0}".'.format(str(exc)) - raise F5ModuleError(error) diff --git a/plugins/module_utils/network/f5/legacy.py b/plugins/module_utils/network/f5/legacy.py deleted file mode 100644 index bb2189c2..00000000 --- a/plugins/module_utils/network/f5/legacy.py +++ /dev/null @@ -1,121 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017 F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -try: - import bigsuds - bigsuds_found = True -except ImportError: - bigsuds_found = False - - -from ansible.module_utils.basic import env_fallback - - -def f5_argument_spec(): - return dict( - server=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_SERVER']) - ), - user=dict( - type='str', - required=True, - fallback=(env_fallback, ['F5_USER']) - ), - password=dict( - type='str', - aliases=['pass', 'pwd'], - required=True, - no_log=True, - fallback=(env_fallback, ['F5_PASSWORD']) - ), - validate_certs=dict( - default='yes', - type='bool', - fallback=(env_fallback, ['F5_VALIDATE_CERTS']) - ), - server_port=dict( - type='int', - default=443, - fallback=(env_fallback, ['F5_SERVER_PORT']) - ), - state=dict( - type='str', - default='present', - choices=['present', 'absent'] - ), - partition=dict( - type='str', - default='Common', - fallback=(env_fallback, ['F5_PARTITION']) - ) - ) - - -def f5_parse_arguments(module): - if not bigsuds_found: - module.fail_json(msg="the python bigsuds module is required") - - if module.params['validate_certs']: - import ssl - if not hasattr(ssl, 'SSLContext'): - module.fail_json( - msg="bigsuds does not support verifying certificates with python < 2.7.9." - "Either update python or set validate_certs=False on the task'") - - return ( - module.params['server'], - module.params['user'], - module.params['password'], - module.params['state'], - module.params['partition'], - module.params['validate_certs'], - module.params['server_port'] - ) - - -def bigip_api(bigip, user, password, validate_certs, port=443): - try: - if bigsuds.__version__ >= '1.0.4': - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password, verify=validate_certs, port=port) - elif bigsuds.__version__ == '1.0.3': - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password, verify=validate_certs) - else: - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - except TypeError: - # bigsuds < 1.0.3, no verify param - if validate_certs: - # Note: verified we have SSLContext when we parsed params - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - else: - import ssl - if hasattr(ssl, 'SSLContext'): - # Really, you should never do this. It disables certificate - # verification *globally*. But since older bigip libraries - # don't give us a way to toggle verification we need to - # disable it at the global level. - # From https://www.python.org/dev/peps/pep-0476/#id29 - ssl._create_default_https_context = ssl._create_unverified_context - api = bigsuds.BIGIP(hostname=bigip, username=user, password=password) - - return api - - -# Fully Qualified name (with the partition) -def fq_name(partition, name): - if name is not None and not name.startswith('/'): - return '/%s/%s' % (partition, name) - return name - - -# Fully Qualified name (with partition) for a list -def fq_list_names(partition, list_names): - if list_names is None: - return None - return map(lambda x: fq_name(partition, x), list_names) diff --git a/plugins/module_utils/network/f5/urls.py b/plugins/module_utils/network/f5/urls.py deleted file mode 100644 index d81b46a5..00000000 --- a/plugins/module_utils/network/f5/urls.py +++ /dev/null @@ -1,122 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2017, F5 Networks Inc. -# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -import re - -try: - from library.module_utils.network.f5.common import F5ModuleError -except ImportError: - from ansible_collections.community.network.plugins.module_utils.network.f5._common import F5ModuleError - -_CLEAN_HEADER_REGEX_BYTE = re.compile(b'^\\S[^\\r\\n]*$|^$') -_CLEAN_HEADER_REGEX_STR = re.compile(r'^\S[^\r\n]*$|^$') - - -def check_header_validity(header): - """Verifies that header value is a string which doesn't contain - leading whitespace or return characters. - - NOTE: This is a slightly modified version of the original function - taken from the requests library: - http://docs.python-requests.org/en/master/_modules/requests/utils/ - - :param header: string containing ':'. - """ - try: - name, value = header.split(':') - except ValueError: - raise F5ModuleError('Invalid header format: {0}'.format(header)) - if name == '': - raise F5ModuleError('Invalid header format: {0}'.format(header)) - - if isinstance(value, bytes): - pat = _CLEAN_HEADER_REGEX_BYTE - else: - pat = _CLEAN_HEADER_REGEX_STR - try: - if not pat.match(value): - raise F5ModuleError("Invalid return character or leading space in header: %s" % name) - except TypeError: - raise F5ModuleError("Value for header {%s: %s} must be of type str or " - "bytes, not %s" % (name, value, type(value))) - - -def build_service_uri(base_uri, partition, name): - """Build the proper uri for a service resource. - This follows the scheme: - /~~<.app>~ - :param base_uri: str -- base uri of the REST endpoint - :param partition: str -- partition for the service - :param name: str -- name of the service - :returns: str -- uri to access the service - """ - name = name.replace('/', '~') - return '%s~%s~%s.app~%s' % (base_uri, partition, name, name) - - -def parseStats(entry): - if 'description' in entry: - return entry['description'] - elif 'value' in entry: - return entry['value'] - elif 'entries' in entry or 'nestedStats' in entry and 'entries' in entry['nestedStats']: - if 'entries' in entry: - entries = entry['entries'] - else: - entries = entry['nestedStats']['entries'] - result = None - - for name in entries: - entry = entries[name] - if 'https://localhost' in name: - name = name.split('/') - name = name[-1] - if result and isinstance(result, list): - result.append(parseStats(entry)) - elif result and isinstance(result, dict): - result[name] = parseStats(entry) - else: - try: - int(name) - result = list() - result.append(parseStats(entry)) - except ValueError: - result = dict() - result[name] = parseStats(entry) - else: - if '.' in name: - names = name.split('.') - key = names[0] - value = names[1] - if result is None: - # result can be None if this branch is reached first - # - # For example, the mgmt/tm/net/trunk/NAME/stats API - # returns counters.bitsIn before anything else. - result = dict() - result[key] = dict() - elif key not in result: - result[key] = dict() - elif result[key] is None: - result[key] = dict() - result[key][value] = parseStats(entry) - else: - if result and isinstance(result, list): - result.append(parseStats(entry)) - elif result and isinstance(result, dict): - result[name] = parseStats(entry) - else: - try: - int(name) - result = list() - result.append(parseStats(entry)) - except ValueError: - result = dict() - result[name] = parseStats(entry) - return result diff --git a/plugins/module_utils/network/onyx/__init__.py b/plugins/module_utils/network/onyx/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/module_utils/network/onyx/onyx.py b/plugins/module_utils/network/onyx/onyx.py deleted file mode 100644 index d537e048..00000000 --- a/plugins/module_utils/network/onyx/onyx.py +++ /dev/null @@ -1,261 +0,0 @@ -# -*- coding: utf-8 -*- -# -# (c) 2017, Ansible by Red Hat, inc -# -# This file is part of Ansible by Red Hat -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -import json - -from ansible.module_utils._text import to_text -from ansible.module_utils.connection import Connection, ConnectionError -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list, EntityCollection - -_DEVICE_CONFIGS = {} -_CONNECTION = None - -_COMMAND_SPEC = { - 'command': dict(key=True), - 'prompt': dict(), - 'answer': dict() -} - - -def get_connection(module): - global _CONNECTION - if _CONNECTION: - return _CONNECTION - _CONNECTION = Connection(module._socket_path) - return _CONNECTION - - -def to_commands(module, commands): - if not isinstance(commands, list): - raise AssertionError('argument must be of type ') - - transform = EntityCollection(module, _COMMAND_SPEC) - commands = transform(commands) - return commands - - -def run_commands(module, commands, check_rc=True): - connection = get_connection(module) - - commands = to_commands(module, to_list(commands)) - - responses = list() - - for cmd in commands: - out = connection.get(**cmd) - responses.append(to_text(out, errors='surrogate_then_replace')) - - return responses - - -def get_config(module, source='running'): - conn = get_connection(module) - out = conn.get_config(source) - cfg = to_text(out, errors='surrogate_then_replace').strip() - return cfg - - -def load_config(module, config): - try: - conn = get_connection(module) - conn.edit_config(config) - except ConnectionError as exc: - module.fail_json(msg=to_text(exc)) - - -def _parse_json_output(out): - out_list = out.split('\n') - first_index = 0 - opening_char = None - lines_count = len(out_list) - while first_index < lines_count: - first_line = out_list[first_index].strip() - if not first_line or first_line[0] not in ("[", "{"): - first_index += 1 - continue - opening_char = first_line[0] - break - if not opening_char: - return "null" - closing_char = ']' if opening_char == '[' else '}' - last_index = lines_count - 1 - found = False - while last_index > first_index: - last_line = out_list[last_index].strip() - if not last_line or last_line[0] != closing_char: - last_index -= 1 - continue - found = True - break - if not found: - return opening_char + closing_char - return "".join(out_list[first_index:last_index + 1]) - - -def show_cmd(module, cmd, json_fmt=True, fail_on_error=True): - if json_fmt: - cmd += " | json-print" - conn = get_connection(module) - command_obj = to_commands(module, to_list(cmd))[0] - try: - out = conn.get(**command_obj) - except ConnectionError: - if fail_on_error: - raise - return None - if json_fmt: - out = _parse_json_output(out) - try: - cfg = json.loads(out) - except ValueError: - module.fail_json( - msg="got invalid json", - stderr=to_text(out, errors='surrogate_then_replace')) - else: - cfg = to_text(out, errors='surrogate_then_replace').strip() - return cfg - - -def get_interfaces_config(module, interface_type, flags=None, json_fmt=True): - cmd = "show interfaces %s" % interface_type - if flags: - cmd += " %s" % flags - return show_cmd(module, cmd, json_fmt) - - -def get_bgp_summary(module): - cmd = "show running-config protocol bgp" - return show_cmd(module, cmd, json_fmt=False, fail_on_error=False) - - -def get_capabilities(module): - """Returns platform info of the remove device - """ - if hasattr(module, '_capabilities'): - return module._capabilities - - connection = get_connection(module) - try: - capabilities = connection.get_capabilities() - except ConnectionError as exc: - module.fail_json(msg=to_text(exc, errors='surrogate_then_replace')) - - module._capabilities = json.loads(capabilities) - return module._capabilities - - -class BaseOnyxModule(object): - ONYX_API_VERSION = "3.6.6000" - - def __init__(self): - self._module = None - self._commands = list() - self._current_config = None - self._required_config = None - self._os_version = None - - def init_module(self): - pass - - def load_current_config(self): - pass - - def get_required_config(self): - pass - - def _get_os_version(self): - capabilities = get_capabilities(self._module) - device_info = capabilities['device_info'] - return device_info['network_os_version'] - - # pylint: disable=unused-argument - def check_declarative_intent_params(self, result): - return None - - def _validate_key(self, param, key): - validator = getattr(self, 'validate_%s' % key) - if callable(validator): - validator(param.get(key)) - - def validate_param_values(self, obj, param=None): - if param is None: - param = self._module.params - for key in obj: - # validate the param value (if validator func exists) - try: - self._validate_key(param, key) - except AttributeError: - pass - - @classmethod - def get_config_attr(cls, item, arg): - return item.get(arg) - - @classmethod - def get_mtu(cls, item): - mtu = cls.get_config_attr(item, "MTU") - mtu_parts = mtu.split() - try: - return int(mtu_parts[0]) - except ValueError: - return None - - def _validate_range(self, attr_name, min_val, max_val, value): - if value is None: - return True - if not min_val <= int(value) <= max_val: - msg = '%s must be between %s and %s' % ( - attr_name, min_val, max_val) - self._module.fail_json(msg=msg) - - def validate_mtu(self, value): - self._validate_range('mtu', 1500, 9612, value) - - def generate_commands(self): - pass - - def run(self): - self.init_module() - - result = {'changed': False} - - self.get_required_config() - self.load_current_config() - - self.generate_commands() - result['commands'] = self._commands - - if self._commands: - if not self._module.check_mode: - load_config(self._module, self._commands) - result['changed'] = True - - failed_conditions = self.check_declarative_intent_params(result) - - if failed_conditions: - msg = 'One or more conditional statements have not been satisfied' - self._module.fail_json(msg=msg, - failed_conditions=failed_conditions) - - self._module.exit_json(**result) - - @classmethod - def main(cls): - app = cls() - app.run() diff --git a/plugins/modules/network/onyx/onyx_aaa.py b/plugins/modules/network/onyx/onyx_aaa.py deleted file mode 100644 index 115771df..00000000 --- a/plugins/modules/network/onyx/onyx_aaa.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_aaa -version_added: '0.2.0' -author: "Sara Touqan (@sarato)" -short_description: Configures AAA parameters -description: - - This module provides declarative management of AAA protocol params - on Mellanox ONYX network devices. -options: - tacacs_accounting_enabled: - description: - - Configures accounting settings. - type: bool - auth_default_user: - description: - - Sets local user default mapping. - type: str - choices: ['admin', 'monitor'] - auth_order: - description: - - Sets the order on how to handle remote to local user mappings. - type: str - choices: ['local-only', 'remote-first', 'remote-only'] - auth_fallback_enabled: - description: - - Enables/Disables fallback server-err option. - type: bool -''' - -EXAMPLES = """ -- name: Configures aaa - onyx_aaa: - tacacs_accounting_enabled: yes - auth_default_user: monitor - auth_order: local-only - auth_fallback_enabled: false -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - aaa accounting changes default stop-only tacacs+ - - no aaa accounting changes default stop-only tacacs+ - - aaa authorization map default-user - - aaa authorization map order - - aaa authorization map fallback server-err - - no aaa authorization map fallback server-err -""" - -import re - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxAAAModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - element_spec = dict( - tacacs_accounting_enabled=dict(type='bool'), - auth_default_user=dict(type='str', choices=['admin', 'monitor']), - auth_order=dict(type='str', choices=['local-only', 'remote-first', 'remote-only']), - auth_fallback_enabled=dict(type='bool') - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _set_aaa_config(self, all_aaa_config): - aaa_config = all_aaa_config[0] - self._current_config['auth_default_user'] = aaa_config.get("Default User") - self._current_config['auth_order'] = aaa_config.get("Map Order") - auth_fallback_enabled = aaa_config.get("Fallback on server-err") - if auth_fallback_enabled == "yes": - self._current_config['auth_fallback_enabled'] = True - else: - self._current_config['auth_fallback_enabled'] = False - aaa_config_2 = all_aaa_config[2] - accounting_message = aaa_config_2.get("message") - if accounting_message == "No accounting methods configured.": - self._current_config['tacacs_accounting_enabled'] = False - else: - self._current_config['tacacs_accounting_enabled'] = True - - def _show_aaa_config(self): - cmd = "show aaa" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - aaa_config = self._show_aaa_config() - if aaa_config: - self._set_aaa_config(aaa_config) - - def generate_commands(self): - tacacs_accounting_enabled = self._required_config.get("tacacs_accounting_enabled") - if tacacs_accounting_enabled is not None: - current_accounting_enabled = self._current_config.get("tacacs_accounting_enabled") - if current_accounting_enabled != tacacs_accounting_enabled: - if tacacs_accounting_enabled is True: - self._commands.append('aaa accounting changes default stop-only tacacs+') - else: - self._commands.append('no aaa accounting changes default stop-only tacacs+') - - auth_default_user = self._required_config.get("auth_default_user") - if auth_default_user is not None: - current_user = self._current_config.get("auth_default_user") - if current_user != auth_default_user: - self._commands.append('aaa authorization map default-user {0}' .format(auth_default_user)) - - auth_order = self._required_config.get("auth_order") - if auth_order is not None: - current_order = self._current_config.get("auth_order") - if current_order != auth_order: - self._commands.append('aaa authorization map order {0}' .format(auth_order)) - - auth_fallback_enabled = self._required_config.get("auth_fallback_enabled") - if auth_fallback_enabled is not None: - current_fallback = self._current_config.get("auth_fallback_enabled") - if current_fallback != auth_fallback_enabled: - if auth_fallback_enabled is True: - self._commands.append('aaa authorization map fallback server-err') - else: - self._commands.append('no aaa authorization map fallback server-err') - - -def main(): - """ main entry point for module execution - """ - OnyxAAAModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_bfd.py b/plugins/modules/network/onyx/onyx_bfd.py deleted file mode 100644 index 81a1fd95..00000000 --- a/plugins/modules/network/onyx/onyx_bfd.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_bfd -version_added: '0.2.0' -author: "Sara Touqan (@sarato)" -short_description: Configures BFD parameters -description: - - This module provides declarative management of BFD protocol params - on Mellanox ONYX network devices. -options: - shutdown: - description: - - Administratively shut down BFD protection. - type: bool - vrf: - description: - - Specifys the vrf name. - type: str - interval_min_rx: - description: - - Minimum desired receive rate, should be between 50 and 6000. - type: int - interval_multiplier: - description: - - Desired detection multiplier, should be between 3 and 50. - type: int - interval_transmit_rate: - description: - - Minimum desired transmit rate, should be between 50 and 60000. - type: int - iproute_network_prefix: - description: - - Configures the ip route network prefix, e.g 1.1.1.1. - type: str - iproute_mask_length: - description: - - Configures the mask length of the ip route network prefix, e.g 24. - type: int - iproute_next_hop: - description: - - Configures the ip route next hop, e.g 2.2.2.2. - type: str -''' - -EXAMPLES = """ -- name: Configures bfd - onyx_bfd: - shutdown: yes - vrf: 5 - interval_min_rx: 55 - interval_multiplier: 8 - interval_transmit_rate: 88 - iproute_network_prefix: 1.1.1.0 - iproute_mask_length: 24 - iproute_next_hop: 3.2.2.2 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - ip bfd shutdown - - no ip bfd shutdown - - ip bfd shutdown vrf - - no ip bfd shutdown vrf - - ip bfd vrf interval min-rx multiplier transmit-rate force - - ip bfd interval min-rx multiplier transmit-rate force - - ip route vrf / bfd - - ip route / bfd -""" - -import re - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxBFDModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - element_spec = dict( - shutdown=dict(type='bool'), - vrf=dict(type='str'), - interval_min_rx=dict(type='int'), - interval_multiplier=dict(type='int'), - interval_transmit_rate=dict(type='int'), - iproute_network_prefix=dict(type='str'), - iproute_mask_length=dict(type='int'), - iproute_next_hop=dict(type='str'), - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_together=[ - ['interval_min_rx', 'interval_multiplier', 'interval_transmit_rate'], - ['iproute_network_prefix', 'iproute_mask_length', 'iproute_next_hop']]) - - def validate_bfd_interval_values(self): - interval_min_rx = self._required_config.get('interval_min_rx') - if interval_min_rx: - if ((interval_min_rx < 50) or (interval_min_rx > 6000)): - self._module.fail_json(msg='Receive interval should be between 50 and 6000.') - interval_multiplier = self._required_config.get('interval_multiplier') - if interval_multiplier: - if ((interval_multiplier < 3) or (interval_multiplier > 50)): - self._module.fail_json(msg='Multiplier should be between 3 and 50.') - interval_transmit_rate = self._required_config.get('interval_transmit_rate') - if interval_transmit_rate: - if ((interval_transmit_rate < 50) or (interval_transmit_rate > 60000)): - self._module.fail_json(msg='Transmit interval should be between 50 and 60000.') - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - self.validate_bfd_interval_values() - - def _set_bfd_config(self, bfd_config): - curr_config_arr = [] - bfd_config = bfd_config.get('Lines') - if bfd_config is None: - return - for runn_config in bfd_config: - curr_config_arr.append(runn_config.strip()) - if 'ip bfd shutdown vrf default' in curr_config_arr: - self._current_config['bfd_shutdown'] = True - else: - self._current_config['bfd_shutdown'] = False - self._current_config['curr_config_arr'] = curr_config_arr - - def _show_bfd_config(self): - cmd = "show running-config | include bfd" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - bfd_config = self._show_bfd_config() - if bfd_config: - self._set_bfd_config(bfd_config) - - def generate_shutdown_commands(self, curr_config_arr): - shutdown_enabled = self._required_config.get('shutdown') - vrf_name = self._required_config.get('vrf') - current_shutdown = self._current_config.get("bfd_shutdown") - if shutdown_enabled is not None: - if vrf_name is not None: - if curr_config_arr is not None: - if ('ip bfd shutdown vrf {0}' .format(vrf_name)) not in curr_config_arr: - if shutdown_enabled is True: - self._commands.append('ip bfd shutdown vrf {0}' .format(vrf_name)) - else: - if shutdown_enabled is False: - self._commands.append('no ip bfd shutdown vrf {0}' .format(vrf_name)) - else: - if ((current_shutdown is not None and (current_shutdown != shutdown_enabled)) or (current_shutdown is None)): - if shutdown_enabled is True: - self._commands.append('ip bfd shutdown') - else: - self._commands.append('no ip bfd shutdown') - - def generate_interval_commands(self, curr_config_arr): - interval_min_rx = self._required_config.get('interval_min_rx') - interval_multiplier = self._required_config.get('interval_multiplier') - interval_transmit_rate = self._required_config.get('interval_transmit_rate') - vrf_name = self._required_config.get('vrf') - if ((interval_min_rx is not None) and (interval_multiplier is not None) and (interval_transmit_rate is not None)): - if vrf_name is not None: - if curr_config_arr is not None: - if ((('ip bfd vrf {0} interval transmit-rate {1} force' .format(vrf_name, interval_transmit_rate)) not in curr_config_arr) or - (('ip bfd vrf {0} interval min-rx {1} force' .format(vrf_name, interval_min_rx)) not in curr_config_arr) or - (('ip bfd vrf {0} interval multiplier {1} force' .format(vrf_name, interval_multiplier)) not in curr_config_arr)): - self._commands.append('ip bfd vrf {0} interval min-rx {1} multiplier {2} transmit-rate {3} force' - .format(vrf_name, interval_min_rx, interval_multiplier, interval_transmit_rate)) - else: - self._commands.append('ip bfd vrf {0} interval min-rx {1} multiplier {2} transmit-rate {3} force' - .format(vrf_name, interval_min_rx, interval_multiplier, interval_transmit_rate)) - else: - if curr_config_arr is not None: - if ((('ip bfd vrf default interval transmit-rate {0} force' .format(interval_transmit_rate)) not in curr_config_arr) or - (('ip bfd vrf default interval min-rx {0} force' .format(interval_min_rx)) not in curr_config_arr) or - (('ip bfd vrf default interval multiplier {0} force' .format(interval_multiplier)) not in curr_config_arr)): - self._commands.append('ip bfd interval min-rx {0} multiplier {1} transmit-rate {2} force' - .format(interval_min_rx, interval_multiplier, interval_transmit_rate)) - else: - self._commands.append('ip bfd interval min-rx {0} multiplier {1} transmit-rate {2} force' - .format(interval_min_rx, interval_multiplier, interval_transmit_rate)) - - def generate_iproute_commands(self, curr_config_arr): - iproute_network_prefix = self._required_config.get('iproute_network_prefix') - iproute_mask_length = self._required_config.get('iproute_mask_length') - iproute_next_hop = self._required_config.get('iproute_next_hop') - vrf_name = self._required_config.get('vrf') - if ((iproute_network_prefix is not None) and (iproute_mask_length is not None) and - (iproute_next_hop is not None)): - if vrf_name is not None: - if curr_config_arr is not None: - if ('ip route vrf {0} {1}/{2} {3} bfd' .format(vrf_name, iproute_network_prefix, - iproute_mask_length, iproute_next_hop)) not in curr_config_arr: - self._commands.append('ip route vrf {0} {1} /{2} {3} bfd' - .format(vrf_name, iproute_network_prefix, iproute_mask_length, iproute_next_hop)) - else: - self._commands.append('ip route vrf {0} {1} /{2} {3} bfd' .format(vrf_name, iproute_network_prefix, iproute_mask_length, iproute_next_hop)) - else: - if curr_config_arr is not None: - if ('ip route vrf default {0}/{1} {2} bfd' .format(iproute_network_prefix, - iproute_mask_length, iproute_next_hop)) not in curr_config_arr: - self._commands.append('ip route {0} /{1} {2} bfd' .format(iproute_network_prefix, iproute_mask_length, iproute_next_hop)) - else: - self._commands.append('ip route {0} /{1} {2} bfd' .format(iproute_network_prefix, iproute_mask_length, iproute_next_hop)) - - def generate_commands(self): - curr_config_arr = self._current_config.get("curr_config_arr") - self.generate_shutdown_commands(curr_config_arr) - self.generate_interval_commands(curr_config_arr) - self.generate_iproute_commands(curr_config_arr) - - -def main(): - """ main entry point for module execution - """ - OnyxBFDModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_bgp.py b/plugins/modules/network/onyx/onyx_bgp.py deleted file mode 100644 index 8692e996..00000000 --- a/plugins/modules/network/onyx/onyx_bgp.py +++ /dev/null @@ -1,446 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_bgp -author: "Samer Deeb (@samerd), Anas Badaha (@anasb)" -short_description: Configures BGP on Mellanox ONYX network devices -description: - - This module provides declarative management of BGP router and neighbors - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - as_number: - description: - - Local AS number. - required: true - router_id: - description: - - Router IP address. - neighbors: - description: - - List of neighbors. Required if I(state=present). - suboptions: - remote_as: - description: - - Remote AS number. - required: true - neighbor: - description: - - Neighbor IP address. - required: true - multihop: - description: - - multihop number. - networks: - description: - - List of advertised networks. - fast_external_fallover: - description: - - will configure fast_external_fallover when it is True. - type: bool - max_paths: - description: - - Maximum bgp paths. - ecmp_bestpath: - description: - - Enables ECMP across AS paths. - type: bool - evpn: - description: - - Configure evpn peer-group. - type: bool - vrf: - description: - - vrf name. - state: - description: - - BGP state. - default: present - choices: ['present', 'absent'] - purge: - description: - - will remove all neighbors when it is True. - type: bool - default: false -''' - -EXAMPLES = """ -- name: Configure bgp - onyx_bgp: - as_number: 320 - router_id: 10.3.3.3 - neighbors: - - remote_as: 321 - neighbor: 10.3.3.4 - - remote_as: 322 - neighbor: 10.3.3.5 - multihop: 250 - purge: True - state: present - networks: - - 172.16.1.0/24 - vrf: default - evpn: yes - fast_external_fallover: yes - max_paths: 32 - ecmp_bestpath: yes - -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - router bgp 320 vrf default - - exit - - router bgp 320 router-id 10.3.3.3 force - - router bgp 320 vrf default bgp fast-external-fallover - - router bgp 320 vrf default maximum-paths 32 - - router bgp 320 vrf default bestpath as-path multipath-relax force - - router bgp 320 vrf default neighbor evpn peer-group - - router bgp 320 vrf default neighbor evpn send-community extended - - router bgp 320 vrf default address-family l2vpn-evpn neighbor evpn next-hop-unchanged - - router bgp 320 vrf default address-family l2vpn-evpn neighbor evpn activate - - router bgp 320 vrf default address-family l2vpn-evpn auto-create - - router bgp 320 vrf default neighbor 10.3.3.4 remote-as 321 - - router bgp 320 vrf default neighbor 10.3.3.4 ebgp-multihop 250 - - router bgp 320 vrf default neighbor 10.3.3.5 remote-as 322 - - router bgp 320 vrf default network 172.16.1.0 /24 -""" -import re -from ansible.module_utils.six import iteritems - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_bgp_summary -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxBgpModule(BaseOnyxModule): - LOCAL_AS_REGEX = re.compile(r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+).*') - ROUTER_ID_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+).*router-id\s+(\S+)\s+.*') - NEIGHBOR_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+).*neighbor\s+(\S+)\s+remote\-as\s+(\d+).*') - NEIGHBOR_MULTIHOP_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+).*neighbor\s+(\S+)\s+ebgp\-multihop\s+(\d+).*') - NETWORK_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+).*network\s+(\S+)\s+(\S+).*') - FAST_EXTERNAL_FALLOVER_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+bgp fast\-external\-fallover.*') - MAX_PATHS_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+maximum\-paths\s+(\d+).*') - ECMP_BESTPATH_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+bestpath as\-path multipath\-relax.*') - NEIGHBOR_EVPN_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+neighbor\s+(\S+)\s+peer\-group evpn.*') - EVPN_PEER_GROUP_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+neighbor evpn peer\-group.*') - EVPN_SEND_COMMUNITY_EXTENDED_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+neighbor evpn send-community extended.*') - EVPN_NEXT_HOP_UNCHANGED_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+address\-family l2vpn\-evpn neighbor evpn next\-hop-unchanged.*') - EVPN_ACTIVATE_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+address-family l2vpn\-evpn neighbor evpn activate.*') - EVPN_AUTO_CREATE_REGEX = re.compile( - r'^\s.*router bgp\s+(\d+)\s+vrf\s+(\S+)\s+address-family l2vpn\-evpn auto-create.*') - - _purge = False - - EVPN_PEER_GROUP_ATTR = "evpn_peer_group" - EVPN_SEND_COMMUNITY_EXTENDED_ATTR = "evpn_send_community_extended" - EVPN_NEXT_HOP_UNCHANGED_ATTR = "evpn_next_hop_unchanged" - EVPN_ACTIVATE_ATTR = "evpn_activate" - EVPN_AUTO_CREATE_ATTR = "evpn_auto_create" - - EVPN_PEER_GROUP_CMD = "router bgp %s vrf %s neighbor evpn peer-group" - EVPN_SEND_COMMUNITY_EXTENDED_CMD = "router bgp %s vrf %s neighbor evpn send-community extended" - EVPN_NEXT_HOP_UNCHANGED_CMD = "router bgp %s vrf %s address-family l2vpn-evpn neighbor evpn next-hop-unchanged" - EVPN_ACTIVATE_CMD = "router bgp %s vrf %s address-family l2vpn-evpn neighbor evpn activate" - EVPN_AUTO_CREATE_CMD = "router bgp %s vrf %s address-family l2vpn-evpn auto-create" - - EVPN_ENABLE_ATTRS = [EVPN_PEER_GROUP_ATTR, EVPN_SEND_COMMUNITY_EXTENDED_ATTR, - EVPN_NEXT_HOP_UNCHANGED_ATTR, EVPN_ACTIVATE_ATTR, EVPN_AUTO_CREATE_ATTR] - - EVPN_DISABLE_ATTRS = [EVPN_PEER_GROUP_ATTR, EVPN_AUTO_CREATE_ATTR] - - EVPN_COMMANDS_REGEX_MAPPER = { - EVPN_PEER_GROUP_ATTR: (EVPN_PEER_GROUP_REGEX, EVPN_PEER_GROUP_CMD), - EVPN_SEND_COMMUNITY_EXTENDED_ATTR: (EVPN_SEND_COMMUNITY_EXTENDED_REGEX, - EVPN_SEND_COMMUNITY_EXTENDED_CMD), - EVPN_NEXT_HOP_UNCHANGED_ATTR: (EVPN_NEXT_HOP_UNCHANGED_REGEX, - EVPN_NEXT_HOP_UNCHANGED_CMD), - EVPN_ACTIVATE_ATTR: (EVPN_ACTIVATE_REGEX, EVPN_ACTIVATE_CMD), - EVPN_AUTO_CREATE_ATTR: (EVPN_AUTO_CREATE_REGEX, EVPN_AUTO_CREATE_CMD) - } - - def init_module(self): - """ initialize module - """ - neighbor_spec = dict( - remote_as=dict(type='int', required=True), - neighbor=dict(required=True), - multihop=dict(type='int') - ) - element_spec = dict( - as_number=dict(type='int', required=True), - router_id=dict(), - neighbors=dict(type='list', elements='dict', - options=neighbor_spec), - networks=dict(type='list', elements='str'), - state=dict(choices=['present', 'absent'], default='present'), - purge=dict(default=False, type='bool'), - vrf=dict(), - fast_external_fallover=dict(type='bool'), - max_paths=dict(type='int'), - ecmp_bestpath=dict(type='bool'), - evpn=dict(type='bool') - ) - argument_spec = dict() - - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self._purge = self._required_config.get('purge', False) - self.validate_param_values(self._required_config) - - def _set_bgp_config(self, bgp_config): - lines = bgp_config.split('\n') - self._current_config['router_id'] = None - self._current_config['as_number'] = None - self._current_config['fast_external_fallover'] = False - self._current_config['ecmp_bestpath'] = False - self._current_config[self.EVPN_PEER_GROUP_ATTR] = False - self._current_config[self.EVPN_SEND_COMMUNITY_EXTENDED_ATTR] = False - self._current_config[self.EVPN_NEXT_HOP_UNCHANGED_ATTR] = False - self._current_config[self.EVPN_AUTO_CREATE_ATTR] = False - self._current_config[self.EVPN_ACTIVATE_ATTR] = False - neighbors = self._current_config['neighbors'] = dict() - networks = self._current_config['networks'] = list() - for line in lines: - if line.startswith('#'): - continue - if not self._current_config['as_number']: - match = self.LOCAL_AS_REGEX.match(line) - if match: - self._current_config['as_number'] = int(match.group(1)) - self._current_config['vrf'] = match.group(2) - continue - if not self._current_config['router_id']: - match = self.ROUTER_ID_REGEX.match(line) - if match: - self._current_config['router_id'] = match.group(2) - continue - match = self.NEIGHBOR_REGEX.match(line) - if match: - neighbor = neighbors.setdefault(match.group(2), dict()) - neighbor['remote_as'] = int(match.group(3)) - continue - match = self.NEIGHBOR_MULTIHOP_REGEX.match(line) - if match: - neighbor = neighbors.setdefault(match.group(2), dict()) - neighbor["multihop"] = int(match.group(3)) - continue - match = self.NEIGHBOR_EVPN_REGEX.match(line) - if match: - neighbor = neighbors.setdefault(match.group(3), dict()) - neighbor["evpn"] = True - continue - match = self.NETWORK_REGEX.match(line) - if match: - network = match.group(2) + match.group(3) - networks.append(network) - continue - match = self.FAST_EXTERNAL_FALLOVER_REGEX.match(line) - if match: - self._current_config['fast_external_fallover'] = True - continue - match = self.ECMP_BESTPATH_REGEX.match(line) - if match: - self._current_config['ecmp_bestpath'] = True - continue - match = self.MAX_PATHS_REGEX.match(line) - if match: - self._current_config['max_paths'] = int(match.group(3)) - continue - for key, value in iteritems(self.EVPN_COMMANDS_REGEX_MAPPER): - match = value[0].match(line) - if match: - self._current_config[key] = True - break - - def _get_bgp_summary(self): - return get_bgp_summary(self._module) - - def load_current_config(self): - self._current_config = dict() - bgp_config = self._get_bgp_summary() - if bgp_config: - self._set_bgp_config(bgp_config) - - def generate_commands(self): - state = self._required_config['state'] - if state == 'present': - self._generate_bgp_cmds() - else: - self._generate_no_bgp_cmds() - - def _generate_bgp_cmds(self): - vrf = self._required_config.get('vrf') - if vrf is None: - vrf = "default" - - as_number = self._required_config['as_number'] - curr_as_num = self._current_config.get('as_number') - curr_vrf = self._current_config.get("vrf") - bgp_removed = False - if curr_as_num != as_number or vrf != curr_vrf: - if curr_as_num: - self._commands.append('no router bgp %d vrf %s' % (curr_as_num, curr_vrf)) - bgp_removed = True - self._commands.append('router bgp %d vrf %s' % (as_number, vrf)) - self._commands.append('exit') - - req_router_id = self._required_config.get('router_id') - if req_router_id is not None: - curr_route_id = self._current_config.get('router_id') - if bgp_removed or req_router_id != curr_route_id: - self._commands.append('router bgp %d vrf %s router-id %s force' % (as_number, vrf, req_router_id)) - - fast_external_fallover = self._required_config.get('fast_external_fallover') - if fast_external_fallover is not None: - current_fast_external_fallover = self._current_config.get('fast_external_fallover') - if fast_external_fallover and (bgp_removed or fast_external_fallover != current_fast_external_fallover): - self._commands.append('router bgp %d vrf %s bgp fast-external-fallover' % (as_number, vrf)) - elif not fast_external_fallover and (bgp_removed or fast_external_fallover != current_fast_external_fallover): - self._commands.append('router bgp %d vrf %s no bgp fast-external-fallover' % (as_number, vrf)) - - max_paths = self._required_config.get('max_paths') - if max_paths is not None: - current_max_paths = self._current_config.get('max_paths') - if bgp_removed or max_paths != current_max_paths: - self._commands.append('router bgp %d vrf %s maximum-paths %s' % (as_number, vrf, max_paths)) - - ecmp_bestpath = self._required_config.get('ecmp_bestpath') - if ecmp_bestpath is not None: - current_ecmp_bestpath = self._current_config.get('ecmp_bestpath') - if ecmp_bestpath and (bgp_removed or ecmp_bestpath != current_ecmp_bestpath): - self._commands.append('router bgp %d vrf %s bestpath as-path multipath-relax force' % (as_number, vrf)) - elif not ecmp_bestpath and (bgp_removed or ecmp_bestpath != current_ecmp_bestpath): - self._commands.append('router bgp %d vrf %s no bestpath as-path multipath-relax force' % (as_number, vrf)) - - evpn = self._required_config.get('evpn') - if evpn is not None: - self._generate_evpn_cmds(evpn, as_number, vrf) - - self._generate_neighbors_cmds(as_number, vrf, bgp_removed) - self._generate_networks_cmds(as_number, vrf, bgp_removed) - - def _generate_neighbors_cmds(self, as_number, vrf, bgp_removed): - req_neighbors = self._required_config['neighbors'] - curr_neighbors = self._current_config.get('neighbors', {}) - evpn = self._required_config.get('evpn') - if self._purge: - for neighbor in curr_neighbors: - remote_as = curr_neighbors[neighbor].get("remote_as") - self._commands.append('router bgp %s vrf %s no neighbor %s remote-as %s' % ( - as_number, vrf, neighbor, remote_as)) - - if req_neighbors is not None: - for neighbor_data in req_neighbors: - neighbor = neighbor_data.get("neighbor") - curr_neighbor = curr_neighbors.get(neighbor) - remote_as = neighbor_data.get("remote_as") - multihop = neighbor_data.get("multihop") - if bgp_removed or curr_neighbor is None: - if remote_as is not None: - self._commands.append( - 'router bgp %s vrf %s neighbor %s remote-as %s' % (as_number, vrf, neighbor, remote_as)) - if multihop is not None: - self._commands.append( - 'router bgp %s vrf %s neighbor %s ebgp-multihop %s' % (as_number, vrf, neighbor, multihop)) - if evpn: - self._commands.append( - 'router bgp %s vrf %s neighbor %s peer-group evpn' % (as_number, vrf, neighbor)) - elif curr_neighbor is not None: - curr_remote_as = curr_neighbor.get("remote_as") - curr_multihop = curr_neighbor.get("multihop") - curr_neighbor_evpn = curr_neighbor.get("evpn") - if remote_as != curr_remote_as: - self._commands.append( - 'router bgp %s vrf %s neighbor %s remote-as %s' % (as_number, vrf, neighbor, remote_as)) - if multihop is not None and multihop != curr_multihop: - self._commands.append( - 'router bgp %s vrf %s neighbor %s ebgp-multihop %s' % (as_number, vrf, neighbor, multihop)) - if evpn and curr_neighbor_evpn is not True: - self._commands.append( - 'router bgp %s vrf %s neighbor %s peer-group evpn' % (as_number, vrf, neighbor)) - - def _generate_networks_cmds(self, as_number, vrf, bgp_removed): - req_networks = self._required_config['networks'] or [] - curr_networks = self._current_config.get('networks', []) - if not bgp_removed: - for network in curr_networks: - if network not in req_networks: - net_attrs = network.split('/') - if len(net_attrs) != 2: - self._module.fail_json( - msg='Invalid network %s' % network) - - net_address, netmask = net_attrs - cmd = 'router bgp %s no network %s /%s' % ( - as_number, net_address, netmask) - self._commands.append(cmd) - - for network in req_networks: - if bgp_removed or network not in curr_networks: - net_attrs = network.split('/') - if len(net_attrs) != 2: - self._module.fail_json( - msg='Invalid network %s' % network) - net_address, netmask = net_attrs - cmd = 'router bgp %s vrf %s network %s /%s' % ( - as_number, vrf, net_address, netmask) - self._commands.append(cmd) - - def _generate_no_bgp_cmds(self): - as_number = self._required_config['as_number'] - curr_as_num = self._current_config.get('as_number') - if curr_as_num and curr_as_num == as_number: - self._commands.append('no router bgp %d' % as_number) - - def _generate_evpn_cmds(self, evpn, as_number, vrf): - if evpn: - for attr in self.EVPN_ENABLE_ATTRS: - curr_attr = self._current_config.get(attr) - if curr_attr is not True: - self._commands.append(self.EVPN_COMMANDS_REGEX_MAPPER.get(attr)[1] % (as_number, vrf)) - elif not evpn: - for attr in self.EVPN_DISABLE_ATTRS: - curr_attr = self._current_config.get(attr) - if curr_attr is not False: - self._commands.append("no " + self.EVPN_COMMANDS_REGEX_MAPPER.get(attr)[1] % (as_number, vrf)) - - -def main(): - """ main entry point for module execution - """ - OnyxBgpModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_buffer_pool.py b/plugins/modules/network/onyx/onyx_buffer_pool.py deleted file mode 100644 index 7d729673..00000000 --- a/plugins/modules/network/onyx/onyx_buffer_pool.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_buffer_pool -author: "Anas Badaha (@anasb)" -short_description: Configures Buffer Pool -description: - - This module provides declarative management of Onyx Buffer Pool configuration - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.8130 -options: - name: - description: - - pool name. - required: true - pool_type: - description: - - pool type. - choices: ['lossless', 'lossy'] - default: lossy - memory_percent: - description: - - memory percent. - switch_priority: - description: - - switch priority, range 1-7. -''' - -EXAMPLES = """ -- name: Configure buffer pool - onyx_buffer_pool: - name: roce - pool_type: lossless - memory_percent: 50.00 - switch_priority: 3 - -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - traffic pool roce type lossless - - traffic pool roce memory percent 50.00 - - traffic pool roce map switch-priority 3 -""" - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxBufferPoolModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - element_spec = dict( - name=dict(type='str', required=True), - pool_type=dict(choices=['lossless', 'lossy'], default='lossy'), - memory_percent=dict(type='float'), - switch_priority=dict(type='int') - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def validate_switch_priority(self, value): - if value and not 0 <= int(value) <= 7: - self._module.fail_json(msg='switch_priority value must be between 0 and 7') - - def _set_traffic_pool_config(self, traffic_pool_config): - if traffic_pool_config is None: - return - traffic_pool_config = traffic_pool_config.get(self._required_config.get('name')) - self._current_config['pool_type'] = traffic_pool_config[0].get("Type") - self._current_config['switch_priority'] = int(traffic_pool_config[0].get("Switch Priorities")) - self._current_config['memory_percent'] = float(traffic_pool_config[0].get("Memory [%]")) - - def _show_traffic_pool(self): - cmd = "show traffic pool {0}".format(self._required_config.get("name")) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - traffic_pool_config = self._show_traffic_pool() - self._set_traffic_pool_config(traffic_pool_config) - - def generate_commands(self): - name = self._required_config.get("name") - pool_type = self._required_config.get("pool_type") - - if self._current_config is None: - self._add_add_traffic_pool_cmds(name, pool_type) - else: - current_pool_type = self._current_config.get("pool_type") - if pool_type != current_pool_type: - self._add_add_traffic_pool_cmds(name, pool_type) - - memory_percent = self._required_config.get("memory_percent") - if memory_percent is not None: - curr_memory_percent = self._current_config.get("memory_percent") - if curr_memory_percent is None or memory_percent != curr_memory_percent: - self._commands.append('traffic pool {0} memory percent {1}'.format(name, memory_percent)) - - switch_priority = self._required_config.get("switch_priority") - if switch_priority is not None: - curr_switch_priority = self._current_config.get("switch_priority") - if curr_switch_priority is None or switch_priority != curr_switch_priority: - self._commands.append('traffic pool {0} map switch-priority {1}'.format(name, switch_priority)) - - def _add_add_traffic_pool_cmds(self, name, pool_type): - self._commands.append('traffic pool {0} type {1}'.format(name, pool_type)) - - -def main(): - """ main entry point for module execution - """ - OnyxBufferPoolModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_command.py b/plugins/modules/network/onyx/onyx_command.py deleted file mode 100644 index 153e29d5..00000000 --- a/plugins/modules/network/onyx/onyx_command.py +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_command -extends_documentation_fragment: -- community.network.onyx - -author: "Samer Deeb (@samerd)" -short_description: Run commands on remote devices running Mellanox ONYX -description: - - Sends arbitrary commands to an Mellanox ONYX network device and returns - the results read from the device. This module includes an - argument that will cause the module to wait for a specific condition - before returning or timing out if the condition is not met. - - This module does not support running commands in configuration mode. - Please use M(onyx_config) to configure Mellanox ONYX devices. -notes: - - Tested on ONYX 3.6.4000 -options: - commands: - description: - - List of commands to send to the remote Mellanox ONYX network device. - The resulting output from the command - is returned. If the I(wait_for) argument is provided, the - module is not returned until the condition is satisfied or - the number of retries has expired. - required: true - wait_for: - description: - - List of conditions to evaluate against the output of the - command. The task will wait for each condition to be true - before moving forward. If the conditional is not true - within the configured number of retries, the task fails. - See examples. - match: - description: - - The I(match) argument is used in conjunction with the - I(wait_for) argument to specify the match policy. Valid - values are C(all) or C(any). If the value is set to C(all) - then all conditionals in the wait_for must be satisfied. If - the value is set to C(any) then only one of the values must be - satisfied. - default: all - choices: ['any', 'all'] - retries: - description: - - Specifies the number of retries a command should by tried - before it is considered failed. The command is run on the - target device every retry and evaluated against the - I(wait_for) conditions. - default: 10 - interval: - description: - - Configures the interval in seconds to wait between retries - of the command. If the command does not pass the specified - conditions, the interval indicates how long to wait before - trying the command again. - default: 1 -''' - -EXAMPLES = """ -tasks: - - name: Run show version on remote devices - onyx_command: - commands: show version - - - name: Run show version and check to see if output contains MLNXOS - onyx_command: - commands: show version - wait_for: result[0] contains MLNXOS - - - name: Run multiple commands on remote nodes - onyx_command: - commands: - - show version - - show interfaces - - - name: Run multiple commands and evaluate the output - onyx_command: - commands: - - show version - - show interfaces - wait_for: - - result[0] contains MLNXOS - - result[1] contains mgmt1 -""" - -RETURN = """ -stdout: - description: The set of responses from the commands - returned: always apart from low level errors (such as action plugin) - type: list - sample: ['...', '...'] -stdout_lines: - description: The value of stdout split into a list - returned: always apart from low level errors (such as action plugin) - type: list - sample: [['...', '...'], ['...'], ['...']] -failed_conditions: - description: The list of conditionals that have failed - returned: failed - type: list - sample: ['...', '...'] -""" - -import time - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import Conditional -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ComplexList -from ansible.module_utils.six import string_types - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import run_commands - - -def to_lines(stdout): - for item in stdout: - if isinstance(item, string_types): - item = str(item).split('\n') - yield item - - -def parse_commands(module, warnings): - command = ComplexList(dict( - command=dict(key=True), - prompt=dict(), - answer=dict() - ), module) - commands = command(module.params['commands']) - for item in list(commands): - if module.check_mode and not item['command'].startswith('show'): - warnings.append( - 'only show commands are supported when using check mode, not ' - 'executing `%s`' % item['command'] - ) - commands.remove(item) - elif item['command'].startswith('conf'): - module.fail_json( - msg='onyx_command does not support running config mode ' - 'commands. Please use onyx_config instead' - ) - return commands - - -def main(): - """main entry point for module execution - """ - argument_spec = dict( - commands=dict(type='list', required=True), - - wait_for=dict(type='list'), - match=dict(default='all', choices=['all', 'any']), - - retries=dict(default=10, type='int'), - interval=dict(default=1, type='int') - ) - - module = AnsibleModule(argument_spec=argument_spec, - supports_check_mode=True) - - result = {'changed': False} - - warnings = list() - commands = parse_commands(module, warnings) - result['warnings'] = warnings - - wait_for = module.params['wait_for'] or list() - conditionals = [Conditional(c) for c in wait_for] - - retries = module.params['retries'] - interval = module.params['interval'] - match = module.params['match'] - - while retries > 0: - responses = run_commands(module, commands) - - for item in list(conditionals): - if item(responses): - if match == 'any': - conditionals = list() - break - conditionals.remove(item) - - if not conditionals: - break - - time.sleep(interval) - retries -= 1 - - if conditionals: - failed_conditions = [item.raw for item in conditionals] - msg = 'One or more conditional statements have not been satisfied' - module.fail_json(msg=msg, failed_conditions=failed_conditions) - - result.update({ - 'changed': False, - 'stdout': responses, - 'stdout_lines': list(to_lines(responses)) - }) - - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_config.py b/plugins/modules/network/onyx/onyx_config.py deleted file mode 100644 index 6bf540c1..00000000 --- a/plugins/modules/network/onyx/onyx_config.py +++ /dev/null @@ -1,250 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_config -extends_documentation_fragment: -- community.network.onyx - -author: "Alex Tabachnik (@atabachnik), Samer Deeb (@samerd)" -short_description: Manage Mellanox ONYX configuration sections -description: - - Mellanox ONYX configurations uses a simple block indent file syntax - for segmenting configuration into sections. This module provides - an implementation for working with ONYX configuration sections in - a deterministic way. -options: - lines: - description: - - The ordered set of commands that should be configured in the - section. The commands must be the exact same commands as found - in the device running-config. Be sure to note the configuration - command syntax as some commands are automatically modified by the - device config parser. - aliases: ['commands'] - parents: - description: - - The ordered set of parents that uniquely identify the section - the commands should be checked against. If the parents argument - is omitted, the commands are checked against the set of top - level or global commands. - src: - description: - - Specifies the source path to the file that contains the configuration - or configuration template to load. The path to the source file can - either be the full path on the Ansible control host or a relative - path from the playbook or role root directory. This argument is mutually - exclusive with I(lines), I(parents). - before: - description: - - The ordered set of commands to push on to the command stack if - a change needs to be made. This allows the playbook designer - the opportunity to perform configuration commands prior to pushing - any changes without affecting how the set of commands are matched - against the system. - after: - description: - - The ordered set of commands to append to the end of the command - stack if a change needs to be made. Just like with I(before) this - allows the playbook designer to append a set of commands to be - executed after the command set. - match: - description: - - Instructs the module on the way to perform the matching of - the set of commands against the current device config. If - match is set to I(line), commands are matched line by line. If - match is set to I(strict), command lines are matched with respect - to position. If match is set to I(exact), command lines - must be an equal match. Finally, if match is set to I(none), the - module will not attempt to compare the source configuration with - the running configuration on the remote device. - default: line - choices: ['line', 'strict', 'exact', 'none'] - replace: - description: - - Instructs the module on the way to perform the configuration - on the device. If the replace argument is set to I(line) then - the modified lines are pushed to the device in configuration - mode. If the replace argument is set to I(block) then the entire - command block is pushed to the device in configuration mode if any - line is not correct - default: line - choices: ['line', 'block'] - backup: - description: - - This argument will cause the module to create a full backup of - the current C(running-config) from the remote device before any - changes are made. If the C(backup_options) value is not given, - the backup file is written to the C(backup) folder in the playbook - root directory. If the directory does not exist, it is created. - default: no - type: bool - config: - description: - - The C(config) argument allows the playbook designer to supply - the base configuration to be used to validate configuration - changes necessary. If this argument is provided, the module - will not download the running-config from the remote node. - save: - description: - - The C(save) argument instructs the module to save the running- - config to the startup-config at the conclusion of the module - running. If check mode is specified, this argument is ignored. - default: no - type: bool - backup_options: - description: - - This is a dict object containing configurable options related to backup file path. - The value of this option is read only when C(backup) is set to I(yes), if C(backup) is set - to I(no) this option will be silently ignored. - suboptions: - filename: - description: - - The filename to be used to store the backup configuration. If the filename - is not given it will be generated based on the hostname, current time and date - in format defined by _config.@ - dir_path: - description: - - This option provides the path ending with directory name in which the backup - configuration file will be stored. If the directory does not exist it will be first - created and the filename is either the value of C(filename) or default filename - as described in C(filename) options description. If the path value is not given - in that case a I(backup) directory will be created in the current working directory - and backup configuration will be copied in C(filename) within I(backup) directory. - type: path - type: dict -''' - -EXAMPLES = """ ---- -- onyx_config: - lines: - - snmp-server community - - snmp-server host 10.2.2.2 traps version 2c -""" - -RETURN = """ -updates: - description: The set of commands that will be pushed to the remote device - returned: always - type: list - sample: ['...', '...'] -backup_path: - description: The full path to the backup file - returned: when backup is yes - type: str - sample: /playbooks/ansible/backup/onyx_config.2016-07-16@22:28:34 -""" - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import NetworkConfig, dumps - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_config -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import load_config -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import run_commands - - -def get_candidate(module): - candidate = NetworkConfig(indent=1) - if module.params['src']: - candidate.load(module.params['src']) - elif module.params['lines']: - parents = module.params['parents'] or list() - candidate.add(module.params['lines'], parents=parents) - return candidate - - -def run(module, result): - match = module.params['match'] - replace = module.params['replace'] - path = module.params['parents'] - - candidate = get_candidate(module) - if match != 'none': - contents = module.params['config'] - if not contents: - contents = get_config(module) - config = NetworkConfig(indent=1, contents=contents) - configobjs = candidate.difference(config, path=path, match=match, - replace=replace) - - else: - configobjs = candidate.items - - total_commands = [] - if configobjs: - commands = dumps(configobjs, 'commands').split('\n') - - if module.params['lines']: - if module.params['before']: - commands[:0] = module.params['before'] - - if module.params['after']: - commands.extend(module.params['after']) - - total_commands.extend(commands) - result['updates'] = total_commands - - if module.params['save']: - total_commands.append('configuration write') - if total_commands: - result['changed'] = True - if not module.check_mode: - load_config(module, total_commands) - - -def main(): - """ main entry point for module execution - """ - backup_spec = dict( - filename=dict(), - dir_path=dict(type='path') - ) - argument_spec = dict( - src=dict(type='path'), - - lines=dict(aliases=['commands'], type='list'), - parents=dict(type='list'), - - before=dict(type='list'), - after=dict(type='list'), - - match=dict(default='line', choices=['line', 'strict', 'exact', 'none']), - replace=dict(default='line', choices=['line', 'block']), - - config=dict(), - - backup=dict(type='bool', default=False), - backup_options=dict(type='dict', options=backup_spec), - save=dict(type='bool', default=False), - ) - - mutually_exclusive = [('lines', 'src'), - ('parents', 'src')] - - required_if = [('match', 'strict', ['lines']), - ('match', 'exact', ['lines']), - ('replace', 'block', ['lines'])] - - module = AnsibleModule(argument_spec=argument_spec, - mutually_exclusive=mutually_exclusive, - required_if=required_if, - supports_check_mode=True) - - result = {'changed': False} - if module.params['backup']: - result['__backup__'] = get_config(module) - - run(module, result) - - module.exit_json(**result) - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_facts.py b/plugins/modules/network/onyx/onyx_facts.py deleted file mode 100644 index 68adda43..00000000 --- a/plugins/modules/network/onyx/onyx_facts.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_facts -author: "Waleed Mousa (@waleedym), Samer Deeb (@samerd)" -short_description: Collect facts from Mellanox ONYX network devices -description: - - Collects a base set of device facts from a ONYX Mellanox network devices - This module prepends all of the base network fact keys with - C(ansible_net_). The facts module will always collect a base set of - facts from the device and can enable or disable collection of additional - facts. -notes: - - Tested against ONYX 3.6 -options: - gather_subset: - description: - - When supplied, this argument will restrict the facts collected - to a given subset. Possible values for this argument include - all, version, module, and interfaces. Can specify a list of - values to include a larger subset. Values can also be used - with an initial C(M(!)) to specify that a specific subset should - not be collected. - required: false - default: version -''' - -EXAMPLES = """ ---- -- name: Collect all facts from the device - onyx_facts: - gather_subset: all -- name: Collect only the interfaces facts - onyx_facts: - gather_subset: - - interfaces -- name: Do not collect version facts - onyx_facts: - gather_subset: - - "!version" -""" - -RETURN = """ -ansible_net_gather_subset: - description: The list of fact subsets collected from the device - returned: always - type: list -# version -ansible_net_version: - description: A hash of all currently running system image information - returned: when version is configured or when no gather_subset is provided - type: dict -# modules -ansible_net_modules: - description: A hash of all modules on the systeme with status - returned: when modules is configured - type: dict -# interfaces -ansible_net_interfaces: - description: A hash of all interfaces running on the system - returned: when interfaces is configured - type: dict -""" - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxFactsModule(BaseOnyxModule): - - def get_runable_subset(self, gather_subset): - runable_subsets = set() - exclude_subsets = set() - for subset in gather_subset: - if subset == 'all': - runable_subsets.update(VALID_SUBSETS) - continue - - if subset.startswith('!'): - subset = subset[1:] - if subset == 'all': - exclude_subsets.update(VALID_SUBSETS) - continue - exclude = True - else: - exclude = False - - if subset not in VALID_SUBSETS: - self._module.fail_json(msg='Bad subset') - - if exclude: - exclude_subsets.add(subset) - else: - runable_subsets.add(subset) - - if not runable_subsets: - runable_subsets.update(VALID_SUBSETS) - - runable_subsets.difference_update(exclude_subsets) - if not runable_subsets: - runable_subsets.add('version') - return runable_subsets - - def init_module(self): - """ module initialization - """ - argument_spec = dict( - gather_subset=dict(default=['version'], type='list') - ) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def run(self): - self.init_module() - gather_subset = self._module.params['gather_subset'] - runable_subsets = self.get_runable_subset(gather_subset) - facts = dict() - facts['gather_subset'] = list(runable_subsets) - - instances = list() - for key in runable_subsets: - facter_cls = FACT_SUBSETS[key] - instances.append(facter_cls(self._module)) - - for inst in instances: - inst.populate() - facts.update(inst.facts) - - ansible_facts = dict() - for key, value in iteritems(facts): - key = 'ansible_net_%s' % key - ansible_facts[key] = value - self._module.exit_json(ansible_facts=ansible_facts) - - -class FactsBase(object): - - COMMANDS = [''] - - def __init__(self, module): - self.module = module - self.facts = dict() - self.responses = None - - def _show_cmd(self, cmd): - return show_cmd(self.module, cmd, json_fmt=True) - - def populate(self): - self.responses = [] - for cmd in self.COMMANDS: - self.responses.append(self._show_cmd(cmd)) - - -class Version(FactsBase): - - COMMANDS = ['show version'] - - def populate(self): - super(Version, self).populate() - data = self.responses[0] - if data: - self.facts['version'] = data - - -class Module(FactsBase): - - COMMANDS = ['show module'] - - def populate(self): - super(Module, self).populate() - data = self.responses[0] - if data: - self.facts['modules'] = data - - -class Interfaces(FactsBase): - - COMMANDS = ['show version', 'show interfaces ethernet'] - - def populate(self): - super(Interfaces, self).populate() - - version_data = self.responses[0] - os_version = version_data['Product release'] - data = self.responses[1] - - if data: - self.facts['interfaces'] = self.populate_interfaces(data, os_version) - - def extractIfData(self, interface_data): - return {"MAC Address": interface_data["Mac address"], - "Actual Speed": interface_data["Actual speed"], - "MTU": interface_data["MTU"], - "Admin State": interface_data["Admin state"], - "Operational State": interface_data["Operational state"]} - - def populate_interfaces(self, interfaces, os_version): - interfaces_dict = dict() - for if_data in interfaces: - if_dict = dict() - if os_version >= BaseOnyxModule.ONYX_API_VERSION: - for if_name, interface_data in iteritems(if_data): - interface_data = interface_data[0] - if_dict = self.extractIfData(interface_data) - if_name = if_dict["Interface Name"] = if_name - - else: - if_dict = self.extractIfData(if_data) - if_name = if_dict["Interface Name"] = if_data["header"] - interfaces_dict[if_name] = if_dict - return interfaces_dict - - -FACT_SUBSETS = dict( - version=Version, - modules=Module, - interfaces=Interfaces -) - -VALID_SUBSETS = frozenset(FACT_SUBSETS.keys()) - - -def main(): - """ main entry point for module execution - """ - OnyxFactsModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_igmp.py b/plugins/modules/network/onyx/onyx_igmp.py deleted file mode 100644 index d04a957a..00000000 --- a/plugins/modules/network/onyx/onyx_igmp.py +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_igmp -author: "Samer Deeb (@samerd)" -short_description: Configures IGMP global parameters -description: - - This module provides declarative management of IGMP protocol params - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.6107 -options: - state: - description: - - IGMP state. - required: true - choices: ['enabled', 'disabled'] - last_member_query_interval: - description: - - Configure the last member query interval, range 1-25 - mrouter_timeout: - description: - - Configure the mrouter timeout, range 60-600 - port_purge_timeout: - description: - - Configure the host port purge timeout, range 130-1225 - proxy_reporting: - description: - - Configure ip igmp snooping proxy and enable reporting mode - choices: ['enabled', 'disabled'] - report_suppression_interval: - description: - - Configure the report suppression interval, range 1-25 - unregistered_multicast: - description: - - Configure the unregistered multicast mode - Flood unregistered multicast - Forward unregistered multicast to mrouter ports - choices: ['flood', 'forward-to-mrouter-ports'] - default_version: - description: - - Configure the default operating version of the IGMP snooping - choices: ['V2','V3'] -''' - -EXAMPLES = """ -- name: Configure igmp - onyx_igmp: - state: enabled - unregistered_multicast: flood -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - ip igmp snooping - - ip igmp snooping last-member-query-interval 10 - - ip igmp snooping mrouter-timeout 150 - - ip igmp snooping port-purge-timeout 150 -""" - -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxIgmpModule(BaseOnyxModule): - TIME_INTERVAL_REGEX = re.compile(r'^(\d+)\s+seconds') - - _RANGE_INTERVALS = dict( - last_member_query_interval=(1, 25, 'Last member query interval'), - mrouter_timeout=(60, 600, 'Mrouter timeout'), - port_purge_timeout=(130, 1225, 'Port purge timeout'), - report_suppression_interval=(1, 25, 'Report suppression interval'), - ) - - def init_module(self): - """ initialize module - """ - element_spec = dict( - state=dict(choices=['enabled', 'disabled'], required=True), - last_member_query_interval=dict(type='int'), - mrouter_timeout=dict(type='int'), - port_purge_timeout=dict(type='int'), - proxy_reporting=dict(choices=['enabled', 'disabled']), - report_suppression_interval=dict(type='int'), - unregistered_multicast=dict( - choices=['flood', 'forward-to-mrouter-ports']), - default_version=dict(choices=['V2', 'V3']), - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def _validate_key(self, param, key): - interval_params = self._RANGE_VALIDATORS.get(key) - if interval_params: - min_val, max_val = interval_params[0], interval_params[1] - value = param.get(key) - self._validate_range(key, min_val, max_val, value) - else: - super(OnyxIgmpModule, self)._validate_key(param, key) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _set_igmp_config(self, igmp_config): - igmp_config = igmp_config[0] - if not igmp_config: - return - self._current_config['state'] = igmp_config.get( - 'IGMP snooping globally', 'disabled') - self._current_config['proxy_reporting'] = igmp_config.get( - 'Proxy-reporting globally', 'disabled') - self._current_config['default_version'] = igmp_config.get( - 'IGMP default version for new VLAN', 'V3') - self._current_config['unregistered_multicast'] = igmp_config.get( - 'IGMP snooping unregistered multicast', 'flood') - - for interval_name, interval_params in iteritems(self._RANGE_INTERVALS): - display_str = interval_params[2] - value = igmp_config.get(display_str, '') - match = self.TIME_INTERVAL_REGEX.match(value) - if match: - interval_value = int(match.group(1)) - else: - interval_value = None - self._current_config[interval_name] = interval_value - - def _show_igmp(self): - cmd = "show ip igmp snooping" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - igmp_config = self._show_igmp() - if igmp_config: - self._set_igmp_config(igmp_config) - - def generate_commands(self): - state = self._required_config['state'] - if state == 'enabled': - self._generate_igmp_cmds() - else: - self._generate_no_igmp_cmds() - - def _generate_igmp_cmds(self): - curr_state = self._current_config.get('state', 'disabled') - if curr_state == 'disabled': - self._commands.append('ip igmp snooping') - for interval_name in self._RANGE_INTERVALS: - req_val = self._required_config.get(interval_name) - if not req_val: - continue - curr_value = self._current_config.get(interval_name) - if curr_value == req_val: - continue - interval_cmd = interval_name.replace('_', '-') - self._commands.append( - 'ip igmp snooping %s %s' % (interval_cmd, req_val)) - - req_val = self._required_config.get('unregistered_multicast') - if req_val: - curr_value = self._current_config.get( - 'unregistered_multicast', 'flood') - if req_val != curr_value: - self._commands.append( - 'ip igmp snooping unregistered multicast %s' % req_val) - - req_val = self._required_config.get('proxy_reporting') - if req_val: - curr_value = self._current_config.get( - 'proxy_reporting', 'disabled') - if req_val != curr_value: - cmd = 'ip igmp snooping proxy reporting' - if req_val == 'disabled': - cmd = 'no %s' % cmd - self._commands.append(cmd) - - req_val = self._required_config.get('default_version') - if req_val: - curr_value = self._current_config.get( - 'default_version', 'V3') - if req_val != curr_value: - version = req_val[1] # remove the 'V' and take the number only - self._commands.append( - 'ip igmp snooping version %s' % version) - - def _generate_no_igmp_cmds(self): - curr_state = self._current_config.get('state', 'disabled') - if curr_state != 'disabled': - self._commands.append('no ip igmp snooping') - - -def main(): - """ main entry point for module execution - """ - OnyxIgmpModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_igmp_interface.py b/plugins/modules/network/onyx/onyx_igmp_interface.py deleted file mode 100644 index b34a2ac4..00000000 --- a/plugins/modules/network/onyx/onyx_igmp_interface.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_igmp_interface -author: "Anas Badaha (@anasb)" -short_description: Configures IGMP interface parameters -description: - - This module provides declarative management of IGMP interface configuration - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.8130 -options: - name: - description: - - interface name that we want to configure IGMP on it - required: true - state: - description: - - IGMP Interface state. - choices: ['enabled', 'disabled'] - default: enabled -''' - -EXAMPLES = """ -- name: Configure igmp interface - onyx_igmp_interface: - state: enabled - name: Eth1/1 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/1 ip igmp snooping fast-leave -""" - -import re -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxIgmpInterfaceModule(BaseOnyxModule): - IF_NAME_REGEX = re.compile(r"^(Eth\d+\/\d+|Eth\d+\/\d+\d+)$") - - def init_module(self): - """ initialize module - """ - element_spec = dict( - state=dict(choices=['enabled', 'disabled'], default='enabled'), - name=dict(required=True) - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - match = self.IF_NAME_REGEX.match(self._required_config["name"]) - if not match: - raise AttributeError("Please Insert Valid Interface Name") - - self.validate_param_values(self._required_config) - - def _set_igmp_config(self, igmp_interfaces_config): - if not igmp_interfaces_config: - return - name = self._required_config.get('name') - interface_state = igmp_interfaces_config[name][0].get('leave-mode') - if interface_state == "Fast": - self._current_config['state'] = "enabled" - else: - self._current_config['state'] = "disabled" - - def _show_igmp_interfaces(self): - cmd = "show ip igmp snooping interfaces" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - igmp_interfaces_config = self._show_igmp_interfaces() - if igmp_interfaces_config: - self._set_igmp_config(igmp_interfaces_config) - - def generate_commands(self): - req_state = self._required_config['state'] - self._req_val = self._required_config.get('name').replace("Eth", "ethernet ") - - if req_state == 'enabled': - self._generate_igmp_interface_cmds() - else: - self._generate_no_igmp_cmds() - - def _generate_igmp_interface_cmds(self): - curr_state = self._current_config.get('state', 'enabled') - if curr_state == 'enabled': - pass - - elif curr_state == 'disabled': - self._commands.append('interface %s ip igmp snooping fast-leave' % self._req_val) - - def _generate_no_igmp_cmds(self): - curr_state = self._current_config.get('state', 'enabled') - if curr_state == 'enabled': - self._commands.append('interface %s no ip igmp snooping fast-leave' % self._req_val) - else: - pass - - -def main(): - """ main entry point for module execution - """ - OnyxIgmpInterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_igmp_vlan.py b/plugins/modules/network/onyx/onyx_igmp_vlan.py deleted file mode 100644 index 5ff2ec5d..00000000 --- a/plugins/modules/network/onyx/onyx_igmp_vlan.py +++ /dev/null @@ -1,431 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_igmp_vlan -author: Anas Badaha (@anasbadaha) -short_description: Configures IGMP Vlan parameters -description: - - This module provides declarative management of IGMP vlan configuration on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.7.0932-01 -options: - vlan_id: - description: - - VLAN ID, vlan should exist. - required: true - state: - description: - - IGMP state. - choices: ['enabled', 'disabled'] - default: enabled - mrouter: - description: - - Configure ip igmp snooping mrouter port on vlan - suboptions: - state: - description: - - Enable IGMP snooping mrouter on vlan interface. - choices: ['enabled', 'disabled'] - default: enabled - name: - description: - - Configure mrouter interface - required: true - querier: - description: - - Configure the IGMP querier parameters - suboptions: - state: - description: - - Enable IGMP snooping querier on vlan in the switch. - choices: ['enabled', 'disabled'] - default: enabled - interval: - description: - - Update time interval between querier queries, range 60-600 - address: - description: - - Update IP address for the querier - static_groups: - description: - - List of IGMP static groups. - suboptions: - multicast_ip_address: - description: - - Configure static IP multicast group, range 224.0.1.0-239.255.255.25. - required: true - name: - description: - - interface name to configure static groups on it. - sources: - description: - - List of IP sources to be configured - version: - description: - - IGMP snooping operation version on this vlan - choices: ['V2','V3'] -''' - -EXAMPLES = """ -- name: Configure igmp vlan - onyx_igmp_vlan: - state: enabled - vlan_id: 10 - version: - V2 - querier: - state: enabled - interval: 70 - address: 10.11.121.13 - mrouter: - state: disabled - name: Eth1/2 - static_groups: - - multicast_ip_address: 224.5.5.8 - name: Eth1/1 - sources: - - 1.1.1.1 - - 1.1.1.2 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - vlan 10 ip igmp snooping - - vlan 10 ip igmp snooping static-group 224.5.5.5 interface ethernet 1/1 -""" -import socket -import struct - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -def _ip_to_int(addr): - return struct.unpack("!I", socket.inet_aton(addr))[0] - - -class OnyxIgmpVlanModule(BaseOnyxModule): - MIN_MULTICAST_IP = _ip_to_int("224.0.1.0") - MAX_MULTICAST_IP = _ip_to_int("239.255.255.255") - - def init_module(self): - """ initialize module - """ - mrouter_spec = dict(name=dict(required=True), - state=dict(choices=['enabled', 'disabled'], default='enabled')) - querier_spec = dict(state=dict(choices=['enabled', 'disabled'], default='enabled'), - interval=dict(type='int'), address=dict()) - static_groups_spec = dict(multicast_ip_address=dict(required=True), - name=dict(required=True), sources=dict(type='list')) - element_spec = dict(vlan_id=dict(type='int', required=True), - state=dict(choices=['enabled', 'disabled'], default='enabled'), - querier=dict(type='dict', options=querier_spec), - static_groups=dict(type='list', elements='dict', options=static_groups_spec), - mrouter=dict(type='dict', options=mrouter_spec), - version=dict(choices=['V2', 'V3'])) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _validate_attr_is_not_none(self, attr_name, attr_value): - if attr_name == 'vlan_id' or attr_name == 'state': - pass - elif attr_value is not None: - self._module.fail_json(msg='Can not set %s value on switch while state is disabled' % attr_name) - - def validate_param_values(self, obj, param=None): - if obj['state'] == 'disabled': - for attr_name in obj: - self._validate_attr_is_not_none(attr_name, obj[attr_name]) - super(OnyxIgmpVlanModule, self).validate_param_values(obj, param) - - def validate_querier(self, value): - interval = value.get('interval') - if interval and not 60 <= int(interval) <= 600: - self._module.fail_json(msg='query-interval value must be between 60 and 600') - - def validate_static_groups(self, value): - multicast_ip = value.get('multicast_ip_address') - multicast_ip = _ip_to_int(multicast_ip) - - if multicast_ip < self.MIN_MULTICAST_IP or multicast_ip > self.MAX_MULTICAST_IP: - self._module.fail_json(msg='multicast IP address must be in range 224.0.1.0 - 239.255.255.255') - - @staticmethod - def _get_curr_mrouter_config(mrouter_port): - if mrouter_port == "none": - return {'state': 'disabled'} - else: - return {'state': 'enabled', - 'name': mrouter_port} - - def _get_curr_querier_config(self, querier_config): - if "Non-Querier" in querier_config: - return {'state': 'disabled'} - elif "Querier" in querier_config: - igmp_querier_config = self._show_igmp_querier_config()[0] - snooping_querier_info = igmp_querier_config["Snooping querier information for VLAN %d" % ( - self._required_config['vlan_id'])] - snooping_querier_info = snooping_querier_info[1] - interval = int(snooping_querier_info["Query interval"]) - address = snooping_querier_info["Configured querier IP address"] - return {'state': 'enabled', - 'interval': interval, - 'address': address} - - @staticmethod - def _get_curr_version(version): - if "V3" in version: - return "V3" - elif "V2" in version: - return "V2" - - def _get_curr_static_group_config(self, multicast_ip_address): - sources = None - names = None - igmp_snooping_groups_config = self._show_igmp_snooping_groups_config(multicast_ip_address) - if igmp_snooping_groups_config is not None: - igmp_snooping_groups_config = igmp_snooping_groups_config[0] - snooping_group_information = igmp_snooping_groups_config.get('Snooping group ' - 'information for VLAN %d and group ' - '%s' % (self._required_config['vlan_id'], - multicast_ip_address)) - if snooping_group_information is not None: - if len(snooping_group_information) == 1: - names = snooping_group_information[0].get('V1/V2 Receiver Ports') - elif len(snooping_group_information) == 2: - sources_dict = dict() - v3_receiver_ports = snooping_group_information[1].get('V3 Receiver Ports') - ports_number = v3_receiver_ports[0].get('Port Number') - sources = v3_receiver_ports[0].get('Include sources') - if isinstance(ports_number, list): - i = 0 - for port_number in ports_number: - sources_dict[port_number] = sources[i] - i += 1 - else: - sources_dict[ports_number] = sources - names = snooping_group_information[0].get('V1/V2 Receiver Ports') - sources = sources_dict - - return {'sources': sources, - 'names': names} - else: - return None - else: - return None - - def _set_igmp_config(self, igmp_vlan_config): - igmp_vlan_config = igmp_vlan_config[0] - if not igmp_vlan_config: - return - - self._current_config['state'] = igmp_vlan_config.get('message 1') - if "enabled" in self._current_config['state']: - self._current_config['state'] = "enabled" - elif "disabled" in self._current_config['state']: - self._current_config['state'] = "disabled" - - mrouter_port = igmp_vlan_config.get('mrouter static port list') - self._current_config['mrouter'] = dict(self._get_curr_mrouter_config(mrouter_port)) - - querier_config = igmp_vlan_config.get('message 3') - self._current_config['querier'] = dict(self._get_curr_querier_config(querier_config)) - - version = igmp_vlan_config.get('message 2') - self._current_config['version'] = self._get_curr_version(version) - - req_static_groups = self._required_config.get('static_groups') - if req_static_groups is not None: - static_groups = self._current_config['static_groups'] = dict() - for static_group in req_static_groups: - static_group_config = self._get_curr_static_group_config(static_group['multicast_ip_address']) - static_groups[static_group['multicast_ip_address']] = static_group_config - - def _show_igmp_vlan(self): - cmd = ("show ip igmp snooping vlan %d" % self._required_config['vlan_id']) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_igmp_querier_config(self): - cmd = ("show ip igmp snooping querier vlan %d " % self._required_config['vlan_id']) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_igmp_snooping_groups_config(self, multicast_ip_address): - cmd = ("show ip igmp snooping groups vlan %d group %s" % (self._required_config['vlan_id'], - multicast_ip_address)) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - igmp_vlan_config = self._show_igmp_vlan() - if igmp_vlan_config: - self._set_igmp_config(igmp_vlan_config) - - def generate_commands(self): - req_state = self._required_config.get('state', 'enabled') - self._generate_igmp_vlan_cmds(req_state) - - _mrouter = self._required_config.get('mrouter') - if _mrouter is not None: - self._generate_igmp_mrouter_cmds(_mrouter) - - _querier = self._required_config.get('querier') - if _querier is not None: - req_querier_state = _querier.get('state', 'enabled') - self._generate_igmp_querier_cmds(req_querier_state) - - req_querier_interval = _querier.get('interval') - if req_querier_interval is not None: - self._gen_querier_attr_commands("interval", req_querier_interval, "query-interval") - - req_querier_address = _querier.get('address') - if req_querier_address is not None: - self._gen_querier_attr_commands("address", req_querier_address, "address") - - _version = self._required_config.get('version') - if _version is not None: - self._generate_igmp_version_cmds(_version) - - _static_groups = self._required_config.get('static_groups') - if _static_groups is not None: - for static_group in _static_groups: - self._generate_igmp_static_groups_cmd(static_group) - - def _add_igmp_vlan_commands(self, req_state): - if req_state == 'enabled': - igmp_vlan_cmd = 'vlan %d ip igmp snooping' % self._required_config['vlan_id'] - else: - igmp_vlan_cmd = 'vlan %d no ip igmp snooping' % self._required_config['vlan_id'] - - self._commands.append(igmp_vlan_cmd) - - def _generate_igmp_vlan_cmds(self, req_state): - curr_state = self._current_config.get('state') - if curr_state != req_state: - self._add_igmp_vlan_commands(req_state) - - def _gen_querier_attr_commands(self, attr_name, req_attr_value, attr_cmd_name): - _curr_querier = self._current_config.get('querier') - curr_querier_val = _curr_querier.get(attr_name) - if req_attr_value != curr_querier_val: - self._commands.append('vlan %d ip igmp snooping querier %s %s' % (self._required_config['vlan_id'], - attr_cmd_name, req_attr_value)) - - def _add_querier_commands(self, req_querier_state): - if req_querier_state == 'enabled': - self._commands.append('vlan %d ip igmp snooping querier' % self._required_config['vlan_id']) - elif req_querier_state == 'disabled': - self._commands.append('vlan %d no ip igmp snooping querier' % ( - self._required_config['vlan_id'])) - - def _generate_igmp_querier_cmds(self, req_querier_state): - _curr_querier = self._current_config.get('querier') - curr_querier_state = _curr_querier.get('state') - if req_querier_state != curr_querier_state: - self._add_querier_commands(req_querier_state) - - def _generate_igmp_version_cmds(self, version): - _curr_version = self._current_config.get('version') - if version != _curr_version: - self._commands.append('vlan %d ip igmp snooping version %s' % ( - self._required_config['vlan_id'], version[1])) - - def _add_mrouter_commands(self, req_mrouter, curr_mrouter): - curr_state = curr_mrouter.get('state') - curr_interface = curr_mrouter.get('name') - req_state = req_mrouter.get('state') - req_interface = req_mrouter.get('name') - mrouter_interface = req_interface.replace("Eth", "ethernet ") - if curr_state == 'enabled' and req_state == 'disabled': - self._commands.append('vlan %d no ip igmp snooping mrouter interface ' - '%s' % (self._required_config['vlan_id'], mrouter_interface)) - elif curr_state == 'disabled' and req_state == 'enabled': - self._commands.append('vlan %d ip igmp snooping mrouter interface ' - '%s' % (self._required_config['vlan_id'], mrouter_interface)) - elif req_state == 'enabled' and curr_state == 'enabled' and req_interface != curr_interface: - self._commands.append('vlan %d ip igmp snooping mrouter interface ' - '%s' % (self._required_config['vlan_id'], mrouter_interface)) - - def _generate_igmp_mrouter_cmds(self, req_mrouter): - curr_mrouter = self._current_config.get('mrouter') - if curr_mrouter != req_mrouter: - self._add_mrouter_commands(req_mrouter, curr_mrouter) - - def _add_igmp_static_groups_cmd(self, req_name, req_multicast_ip_address, curr_names): - if curr_names is None: - self._commands.append('vlan %d ip igmp snooping static-group %s interface %s' % ( - self._required_config['vlan_id'], req_multicast_ip_address, req_name.replace('Eth', 'ethernet '))) - elif req_name.replace('E', 'e') not in curr_names: - self._commands.append('vlan %d ip igmp snooping static-group %s interface %s' % ( - self._required_config['vlan_id'], req_multicast_ip_address, req_name.replace('Eth', 'ethernet '))) - - def _add_igmp_static_groups_sources_cmd(self, req_sources, req_name, req_multicast_ip_address, curr_sources): - if curr_sources is None: - for source in req_sources: - self._commands.append('vlan %d ip igmp snooping static-group %s interface %s source %s' % ( - self._required_config['vlan_id'], req_multicast_ip_address, req_name.replace('Eth', 'ethernet '), - source)) - else: - curr_sources = curr_sources.get(req_name.replace('E', 'e')) - if curr_sources is None: - curr_sources = set([]) - else: - curr_sources = set(x.strip() for x in curr_sources.split(',')) - sources_to_add = set(req_sources) - set(curr_sources) - sources_to_remove = set(curr_sources) - set(req_sources) - if len(sources_to_add) != 0: - for source in sources_to_add: - self._commands.append('vlan %d ip igmp snooping static-group %s interface %s source %s' % ( - self._required_config['vlan_id'], req_multicast_ip_address, - req_name.replace('Eth', 'ethernet '), source)) - if len(sources_to_remove) != 0: - for source in sources_to_remove: - self._commands.append('vlan %d no ip igmp snooping static-group %s interface %s source %s' % ( - self._required_config['vlan_id'], req_multicast_ip_address, - req_name.replace('Eth', 'ethernet '), - source)) - - def _generate_igmp_static_groups_cmd(self, static_group): - req_multicast_ip_address = static_group.get('multicast_ip_address') - req_name = static_group.get('name') - req_sources = static_group.get('sources') - curr_static_groups = self._current_config.get('static_groups') - curr_static_group = curr_static_groups.get(req_multicast_ip_address) - curr_names = None - curr_sources = None - if curr_static_group is not None: - curr_names = curr_static_group.get('names') - curr_sources = curr_static_group.get('sources') - - self._add_igmp_static_groups_cmd(req_name, req_multicast_ip_address, curr_names) - if req_sources is not None: - self._add_igmp_static_groups_sources_cmd(req_sources, req_name, req_multicast_ip_address, curr_sources) - - -def main(): - """ main entry point for module execution - """ - OnyxIgmpVlanModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_interface.py b/plugins/modules/network/onyx/onyx_interface.py deleted file mode 100644 index 60267839..00000000 --- a/plugins/modules/network/onyx/onyx_interface.py +++ /dev/null @@ -1,497 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_interface -author: "Samer Deeb (@samerd)" -short_description: Manage Interfaces on Mellanox ONYX network devices -description: - - This module provides declarative management of Interfaces - on Mellanox ONYX network devices. -notes: -options: - name: - description: - - Name of the Interface. - required: true - description: - description: - - Description of Interface. - enabled: - description: - - Interface link status. - type: bool - speed: - description: - - Interface link speed. - choices: ['1G', '10G', '25G', '40G', '50G', '56G', '100G'] - mtu: - description: - - Maximum size of transmit packet. - aggregate: - description: List of Interfaces definitions. - duplex: - description: - - Interface link status - default: auto - choices: ['full', 'half', 'auto'] - tx_rate: - description: - - Transmit rate in bits per second (bps). - - This is state check parameter only. - - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) - rx_rate: - description: - - Receiver rate in bits per second (bps). - - This is state check parameter only. - - Supports conditionals, see L(Conditionals in Networking Modules,../network/user_guide/network_working_with_command_output.html) - delay: - description: - - Time in seconds to wait before checking for the operational state on - remote device. This wait is applicable for operational state argument - which are I(state) with values C(up)/C(down). - default: 10 - purge: - description: - - Purge Interfaces not defined in the aggregate parameter. - This applies only for logical interface. - default: false - type: bool - state: - description: - - State of the Interface configuration, C(up) means present and - operationally up and C(down) means present and operationally C(down) - default: present - choices: ['present', 'absent', 'up', 'down'] -''' - -EXAMPLES = """ -- name: Configure interface - onyx_interface: - name: Eth1/2 - description: test-interface - speed: 100G - mtu: 512 - -- name: Make interface up - onyx_interface: - name: Eth1/2 - enabled: True - -- name: Make interface down - onyx_interface: - name: Eth1/2 - enabled: False - -- name: Check intent arguments - onyx_interface: - name: Eth1/2 - state: up - -- name: Config + intent - onyx_interface: - name: Eth1/2 - enabled: False - state: down -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/2 - - description test-interface - - mtu 512 - - exit -""" - -from copy import deepcopy -import re -from time import sleep - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import conditional -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_interfaces_config - - -class OnyxInterfaceModule(BaseOnyxModule): - IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|\d+\/\d+\/\d+)$") - IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$") - IF_LOOPBACK_REGEX = re.compile(r"^Loopback (\d+)$") - IF_PO_REGEX = re.compile(r"^Po(\d+)$") - - IF_TYPE_ETH = "ethernet" - IF_TYPE_LOOPBACK = "loopback" - IF_TYPE_VLAN = "vlan" - IF_TYPE_PO = "port-channel" - - IF_TYPE_MAP = { - IF_TYPE_ETH: IF_ETH_REGEX, - IF_TYPE_VLAN: IF_VLAN_REGEX, - IF_TYPE_LOOPBACK: IF_LOOPBACK_REGEX, - IF_TYPE_PO: IF_PO_REGEX - } - UNSUPPORTED_ATTRS = { - IF_TYPE_ETH: (), - IF_TYPE_VLAN: ('speed', 'rx_rate', 'tx_rate'), - IF_TYPE_LOOPBACK: ('speed', 'mtu', 'rx_rate', 'tx_rate'), - IF_TYPE_PO: ('speed', 'rx_rate', 'tx_rate'), - } - UNSUPPORTED_STATES = { - IF_TYPE_ETH: ('absent',), - IF_TYPE_VLAN: (), - IF_TYPE_LOOPBACK: ('up', 'down'), - IF_TYPE_PO: ('absent'), - } - - IF_MODIFIABLE_ATTRS = ('speed', 'description', 'mtu') - _interface_type = None - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(type='str'), - description=dict(), - speed=dict(choices=['1G', '10G', '25G', '40G', '50G', '56G', '100G']), - mtu=dict(type='int'), - enabled=dict(type='bool'), - delay=dict(default=10, type='int'), - state=dict(default='present', - choices=['present', 'absent', 'up', 'down']), - tx_rate=dict(), - rx_rate=dict(), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def validate_purge(self, value): - if value: - self._module.fail_json( - msg='Purge is not supported!') - - def validate_duplex(self, value): - if value != 'auto': - self._module.fail_json( - msg='Duplex is not supported!') - - def _get_interface_type(self, if_name): - if_type = None - if_id = None - for interface_type, interface_regex in iteritems(self.IF_TYPE_MAP): - match = interface_regex.match(if_name) - if match: - if_type = interface_type - if_id = match.group(1) - break - return if_type, if_id - - def _set_if_type(self, params): - if_name = params['name'] - if_type, if_id = self._get_interface_type(if_name) - if not if_id: - self._module.fail_json( - msg='unsupported interface: %s' % if_name) - params['if_type'] = if_type - params['if_id'] = if_id - - def _check_supported_attrs(self, if_obj): - unsupported_attrs = self.UNSUPPORTED_ATTRS[self._interface_type] - for attr in unsupported_attrs: - val = if_obj[attr] - if val is not None: - self._module.fail_json( - msg='attribute %s is not supported for %s interface' % ( - attr, self._interface_type)) - req_state = if_obj['state'] - unsupported_states = self.UNSUPPORTED_STATES[self._interface_type] - if req_state in unsupported_states: - self._module.fail_json( - msg='%s state is not supported for %s interface' % ( - req_state, self._interface_type)) - - def _validate_interface_type(self): - for if_obj in self._required_config: - if_type = if_obj['if_type'] - if not self._interface_type: - self._interface_type = if_type - elif self._interface_type != if_type: - self._module.fail_json( - msg='Cannot aggregate interfaces from different types') - self._check_supported_attrs(if_obj) - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - - self.validate_param_values(item, item) - req_item = item.copy() - self._set_if_type(req_item) - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'description': module_params['description'], - 'speed': module_params['speed'], - 'mtu': module_params['mtu'], - 'state': module_params['state'], - 'delay': module_params['delay'], - 'enabled': module_params['enabled'], - 'tx_rate': module_params['tx_rate'], - 'rx_rate': module_params['rx_rate'], - } - - self.validate_param_values(params) - self._set_if_type(params) - self._required_config.append(params) - self._validate_interface_type() - - @classmethod - def get_if_name(cls, item): - return cls.get_config_attr(item, "header") - - @classmethod - def get_admin_state(cls, item): - admin_state = cls.get_config_attr(item, "Admin state") - return str(admin_state).lower() == "enabled" - - @classmethod - def get_oper_state(cls, item): - oper_state = cls.get_config_attr(item, "Operational state") - if not oper_state: - oper_state = cls.get_config_attr(item, "State") - return str(oper_state).lower() - - @classmethod - def get_speed(cls, item): - speed = cls.get_config_attr(item, 'Actual speed') - if not speed: - return - try: - speed = int(speed.split()[0]) - return "%dG" % speed - except ValueError: - return None - - def _create_if_data(self, name, item): - regex = self.IF_TYPE_MAP[self._interface_type] - if_id = '' - match = regex.match(name) - if match: - if_id = match.group(1) - return dict( - name=name, - description=self.get_config_attr(item, 'Description'), - speed=self.get_speed(item), - mtu=self.get_mtu(item), - enabled=self.get_admin_state(item), - state=self.get_oper_state(item), - if_id=if_id) - - def _get_interfaces_config(self): - return get_interfaces_config(self._module, self._interface_type) - - def load_current_config(self): - self._os_version = self._get_os_version() - self._current_config = dict() - config = self._get_interfaces_config() - if not config: - return - if self._os_version < self.ONYX_API_VERSION: - for if_data in config: - if_name = self.get_if_name(if_data) - self._current_config[if_name] = self._create_if_data( - if_name, if_data) - else: - if_data = dict() - for if_config in config: - for if_name, if_attr in iteritems(if_config): - for config in if_attr: - for key, value in iteritems(config): - if_data[key] = value - self._current_config[if_name] = self._create_if_data( - if_name, if_data) - - def _generate_no_if_commands(self, req_if, curr_if): - if self._interface_type == self.IF_TYPE_ETH: - name = req_if['name'] - self._module.fail_json( - msg='cannot remove ethernet interface %s' % name) - if not curr_if: - return - if_id = req_if['if_id'] - if not if_id: - return - self._commands.append( - 'no interface %s %s' % (self._interface_type, if_id)) - - def _add_commands_to_interface(self, req_if, cmd_list): - if not cmd_list: - return - if_id = req_if['if_id'] - if not if_id: - return - self._commands.append( - 'interface %s %s' % (self._interface_type, if_id)) - self._commands.extend(cmd_list) - self._commands.append('exit') - - def _generate_if_commands(self, req_if, curr_if): - enabled = req_if['enabled'] - cmd_list = [] - for attr_name in self.IF_MODIFIABLE_ATTRS: - candidate = req_if.get(attr_name) - running = curr_if.get(attr_name) - if candidate != running: - if candidate: - cmd = attr_name + ' ' + str(candidate) - if self._interface_type == self.IF_TYPE_ETH and \ - attr_name in ('mtu', 'speed'): - cmd = cmd + ' ' + 'force' - cmd_list.append(cmd) - curr_enabled = curr_if.get('enabled', False) - if enabled is not None and enabled != curr_enabled: - cmd = 'shutdown' - if enabled: - cmd = "no %s" % cmd - cmd_list.append(cmd) - if cmd_list: - self._add_commands_to_interface(req_if, cmd_list) - - def generate_commands(self): - for req_if in self._required_config: - name = req_if['name'] - curr_if = self._current_config.get(name, {}) - if not curr_if and self._interface_type == self.IF_TYPE_ETH: - self._module.fail_json( - msg='could not find ethernet interface %s' % name) - continue - req_state = req_if['state'] - if req_state == 'absent': - self._generate_no_if_commands(req_if, curr_if) - else: - self._generate_if_commands(req_if, curr_if) - - def _get_interfaces_rates(self): - return get_interfaces_config(self._module, self._interface_type, - "rates") - - def _get_interfaces_status(self): - return get_interfaces_config(self._module, self._interface_type, - "status") - - def _check_state(self, name, want_state, statuses): - curr_if = statuses.get(name, {}) - if curr_if: - curr_if = curr_if[0] - curr_state = self.get_oper_state(curr_if).strip() - if curr_state is None or not conditional(want_state, curr_state): - return 'state eq(%s)' % want_state - - def check_declarative_intent_params(self, result): - failed_conditions = [] - delay_called = False - rates = None - statuses = None - for req_if in self._required_config: - want_state = req_if.get('state') - want_tx_rate = req_if.get('tx_rate') - want_rx_rate = req_if.get('rx_rate') - name = req_if['name'] - if want_state not in ('up', 'down') and not want_tx_rate and not \ - want_rx_rate: - continue - if not delay_called and result['changed']: - delay_called = True - delay = req_if['delay'] - if delay > 0: - sleep(delay) - if want_state in ('up', 'down'): - if statuses is None: - statuses = self._get_interfaces_status() or {} - cond = self._check_state(name, want_state, statuses) - if cond: - failed_conditions.append(cond) - if_rates = None - if want_tx_rate or want_rx_rate: - if not rates: - rates = self._get_interfaces_rates() - if_rates = rates.get(name) - if if_rates: - if_rates = if_rates[0] - if want_tx_rate: - have_tx_rate = None - if if_rates: - have_tx_rate = if_rates.get('egress rate') - if have_tx_rate: - have_tx_rate = have_tx_rate.split()[0] - if have_tx_rate is None or not \ - conditional(want_tx_rate, have_tx_rate.strip(), - cast=int): - failed_conditions.append('tx_rate ' + want_tx_rate) - - if want_rx_rate: - have_rx_rate = None - if if_rates: - have_rx_rate = if_rates.get('ingress rate') - if have_rx_rate: - have_rx_rate = have_rx_rate.split()[0] - if have_rx_rate is None or not \ - conditional(want_rx_rate, have_rx_rate.strip(), - cast=int): - failed_conditions.append('rx_rate ' + want_rx_rate) - - return failed_conditions - - -def main(): - """ main entry point for module execution - """ - OnyxInterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_l2_interface.py b/plugins/modules/network/onyx/onyx_l2_interface.py deleted file mode 100644 index eed76606..00000000 --- a/plugins/modules/network/onyx/onyx_l2_interface.py +++ /dev/null @@ -1,294 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_l2_interface -author: "Samer Deeb (@samerd)" -short_description: Manage Layer-2 interface on Mellanox ONYX network devices -description: - - This module provides declarative management of Layer-2 interface - on Mellanox ONYX network devices. -options: - name: - description: - - Name of the interface. - aggregate: - description: - - List of Layer-2 interface definitions. - mode: - description: - - Mode in which interface needs to be configured. - default: access - choices: ['access', 'trunk', 'hybrid'] - access_vlan: - description: - - Configure given VLAN in access port. - trunk_allowed_vlans: - description: - - List of allowed VLANs in a given trunk port. - state: - description: - - State of the Layer-2 Interface configuration. - default: present - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Configure Layer-2 interface - onyx_l2_interface: - name: Eth1/1 - mode: access - access_vlan: 30 -- name: Remove Layer-2 interface configuration - onyx_l2_interface: - name: Eth1/1 - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - interface ethernet 1/1 - - switchport mode access - - switchport access vlan 30 -""" -from copy import deepcopy -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_interfaces_config - - -class OnyxL2InterfaceModule(BaseOnyxModule): - IFNAME_REGEX = re.compile(r"^.*(Eth\d+\/\d+|Mpo\d+|Po\d+)") - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(), - access_vlan=dict(type='int'), - trunk_allowed_vlans=dict(type='list', elements='int'), - state=dict(default='present', - choices=['present', 'absent']), - mode=dict(default='access', - choices=['access', 'hybrid', 'trunk']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'access_vlan': module_params['access_vlan'], - 'trunk_allowed_vlans': module_params['trunk_allowed_vlans'], - 'mode': module_params['mode'], - 'state': module_params['state'], - } - self.validate_param_values(params) - self._required_config.append(params) - - def validate_access_vlan(self, value): - if value and not 1 <= int(value) <= 4094: - self._module.fail_json(msg='vlan id must be between 1 and 4094') - - @classmethod - def get_allowed_vlans(cls, if_data): - allowed_vlans = cls.get_config_attr(if_data, 'Allowed vlans') - interface_allwoed_vlans = [] - if allowed_vlans: - vlans = [x.strip() for x in allowed_vlans.split(',')] - for vlan in vlans: - if '-' not in vlan: - interface_allwoed_vlans.append(int(vlan)) - else: - vlan_range = vlan.split("-") - min_number = int(vlan_range[0].strip()) - max_number = int(vlan_range[1].strip()) - vlan_list = range(min_number, max_number + 1) - interface_allwoed_vlans.extend(vlan_list) - return interface_allwoed_vlans - - @classmethod - def get_access_vlan(cls, if_data): - access_vlan = cls.get_config_attr(if_data, 'Access vlan') - if access_vlan: - try: - return int(access_vlan) - except ValueError: - return None - - def _create_switchport_data(self, if_name, if_data): - if self._os_version >= self.ONYX_API_VERSION: - if_data = if_data[0] - - return { - 'name': if_name, - 'mode': self.get_config_attr(if_data, 'Mode'), - 'access_vlan': self.get_access_vlan(if_data), - 'trunk_allowed_vlans': self.get_allowed_vlans(if_data) - } - - def _get_switchport_config(self): - return get_interfaces_config(self._module, 'switchport') - - def load_current_config(self): - # called in base class in run function - self._os_version = self._get_os_version() - self._current_config = dict() - switchports_config = self._get_switchport_config() - if not switchports_config: - return - for if_name, if_data in iteritems(switchports_config): - self._current_config[if_name] = \ - self._create_switchport_data(if_name, if_data) - - def _get_switchport_command_name(self, if_name): - if if_name.startswith('Eth'): - return if_name.replace("Eth", "ethernet ") - if if_name.startswith('Po'): - return if_name.replace("Po", "port-channel ") - if if_name.startswith('Mpo'): - return if_name.replace("Mpo", "mlag-port-channel ") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _add_interface_commands(self, if_name, commands): - if_cmd_name = self._get_switchport_command_name(if_name) - self._commands.append("interface %s" % if_cmd_name) - self._commands.extend(commands) - self._commands.append('exit') - - def _generate_no_switchport_commands(self, if_name): - commands = ['no switchport force'] - self._add_interface_commands(if_name, commands) - - def _generate_switchport_commands(self, if_name, req_conf): - commands = [] - curr_conf = self._current_config.get(if_name, {}) - curr_mode = curr_conf.get('mode') - req_mode = req_conf.get('mode') - if req_mode != curr_mode: - commands.append('switchport mode %s' % req_mode) - curr_access_vlan = curr_conf.get('access_vlan') - req_access_vlan = req_conf.get('access_vlan') - if curr_access_vlan != req_access_vlan and req_access_vlan: - commands.append('switchport access vlan %s' % req_access_vlan) - curr_trunk_vlans = curr_conf.get('trunk_allowed_vlans') or set() - if curr_trunk_vlans: - curr_trunk_vlans = set(curr_trunk_vlans) - req_trunk_vlans = req_conf.get('trunk_allowed_vlans') or set() - if req_trunk_vlans: - req_trunk_vlans = set(req_trunk_vlans) - if req_mode != 'access' and curr_trunk_vlans != req_trunk_vlans: - added_vlans = req_trunk_vlans - curr_trunk_vlans - for vlan_id in added_vlans: - commands.append('switchport %s allowed-vlan add %s' % - (req_mode, vlan_id)) - removed_vlans = curr_trunk_vlans - req_trunk_vlans - for vlan_id in removed_vlans: - commands.append('switchport %s allowed-vlan remove %s' % - (req_mode, vlan_id)) - - if commands: - self._add_interface_commands(if_name, commands) - - def generate_commands(self): - for req_conf in self._required_config: - state = req_conf['state'] - if_name = req_conf['name'] - if state == 'absent': - if if_name in self._current_config: - self._generate_no_switchport_commands(if_name) - else: - self._generate_switchport_commands(if_name, req_conf) - - def _generate_vlan_commands(self, vlan_id, req_conf): - curr_vlan = self._current_config.get(vlan_id, {}) - if not curr_vlan: - cmd = "vlan " + vlan_id - self._commands.append("vlan %s" % vlan_id) - self._commands.append("exit") - vlan_name = req_conf['vlan_name'] - if vlan_name: - if vlan_name != curr_vlan.get('vlan_name'): - self._commands.append("vlan %s name %s" % (vlan_id, vlan_name)) - curr_members = set(curr_vlan.get('interfaces', [])) - req_members = req_conf['interfaces'] - mode = req_conf['mode'] - for member in req_members: - if member in curr_members: - continue - if_name = self.get_switchport_command_name(member) - cmd = "interface %s switchport mode %s" % (if_name, mode) - self._commands.append(cmd) - cmd = "interface %s switchport %s allowed-vlan add %s" % ( - if_name, mode, vlan_id) - self._commands.append(cmd) - req_members = set(req_members) - for member in curr_members: - if member in req_members: - continue - if_name = self.get_switchport_command_name(member) - cmd = "interface %s switchport %s allowed-vlan remove %s" % ( - if_name, mode, vlan_id) - self._commands.append(cmd) - - -def main(): - """ main entry point for module execution - """ - OnyxL2InterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_l3_interface.py b/plugins/modules/network/onyx/onyx_l3_interface.py deleted file mode 100644 index a21add44..00000000 --- a/plugins/modules/network/onyx/onyx_l3_interface.py +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_l3_interface -author: "Samer Deeb (@samerd)" -short_description: Manage L3 interfaces on Mellanox ONYX network devices -description: - - This module provides declarative management of L3 interfaces - on Mellanox ONYX network devices. -options: - name: - description: - - Name of the L3 interface. - ipv4: - description: - - IPv4 of the L3 interface. - ipv6: - description: - - IPv6 of the L3 interface (not supported for now). - aggregate: - description: List of L3 interfaces definitions - purge: - description: - - Purge L3 interfaces not defined in the I(aggregate) parameter. - default: false - type: bool - state: - description: - - State of the L3 interface configuration. - default: present - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Set Eth1/1 IPv4 address - onyx_l3_interface: - name: Eth1/1 - ipv4: 192.168.0.1/24 - -- name: Remove Eth1/1 IPv4 address - onyx_l3_interface: - name: Eth1/1 - state: absent - -- name: Set IP addresses on aggregate - onyx_l3_interface: - aggregate: - - { name: Eth1/1, ipv4: 192.168.2.10/24 } - - { name: Eth1/2, ipv4: 192.168.3.10/24 } - -- name: Remove IP addresses on aggregate - onyx_l3_interface: - aggregate: - - { name: Eth1/1, ipv4: 192.168.2.10/24 } - - { name: Eth1/2, ipv4: 192.168.3.10/24 } - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - interfaces ethernet 1/1 ip address 192.168.0.1 /24 -""" -import re -from copy import deepcopy - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_interfaces_config - - -class OnyxL3InterfaceModule(BaseOnyxModule): - IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$") - IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$") - IF_LOOPBACK_REGEX = re.compile(r"^Loopback (\d+)$") - - IF_TYPE_ETH = "ethernet" - IF_TYPE_LOOPBACK = "loopback" - IF_TYPE_VLAN = "vlan" - - IF_TYPE_MAP = { - IF_TYPE_ETH: IF_ETH_REGEX, - IF_TYPE_VLAN: IF_VLAN_REGEX, - IF_TYPE_LOOPBACK: IF_LOOPBACK_REGEX, - } - - IP_ADDR_ATTR_MAP = { - IF_TYPE_ETH: 'IP Address', - IF_TYPE_VLAN: 'Internet Address', - IF_TYPE_LOOPBACK: 'Internet Address', - } - - _purge = False - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(type='str'), - ipv4=dict(type='str'), - ipv6=dict(type='str'), - state=dict(default='present', - choices=['present', 'absent', 'enabled', 'disabled']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def _get_interface_type(self, if_name): - if_type = None - if_id = None - for interface_type, interface_regex in iteritems(self.IF_TYPE_MAP): - match = interface_regex.match(if_name) - if match: - if_type = interface_type - if_id = match.group(1) - break - return if_type, if_id - - def _set_if_type(self, params): - if_name = params['name'] - if_type, if_id = self._get_interface_type(if_name) - if not if_id: - self._module.fail_json( - msg='unsupported interface: %s' % if_name) - params['if_type'] = if_type - params['if_id'] = if_id - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - self._purge = module_params.get('purge', False) - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - self._set_if_type(req_item) - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'ipv4': module_params['ipv4'], - 'ipv6': module_params['ipv6'], - 'state': module_params['state'], - } - self.validate_param_values(params) - self._set_if_type(params) - self._required_config.append(params) - - def _get_interfaces_config(self, interface_type): - return get_interfaces_config(self._module, interface_type) - - def _parse_interfaces_config(self, if_type, if_config): - if self._os_version < self.ONYX_API_VERSION: - for if_data in if_config: - if_name = self.get_config_attr(if_data, 'header') - self._get_if_attributes(if_type, if_name, if_data) - else: - for if_config_item in if_config: - for if_name, if_data in iteritems(if_config_item): - if_data = if_data[0] - self._get_if_attributes(if_type, if_name, if_data) - - def _get_if_attributes(self, if_type, if_name, if_data): - ipaddr_attr = self.IP_ADDR_ATTR_MAP[if_type] - regex = self.IF_TYPE_MAP[if_type] - match = regex.match(if_name) - if not match: - return - ipv4 = self.get_config_attr(if_data, ipaddr_attr) - if ipv4: - ipv4 = ipv4.replace(' ', '') - ipv6 = self.get_config_attr(if_data, 'IPv6 address(es)') - if ipv6: - ipv6 = ipv6.replace('[primary]', '') - ipv6 = ipv6.strip() - if_id = match.group(1) - switchport = self.get_config_attr(if_data, 'Switchport mode') - if_obj = { - 'name': if_name, - 'if_id': if_id, - 'if_type': if_type, - 'ipv4': ipv4, - 'ipv6': ipv6, - 'switchport': switchport, - } - self._current_config[if_name] = if_obj - - def load_current_config(self): - # called in base class in run function - self._os_version = self._get_os_version() - self._current_config = dict() - if_types = set([if_obj['if_type'] for if_obj in self._required_config]) - for if_type in if_types: - if_config = self._get_interfaces_config(if_type) - if not if_config: - continue - self._parse_interfaces_config(if_type, if_config) - - def _generate_no_ip_commands(self, req_conf, curr_conf): - curr_ip = curr_conf.get('ipv4') - if_type = req_conf['if_type'] - if_id = req_conf['if_id'] - if curr_ip: - cmd = "interface %s %s no ip address" % (if_type, if_id) - self._commands.append(cmd) - curr_ipv6 = curr_conf.get('ipv6') - if curr_ipv6: - cmd = "interface %s %s no ipv6 address %s" % ( - if_type, if_id, curr_ipv6) - self._commands.append(cmd) - - def _generate_ip_commands(self, req_conf, curr_conf): - curr_ipv4 = curr_conf.get('ipv4') - req_ipv4 = req_conf.get('ipv4') - curr_ipv6 = curr_conf.get('ipv6') - req_ipv6 = req_conf.get('ipv6') - if_type = req_conf['if_type'] - if_id = req_conf['if_id'] - switchport = curr_conf.get('switchport') - if switchport: - cmd = "interface %s %s no switchport force" % (if_type, if_id) - self._commands.append(cmd) - if curr_ipv4 != req_ipv4: - cmd = "interface %s %s ip address %s" % (if_type, if_id, req_ipv4) - self._commands.append(cmd) - if curr_ipv6 != req_ipv6: - cmd = "interface %s %s ipv6 address %s" % ( - if_type, if_id, req_ipv6) - self._commands.append(cmd) - - def generate_commands(self): - req_interfaces = set() - for req_conf in self._required_config: - state = req_conf['state'] - if_name = req_conf['name'] - curr_conf = self._current_config.get(if_name, {}) - if state == 'absent': - self._generate_no_ip_commands(req_conf, curr_conf) - else: - req_interfaces.add(if_name) - self._generate_ip_commands(req_conf, curr_conf) - if self._purge: - for if_name, curr_conf in iteritems(self._current_config): - if if_name not in req_interfaces: - self._generate_no_ip_commands(req_conf, curr_conf) - - -def main(): - """ main entry point for module execution - """ - OnyxL3InterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_linkagg.py b/plugins/modules/network/onyx/onyx_linkagg.py deleted file mode 100644 index 091f0581..00000000 --- a/plugins/modules/network/onyx/onyx_linkagg.py +++ /dev/null @@ -1,349 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_linkagg -author: "Samer Deeb (@samerd)" -short_description: Manage link aggregation groups on Mellanox ONYX network devices -description: - - This module provides declarative management of link aggregation groups - on Mellanox ONYX network devices. -options: - name: - description: - - Name of the link aggregation group. - required: true - mode: - description: - - Mode of the link aggregation group. A value of C(on) will enable LACP. - C(active) configures the link to actively information about the state of the link, - or it can be configured in C(passive) mode ie. send link state information only when - received them from another link. - default: on - choices: ['on', 'active', 'passive'] - members: - description: - - List of members interfaces of the link aggregation group. The value can be - single interface or list of interfaces. - required: true - aggregate: - description: List of link aggregation definitions. - purge: - description: - - Purge link aggregation groups not defined in the I(aggregate) parameter. - default: false - type: bool - state: - description: - - State of the link aggregation group. - default: present - choices: ['present', 'absent', 'up', 'down'] -''' - -EXAMPLES = """ -- name: Configure link aggregation group - onyx_linkagg: - name: Po1 - members: - - Eth1/1 - - Eth1/2 - -- name: Remove configuration - onyx_linkagg: - name: Po1 - state: absent - -- name: Create aggregate of linkagg definitions - onyx_linkagg: - aggregate: - - { name: Po1, members: [Eth1/1] } - - { name: Po2, members: [Eth1/2] } - -- name: Remove aggregate of linkagg definitions - onyx_linkagg: - aggregate: - - name: Po1 - - name: Po2 - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - interface port-channel 1 - - exit - - interface ethernet 1/1 channel-group 1 mode on - - interface ethernet 1/2 channel-group 1 mode on -""" - -import re -from copy import deepcopy - -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import get_interfaces_config - - -class OnyxLinkAggModule(BaseOnyxModule): - LAG_ID_REGEX = re.compile(r"^\d+ (Po\d+|Mpo\d+)\(([A-Z])\)$") - LAG_NAME_REGEX = re.compile(r"^(Po|Mpo)(\d+)$") - IF_NAME_REGEX = re.compile(r"^(Eth\d+\/\d+|Eth\d+\/\d+\/\d+)(.*)$") - PORT_CHANNEL = 'port-channel' - CHANNEL_GROUP = 'channel-group' - MLAG_PORT_CHANNEL = 'mlag-port-channel' - MLAG_CHANNEL_GROUP = 'mlag-channel-group' - MLAG_SUMMARY = 'MLAG Port-Channel Summary' - - LAG_TYPE = 'lag' - MLAG_TYPE = 'mlag' - - IF_TYPE_MAP = dict( - lag=PORT_CHANNEL, - mlag=MLAG_PORT_CHANNEL - ) - - _purge = False - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(type='str'), - members=dict(type='list'), - mode=dict(default='on', choices=['active', 'on', 'passive']), - state=dict(default='present', choices=['present', 'absent']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def _get_lag_type(self, lag_name): - match = self.LAG_NAME_REGEX.match(lag_name) - if match: - prefix = match.group(1) - if prefix == "Po": - return self.LAG_TYPE - return self.MLAG_TYPE - self._module.fail_json( - msg='invalid lag name: %s, lag name should start with Po or ' - 'Mpo' % lag_name) - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - self._purge = module_params.get('purge', False) - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - req_item['type'] = self._get_lag_type(req_item['name']) - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'state': module_params['state'], - 'members': module_params['members'], - 'mode': module_params['mode'], - 'type': self._get_lag_type(module_params['name']), - } - self.validate_param_values(params) - self._required_config.append(params) - - @classmethod - def _extract_lag_name(cls, header): - match = cls.LAG_ID_REGEX.match(header) - state = None - lag_name = None - if match: - state = 'up' if match.group(2) == 'U' else 'down' - lag_name = match.group(1) - return lag_name, state - - @classmethod - def _extract_if_name(cls, member): - match = cls.IF_NAME_REGEX.match(member) - if match: - return match.group(1) - - @classmethod - def _extract_lag_members(cls, lag_type, lag_item): - members = "" - if lag_type == cls.LAG_TYPE: - members = cls.get_config_attr(lag_item, "Member Ports") - else: - for attr_name, attr_val in iteritems(lag_item): - if attr_name.startswith('Local Ports'): - members = attr_val - return [cls._extract_if_name(member) for member in members.split()] - - def _get_port_channels(self, if_type): - return get_interfaces_config(self._module, if_type, flags="summary") - - def _parse_port_channels_summary(self, lag_type, lag_summary): - if lag_type == self.MLAG_TYPE: - if self._os_version >= self.ONYX_API_VERSION: - found_summary = False - for summary_item in lag_summary: - if self.MLAG_SUMMARY in summary_item: - lag_summary = summary_item[self.MLAG_SUMMARY] - if lag_summary: - lag_summary = lag_summary[0] - else: - lag_summary = dict() - found_summary = True - break - if not found_summary: - lag_summary = dict() - else: - lag_summary = lag_summary.get(self.MLAG_SUMMARY, dict()) - for lag_key, lag_data in iteritems(lag_summary): - lag_name, state = self._extract_lag_name(lag_key) - if not lag_name: - continue - lag_members = self._extract_lag_members(lag_type, lag_data[0]) - lag_obj = dict( - name=lag_name, - state=state, - members=lag_members - ) - self._current_config[lag_name] = lag_obj - - def load_current_config(self): - self._current_config = dict() - self._os_version = self._get_os_version() - lag_types = set([lag_obj['type'] for lag_obj in self._required_config]) - for lag_type in lag_types: - if_type = self.IF_TYPE_MAP[lag_type] - lag_summary = self._get_port_channels(if_type) - if lag_summary: - self._parse_port_channels_summary(lag_type, lag_summary) - - def _get_interface_command_suffix(self, if_name): - if if_name.startswith('Eth'): - return if_name.replace("Eth", "ethernet ") - if if_name.startswith('Po'): - return if_name.replace("Po", "port-channel ") - if if_name.startswith('Mpo'): - return if_name.replace("Mpo", "mlag-port-channel ") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _get_channel_group(self, if_name): - if if_name.startswith('Po'): - return if_name.replace("Po", "channel-group ") - if if_name.startswith('Mpo'): - return if_name.replace("Mpo", "mlag-channel-group ") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _generate_no_linkagg_commands(self, lag_name): - suffix = self._get_interface_command_suffix(lag_name) - command = 'no interface %s' % suffix - self._commands.append(command) - - def _generate_linkagg_commands(self, lag_name, req_lag): - curr_lag = self._current_config.get(lag_name, {}) - if not curr_lag: - suffix = self._get_interface_command_suffix(lag_name) - self._commands.append("interface %s" % suffix) - self._commands.append("exit") - curr_members = set(curr_lag.get('members', [])) - req_members = set(req_lag.get('members') or []) - - lag_mode = req_lag['mode'] - if req_members != curr_members: - channel_group = self._get_channel_group(lag_name) - channel_group_type = channel_group.split()[0] - for member in req_members: - if member in curr_members: - continue - suffix = self._get_interface_command_suffix(member) - self._commands.append( - "interface %s %s mode %s" % - (suffix, channel_group, lag_mode)) - for member in curr_members: - if member in req_members: - continue - suffix = self._get_interface_command_suffix(member) - self._commands.append( - "interface %s no %s" % (suffix, channel_group_type)) - req_state = req_lag.get('state') - if req_state in ('up', 'down'): - curr_state = curr_lag.get('state') - if curr_state != req_state: - suffix = self._get_interface_command_suffix(lag_name) - cmd = "interface %s " % suffix - if req_state == 'up': - cmd += 'no shutdown' - else: - cmd += 'shutdown' - self._commands.append(cmd) - - def generate_commands(self): - req_lags = set() - for req_conf in self._required_config: - state = req_conf['state'] - lag_name = req_conf['name'] - if state == 'absent': - if lag_name in self._current_config: - self._generate_no_linkagg_commands(lag_name) - else: - req_lags.add(lag_name) - self._generate_linkagg_commands(lag_name, req_conf) - if self._purge: - for lag_name in self._current_config: - if lag_name not in req_lags: - self._generate_no_linkagg_commands(lag_name) - - def check_declarative_intent_params(self, result): - pass - - -def main(): - """ main entry point for module execution - """ - OnyxLinkAggModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_lldp.py b/plugins/modules/network/onyx/onyx_lldp.py deleted file mode 100644 index 6aab5bb0..00000000 --- a/plugins/modules/network/onyx/onyx_lldp.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/python - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_lldp -author: "Samer Deeb (@samerd)" -short_description: Manage LLDP configuration on Mellanox ONYX network devices -description: - - This module provides declarative management of LLDP service configuration - on Mellanox ONYX network devices. -options: - state: - description: - - State of the LLDP protocol configuration. - default: present - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Enable LLDP protocol - onyx_lldp: - state: present - -- name: Disable LLDP protocol - onyx_lldp: - state: lldp -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - lldp -""" - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxLldpModule(BaseOnyxModule): - LLDP_ENTRY = 'LLDP' - SHOW_LLDP_CMD = 'show lldp local' - - @classmethod - def _get_element_spec(cls): - return dict( - state=dict(default='present', choices=['present', 'absent']), - ) - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - self._required_config = dict() - module_params = self._module.params - params = { - 'state': module_params['state'], - } - - self.validate_param_values(params) - self._required_config.update(params) - - def _get_lldp_config(self): - return show_cmd(self._module, self.SHOW_LLDP_CMD) - - def load_current_config(self): - self._current_config = dict() - state = 'absent' - config = self._get_lldp_config() or dict() - for item in config: - lldp_state = item.get(self.LLDP_ENTRY) - if lldp_state is not None: - if lldp_state == 'enabled': - state = 'present' - break - self._current_config['state'] = state - - def generate_commands(self): - req_state = self._required_config['state'] - curr_state = self._current_config['state'] - if curr_state != req_state: - cmd = 'lldp' - if req_state == 'absent': - cmd = 'no %s' % cmd - self._commands.append(cmd) - - -def main(): - """ main entry point for module execution - """ - OnyxLldpModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_lldp_interface.py b/plugins/modules/network/onyx/onyx_lldp_interface.py deleted file mode 100644 index a92c0cee..00000000 --- a/plugins/modules/network/onyx/onyx_lldp_interface.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_lldp_interface -author: "Samer Deeb (@samerd)" -short_description: Manage LLDP interfaces configuration on Mellanox ONYX network devices -description: - - This module provides declarative management of LLDP interfaces - configuration on Mellanox ONYX network devices. -options: - name: - description: - - Name of the interface LLDP should be configured on. - aggregate: - description: List of interfaces LLDP should be configured on. - purge: - description: - - Purge interfaces not defined in the aggregate parameter. - type: bool - default: false - state: - description: - - State of the LLDP configuration. - default: present - choices: ['present', 'absent', 'enabled', 'disabled'] -''' - -EXAMPLES = """ -- name: Configure LLDP on specific interfaces - onyx_lldp_interface: - name: Eth1/1 - state: present - -- name: Disable LLDP on specific interfaces - onyx_lldp_interface: - name: Eth1/1 - state: disabled - -- name: Enable LLDP on specific interfaces - onyx_lldp_interface: - name: Eth1/1 - state: enabled - -- name: Delete LLDP on specific interfaces - onyx_lldp_interface: - name: Eth1/1 - state: absent - -- name: Create aggregate of LLDP interface configurations - onyx_lldp_interface: - aggregate: - - { name: Eth1/1 } - - { name: Eth1/2 } - state: present - -- name: Delete aggregate of LLDP interface configurations - onyx_lldp_interface: - aggregate: - - { name: Eth1/1 } - - { name: Eth1/2 } - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - interface ethernet 1/1 lldp transmit - - interface ethernet 1/1 lldp receive -""" -import re -from copy import deepcopy - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxLldpInterfaceModule(BaseOnyxModule): - IF_NAME_REGEX = re.compile(r"^(Eth\d+\/\d+|Eth\d+\/\d+\d+)$") - _purge = False - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(type='str'), - state=dict(default='present', - choices=['present', 'absent', 'enabled', 'disabled']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - self._purge = module_params.get('purge', False) - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'state': module_params['state'], - } - self.validate_param_values(params) - self._required_config.append(params) - - def _create_if_lldp_data(self, if_name, if_lldp_data): - return { - 'name': if_name, - 'receive': self.get_config_attr(if_lldp_data, 'Receive'), - 'transmit': self.get_config_attr(if_lldp_data, 'Transmit'), - } - - def _get_lldp_config(self): - return show_cmd(self._module, "show lldp interfaces") - - def load_current_config(self): - # called in base class in run function - self._current_config = dict() - lldp_config = self._get_lldp_config() - if not lldp_config: - return - for if_name, if_lldp_data in iteritems(lldp_config): - match = self.IF_NAME_REGEX.match(if_name) - if not match: - continue - if if_lldp_data: - if_lldp_data = if_lldp_data[0] - self._current_config[if_name] = \ - self._create_if_lldp_data(if_name, if_lldp_data) - - def _get_interface_cmd_name(self, if_name): - return if_name.replace("Eth", "ethernet ") - - def _add_if_lldp_commands(self, if_name, flag, enable): - cmd_prefix = "interface %s " % self._get_interface_cmd_name(if_name) - lldp_cmd = "lldp %s" % flag - if not enable: - lldp_cmd = 'no %s' % lldp_cmd - self._commands.append(cmd_prefix + lldp_cmd) - - def _gen_lldp_commands(self, if_name, req_state, curr_conf): - curr_receive = curr_conf.get('receive') - curr_transmit = curr_conf.get('transmit') - enable = (req_state == 'Enabled') - if curr_receive != req_state: - flag = 'receive' - self._add_if_lldp_commands(if_name, flag, enable) - if curr_transmit != req_state: - flag = 'transmit' - self._add_if_lldp_commands(if_name, flag, enable) - - def generate_commands(self): - req_interfaces = set() - for req_conf in self._required_config: - state = req_conf['state'] - if_name = req_conf['name'] - if state in ('absent', 'disabled'): - req_state = 'Disabled' - else: - req_interfaces.add(if_name) - req_state = 'Enabled' - curr_conf = self._current_config.get(if_name, {}) - self._gen_lldp_commands(if_name, req_state, curr_conf) - if self._purge: - for if_name, curr_conf in iteritems(self._current_config): - if if_name not in req_interfaces: - req_state = 'Disabled' - self._gen_lldp_commands(if_name, req_state, curr_conf) - - -def main(): - """ main entry point for module execution - """ - OnyxLldpInterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_magp.py b/plugins/modules/network/onyx/onyx_magp.py deleted file mode 100644 index c8d69d01..00000000 --- a/plugins/modules/network/onyx/onyx_magp.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_magp -author: "Samer Deeb (@samerd)" -short_description: Manage MAGP protocol on Mellanox ONYX network devices -description: - - This module provides declarative management of MAGP protocol on vlan - interface of Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - magp_id: - description: - - "MAGP instance number 1-255" - required: true - interface: - description: - - VLAN Interface name. - required: true - state: - description: - - MAGP state. - default: present - choices: ['present', 'absent', 'enabled', 'disabled'] - router_ip: - description: - - MAGP router IP address. - router_mac: - description: - - MAGP router MAC address. -''' - -EXAMPLES = """ -- name: Run add vlan interface with magp - onyx_magp: - magp_id: 103 - router_ip: 192.168.8.2 - router_mac: AA:1B:2C:3D:4E:5F - interface: Vlan 1002 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface vlan 234 magp 103 - - exit - - interface vlan 234 magp 103 ip virtual-router address 1.2.3.4 -""" -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxMagpModule(BaseOnyxModule): - IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$") - - @classmethod - def _get_element_spec(cls): - return dict( - magp_id=dict(type='int', required=True), - state=dict(default='present', - choices=['present', 'absent', 'enabled', 'disabled']), - interface=dict(required=True), - router_ip=dict(), - router_mac=dict(), - ) - - def init_module(self): - """ Ansible module initialization - """ - element_spec = self._get_element_spec() - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def validate_magp_id(self, value): - if value and not 1 <= int(value) <= 255: - self._module.fail_json(msg='magp id must be between 1 and 255') - - def get_required_config(self): - module_params = self._module.params - interface = module_params['interface'] - match = self.IF_VLAN_REGEX.match(interface) - vlan_id = 0 - if match: - vlan_id = int(match.group(1)) - else: - self._module.fail_json( - msg='Invalid interface name: should be "Vlan "') - - self._required_config = dict( - magp_id=module_params['magp_id'], - state=module_params['state'], - vlan_id=vlan_id, - router_ip=module_params['router_ip'], - router_mac=module_params['router_mac']) - self.validate_param_values(self._required_config) - - @classmethod - def get_magp_id(cls, item): - header = cls.get_config_attr(item, "header") - return int(header.split()[1]) - - def _create_magp_instance_data(self, magp_id, item): - vlan_id = int(self.get_config_attr(item, "Interface vlan")) - state = self.get_config_attr(item, "Admin state").lower() - return dict( - magp_id=magp_id, - state=state, - vlan_id=vlan_id, - router_ip=self.get_config_attr(item, "Virtual IP"), - router_mac=self.get_config_attr(item, "Virtual MAC")) - - def _update_magp_data(self, magp_data): - if self._os_version >= self.ONYX_API_VERSION: - for magp_config in magp_data: - for magp_name, data in iteritems(magp_config): - magp_id = int(magp_name.replace('MAGP ', '')) - self._current_config[magp_id] = \ - self._create_magp_instance_data(magp_id, data[0]) - else: - for magp_item in magp_data: - magp_id = self.get_magp_id(magp_item) - inst_data = self._create_magp_instance_data(magp_id, magp_item) - self._current_config[magp_id] = inst_data - - def _get_magp_config(self): - cmd = "show magp" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - # called in base class in run function - self._os_version = self._get_os_version() - self._current_config = dict() - magp_data = self._get_magp_config() - if magp_data: - self._update_magp_data(magp_data) - - def _generate_no_magp_commands(self): - req_vlan_id = self._required_config['vlan_id'] - req_magp_id = self._required_config['magp_id'] - curr_magp_data = self._current_config.get(req_magp_id) - if not curr_magp_data: - return - curr_vlan_id = curr_magp_data.get(req_vlan_id) - if curr_vlan_id == req_vlan_id: - cmd = 'interface vlan %s no magp %s' % (req_vlan_id, req_magp_id) - self._commands.append(cmd) - - def _generate_magp_commands(self, req_state): - req_vlan_id = self._required_config['vlan_id'] - req_magp_id = self._required_config['magp_id'] - curr_magp_data = self._current_config.get(req_magp_id, dict()) - curr_vlan_id = curr_magp_data.get('vlan_id') - magp_prefix = 'interface vlan %s magp %s' % (req_vlan_id, req_magp_id) - create_new_magp = False - if curr_vlan_id != req_vlan_id: - if curr_vlan_id: - cmd = 'interface vlan %s no magp %s' % ( - curr_vlan_id, req_magp_id) - self._commands.append(cmd) - create_new_magp = True - self._commands.append(magp_prefix) - self._commands.append('exit') - req_router_ip = self._required_config['router_ip'] - curr_router_ip = curr_magp_data.get('router_ip') - if req_router_ip: - if curr_router_ip != req_router_ip or create_new_magp: - cmd = '%s ip virtual-router address %s' % ( - magp_prefix, req_router_ip) - self._commands.append(cmd) - else: - if curr_router_ip and curr_router_ip != '0.0.0.0': - cmd = '%s no ip virtual-router address' % magp_prefix - self._commands.append(cmd) - req_router_mac = self._required_config['router_mac'] - curr_router_mac = curr_magp_data.get('router_mac') - if curr_router_mac: - curr_router_mac = curr_router_mac.lower() - if req_router_mac: - req_router_mac = req_router_mac.lower() - if curr_router_mac != req_router_mac or create_new_magp: - cmd = '%s ip virtual-router mac-address %s' % ( - magp_prefix, req_router_mac) - self._commands.append(cmd) - else: - if curr_router_mac and curr_router_mac != '00:00:00:00:00:00': - cmd = '%s no ip virtual-router mac-address' % magp_prefix - self._commands.append(cmd) - if req_state in ('enabled', 'disabled'): - curr_state = curr_magp_data.get('state', 'enabled') - if curr_state != req_state: - if req_state == 'enabled': - suffix = 'no shutdown' - else: - suffix = 'shutdown' - cmd = '%s %s' % (magp_prefix, suffix) - self._commands.append(cmd) - - def generate_commands(self): - req_state = self._required_config['state'] - if req_state == 'absent': - return self._generate_no_magp_commands() - return self._generate_magp_commands(req_state) - - -def main(): - """ main entry point for module execution - """ - OnyxMagpModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_mlag_ipl.py b/plugins/modules/network/onyx/onyx_mlag_ipl.py deleted file mode 100644 index fab6259f..00000000 --- a/plugins/modules/network/onyx/onyx_mlag_ipl.py +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_mlag_ipl -author: "Samer Deeb (@samerd)" -short_description: Manage IPL (inter-peer link) on Mellanox ONYX network devices -description: - - This module provides declarative management of IPL (inter-peer link) - management on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - name: - description: - - Name of the interface (port-channel) IPL should be configured on. - required: true - vlan_interface: - description: - - Name of the IPL vlan interface. - state: - description: - - IPL state. - default: present - choices: ['present', 'absent'] - peer_address: - description: - - IPL peer IP address. -''' - -EXAMPLES = """ -- name: Run configure ipl - onyx_mlag_ipl: - name: Po1 - vlan_interface: Vlan 322 - state: present - peer_address: 192.168.7.1 - -- name: Run remove ipl - onyx_mlag_ipl: - name: Po1 - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface port-channel 1 ipl 1 - - interface vlan 1024 ipl 1 peer-address 10.10.10.10 -""" -import re - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxMlagIplModule(BaseOnyxModule): - VLAN_IF_REGEX = re.compile(r'^Vlan \d+') - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(required=True), - state=dict(default='present', - choices=['present', 'absent']), - peer_address=dict(), - vlan_interface=dict(), - ) - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict( - name=module_params['name'], - state=module_params['state'], - peer_address=module_params['peer_address'], - vlan_interface=module_params['vlan_interface']) - self.validate_param_values(self._required_config) - - def _update_mlag_data(self, mlag_data): - if not mlag_data: - return - mlag_summary = mlag_data.get("MLAG IPLs Summary", {}) - ipl_id = "1" - ipl_list = mlag_summary.get(ipl_id) - if ipl_list: - ipl_data = ipl_list[0] - vlan_id = ipl_data.get("Vlan Interface") - vlan_interface = "" - if vlan_id != "N/A": - vlan_interface = "Vlan %s" % vlan_id - peer_address = ipl_data.get("Peer IP address") - name = ipl_data.get("Group Port-Channel") - self._current_config = dict( - name=name, - peer_address=peer_address, - vlan_interface=vlan_interface) - - def _show_mlag_data(self): - cmd = "show mlag" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - # called in base class in run function - self._current_config = dict() - mlag_data = self._show_mlag_data() - self._update_mlag_data(mlag_data) - - def _get_interface_cmd_name(self, if_name): - if if_name.startswith('Po'): - return if_name.replace("Po", "port-channel ") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _generate_port_channel_command(self, if_name, enable): - if_cmd_name = self._get_interface_cmd_name(if_name) - if enable: - ipl_cmd = 'ipl 1' - else: - ipl_cmd = "no ipl 1" - cmd = "interface %s %s" % (if_cmd_name, ipl_cmd) - return cmd - - def _generate_vlan_if_command(self, if_name, enable, peer_address): - if_cmd_name = if_name.lower() - if enable: - ipl_cmd = 'ipl 1 peer-address %s' % peer_address - else: - ipl_cmd = "no ipl 1" - cmd = "interface %s %s" % (if_cmd_name, ipl_cmd) - return cmd - - def _generate_no_ipl_commands(self): - curr_interface = self._current_config.get('name') - req_interface = self._required_config.get('name') - if curr_interface == req_interface: - cmd = self._generate_port_channel_command( - req_interface, enable=False) - self._commands.append(cmd) - - def _generate_ipl_commands(self): - curr_interface = self._current_config.get('name') - req_interface = self._required_config.get('name') - if curr_interface != req_interface: - if curr_interface and curr_interface != 'N/A': - cmd = self._generate_port_channel_command( - curr_interface, enable=False) - self._commands.append(cmd) - cmd = self._generate_port_channel_command( - req_interface, enable=True) - self._commands.append(cmd) - curr_vlan = self._current_config.get('vlan_interface') - req_vlan = self._required_config.get('vlan_interface') - add_peer = False - if curr_vlan != req_vlan: - add_peer = True - if curr_vlan: - cmd = self._generate_vlan_if_command(curr_vlan, enable=False, - peer_address=None) - self._commands.append(cmd) - curr_peer = self._current_config.get('peer_address') - req_peer = self._required_config.get('peer_address') - if req_peer != curr_peer: - add_peer = True - if add_peer and req_peer: - cmd = self._generate_vlan_if_command(req_vlan, enable=True, - peer_address=req_peer) - self._commands.append(cmd) - - def generate_commands(self): - state = self._required_config['state'] - if state == 'absent': - self._generate_no_ipl_commands() - else: - self._generate_ipl_commands() - - -def main(): - """ main entry point for module execution - """ - OnyxMlagIplModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_mlag_vip.py b/plugins/modules/network/onyx/onyx_mlag_vip.py deleted file mode 100644 index f2cb0e88..00000000 --- a/plugins/modules/network/onyx/onyx_mlag_vip.py +++ /dev/null @@ -1,180 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_mlag_vip -author: "Samer Deeb (@samerd)" -short_description: Configures MLAG VIP on Mellanox ONYX network devices -description: - - This module provides declarative management of MLAG virtual IPs - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - ipaddress: - description: - - Virtual IP address of the MLAG. Required if I(state=present). - group_name: - description: - - MLAG group name. Required if I(state=present). - mac_address: - description: - - MLAG system MAC address. Required if I(state=present). - state: - description: - - MLAG VIP state. - choices: ['present', 'absent'] - delay: - description: - - Delay interval, in seconds, waiting for the changes on mlag VIP to take - effect. - default: 12 -''' - -EXAMPLES = """ -- name: Configure mlag-vip - onyx_mlag_vip: - ipaddress: 50.3.3.1/24 - group_name: ansible-test-group - mac_address: 00:11:12:23:34:45 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - mlag-vip ansible_test_group ip 50.3.3.1 /24 force - - no mlag shutdown -""" - -import time - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxMLagVipModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - element_spec = dict( - ipaddress=dict(), - group_name=dict(), - mac_address=dict(), - delay=dict(type='int', default=12), - state=dict(choices=['present', 'absent'], default='present'), - ) - argument_spec = dict() - - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - lag_params = { - 'ipaddress': module_params['ipaddress'], - 'group_name': module_params['group_name'], - 'mac_address': module_params['mac_address'], - 'delay': module_params['delay'], - 'state': module_params['state'], - } - - self.validate_param_values(lag_params) - self._required_config = lag_params - - def _show_mlag_cmd(self, cmd): - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_mlag(self): - cmd = "show mlag" - return self._show_mlag_cmd(cmd) - - def _show_mlag_vip(self): - cmd = "show mlag-vip" - return self._show_mlag_cmd(cmd) - - def load_current_config(self): - self._current_config = dict() - mlag_config = self._show_mlag() - mlag_vip_config = self._show_mlag_vip() - if mlag_vip_config: - mlag_vip = mlag_vip_config.get("MLAG-VIP", {}) - self._current_config['group_name'] = \ - mlag_vip.get("MLAG group name") - self._current_config['ipaddress'] = \ - mlag_vip.get("MLAG VIP address") - if mlag_config: - self._current_config['mac_address'] = \ - mlag_config.get("System-mac") - - def generate_commands(self): - state = self._required_config['state'] - if state == 'present': - self._generate_mlag_vip_cmds() - else: - self._generate_no_mlag_vip_cmds() - - def _generate_mlag_vip_cmds(self): - current_group = self._current_config.get('group_name') - current_ip = self._current_config.get('ipaddress') - current_mac = self._current_config.get('mac_address') - if current_mac: - current_mac = current_mac.lower() - - req_group = self._required_config.get('group_name') - req_ip = self._required_config.get('ipaddress') - req_mac = self._required_config.get('mac_address') - if req_mac: - req_mac = req_mac.lower() - - if req_ip is not None: - if req_group is None: - self._module.fail_json(msg='In order to configure Mlag-Vip you must send ' - 'group name param beside IPaddress') - ipaddr, mask = req_ip.split('/') - if req_group != current_group or req_ip != current_ip: - self._commands.append('mlag-vip %s ip %s /%s force' % (req_group, ipaddr, mask)) - elif req_group and req_group != current_group: - self._commands.append('mlag-vip %s' % req_group) - - if req_mac and req_mac != current_mac: - self._commands.append( - 'mlag system-mac %s' % (req_mac)) - if self._commands: - self._commands.append('no mlag shutdown') - - def _generate_no_mlag_vip_cmds(self): - if self._current_config.get('group_name'): - self._commands.append('no mlag-vip') - - def check_declarative_intent_params(self, result): - if not result['changed']: - return - delay_interval = self._required_config.get('delay') - if delay_interval > 0: - time.sleep(delay_interval) - for cmd in ("show mlag-vip", ""): - show_cmd(self._module, cmd, json_fmt=False, fail_on_error=False) - - -def main(): - """ main entry point for module execution - """ - OnyxMLagVipModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_ntp.py b/plugins/modules/network/onyx/onyx_ntp.py deleted file mode 100644 index 8cdadf22..00000000 --- a/plugins/modules/network/onyx/onyx_ntp.py +++ /dev/null @@ -1,239 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_ntp -version_added: '0.2.0' -author: "Sara-Touqan (@sarato)" -short_description: Manage NTP general configurations and ntp keys configurations on Mellanox ONYX network devices -description: - - This module provides declarative management of NTP & NTP Keys - on Mellanox ONYX network devices. -options: - state: - description: - - State of the NTP configuration. - choices: ['enabled', 'disabled'] - type: str - authenticate_state: - description: - - State of the NTP authentication configuration. - choices: ['enabled', 'disabled'] - type: str - ntp_authentication_keys: - type: list - description: - - List of ntp authentication keys - suboptions: - auth_key_id: - description: - - Configures ntp key-id, range 1-65534 - required: true - type: int - auth_key_encrypt_type: - description: - - encryption type used to configure ntp authentication key. - required: true - choices: ['md5', 'sha1'] - type: str - auth_key_password: - description: - - password used for ntp authentication key. - required: true - type: str - auth_key_state: - description: - - Used to decide if you want to delete given ntp key or not - choices: ['present', 'absent'] - type: str - trusted_keys: - type: list - description: - - List of ntp trusted keys -''' - -EXAMPLES = """ -- name: Configure NTP - onyx_ntp: - state: enabled - authenticate_state: enabled - ntp_authentication_keys: - - auth_key_id: 1 - auth_key_encrypt_type: md5 - auth_key_password: 12345 - auth_key_state: absent - trusted_keys: 1,2,3 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - ntp enable - - ntp disable - - ntp authenticate - - no ntp authenticate - - ntp authentication-key 1 md5 12345 - - no ntp authentication-key 1 - - ntp trusted-key 1,2,3 -""" - - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxNTPModule(BaseOnyxModule): - - def init_module(self): - """ module initialization - """ - ntp_authentication_key_spec = dict(auth_key_id=dict(type='int', required=True), - auth_key_encrypt_type=dict(required=True, choices=['md5', 'sha1']), - auth_key_password=dict(required=True), - auth_key_state=dict(choices=['present', 'absent'])) - element_spec = dict( - state=dict(choices=['enabled', 'disabled']), - authenticate_state=dict(choices=['enabled', 'disabled']), - ntp_authentication_keys=dict(type='list', elements='dict', options=ntp_authentication_key_spec), - trusted_keys=dict(type='list', elements='int') - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def _validate_key_id(self): - keys_id_list = self._required_config.get("ntp_authentication_keys") - if keys_id_list: - for key_item in keys_id_list: - key_id = key_item.get("auth_key_id") - if (key_id < 1) or (key_id > 65534): - self._module.fail_json( - msg='Invalid Key value, value should be in the range 1-65534') - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - self._validate_key_id() - - def _show_ntp_config(self): - show_cmds = [] - cmd = "show ntp" - show_cmds.append(show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False)) - cmd = "show ntp keys" - show_cmds.append(show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False)) - return show_cmds - - def _set_ntp_keys_config(self, ntp_config): - if not ntp_config: - return - for req_ntp_auth_key in ntp_config: - ecryption_type = req_ntp_auth_key.get("Encryption Type") - self._current_config[req_ntp_auth_key.get("header")] = ecryption_type - - def _set_ntp_config(self, ntp_config): - ntp_config = ntp_config[0] - if not ntp_config: - return - self._current_config['state'] = ntp_config.get("NTP is administratively") - self._current_config['authenticate_state'] = ntp_config.get("NTP Authentication administratively") - - def load_current_config(self): - self._current_config = dict() - ntp_config = self._show_ntp_config() - if ntp_config: - if ntp_config[0]: - self._set_ntp_config(ntp_config[0]) - if ntp_config[1]: - self._set_ntp_keys_config(ntp_config[1]) - - def generate_commands(self): - current_state = self._current_config.get("state") - state = self._required_config.get("state") - if state is None: - state = current_state - if state is not None: - if current_state != state: - if state == 'enabled': - self._commands.append('ntp enable') - else: - self._commands.append('no ntp enable') - authenticate_state = self._required_config.get("authenticate_state") - if authenticate_state: - current_authenticate_state = self._current_config.get("authenticate_state") - if authenticate_state is not None: - if current_authenticate_state != authenticate_state: - if authenticate_state == 'enabled': - self._commands.append('ntp authenticate') - else: - self._commands.append('no ntp authenticate') - req_ntp_auth_keys = self._required_config.get('ntp_authentication_keys') - if req_ntp_auth_keys: - if req_ntp_auth_keys is not None: - for req_ntp_auth_key in req_ntp_auth_keys: - req_key_id = req_ntp_auth_key.get('auth_key_id') - req_key = 'NTP Key ' + str(req_key_id) - current_req_key = self._current_config.get(req_key) - auth_key_state = req_ntp_auth_key.get('auth_key_state') - req_encrypt_type = req_ntp_auth_key.get('auth_key_encrypt_type') - req_password = req_ntp_auth_key.get('auth_key_password') - if current_req_key: - if req_encrypt_type == current_req_key: - if auth_key_state: - if auth_key_state == 'absent': - self._commands.append('no ntp authentication-key {0}' .format(req_key_id)) - else: - continue - else: - if auth_key_state: - if auth_key_state == 'present': - self._commands.append('ntp authentication-key {0} {1} {2}' - .format(req_key_id, - req_encrypt_type, - req_password)) - else: - self._commands.append('ntp authentication-key {0} {1} {2}' - .format(req_key_id, - req_encrypt_type, - req_password)) - - else: - if auth_key_state: - if auth_key_state == 'present': - self._commands.append('ntp authentication-key {0} {1} {2}' - .format(req_key_id, - req_encrypt_type, - req_password)) - else: - self._commands.append('ntp authentication-key {0} {1} {2}' - .format(req_key_id, - req_encrypt_type, - req_password)) - - req_trusted_keys = self._required_config.get('trusted_keys') - if req_trusted_keys: - for key in req_trusted_keys: - self._commands.append('ntp trusted-key {0}' .format(key)) - - -def main(): - """ main entry point for module execution - """ - OnyxNTPModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_ntp_servers_peers.py b/plugins/modules/network/onyx/onyx_ntp_servers_peers.py deleted file mode 100644 index a2ee2d15..00000000 --- a/plugins/modules/network/onyx/onyx_ntp_servers_peers.py +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_ntp_servers_peers -version_added: '0.2.0' -author: "Sara-Touqan (@sarato)" -short_description: Configures NTP peers and servers parameters -description: - - This module provides declarative management of NTP peers and servers configuration on Mellanox ONYX network devices. -options: - peer: - type: list - description: - - List of ntp peers. - suboptions: - ip_or_name: - description: - - Configures ntp peer name or ip. - required: true - type: str - enabled: - description: - - Disables/Enables ntp peer state - type: bool - version: - description: - - version number for the ntp peer - choices: [3, 4] - type: int - key_id: - description: - - Used to configure the key-id for the ntp peer - type: int - state: - description: - - Indicates if the ntp peer exists or should be deleted - choices: ['present', 'absent'] - type: str - server: - type: list - description: - - List of ntp servers. - suboptions: - ip_or_name: - description: - - Configures ntp server name or ip. - required: true - type: str - enabled: - description: - - Disables/Enables ntp server - type: bool - trusted_enable: - description: - - Disables/Enables the trusted state for the ntp server. - type: bool - version: - description: - - version number for the ntp server - choices: [3, 4] - type: int - key_id: - description: - - Used to configure the key-id for the ntp server - type: int - state: - description: - - Indicates if the ntp peer exists or should be deleted. - choices: ['present', 'absent'] - type: str - ntpdate: - description: - - Sets system clock once from a remote server using NTP. - type: str -''' - -EXAMPLES = """ -- name: Configure NTP peers and servers - onyx_ntp_peers_servers: - peer: - - ip_or_name: 1.1.1.1 - enabled: yes - version: 4 - key_id: 6 - state: present - server: - - ip_or_name: 2.2.2.2 - enabled: true - version: 3 - key_id: 8 - trusted_enable: no - state: present - ntpdate: 192.168.10.10 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - ntp peer 1.1.1.1 disable - no ntp peer 1.1.1.1 disable - ntp peer 1.1.1.1 keyId 6 - ntp peer 1.1.1.1 version 4 - no ntp peer 1.1.1.1 - ntp server 2.2.2.2 disable - no ntp server 2.2.2.2 disable - ntp server 2.2.2.2 keyID 8 - ntp server 2.2.2.2 version 3 - ntp server 2.2.2.2 trusted-enable - no ntp server 2.2.2.2 - ntp server 192.168.10.10 - ntpdate 192.168.10.10 -""" - -from copy import deepcopy -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxNTPServersPeersModule(BaseOnyxModule): - - def init_module(self): - """ module initialization - """ - peer_spec = dict(ip_or_name=dict(required=True), - enabled=dict(type='bool'), - version=dict(type='int', choices=[3, 4]), - key_id=dict(type='int'), - state=dict(choices=['present', 'absent'])) - server_spec = dict(ip_or_name=dict(required=True), - enabled=dict(type='bool'), - version=dict(type='int', choices=[3, 4]), - trusted_enable=dict(type='bool'), - key_id=dict(type='int'), - state=dict(choices=['present', 'absent'])) - element_spec = dict(peer=dict(type='list', elements='dict', options=peer_spec), - server=dict(type='list', elements='dict', options=server_spec), - ntpdate=dict()) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _show_peers_servers_config(self): - cmd = "show ntp configured" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _set_servers_config(self, peers_servers_config): - servers = dict() - peers = dict() - if not peers_servers_config: - return - index = 0 - for peer_server in peers_servers_config: - if (index == 0): - index += 1 - continue - else: - header_list = peer_server.get("header").split(" ") - header_type = header_list[1] - if peer_server.get("Enabled") == "yes": - enabled_state = True - else: - enabled_state = False - if (header_type == 'server'): - trusted_state = peer_server.get("Trusted") - if trusted_state == 'yes': - trusted_state = True - else: - trusted_state = False - server_entry = {"version": peer_server.get("NTP version"), - "enabled": enabled_state, - "trusted_enable": trusted_state, - "key_id": peer_server.get("Key ID")} - servers[header_list[2]] = server_entry - else: - peer_entry = {"version": peer_server.get("NTP version"), - "enabled": enabled_state, - "key_id": peer_server.get("Key ID")} - peers[header_list[2]] = peer_entry - index += 1 - self._current_config = dict(server=servers, - peer=peers) - - def load_current_config(self): - servers = dict() - peers = dict() - self._current_config = dict(server=servers, - peer=peers) - peers_servers_config = self._show_peers_servers_config() - if peers_servers_config: - self._set_servers_config(peers_servers_config) - - def generate_commands(self): - for option in self._current_config: - req_ntp = self._required_config.get(option) - if req_ntp is not None: - for ntp_peer in req_ntp: - peer_name = ntp_peer.get('ip_or_name') - peer_key = ntp_peer.get('key_id') - peer_state = ntp_peer.get("state") - peer_enabled = ntp_peer.get("enabled") - peer_version = ntp_peer.get("version") - peer_key = ntp_peer.get("key_id") - curr_name = self._current_config.get(option).get(peer_name) - peer_version = ntp_peer.get('version') - if self._current_config.get(option) and curr_name: - if peer_state: - if(peer_state == "absent"): - self._commands.append('no ntp {0} {1}' .format(option, peer_name)) - continue - if peer_enabled is not None: - if curr_name.get("enabled") != peer_enabled: - if(peer_enabled is True): - self._commands.append('no ntp {0} {1} disable' .format(option, peer_name)) - else: - self._commands.append('ntp {0} {1} disable' .format(option, peer_name)) - if peer_version: - if (int(curr_name.get("version")) != peer_version): - self._commands.append('ntp {0} {1} version {2}' .format(option, peer_name, peer_version)) - if peer_key: - if curr_name.get("key_id") != "none": - if (int(curr_name.get("key_id")) != peer_key): - self._commands.append('ntp {0} {1} keyID {2}' .format(option, peer_name, peer_key)) - else: - self._commands.append('ntp {0} {1} keyID {2}' .format(option, peer_name, peer_key)) - if option == "server": - server_trusted = ntp_peer.get("trusted_enable") - if server_trusted is not None: - if (curr_name.get("trusted_enable") != server_trusted): - if server_trusted is True: - self._commands.append('ntp {0} {1} trusted-enable' .format(option, peer_name)) - else: - self._commands.append('no ntp {0} {1} trusted-enable' .format(option, peer_name)) - else: - if peer_state: - if(peer_state == "absent"): - continue - if peer_enabled is not None: - if(peer_enabled is True): - self._commands.append('no ntp {0} {1} disable' .format(option, peer_name)) - else: - self._commands.append('ntp {0} {1} disable' .format(option, peer_name)) - else: - self._commands.append('ntp {0} {1} disable' .format(option, peer_name)) - if peer_version: - self._commands.append('ntp {0} {1} version {2}' .format(option, peer_name, peer_version)) - if peer_key: - self._commands.append('ntp {0} {1} keyID {2}' .format(option, peer_name, peer_key)) - - ntpdate = self._required_config.get("ntpdate") - if ntpdate is not None: - self._commands.append('ntpdate {0}' .format(ntpdate)) - - -def main(): - """ main entry point for module execution - """ - OnyxNTPServersPeersModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_ospf.py b/plugins/modules/network/onyx/onyx_ospf.py deleted file mode 100644 index 73a4bcc7..00000000 --- a/plugins/modules/network/onyx/onyx_ospf.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_ospf -author: "Samer Deeb (@samerd)" -short_description: Manage OSPF protocol on Mellanox ONYX network devices -description: - - This module provides declarative management and configuration of OSPF - protocol on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - ospf: - description: - - "OSPF instance number 1-65535" - required: true - router_id: - description: - - OSPF router ID. Required if I(state=present). - interfaces: - description: - - List of interfaces and areas. Required if I(state=present). - suboptions: - name: - description: - - Interface name. - required: true - area: - description: - - OSPF area. - required: true - state: - description: - - OSPF state. - default: present - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Add ospf router to interface - onyx_ospf: - ospf: 2 - router_id: 192.168.8.2 - interfaces: - - name: Eth1/1 - - area: 0.0.0.0 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - router ospf 2 - - router-id 192.168.8.2 - - exit - - interface ethernet 1/1 ip ospf area 0.0.0.0 -""" -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxOspfModule(BaseOnyxModule): - OSPF_IF_REGEX = re.compile( - r'^(Loopback\d+|Eth\d+\/\d+|Vlan\d+|Po\d+)\s+(\S+).*') - OSPF_ROUTER_REGEX = re.compile(r'^Routing Process (\d+).*ID\s+(\S+).*') - - @classmethod - def _get_element_spec(cls): - interface_spec = dict( - name=dict(required=True), - area=dict(required=True), - ) - element_spec = dict( - ospf=dict(type='int', required=True), - router_id=dict(), - interfaces=dict(type='list', elements='dict', - options=interface_spec), - state=dict(choices=['present', 'absent'], default='present'), - ) - return element_spec - - def init_module(self): - """ Ansible module initialization - """ - element_spec = self._get_element_spec() - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def validate_ospf(self, value): - if value and not 1 <= int(value) <= 65535: - self._module.fail_json(msg='ospf id must be between 1 and 65535') - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict( - ospf=module_params['ospf'], - router_id=module_params['router_id'], - state=module_params['state'], - ) - interfaces = module_params['interfaces'] or list() - req_interfaces = self._required_config['interfaces'] = dict() - for interface_data in interfaces: - req_interfaces[interface_data['name']] = interface_data['area'] - self.validate_param_values(self._required_config) - - def _update_ospf_data(self, ospf_data): - match = self.OSPF_ROUTER_REGEX.match(ospf_data) - if match: - ospf_id = int(match.group(1)) - router_id = match.group(2) - self._current_config['ospf'] = ospf_id - self._current_config['router_id'] = router_id - - def _update_ospf_interfaces(self, ospf_interfaces): - interfaces = self._current_config['interfaces'] = dict() - lines = ospf_interfaces.split('\n') - for line in lines: - line = line.strip() - match = self.OSPF_IF_REGEX.match(line) - if match: - name = match.group(1) - area = match.group(2) - for prefix in ("Vlan", "Loopback"): - if name.startswith(prefix): - name = name.replace(prefix, prefix + ' ') - interfaces[name] = area - - def _get_ospf_config(self, ospf_id): - cmd = 'show ip ospf %s | include Process' % ospf_id - return show_cmd(self._module, cmd, json_fmt=False, fail_on_error=False) - - def _get_ospf_interfaces_config(self, ospf_id): - cmd = 'show ip ospf interface %s brief' % ospf_id - return show_cmd(self._module, cmd, json_fmt=False, fail_on_error=False) - - def load_current_config(self): - # called in base class in run function - ospf_id = self._required_config['ospf'] - self._current_config = dict() - ospf_data = self._get_ospf_config(ospf_id) - if ospf_data: - self._update_ospf_data(ospf_data) - ospf_interfaces = self._get_ospf_interfaces_config(ospf_id) - if ospf_interfaces: - self._update_ospf_interfaces(ospf_interfaces) - - def _generate_no_ospf_commands(self): - req_ospf_id = self._required_config['ospf'] - curr_ospf_id = self._current_config.get('ospf') - if curr_ospf_id == req_ospf_id: - cmd = 'no router ospf %s' % req_ospf_id - self._commands.append(cmd) - - def _get_interface_command_name(self, if_name): - if if_name.startswith('Eth'): - return if_name.replace("Eth", "ethernet ") - if if_name.startswith('Po'): - return if_name.replace("Po", "port-channel ") - if if_name.startswith('Vlan'): - return if_name.replace("Vlan", "vlan") - if if_name.startswith('Loopback'): - return if_name.replace("Loopback", "loopback") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _get_interface_area_cmd(self, if_name, area): - interface_prefix = self._get_interface_command_name(if_name) - if area: - area_cmd = 'ip ospf area %s' % area - else: - area_cmd = 'no ip ospf area' - cmd = 'interface %s %s' % (interface_prefix, area_cmd) - return cmd - - def _generate_ospf_commands(self): - req_router_id = self._required_config['router_id'] - req_ospf_id = self._required_config['ospf'] - curr_router_id = self._current_config.get('router_id') - curr_ospf_id = self._current_config.get('ospf') - if curr_ospf_id != req_ospf_id or req_router_id != curr_router_id: - cmd = 'router ospf %s' % req_ospf_id - self._commands.append(cmd) - if req_router_id != curr_router_id: - if req_router_id: - cmd = 'router-id %s' % req_router_id - else: - cmd = 'no router-id' - self._commands.append(cmd) - self._commands.append('exit') - req_interfaces = self._required_config['interfaces'] - curr_interfaces = self._current_config.get('interfaces', dict()) - for if_name, area in iteritems(req_interfaces): - curr_area = curr_interfaces.get(if_name) - if curr_area != area: - cmd = self._get_interface_area_cmd(if_name, area) - self._commands.append(cmd) - for if_name in curr_interfaces: - if if_name not in req_interfaces: - cmd = self._get_interface_area_cmd(if_name, None) - self._commands.append(cmd) - - def generate_commands(self): - req_state = self._required_config['state'] - if req_state == 'absent': - return self._generate_no_ospf_commands() - return self._generate_ospf_commands() - - -def main(): - """ main entry point for module execution - """ - OnyxOspfModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_pfc_interface.py b/plugins/modules/network/onyx/onyx_pfc_interface.py deleted file mode 100644 index 234ca2ec..00000000 --- a/plugins/modules/network/onyx/onyx_pfc_interface.py +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_pfc_interface -author: "Samer Deeb (@samerd)" -short_description: Manage priority flow control on ONYX network devices -description: - - This module provides declarative management of priority flow control (PFC) - on interfaces of Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - name: - description: - - Name of the interface PFC should be configured on. - aggregate: - description: List of interfaces PFC should be configured on. - purge: - description: - - Purge interfaces not defined in the aggregate parameter. - type: bool - default: false - state: - description: - - State of the PFC configuration. - default: enabled - choices: ['enabled', 'disabled'] -''' - -EXAMPLES = """ -- name: Configure PFC - onyx_pfc_interface: - name: Eth1/1 - state: enabled -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/17 dcb priority-flow-control mode on -""" -from copy import deepcopy -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxPfcInterfaceModule(BaseOnyxModule): - PFC_IF_REGEX = re.compile( - r"^(Eth\d+\/\d+)|(Eth\d+\/\d+\/\d+)|(Po\d+)|(Mpo\d+)$") - - _purge = False - - @classmethod - def _get_element_spec(cls): - return dict( - name=dict(type='str'), - state=dict(default='enabled', - choices=['enabled', 'disabled']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['name'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['name', 'aggregate']] - mutually_exclusive = [['name', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - self._purge = module_params.get('purge', False) - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - self._required_config.append(req_item) - else: - params = { - 'name': module_params['name'], - 'state': module_params['state'], - } - self.validate_param_values(params) - self._required_config.append(params) - - def _create_if_pfc_data(self, if_name, if_pfc_data): - state = self.get_config_attr(if_pfc_data, "PFC oper") - state = state.lower() - return dict( - name=if_name, - state=state) - - def _get_pfc_config(self): - return show_cmd(self._module, "show dcb priority-flow-control") - - def load_current_config(self): - # called in base class in run function - self._os_version = self._get_os_version() - self._current_config = dict() - pfc_config = self._get_pfc_config() - if not pfc_config: - return - if self._os_version >= self.ONYX_API_VERSION: - if len(pfc_config) >= 3: - pfc_config = pfc_config[2] - else: - pfc_config = dict() - else: - if 'Table 2' in pfc_config: - pfc_config = pfc_config['Table 2'] - - for if_name, if_pfc_data in iteritems(pfc_config): - match = self.PFC_IF_REGEX.match(if_name) - if not match: - continue - if if_pfc_data: - if_pfc_data = if_pfc_data[0] - self._current_config[if_name] = \ - self._create_if_pfc_data(if_name, if_pfc_data) - - def _get_interface_cmd_name(self, if_name): - if if_name.startswith('Eth'): - return if_name.replace("Eth", "ethernet ") - if if_name.startswith('Po'): - return if_name.replace("Po", "port-channel ") - if if_name.startswith('Mpo'): - return if_name.replace("Mpo", "mlag-port-channel ") - self._module.fail_json( - msg='invalid interface name: %s' % if_name) - - def _add_if_pfc_commands(self, if_name, req_state): - cmd_prefix = "interface %s " % self._get_interface_cmd_name(if_name) - - if req_state == 'disabled': - pfc_cmd = 'no dcb priority-flow-control mode force' - else: - pfc_cmd = 'dcb priority-flow-control mode on force' - self._commands.append(cmd_prefix + pfc_cmd) - - def _gen_pfc_commands(self, if_name, curr_conf, req_state): - curr_state = curr_conf.get('state', 'disabled') - if curr_state != req_state: - self._add_if_pfc_commands(if_name, req_state) - - def generate_commands(self): - req_interfaces = set() - for req_conf in self._required_config: - req_state = req_conf['state'] - if_name = req_conf['name'] - if req_state == 'enabled': - req_interfaces.add(if_name) - curr_conf = self._current_config.get(if_name, {}) - self._gen_pfc_commands(if_name, curr_conf, req_state) - if self._purge: - for if_name, curr_conf in iteritems(self._current_config): - if if_name not in req_interfaces: - req_state = 'disabled' - self._gen_pfc_commands(if_name, curr_conf, req_state) - - -def main(): - """ main entry point for module execution - """ - OnyxPfcInterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_protocol.py b/plugins/modules/network/onyx/onyx_protocol.py deleted file mode 100644 index 472938ee..00000000 --- a/plugins/modules/network/onyx/onyx_protocol.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_protocol -author: "Samer Deeb (@samerd)" -short_description: Enables/Disables protocols on Mellanox ONYX network devices -description: - - This module provides a mechanism for enabling and disabling protocols - Mellanox on ONYX network devices. -notes: - - Tested on ONYX 3.6.4000 -options: - mlag: - description: MLAG protocol - choices: ['enabled', 'disabled'] - magp: - description: MAGP protocol - choices: ['enabled', 'disabled'] - spanning_tree: - description: Spanning Tree support - choices: ['enabled', 'disabled'] - dcb_pfc: - description: DCB priority flow control - choices: ['enabled', 'disabled'] - igmp_snooping: - description: IP IGMP snooping - choices: ['enabled', 'disabled'] - lacp: - description: LACP protocol - choices: ['enabled', 'disabled'] - ip_l3: - description: IP L3 support - choices: ['enabled', 'disabled'] - ip_routing: - description: IP routing support - choices: ['enabled', 'disabled'] - lldp: - description: LLDP protocol - choices: ['enabled', 'disabled'] - bgp: - description: BGP protocol - choices: ['enabled', 'disabled'] - ospf: - description: OSPF protocol - choices: ['enabled', 'disabled'] - nve: - description: nve protocol - choices: ['enabled', 'disabled'] - bfd: - description: bfd protocol - choices: ['enabled', 'disabled'] - version_added: '0.2.0' -''' - -EXAMPLES = """ -- name: Enable protocols for MLAG - onyx_protocol: - lacp: enabled - spanning_tree: disabled - ip_routing: enabled - mlag: enabled - dcb_pfc: enabled -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - no spanning-tree - - protocol mlag -""" - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxProtocolModule(BaseOnyxModule): - - PROTOCOL_MAPPING = dict( - mlag=dict(name="mlag", enable="protocol mlag", - disable="no protocol mlag"), - magp=dict(name="magp", enable="protocol magp", - disable="no protocol magp"), - spanning_tree=dict(name="spanning-tree", enable="spanning-tree", - disable="no spanning-tree"), - dcb_pfc=dict(name="priority-flow-control", - enable="dcb priority-flow-control enable force", - disable="no dcb priority-flow-control enable force"), - igmp_snooping=dict(name="igmp-snooping", enable="ip igmp snooping", - disable="no ip igmp snooping"), - lacp=dict(name="lacp", enable="lacp", disable="no lacp"), - ip_l3=dict(name="IP L3", enable="ip l3", - disable="no ip l3"), - ip_routing=dict(name="IP routing", enable="ip routing", - disable="no ip routing"), - lldp=dict(name="lldp", enable="lldp", disable="no lldp"), - bgp=dict(name="bgp", enable="protocol bgp", disable="no protocol bgp"), - ospf=dict(name="ospf", enable="protocol ospf", - disable="no protocol ospf"), - nve=dict(name="nve", enable="protocol nve", - disable="no protocol nve"), - bfd=dict(name="bfd", enable="protocol bfd", - disable="no protocol bfd"), - ) - - @classmethod - def _get_element_spec(cls): - element_spec = dict() - for protocol in cls.PROTOCOL_MAPPING: - element_spec[protocol] = dict(choices=['enabled', 'disabled']) - return element_spec - - def init_module(self): - """ Ansible module initialization - """ - element_spec = self._get_element_spec() - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True - ) - - def get_required_config(self): - self._required_config = dict() - module_params = self._module.params - for key, val in iteritems(module_params): - if key in self.PROTOCOL_MAPPING and val is not None: - self._required_config[key] = val - - def _get_protocols(self): - return show_cmd(self._module, "show protocols") - - def _get_ip_routing(self): - return show_cmd(self._module, 'show ip routing | include "IP routing"', - json_fmt=False) - - def load_current_config(self): - self._current_config = dict() - protocols_config = self._get_protocols() - if not protocols_config: - protocols_config = dict() - ip_config = self._get_ip_routing() - if ip_config: - lines = ip_config.split('\n') - for line in lines: - line = line.strip() - line_attr = line.split(':') - if len(line_attr) == 2: - attr = line_attr[0].strip() - val = line_attr[1].strip() - protocols_config[attr] = val - for protocol, protocol_metadata in iteritems(self.PROTOCOL_MAPPING): - protocol_json_attr = protocol_metadata['name'] - val = protocols_config.get(protocol_json_attr, 'disabled') - if val not in ('enabled', 'disabled'): - val = 'enabled' - self._current_config[protocol] = val - - def generate_commands(self): - for protocol, req_val in iteritems(self._required_config): - protocol_metadata = self.PROTOCOL_MAPPING[protocol] - curr_val = self._current_config.get(protocol, 'disabled') - if curr_val != req_val: - if req_val == 'disabled': - command = protocol_metadata['disable'] - else: - command = protocol_metadata['enable'] - self._commands.append(command) - - -def main(): - """ main entry point for module execution - """ - OnyxProtocolModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_ptp_global.py b/plugins/modules/network/onyx/onyx_ptp_global.py deleted file mode 100644 index 8d8c71d3..00000000 --- a/plugins/modules/network/onyx/onyx_ptp_global.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_ptp_global -author: "Anas Badaha (@anasb)" -short_description: Configures PTP Global parameters -description: - - This module provides declarative management of PTP Global configuration - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.8130 - ptp and ntp protocols cannot be enabled at the same time -options: - ptp_state: - description: - - PTP state. - choices: ['enabled', 'disabled'] - default: enabled - ntp_state: - description: - - NTP state. - choices: ['enabled', 'disabled'] - domain: - description: - - "set PTP domain number Range 0-127" - primary_priority: - description: - - "set PTP primary priority Range 0-225" - secondary_priority: - description: - - "set PTP secondary priority Range 0-225" -''' - -EXAMPLES = """ -- name: Configure PTP - onyx_ptp_global: - ntp_state: enabled - ptp_state: disabled - domain: 127 - primary_priority: 128 - secondary_priority: 128 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - no ntp enable - - protocol ptp - - ptp domain 127 -""" - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxPtpGlobalModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - element_spec = dict( - ntp_state=dict(choices=['enabled', 'disabled']), - ptp_state=dict(choices=['enabled', 'disabled'], default='enabled'), - domain=dict(type=int), - primary_priority=dict(type=int), - secondary_priority=dict(type=int) - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self._validate_param_values(self._required_config) - - def _validate_param_values(self, obj, param=None): - super(OnyxPtpGlobalModule, self).validate_param_values(obj, param) - if obj['ntp_state'] == 'enabled' and obj['ptp_state'] == 'enabled': - self._module.fail_json(msg='PTP State and NTP State Can not be enabled at the same time') - - def validate_domain(self, value): - if value and not 0 <= int(value) <= 127: - self._module.fail_json(msg='domain must be between 0 and 127') - - def validate_primary_priority(self, value): - if value and not 0 <= int(value) <= 255: - self._module.fail_json(msg='Primary Priority must be between 0 and 255') - - def validate_secondary_priority(self, value): - if value and not 0 <= int(value) <= 255: - self._module.fail_json(msg='Secondary Priority must be between 0 and 255') - - def _set_ntp_config(self, ntp_config): - ntp_config = ntp_config[0] - if not ntp_config: - return - ntp_state = ntp_config.get('NTP enabled') - if ntp_state == "yes": - self._current_config['ntp_state'] = "enabled" - else: - self._current_config['ntp_state'] = "disabled" - - def _set_ptp_config(self, ptp_config): - if ptp_config is None: - self._current_config['ptp_state'] = 'disabled' - else: - self._current_config['ptp_state'] = 'enabled' - self._current_config['domain'] = int(ptp_config['Domain']) - self._current_config['primary_priority'] = int(ptp_config['Priority1']) - self._current_config['secondary_priority'] = int(ptp_config['Priority2']) - - def _show_ntp_config(self): - cmd = "show ntp configured" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_ptp_config(self): - cmd = "show ptp clock" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - - ntp_config = self._show_ntp_config() - self._set_ntp_config(ntp_config) - - ptp_config = self._show_ptp_config() - self._set_ptp_config(ptp_config) - - def generate_commands(self): - ntp_state = self._required_config.get("ntp_state") - if ntp_state == "enabled": - self._enable_ntp() - elif ntp_state == "disabled": - self._disable_ntp() - - ptp_state = self._required_config.get("ptp_state", "enabled") - if ptp_state == "enabled": - self._enable_ptp() - else: - self._disable_ptp() - - domain = self._required_config.get("domain") - if domain is not None: - curr_domain = self._current_config.get("domain") - if domain != curr_domain: - self._commands.append('ptp domain %d' % domain) - - primary_priority = self._required_config.get("primary_priority") - if primary_priority is not None: - curr_primary_priority = self._current_config.get("primary_priority") - if primary_priority != curr_primary_priority: - self._commands.append('ptp priority1 %d' % primary_priority) - - secondary_priority = self._required_config.get("secondary_priority") - if secondary_priority is not None: - curr_secondary_priority = self._current_config.get("secondary_priority") - if secondary_priority != curr_secondary_priority: - self._commands.append('ptp priority2 %d' % secondary_priority) - - def _enable_ptp(self): - curr_ptp_state = self._current_config['ptp_state'] - if curr_ptp_state == 'disabled': - self._commands.append('protocol ptp') - - def _disable_ptp(self): - curr_ptp_state = self._current_config['ptp_state'] - if curr_ptp_state == 'enabled': - self._commands.append('no protocol ptp') - - def _enable_ntp(self): - curr_ntp_state = self._current_config.get('ntp_state') - if curr_ntp_state == 'disabled': - self._commands.append('ntp enable') - - def _disable_ntp(self): - curr_ntp_state = self._current_config['ntp_state'] - if curr_ntp_state == 'enabled': - self._commands.append('no ntp enable') - - -def main(): - """ main entry point for module execution - """ - OnyxPtpGlobalModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_ptp_interface.py b/plugins/modules/network/onyx/onyx_ptp_interface.py deleted file mode 100644 index b5818a5a..00000000 --- a/plugins/modules/network/onyx/onyx_ptp_interface.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_ptp_interface -author: 'Anas Badaha (@anasb)' -short_description: 'Configures PTP on interface' -description: - - "This module provides declarative management of PTP interfaces configuration -on Mellanox ONYX network devices." -notes: - - 'Tested on ONYX 3.6.8130' - - 'PTP Protocol must be enabled on switch.' - - 'Interface must not be a switch port interface.' -options: - name: - description: - - 'ethernet or vlan interface name that we want to configure PTP on it' - required: true - state: - description: - - 'Enable/Disable PTP on Interface' - default: enabled - choices: - - enabled - - disabled - delay_request: - description: - - 'configure PTP delay request interval, Range 0-5' - announce_interval: - description: - - 'configure PTP announce setting for interval, Range -3-1' - announce_timeout: - description: - - 'configure PTP announce setting for timeout, Range 2-10' - sync_interval: - description: - - 'configure PTP sync interval, Range -7--1' -''' - -EXAMPLES = """ -- name: Configure PTP interface - onyx_ptp_interface: - state: enabled - name: Eth1/1 - delay_request: 0 - announce_interval: -2 - announce_timeout: 3 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/16 ptp enable - - interface ethernet 1/16 ptp delay-req interval 0 - - interface ethernet 1/16 ptp announce interval -1 -""" - -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxPtpInterfaceModule(BaseOnyxModule): - IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$") - IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$") - - IF_TYPE_ETH = "ethernet" - IF_TYPE_VLAN = "vlan" - - IF_TYPE_MAP = { - IF_TYPE_ETH: IF_ETH_REGEX, - IF_TYPE_VLAN: IF_VLAN_REGEX - } - - RANGE_ATTR = { - "delay_request": (0, 5), - "announce_interval": (-3, -1), - "announce_timeout": (2, 10), - "sync_interval": (-7, -1) - } - - _interface_type = None - _interface_id = None - - def init_module(self): - """ initialize module - """ - element_spec = dict( - name=dict(required=True), - state=dict(choices=['enabled', 'disabled'], default='enabled'), - delay_request=dict(type=int), - announce_interval=dict(type=int), - announce_timeout=dict(type=int), - sync_interval=dict(type=int) - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - @classmethod - def _get_interface_type(cls, if_name): - if_type = None - if_id = None - for interface_type, interface_regex in iteritems(cls.IF_TYPE_MAP): - match = interface_regex.match(if_name) - if match: - if_type = interface_type - if_id = match.group(1) - break - return if_type, if_id - - def _set_if_type(self, module_params): - if_name = module_params['name'] - self._interface_type, self._interface_id = self._get_interface_type(if_name) - if not self._interface_id: - self._module.fail_json( - msg='unsupported interface name/type: %s' % if_name) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self._set_if_type(self._required_config) - self.validate_param_values(self._required_config) - - def _validate_attr_is_not_none(self, attr_name, attr_value): - if attr_value is not None: - self._module.fail_json(msg='Can not set %s value on switch while state is disabled' % attr_name) - - def validate_param_values(self, obj, param=None): - if obj['state'] == 'disabled': - for attr_name in self.RANGE_ATTR: - self._validate_attr_is_not_none(attr_name, obj[attr_name]) - super(OnyxPtpInterfaceModule, self).validate_param_values(obj, param) - - def _validate_range(self, value, attr_name): - min_value, max_value = self.RANGE_ATTR[attr_name] - if value and not min_value <= int(value) <= max_value: - self._module.fail_json(msg='%s value must be between %d and %d' % (attr_name, min_value, max_value)) - - def validate_delay_request(self, value): - self._validate_range(value, "delay_request") - - def validate_announce_interval(self, value): - self._validate_range(value, "announce_interval") - - def validate_announce_timeout(self, value): - self._validate_range(value, "announce_timeout") - - def validate_sync_interval(self, value): - self._validate_range(value, "sync_interval") - - def _set_ptp_interface_config(self, ptp_interface_config): - if ptp_interface_config is None: - self._current_config['state'] = 'disabled' - return - ptp_interface_config = ptp_interface_config[0] - self._current_config['state'] = 'enabled' - self._current_config['delay_request'] = int(ptp_interface_config['Delay request interval(log mean)']) - self._current_config['announce_interval'] = int(ptp_interface_config['Announce interval(log mean)']) - self._current_config['announce_timeout'] = int(ptp_interface_config['Announce receipt time out']) - self._current_config['sync_interval'] = int(ptp_interface_config['Sync interval(log mean)']) - - def _show_ptp_interface_config(self): - cmd = "show ptp interface %s %s" % (self._interface_type, self._interface_id) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - ptp_interface_config = self._show_ptp_interface_config() - self._set_ptp_interface_config(ptp_interface_config) - - def _generate_attr_command(self, attr_name, attr_cmd_name): - attr_val = self._required_config.get(attr_name) - if attr_val is not None: - curr_val = self._current_config.get(attr_name) - if attr_val != curr_val: - self._commands.append( - 'interface %s %s ptp %s %d' % (self._interface_type, self._interface_id, attr_cmd_name, attr_val)) - - def generate_commands(self): - state = self._required_config.get("state", "enabled") - self._gen_ptp_commands(state) - - self._generate_attr_command("delay_request", "delay-req interval") - self._generate_attr_command("announce_interval", "announce interval") - self._generate_attr_command("announce_timeout", "announce timeout") - self._generate_attr_command("sync_interval", "sync interval") - - def _add_if_ptp_cmd(self, req_state): - if req_state == 'enabled': - if_ptp_cmd = 'interface %s %s ptp enable' % (self._interface_type, self._interface_id) - else: - if_ptp_cmd = 'no interface %s %s ptp enable' % (self._interface_type, self._interface_id) - self._commands.append(if_ptp_cmd) - - def _gen_ptp_commands(self, req_state): - curr_state = self._current_config.get('state') - if curr_state != req_state: - self._add_if_ptp_cmd(req_state) - - -def main(): - """ main entry point for module execution - """ - OnyxPtpInterfaceModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_qos.py b/plugins/modules/network/onyx/onyx_qos.py deleted file mode 100644 index db92c3be..00000000 --- a/plugins/modules/network/onyx/onyx_qos.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_qos -author: "Anas Badaha (@anasb)" -short_description: Configures QoS -description: - - This module provides declarative management of Onyx QoS configuration - on Mellanox ONYX network devices. -notes: - - Tested on ONYX 3.6.8130 -options: - interfaces: - description: - - list of interfaces name. - required: true - trust: - description: - - trust type. - choices: ['L2', 'L3', 'both'] - default: L2 - rewrite_pcp: - description: - - rewrite with type pcp. - choices: ['enabled', 'disabled'] - default: disabled - rewrite_dscp: - description: - - rewrite with type dscp. - choices: ['enabled', 'disabled'] - default: disabled -''' - -EXAMPLES = """ -- name: Configure QoS - onyx_QoS: - interfaces: - - Mpo7 - - Mpo7 - trust: L3 - rewrite_pcp: disabled - rewrite_dscp: enabled - -- name: Configure QoS - onyx_QoS: - interfaces: - - Eth1/1 - - Eth1/2 - trust: both - rewrite_pcp: disabled - rewrite_dscp: enabled -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/16 qos trust L3 - - interface mlag-port-channel 7 qos trust L3 - - interface port-channel 1 qos trust L3 - - interface mlag-port-channel 7 qos trust L2 - - interface mlag-port-channel 7 qos rewrite dscp - - interface ethernet 1/16 qos rewrite pcp - - interface ethernet 1/1 no qos rewrite pcp -""" - -import re -from ansible.module_utils.six import iteritems -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxQosModule(BaseOnyxModule): - TRUST_CMD = "interface {0} {1} qos trust {2}" - NO_REWRITE_PCP_CMD = "interface {0} {1} no qos rewrite pcp" - NO_REWRITE_DSCP_CMD = "interface {0} {1} no qos rewrite dscp" - REWRITE_PCP_CMD = "interface {0} {1} qos rewrite pcp" - REWRITE_DSCP_CMD = "interface {0} {1} qos rewrite dscp" - - REWRITE_PCP = "pcp" - REWRITE_DSCP = "dscp" - - IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$") - IF_PO_REGEX = re.compile(r"^Po(\d+)$") - MLAG_NAME_REGEX = re.compile(r"^Mpo(\d+)$") - - IF_TYPE_ETH = "ethernet" - PORT_CHANNEL = "port-channel" - MLAG_PORT_CHANNEL = "mlag-port-channel" - - IF_TYPE_MAP = { - IF_TYPE_ETH: IF_ETH_REGEX, - PORT_CHANNEL: IF_PO_REGEX, - MLAG_PORT_CHANNEL: MLAG_NAME_REGEX - } - - def init_module(self): - """ initialize module - """ - element_spec = dict( - interfaces=dict(type='list', required=True), - trust=dict(choices=['L2', 'L3', 'both'], default='L2'), - rewrite_pcp=dict(choices=['enabled', 'disabled'], default='disabled'), - rewrite_dscp=dict(choices=['enabled', 'disabled'], default='disabled') - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _get_interface_type(self, if_name): - if_type = None - if_id = None - for interface_type, interface_regex in iteritems(self.IF_TYPE_MAP): - match = interface_regex.match(if_name) - if match: - if_type = interface_type - if_id = match.group(1) - break - return if_type, if_id - - def _set_interface_qos_config(self, interface_qos_config, interface, if_type, if_id): - interface_qos_config = interface_qos_config[0].get(interface) - trust = interface_qos_config[0].get("Trust mode") - rewrite_dscp = interface_qos_config[0].get("DSCP rewrite") - rewrite_pcp = interface_qos_config[0].get("PCP,DEI rewrite") - - self._current_config[interface] = dict(trust=trust, rewrite_dscp=rewrite_dscp, - rewrite_pcp=rewrite_pcp, if_type=if_type, if_id=if_id) - - def _show_interface_qos(self, if_type, interface): - cmd = "show qos interface {0} {1}".format(if_type, interface) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - for interface in self._required_config.get("interfaces"): - if_type, if_id = self._get_interface_type(interface) - if not if_id: - self._module.fail_json( - msg='unsupported interface: {0}'.format(interface)) - interface_qos_config = self._show_interface_qos(if_type, if_id) - if interface_qos_config is not None: - self._set_interface_qos_config(interface_qos_config, interface, if_type, if_id) - else: - self._module.fail_json( - msg='Interface {0} does not exist on switch'.format(interface)) - - def generate_commands(self): - trust = self._required_config.get("trust") - rewrite_pcp = self._required_config.get("rewrite_pcp") - rewrite_dscp = self._required_config.get("rewrite_dscp") - for interface in self._required_config.get("interfaces"): - ignored1, ignored2, current_trust, if_type, if_id = self._get_current_rewrite_config(interface) - self._add_interface_trust_cmds(if_type, if_id, interface, trust, current_trust) - self._add_interface_rewrite_cmds(if_type, if_id, interface, - rewrite_pcp, rewrite_dscp) - - def _get_current_rewrite_config(self, interface): - current_interface_qos_config = self._current_config.get(interface) - current_rewrite_pcp = current_interface_qos_config.get('rewrite_pcp') - current_rewrite_dscp = current_interface_qos_config.get('rewrite_dscp') - if_type = current_interface_qos_config.get("if_type") - if_id = current_interface_qos_config.get("if_id") - current_trust = current_interface_qos_config.get('trust') - - return current_rewrite_pcp, current_rewrite_dscp, current_trust, if_type, if_id - - def _add_interface_trust_cmds(self, if_type, if_id, interface, trust, current_trust): - - current_rewrite_pcp, current_rewrite_dscp, ignored1, ignored2, ignored3 = self._get_current_rewrite_config( - interface) - - if trust == "L3" and trust != current_trust: - self._add_no_rewrite_cmd(if_type, if_id, interface, self.REWRITE_DSCP, current_rewrite_dscp) - self._commands.append(self.TRUST_CMD.format(if_type, if_id, trust)) - elif trust == "L2" and trust != current_trust: - self._add_no_rewrite_cmd(if_type, if_id, interface, self.REWRITE_PCP, current_rewrite_pcp) - self._commands.append(self.TRUST_CMD.format(if_type, if_id, trust)) - elif trust == "both" and trust != current_trust: - self._add_no_rewrite_cmd(if_type, if_id, interface, self.REWRITE_DSCP, current_rewrite_dscp) - self._add_no_rewrite_cmd(if_type, if_id, interface, self.REWRITE_PCP, current_rewrite_pcp) - self._commands.append(self.TRUST_CMD.format(if_type, if_id, trust)) - - def _add_interface_rewrite_cmds(self, if_type, if_id, interface, rewrite_pcp, rewrite_dscp): - current_rewrite_pcp, current_rewrite_dscp, ignored1, ignored2, ignored3 = self._get_current_rewrite_config( - interface) - - if rewrite_pcp == "enabled" and rewrite_pcp != current_rewrite_pcp: - self._commands.append(self.REWRITE_PCP_CMD.format(if_type, if_id)) - elif rewrite_pcp == "disabled" and rewrite_pcp != current_rewrite_pcp: - self._commands.append(self.NO_REWRITE_PCP_CMD.format(if_type, if_id)) - - if rewrite_dscp == "enabled" and rewrite_dscp != current_rewrite_dscp: - self._commands.append(self.REWRITE_DSCP_CMD.format(if_type, if_id)) - elif rewrite_dscp == "disabled" and rewrite_dscp != current_rewrite_dscp: - self._commands.append(self.NO_REWRITE_DSCP_CMD.format(if_type, if_id)) - - def _add_no_rewrite_cmd(self, if_type, if_id, interface, rewrite_type, current_rewrite): - if rewrite_type == self.REWRITE_PCP and current_rewrite == "enabled": - self._commands.append(self.NO_REWRITE_PCP_CMD.format(if_type, if_id)) - self._current_config[interface]["rewrite_pcp"] = "disabled" - elif rewrite_type == self.REWRITE_DSCP and current_rewrite == "enabled": - self._commands.append(self.NO_REWRITE_DSCP_CMD.format(if_type, if_id)) - self._current_config[interface]["rewrite_dscp"] = "disabled" - - -def main(): - """ main entry point for module execution - """ - OnyxQosModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_snmp.py b/plugins/modules/network/onyx/onyx_snmp.py deleted file mode 100644 index dc17d82d..00000000 --- a/plugins/modules/network/onyx/onyx_snmp.py +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_snmp -version_added: '0.2.0' -author: "Sara-Touqan (@sarato)" -short_description: Manages SNMP general configurations on Mellanox ONYX network devices -description: - - This module provides declarative management of SNMP - on Mellanox ONYX network devices. -options: - state_enabled: - description: - - Enables/Disables the state of the SNMP configuration. - type: bool - contact_name: - description: - - Sets the SNMP contact name. - type: str - location: - description: - - Sets the SNMP location. - type: str - communities_enabled: - description: - - Enables/Disables community-based authentication on the system. - type: bool - multi_communities_enabled: - description: - - Enables/Disables multiple communities to be configured. - type: bool - snmp_communities: - type: list - description: - - List of snmp communities - suboptions: - community_name: - description: - - Configures snmp community name. - required: true - type: str - community_type: - description: - - Add this community as either a read-only or read-write community. - choices: ['read-only', 'read-write'] - type: str - state: - description: - - Used to decide if you want to delete the given snmp community or not - choices: ['present', 'absent'] - type: str - notify_enabled: - description: - - Enables/Disables sending of SNMP notifications (traps and informs) from thee system. - type: bool - notify_port: - description: - - Sets the default port to which notifications are sent. - type: str - notify_community: - description: - - Sets the default community for SNMP v1 and v2c notifications sent to hosts which do not have a community override set. - type: str - notify_send_test: - description: - - Sends a test notification. - type: str - choices: ['yes','no'] - notify_event: - description: - - Specifys which events will be sent as SNMP notifications. - type: str - choices: ['asic-chip-down', 'dcbx-pfc-port-oper-state-trap', 'insufficient-power', 'mstp-new-bridge-root', - 'ospf-lsdb-approaching-overflow', 'sm-stop', 'user-logout', 'cli-line-executed', 'dcbx-pfc-port-peer-state-trap', - 'interface-down', 'mstp-new-root-port', 'ospf-lsdb-overflow', 'snmp-authtrap', 'xstp-new-root-bridge', - 'cpu-util-high', 'disk-io-high', 'interface-up', 'mstp-topology-change', 'ospf-nbr-state-change', - 'temperature-too-high', 'xstp-root-port-change', 'dcbx-ets-module-state-change', 'disk-space-low', - 'internal-bus-error', 'netusage-high', 'paging-high', 'topology_change', 'xstp-topology-change', - 'dcbx-ets-port-admin-state-trap', 'entity-state-change', 'internal-link-speed-mismatch', 'new_root', - 'power-redundancy-mismatch', 'unexpected-cluster-join', 'dcbx-ets-port-oper-state-trap', 'expected-shutdown', - 'liveness-failure', 'ospf-auth-fail', 'process-crash', 'unexpected-cluster-leave', 'dcbx-ets-port-peer-state-trap', - 'health-module-status', 'low-power', 'ospf-config-error', 'process-exit', 'unexpected-cluster-size', - 'dcbx-pfc-module-state-change', 'insufficient-fans', 'low-power-recover', 'ospf-if-rx-bad-packet', - 'sm-restart', 'unexpected-shutdown', 'dcbx-pfc-port-admin-state-trap', 'insufficient-fans-recover', 'memusage-high', - 'ospf-if-state-change', 'sm-start', 'user-login'] - engine_id_reset: - description: - - Sets SNMPv3 engineID to node unique value. - type: bool - snmp_permissions: - type: list - description: - - Allow SNMPSET requests for items in a MIB. - suboptions: - state_enabled: - description: - - Enables/Disables the request. - required: true - type: bool - permission_type: - description: - - Configures the request type. - choices: ['MELLANOX-CONFIG-DB-MIB', 'MELLANOX-EFM-MIB','MELLANOX-POWER-CYCLE','MELLANOX-SW-UPDATE','RFC1213-MIB'] - type: str -''' - -EXAMPLES = """ -- name: Configure SNMP - onyx_snmp: - state_enabled: yes - contact_name: sara - location: Nablus - communities_enabled: no - multi_communities_enabled: no - notify_enabled: yes - notify_port: 1 - notify_community: community_1 - notify_send_test: yes - notify_event: temperature-too-high - snmp_communities: - - community_name: public - community_type: read-only - state: absent - snmp_permissions: - - state_enabled: yes - permission_type: MELLANOX-CONFIG-DB-MIB -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - snmp-server enable - - no snmp-server enable - - snmp-server location - - snmp-server contact - - snmp-server enable communities - - no snmp-server enable communities - - snmp-server enable mult-communities - - no snmp-server enable mult-communities - - snmp-server enable notify - - snmp-server notify port - - snmp-server notify community - - snmp-server notify send-test - - snmp-server notify event - - snmp-server enable set-permission - - no snmp-server enable set-permission - - snmp-server community - - no snmp-server community . - - snmp-server engineID reset. -""" - - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxSNMPModule(BaseOnyxModule): - - def init_module(self): - """ module initialization - """ - - community_spec = dict(community_name=dict(required=True), - community_type=dict(choices=['read-only', 'read-write']), - state=dict(choices=['present', 'absent'])) - - snmp_permission_spec = dict(state_enabled=dict(type='bool', required=True), - permission_type=dict(choices=['MELLANOX-CONFIG-DB-MIB', 'MELLANOX-EFM-MIB', 'MELLANOX-POWER-CYCLE', - 'MELLANOX-SW-UPDATE', 'RFC1213-MIB'])) - - event_choices = ['asic-chip-down', 'dcbx-pfc-port-oper-state-trap', 'insufficient-power', 'mstp-new-bridge-root', - 'ospf-lsdb-approaching-overflow', 'sm-stop', 'user-logout', 'cli-line-executed', 'dcbx-pfc-port-peer-state-trap', - 'interface-down', 'mstp-new-root-port', 'ospf-lsdb-overflow', 'snmp-authtrap', 'xstp-new-root-bridge', - 'cpu-util-high', 'disk-io-high', 'interface-up', 'mstp-topology-change', 'ospf-nbr-state-change', - 'temperature-too-high', 'xstp-root-port-change', 'dcbx-ets-module-state-change', 'disk-space-low', - 'internal-bus-error', 'netusage-high', 'paging-high', 'topology_change', 'xstp-topology-change', - 'dcbx-ets-port-admin-state-trap', 'entity-state-change', 'internal-link-speed-mismatch', 'new_root', - 'power-redundancy-mismatch', 'unexpected-cluster-join', 'dcbx-ets-port-oper-state-trap', 'expected-shutdown', - 'liveness-failure', 'ospf-auth-fail', 'process-crash', 'unexpected-cluster-leave', 'dcbx-ets-port-peer-state-trap', - 'health-module-status', 'low-power', 'ospf-config-error', 'process-exit', 'unexpected-cluster-size', - 'dcbx-pfc-module-state-change', 'insufficient-fans', 'low-power-recover', 'ospf-if-rx-bad-packet', - 'sm-restart', 'unexpected-shutdown', 'dcbx-pfc-port-admin-state-trap', 'insufficient-fans-recover', 'memusage-high', - 'ospf-if-state-change', 'sm-start', 'user-login'] - element_spec = dict( - state_enabled=dict(type='bool'), - contact_name=dict(type='str'), - location=dict(type='str'), - communities_enabled=dict(type='bool'), - multi_communities_enabled=dict(type='bool'), - snmp_communities=dict(type='list', elements='dict', options=community_spec), - notify_enabled=dict(type='bool'), - notify_port=dict(type='str'), - notify_community=dict(type='str'), - notify_send_test=dict(type='str', choices=['yes', 'no']), - notify_event=dict(type='str', choices=event_choices), - engine_id_reset=dict(type='bool'), - snmp_permissions=dict(type='list', elements='dict', options=snmp_permission_spec) - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _show_snmp_config(self): - show_cmds = [] - cmd = "show snmp" - show_cmds.append(show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False)) - cmd = "show running-config | include snmp" - show_cmds.append(show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False)) - return show_cmds - - def _set_snmp_config(self, all_snmp_config): - ro_communities_list = [] - rw_communities_list = [] - snmp_config = all_snmp_config[0] - if not snmp_config: - return - if snmp_config.get("SNMP enabled") == 'yes': - self._current_config['state_enabled'] = True - else: - self._current_config['state_enabled'] = False - self._current_config['contact_name'] = snmp_config.get("System contact") - self._current_config['location'] = snmp_config.get("System location") - curr_ro_comm = snmp_config.get("Read-only community") - if curr_ro_comm: - ro_arr = curr_ro_comm.split(' ') - rw_arr = snmp_config.get("Read-write community").split(' ') - ro_communities_list = ro_arr[0] - rw_communities_list = rw_arr[0] - if (len(ro_arr) == 2): - self._current_config['communities_enabled'] = False - else: - self._current_config['communities_enabled'] = True - else: - read_only_communities = all_snmp_config[1] - read_write_communities = all_snmp_config[2] - if not read_only_communities: - return - read_only_comm = read_only_communities.get("Read-only communities") - if read_only_comm: - self._current_config['communities_enabled'] = True - ro_communities_list = read_only_comm[0].get("Lines") - else: - self._current_config['communities_enabled'] = False - ro_comm_disabled = read_only_communities.get("Read-only communities (DISABLED)") - if ro_comm_disabled: - ro_communities_list = ro_comm_disabled[0].get("Lines") - if not read_write_communities: - return - read_write_comm = read_write_communities.get("Read-write communities") - if read_write_comm: - self._current_config['communities_enabled'] = True - rw_communities_list = read_write_comm[0].get("Lines") - else: - self._current_config['communities_enabled'] = False - rw_comm_disabled = read_write_communities.get("Read-write communities (DISABLED)") - if rw_comm_disabled: - rw_communities_list = rw_comm_disabled[0].get("Lines") - self._current_config['ro_communities_list'] = ro_communities_list - self._current_config['rw_communities_list'] = rw_communities_list - - def _set_snmp_running_config(self, snmp_running_config): - self._current_config['multi_comm_enabled'] = True - self._current_config['notify_enabled'] = True - curr_config_arr = [] - snmp_lines = snmp_running_config.get('Lines') - for runn_config in snmp_lines: - curr_config_arr.append(runn_config.strip()) - if 'no snmp-server enable mult-communities' in snmp_lines: - self._current_config['multi_comm_enabled'] = False - if 'no snmp-server enable notify' in snmp_lines: - self._current_config['notify_enabled'] = False - self._current_config['snmp_running_config'] = curr_config_arr - - def load_current_config(self): - self._current_config = dict() - snmp_config = self._show_snmp_config() - if snmp_config[0]: - self._set_snmp_config(snmp_config[0]) - if snmp_config[1]: - self._set_snmp_running_config(snmp_config[1]) - - def generate_commands(self): - current_state = self._current_config.get("state_enabled") - state = current_state - req_state = self._required_config.get("state_enabled") - if req_state is not None: - state = req_state - if state is not None: - if current_state != state: - if state is True: - self._commands.append('snmp-server enable') - else: - self._commands.append('no snmp-server enable') - - contact_name = self._required_config.get("contact_name") - if contact_name: - current_contact_name = self._current_config.get("contact_name") - if contact_name is not None: - if current_contact_name != contact_name: - self._commands.append('snmp-server contact {0}' .format(contact_name)) - - location = self._required_config.get("location") - if location: - current_location = self._current_config.get("location") - if location is not None: - if current_location != location: - self._commands.append('snmp-server location {0}' .format(location)) - - communities_enabled = self._required_config.get("communities_enabled") - if communities_enabled is not None: - current_communities_enabled = self._current_config.get("communities_enabled") - if communities_enabled is not None: - if current_communities_enabled != communities_enabled: - if communities_enabled is True: - self._commands.append('snmp-server enable communities') - else: - self._commands.append('no snmp-server enable communities') - - ro_communities = self._current_config.get("ro_communities_list") - rw_communities = self._current_config.get("rw_communities_list") - snmp_communities = self._required_config.get("snmp_communities") - if snmp_communities: - if snmp_communities is not None: - for community in snmp_communities: - community_name = community.get("community_name") - state = community.get("state") - if state: - if state == 'absent': - self._commands.append('no snmp-server community {0}' .format(community_name)) - continue - community_type = community.get("community_type") - if community_type: - if community_type == 'read-only': - if community_name not in ro_communities: - self._commands.append('snmp-server community {0} ro' .format(community_name)) - else: - if community_name not in rw_communities: - self._commands.append('snmp-server community {0} rw' .format(community_name)) - else: - if community_name not in ro_communities: - self._commands.append('snmp-server community {0}' .format(community_name)) - - engine_id_reset = self._required_config.get("engine_id_reset") - if engine_id_reset is not None: - if engine_id_reset: - self._commands.append('snmp-server engineID reset') - - current_multi_comm_state = self._current_config.get("multi_comm_enabled") - multi_communities_enabled = self._required_config.get("multi_communities_enabled") - if multi_communities_enabled is not None: - if current_multi_comm_state != multi_communities_enabled: - if multi_communities_enabled is True: - self._commands.append('snmp-server enable mult-communities') - else: - self._commands.append('no snmp-server enable mult-communities') - - notify_enabled = self._required_config.get("notify_enabled") - if notify_enabled is not None: - current_notify_state = self._current_config.get("notify_enabled") - if current_notify_state != notify_enabled: - if notify_enabled is True: - self._commands.append('snmp-server enable notify') - else: - self._commands.append('no snmp-server enable notify') - - snmp_permissions = self._required_config.get("snmp_permissions") - if snmp_permissions is not None: - for permission in snmp_permissions: - permission_type = permission.get('permission_type') - if permission.get('state_enabled') is True: - self._commands.append('snmp-server enable set-permission {0}' .format(permission_type)) - else: - self._commands.append('no snmp-server enable set-permission {0}' .format(permission_type)) - - snmp_running_config = self._current_config.get("snmp_running_config") - notify_port = self._required_config.get("notify_port") - if notify_port is not None: - notified_cmd = 'snmp-server notify port {0}' .format(notify_port) - if notified_cmd not in snmp_running_config: - self._commands.append('snmp-server notify port {0}' .format(notify_port)) - - notify_community = self._required_config.get("notify_community") - if notify_community is not None: - notified_cmd = 'snmp-server notify community {0}' .format(notify_community) - if notified_cmd not in snmp_running_config: - self._commands.append('snmp-server notify community {0}' .format(notify_community)) - - notify_send_test = self._required_config.get("notify_send_test") - if notify_send_test is not None: - if notify_send_test == 'yes': - self._commands.append('snmp-server notify send-test') - - notify_event = self._required_config.get("notify_event") - if notify_event is not None: - self._commands.append('snmp-server notify event {0}' .format(notify_event)) - - -def main(): - """ main entry point for module execution - """ - OnyxSNMPModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_snmp_hosts.py b/plugins/modules/network/onyx/onyx_snmp_hosts.py deleted file mode 100644 index a699b838..00000000 --- a/plugins/modules/network/onyx/onyx_snmp_hosts.py +++ /dev/null @@ -1,421 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_snmp_hosts -version_added: '0.2.0' -author: "Sara Touqan (@sarato)" -short_description: Configures SNMP host parameters -description: - - This module provides declarative management of SNMP hosts protocol params - on Mellanox ONYX network devices. -options: - hosts: - type: list - description: - - List of snmp hosts - suboptions: - name: - description: - - Specifies the name of the host. - required: true - type: str - enabled: - description: - - Temporarily Enables/Disables sending of all notifications to this host. - type: bool - notification_type: - description: - - Configures the type of sending notification to the specified host. - choices: ['trap', 'inform'] - type: str - port: - description: - - Overrides default target port for this host. - type: str - version: - description: - - Specifys SNMP version of informs to send. - choices: ['1', '2c', '3'] - type: str - user_name: - description: - - Specifys username for this inform sink. - type: str - auth_type: - description: - - Configures SNMP v3 security parameters, specifying passwords in a nother parameter (auth_password) (passwords are always stored encrypted). - choices: ['md5', 'sha', 'sha224', 'sha256', 'sha384', 'sha512'] - type: str - auth_password: - description: - - The password needed to configure the auth type. - type: str - privacy_type: - description: - - Specifys SNMP v3 privacy settings for this user. - choices: ['3des', 'aes-128', 'aes-192', 'aes-192-cfb', 'aes-256', 'aes-256-cfb', 'des'] - type: str - privacy_password: - description: - - The password needed to configure the privacy type. - type: str - state: - description: - - Used to decide if you want to delete the specified host or not. - choices: ['present' , 'absent'] - type: str -''' - -EXAMPLES = """ -- name: Enables snmp host - onyx_snmp_hosts: - hosts: - - name: 1.1.1.1 - enabled: true - -- name: Configures snmp host with version 2c - onyx_snmp_hosts: - hosts: - - name: 2.3.2.4 - enabled: true - notification_type: trap - port: 66 - version: 2c - -- name: Configures snmp host with version 3 and configures it with user as sara - onyx_snmp_hosts: - hosts: - - name: 2.3.2.4 - enabled: true - notification_type: trap - port: 66 - version: 3 - user_name: sara - auth_type: sha - auth_password: jnbdfijbdsf - privacy_type: 3des - privacy_password: nojfd8uherwiugfh - -- name: Deletes the snmp host - onyx_snmp_hosts: - hosts: - - name: 2.3.2.4 - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - snmp-server host disable - - no snmp-server host disable - - snmp-server host informs port version - - snmp-server host traps port version - - snmp-server host informs port version user auth - priv - - snmp-server host traps port version user auth - priv - - no snmp-server host . -""" - -import re - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxSNMPHostsModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - host_spec = dict(name=dict(required=True), - enabled=dict(type='bool'), - notification_type=dict(type='str', choices=['trap', 'inform']), - port=dict(type='str'), - version=dict(type='str', choices=['1', '2c', '3']), - user_name=dict(type='str'), - auth_type=dict(type='str', choices=['md5', 'sha', 'sha224', 'sha256', 'sha384', 'sha512']), - privacy_type=dict(type='str', choices=['3des', 'aes-128', 'aes-192', 'aes-192-cfb', 'aes-256', 'aes-256-cfb', 'des']), - privacy_password=dict(type='str', no_log=True), - auth_password=dict(type='str', no_log=True), - state=dict(type='str', choices=['present', 'absent']) - ) - element_spec = dict( - hosts=dict(type='list', elements='dict', options=host_spec), - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def validate_snmp_required_params(self): - req_hosts = self._required_config.get("hosts") - if req_hosts: - for host in req_hosts: - version = host.get('version') - if version: - if version == '3': - if host.get('user_name') is None or host.get('auth_type') is None or host.get('auth_password') is None: - self._module.fail_json(msg='user_name, auth_type and auth_password are required when version number is 3.') - - if host.get('notification_type') is not None: - if host.get('version') is None or host.get('port') is None: - self._module.fail_json(msg='port and version are required when notification_type is provided.') - - if host.get('auth_type') is not None: - if host.get('auth_password') is None: - self._module.fail_json(msg='auth_password is required when auth_type is provided.') - - if host.get('privacy_type') is not None: - if host.get('privacy_password') is None: - self._module.fail_json(msg='privacy_password is required when privacy_type is provided.') - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - self.validate_snmp_required_params() - - def _set_host_config(self, hosts_config): - hosts = hosts_config.get('Notification sinks') - if hosts[0].get('Lines'): - self._current_config['current_hosts'] = dict() - self._current_config['host_names'] = [] - return - - current_hosts = dict() - host_names = [] - for host in hosts: - host_info = dict() - for host_name in host: - host_names.append(host_name) - enabled = True - first_entry = host.get(host_name)[0] - if first_entry: - if first_entry.get('Enabled') == 'no': - enabled = False - notification_type = first_entry.get('Notification type') - notification_type = notification_type.split() - host_info['notification_type'] = notification_type[2] - version = notification_type[1][1:] - host_info['port'] = first_entry.get('Port') - host_info['name'] = host_name - host_info['enabled'] = enabled - host_info['version'] = version - if first_entry.get('Community') is None: - if len(first_entry) == 8: - host_info['user_name'] = first_entry.get('Username') - host_info['auth_type'] = first_entry.get('Authentication type') - host_info['privacy_type'] = first_entry.get('Privacy type') - elif len(host.get(host_name)) == 2: - second_entry = host.get(host_name)[1] - host_info['user_name'] = second_entry.get('Username') - host_info['auth_type'] = second_entry.get('Authentication type') - host_info['privacy_type'] = second_entry.get('Privacy type') - else: - host_info['user_name'] = '' - host_info['auth_type'] = '' - host_info['privacy_type'] = '' - else: - host_info['user_name'] = '' - host_info['auth_type'] = '' - host_info['privacy_type'] = '' - current_hosts[host_name] = host_info - self._current_config['current_hosts'] = current_hosts - self._current_config['host_names'] = host_names - - def _show_hosts_config(self): - cmd = "show snmp host" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - hosts_config = self._show_hosts_config() - if hosts_config[1]: - self._set_host_config(hosts_config[1]) - - def generate_snmp_commands_with_current_config(self, host): - host_id = host.get('name') - host_notification_type = host.get('notification_type') - host_enabled = host.get("enabled") - host_port = host.get('port') - host_version = host.get('version') - host_username = host.get('user_name') - host_auth_type = host.get('auth_type') - host_auth_pass = host.get('auth_password') - host_priv_type = host.get('privacy_type') - host_priv_pass = host.get('privacy_password') - present_state = host.get('state') - current_hosts = self._current_config.get("current_hosts") - current_entry = current_hosts.get(host_id) - if present_state is not None: - if present_state == 'absent': - self._commands.append('no snmp-server host {0}' .format(host_id)) - return - if host_enabled is not None: - if current_entry.get('enabled') != host_enabled: - if host_enabled is True: - self._commands.append('no snmp-server host {0} disable' .format(host_id)) - else: - self._commands.append('snmp-server host {0} disable' .format(host_id)) - if host_notification_type is not None: - current_port = current_entry.get('port') - current_version = current_entry.get('version') - current_priv_type = current_entry.get('privacy_type') - current_username = current_entry.get('user_name') - current_auth_type = current_entry.get('auth_type') - current_noti_type = current_entry.get('notification_type') - if host_port is not None: - if host_version is not None: - if host_version == '3': - if (host_priv_type is not None and host_priv_pass is not None): - if((current_noti_type != host_notification_type) or - ((current_port != host_port)) or - (current_version != host_version) or - (current_priv_type != host_priv_type) or - (current_username != host_username) or - (current_auth_type != host_auth_type)): - self._commands.append('snmp-server host {0} {1}s port {2} version {3} user {4} auth {5} {6} priv {7} {8}' - .format(host_id, host_notification_type, host_port, - host_version, host_username, host_auth_type, host_auth_pass, - host_priv_type, host_priv_pass)) - else: - if((current_noti_type != host_notification_type) or - ((current_port != host_port)) or - (current_version != host_version) or - (current_username != host_username) or - (current_auth_type != host_auth_type)): - self._commands.append('snmp-server host {0} {1}s port {2} version {3} user {4} auth {5} {6}' - .format(host_id, host_notification_type, - host_port, host_version, host_username, - host_auth_type, host_auth_pass)) - else: - if((current_noti_type != host_notification_type) or - ((current_port != host_port)) or - (current_version != host_version)): - self._commands.append('snmp-server host {0} {1}s port {2} version {3}' - .format(host_id, host_notification_type, - host_port, host_version)) - else: - if ((current_noti_type != host_notification_type) or - ((current_port != host_port))): - self._commands.append('snmp-server host {0} {1}s port {2}' - .format(host_id, host_notification_type, host_port)) - else: - if host_version is not None: - if host_version == '3': - if (host_priv_type is not None and host_priv_pass is not None): - if ((current_noti_type != host_notification_type) or - ((current_version != host_version)) or - (current_username != host_username) or - ((current_auth_type != host_auth_type)) or - (current_priv_type != host_priv_type)): - self._commands.append('snmp-server host {0} {1}s version {2} user {3} auth {4} {5} priv {6} {7}' - .format(host_id, host_notification_type, host_version, host_username, - host_auth_type, host_auth_pass, host_priv_type, host_priv_pass)) - - else: - if ((current_noti_type != host_notification_type) or - ((current_version != host_version)) or - (current_username != host_username) or - ((current_auth_type != host_auth_type))): - self._commands.append('snmp-server host {0} {1}s version {2} user {3} auth {4} {5}' - .format(host_id, host_notification_type, - host_version, host_username, host_auth_type, host_auth_pass)) - - else: - if ((current_noti_type != host_notification_type) or - ((current_version != host_version))): - self._commands.append('snmp-server host {0} {1}s version {2}' .format(host_id, - host_notification_type, host_version)) - - def generate_snmp_commands_without_current_config(self, host): - host_id = host.get('name') - host_notification_type = host.get('notification_type') - host_enabled = host.get("enabled") - host_port = host.get('port') - host_version = host.get('version') - host_username = host.get('user_name') - host_auth_type = host.get('auth_type') - host_auth_pass = host.get('auth_password') - host_priv_type = host.get('privacy_type') - host_priv_pass = host.get('privacy_password') - present_state = host.get('state') - present_state = host.get('state') - if present_state is not None: - if present_state == 'absent': - return - if host_enabled is not None: - if host_enabled is True: - self._commands.append('no snmp-server host {0} disable' .format(host_id)) - else: - self._commands.append('snmp-server host {0} disable' .format(host_id)) - - if host_notification_type is not None: - if host_port is not None: - if host_version is not None: - if host_version == '3': - if (host_priv_type is not None and host_priv_pass is not None): - self._commands.append('snmp-server host {0} {1}s port {2} version {3} user {4} auth {5} {6} priv {7} {8}' - .format(host_id, host_notification_type, host_port, host_version, host_username, - host_auth_type, host_auth_pass, host_priv_type, host_priv_pass)) - else: - self._commands.append('snmp-server host {0} {1}s port {2} version {3} user {4} auth {5} {6}' - .format(host_id, host_notification_type, host_port, host_version, host_username, - host_auth_type, host_auth_pass)) - else: - self._commands.append('snmp-server host {0} {1}s port {2} version {3}' .format(host_id, - host_notification_type, host_port, host_version)) - else: - self._commands.append('snmp-server host {0} {1}s port {2}' .format(host_id, - host_notification_type, host_port)) - else: - if host_version is not None: - if host_version == '3': - if (host_priv_type is not None and host_priv_pass is not None): - self._commands.append('snmp-server host {0} {1}s version {2} user {3} auth {4} {5} priv {6} {7}' - .format(host_id, host_notification_type, host_version, host_username, - host_auth_type, host_auth_pass, host_priv_type, host_priv_pass)) - else: - self._commands.append('snmp-server host {0} {1}s version {2} user {3} auth {4} {5}' .format(host_id, - host_notification_type, host_version, host_username, - host_auth_type, host_auth_pass)) - else: - self._commands.append('snmp-server host {0} {1}s version {2}' .format(host_id, - host_notification_type, host_version)) - - def generate_commands(self): - req_hosts = self._required_config.get("hosts") - host_names = self._current_config.get("host_names") - - if req_hosts: - for host in req_hosts: - host_id = host.get('name') - if host_id: - if host_names and (host_id in host_names): - self.generate_snmp_commands_with_current_config(host) - else: - self.generate_snmp_commands_without_current_config(host) - - -def main(): - """ main entry point for module execution - """ - OnyxSNMPHostsModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_snmp_users.py b/plugins/modules/network/onyx/onyx_snmp_users.py deleted file mode 100644 index dc30f2f0..00000000 --- a/plugins/modules/network/onyx/onyx_snmp_users.py +++ /dev/null @@ -1,274 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_snmp_users -version_added: '0.2.0' -author: "Sara Touqan (@sarato)" -short_description: Configures SNMP User parameters -description: - - This module provides declarative management of SNMP Users protocol params - on Mellanox ONYX network devices. -options: - users: - type: list - description: - - List of snmp users - suboptions: - name: - description: - - Specifies the name of the user. - required: true - type: str - enabled: - description: - - Enables/Disables SNMP v3 access for the user. - type: bool - set_access_enabled: - description: - - Enables/Disables SNMP SET requests for the user. - type: bool - require_privacy: - description: - - Enables/Disables the Require privacy (encryption) for requests from this user - type: bool - auth_type: - description: - - Configures the hash type used to configure SNMP v3 security parameters. - choices: ['md5', 'sha', 'sha224', 'sha256', 'sha384', 'sha512'] - type: str - auth_password: - description: - - The password needed to configure the hash type. - type: str - capability_level: - description: - - Sets capability level for SET requests. - choices: ['admin','monitor','unpriv','v_admin'] - type: str -''' - -EXAMPLES = """ -- name: Enables snmp user - onyx_snmp_users: - users: - - name: sara - enabled: true - -- name: Enables snmp set requests - onyx_snmp_users: - users: - - name: sara - set_access_enabled: yes - -- name: Enables user require privacy - onyx_snmp_users: - users: - - name: sara - require_privacy: true - -- name: Configures user hash type - onyx_snmp_users: - users: - - auth_type: md5 - auth_password: 1297sara1234sara - -- name: Configures user capability_level - onyx_snmp_users: - users: - - name: sara - capability_level: admin -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - snmp-server user v3 enable - - no snmp-server user v3 enable - - snmp-server user v3 enable sets - - no snmp-server user v3 enable sets - - snmp-server user v3 require-privacy - - no snmp-server user v3 require-privacy - - snmp-server user v3 capability - - snmp-server user v3 auth -""" - -import re - -from ansible.module_utils.basic import AnsibleModule - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxSNMPUsersModule(BaseOnyxModule): - - def init_module(self): - """ initialize module - """ - user_spec = dict(name=dict(required=True), - enabled=dict(type='bool'), - set_access_enabled=dict(type='bool'), - require_privacy=dict(type='bool'), - auth_type=dict(type='str', choices=['md5', 'sha', 'sha224', 'sha256', 'sha384', 'sha512']), - auth_password=dict(type='str'), - capability_level=dict(type='str', choices=['admin', 'monitor', 'unpriv', 'v_admin']), - ) - element_spec = dict( - users=dict(type='list', elements='dict', options=user_spec), - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _set_snmp_config(self, users_config): - if users_config[0]: - if users_config[0].get('Lines'): - return - current_users = [] - count = 0 - enabled = True - set_access_enabled = True - require_privacy = True - auth_type = '' - capability_level = '' - name = '' - all_users_names = [] - for user in users_config: - user_dict = {} - entry_dict = {} - for entry in user: - name = entry.split()[2] - if user.get(entry): - if user.get(entry)[0]: - enabled = user.get(entry)[0].get('Enabled overall') - if enabled == 'no': - enabled = False - else: - enabled = True - set_access_enabled = user.get(entry)[1].get('SET access')[0].get('Enabled') - if set_access_enabled == 'no': - set_access_enabled = False - else: - set_access_enabled = True - require_privacy = user.get(entry)[0].get('Require privacy') - if require_privacy == 'yes': - require_privacy = True - else: - require_privacy = False - capability_level = user.get(entry)[1].get('SET access')[0].get('Capability level') - auth_type = user.get(entry)[0].get('Authentication type') - user_dict['enabled'] = enabled - user_dict['set_access_enabled'] = set_access_enabled - user_dict['auth_type'] = auth_type - user_dict['capability_level'] = capability_level - user_dict['require_privacy'] = require_privacy - entry_dict[name] = user_dict - all_users_names.append(name) - current_users.append(entry_dict) - self._current_config['users'] = current_users - self._current_config['current_names'] = all_users_names - - def _show_users(self): - cmd = "show snmp user" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - users_config = self._show_users() - if users_config: - self._set_snmp_config(users_config) - - def generate_commands(self): - req_uers = self._required_config.get("users") - current_users = self._current_config.get("users") - current_names = self._current_config.get("current_names") - if req_uers: - for user in req_uers: - user_id = user.get('name') - if user_id: - if current_names and (user_id in current_names): - for user_entry in current_users: - for user_name in user_entry: - if user_name == user_id: - user_state = user.get("enabled") - user_entry_name = user_entry.get(user_name) - if user_state is not None: - if user_state != user_entry_name.get("enabled"): - if user_state is True: - self._commands.append('snmp-server user {0} v3 enable' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 enable' .format(user_id)) - set_state = user.get("set_access_enabled") - if set_state is not None: - if set_state != user_entry_name.get("set_access_enabled"): - if set_state is True: - self._commands.append('snmp-server user {0} v3 enable sets' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 enable sets' .format(user_id)) - auth_type = user.get("auth_type") - if auth_type is not None: - if user.get("auth_password") is not None: - if auth_type != user_entry_name.get("auth_type"): - self._commands.append('snmp-server user {0} v3 auth {1} {2}' - .format(user_id, user.get('auth_type'), user.get('auth_password'))) - cap_level = user.get("capability_level") - if cap_level is not None: - if cap_level != user_entry_name.get("capability_level"): - self._commands.append('snmp-server user {0} v3 capability {1}' - .format(user_id, user.get('capability_level'))) - req_priv = user.get("require_privacy") - if req_priv is not None: - if req_priv != user_entry_name.get("require_privacy"): - if req_priv is True: - self._commands.append('snmp-server user {0} v3 require-privacy' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 require-privacy' .format(user_id)) - - else: - user_state = user.get("enabled") - if user_state is not None: - if user_state is True: - self._commands.append('snmp-server user {0} v3 enable' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 enable' .format(user_id)) - set_state = user.get("set_access_enabled") - if set_state is not None: - if set_state is True: - self._commands.append('snmp-server user {0} v3 enable sets' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 enable sets' .format(user_id)) - if user.get("capability_level") is not None: - self._commands.append('snmp-server user {0} v3 capability {1}' .format(user_id, user.get('capability_level'))) - req_priv = user.get("require_privacy") - if req_priv is not None: - if req_priv is True: - self._commands.append('snmp-server user {0} v3 require-privacy' .format(user_id)) - else: - self._commands.append('no snmp-server user {0} v3 require-privacy' .format(user_id)) - - -def main(): - """ main entry point for module execution - """ - OnyxSNMPUsersModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_syslog_files.py b/plugins/modules/network/onyx/onyx_syslog_files.py deleted file mode 100644 index 83bd559e..00000000 --- a/plugins/modules/network/onyx/onyx_syslog_files.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' -module: onyx_syslog_files -version_added: '0.2.0' -author: "Anas Shami (@anass)" -short_description: Configure file management syslog module -description: - - This module provides declarative management of syslog - on Mellanox ONYX network devices. -notes: -options: - debug: - description: - - Configure settings for debug log files - type: bool - default: False - delete_group: - description: - - Delete certain log files - choices: ['current', 'oldest'] - type: str - rotation: - description: - - rotation related attributes - type: dict - suboptions: - frequency: - description: - - Rotate log files on a fixed time-based schedule - choices: ['daily', 'weekly', 'monthly'] - type: str - force: - description: - - force an immediate rotation of log files - type: bool - max_num: - description: - - Sepcify max_num of old log files to keep - type: int - size: - description: - - Rotate files when they pass max size - type: float - size_pct: - description: - - Rotatoe files when they pass percent of HD - type: float - upload_url: - description: - - upload local log files to remote host (ftp, scp, sftp, tftp) with format protocol://username[:password]@server/path - type: str - upload_file: - description: - - Upload compressed log file (current or filename) - type: str -''' - -EXAMPLES = """ -- name: Syslog delete old files -- onyx_syslog_files: - delete_group: oldest -- name: Syslog upload file -- onyx_syslog_files: - upload_url: scp://username:password@hostnamepath/filename - upload_file: current -- name: Syslog rotation force, frequency and max number -- onyx_syslog_files: - rotation: - force: true - max_num: 30 - frequency: daily - size: 128 -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - logging files delete current - - logging files rotate criteria - - logging files upload current url -""" -import re -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxSyslogFilesModule(BaseOnyxModule): - MAX_FILES = 999999 - URL_REGEX = re.compile( - r'^(ftp|scp|ftps):\/\/[a-z0-9\.]*:(.*)@(.*):([a-zA-Z\/\/])*$') - FREQUANCIES = ['daily', 'weekly', 'monthly'] - ROTATION_KEYS = ['frequency', 'max_num', 'size', 'size_pct', 'force'] - ROTATION_CMDS = {'size': 'logging {0} rotation criteria size {1}', - 'frequency': 'logging {0} rotation criteria frequency {1}', - 'max_num': 'logging {0} rotation max-num {1}', - 'size_pct': 'logging {0} rotation criteria size-pct {1}', - 'force': 'logging {0} rotation force'} - - def init_module(self): - """" Ansible module initialization - """ - rotation_spec = dict(frequency=dict(choices=self.FREQUANCIES), - max_num=dict(type="int"), - force=dict(type="bool"), - size=dict(type="float"), - size_pct=dict(type="float")) - - element_spec = dict(delete_group=dict(choices=['oldest', 'current']), - rotation=dict(type="dict", options=rotation_spec), - upload_file=dict(type="str"), - upload_url=dict(type="str"), - debug=dict(type="bool", default=False)) - - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_together=[['upload_file', 'upload_url']]) - - def validate_rotation(self, rotation): - size_pct = rotation.get('size_pct', None) - max_num = rotation.get('max_num', None) - if size_pct is not None and (float(size_pct) < 0 or float(size_pct) > 100): - self._module.fail_json( - msg='logging size_pct must be in range 0-100') - elif max_num is not None and (int(max_num) < 0 or int(max_num) > self.MAX_FILES): - self._module.fail_json( - msg='logging max_num must be positive number less than {0}'.format(self.MAX_FILES)) - - def validate_upload_url(self, upload_url): - check = self.URL_REGEX.match(upload_url) - if upload_url and not check: - self._module.fail_json( - msg='Invalid url, make sure that you use "[ftp, scp, tftp, sftp]://username:password@hostname:/location" format') - - def show_logging(self): - show_logging = show_cmd(self._module, "show logging", json_fmt=True, fail_on_error=False) - running_config = show_cmd(self._module, "show running-config | include .*logging.*debug-files.*", json_fmt=True, fail_on_error=False) - - if len(show_logging) > 0: - show_logging[0]['debug'] = running_config['Lines'] if 'Lines' in running_config else [] - else: - show_logging = [{ - 'debug': running_config['Lines'] if 'Lines' in running_config else [] - }] - return show_logging - - def load_current_config(self): - self._current_config = dict() - current_config = self.show_logging()[0] - freq = current_config.get('Log rotation frequency') # daily (Once per day at midnight) - size = current_config.get('Log rotation size threshold') # 19.07 megabytes or 10.000% of partition (987.84 megabytes) - max_num = current_config.get('Number of archived log files to keep') - if freq is not None: - freq_str = freq.split()[0] - self._current_config['frequency'] = freq_str - - if size is not None: - size_arr = size.split(' ') - if '%' in size: - size_pct_value = size_arr[0].replace('%', '') - self._current_config['size_pct'] = float(size_pct_value) - size_value = re.sub(r'(\(|\)|megabytes)', '', size_arr[-2]).strip() - self._current_config['size'] = float(size_value) - else: - size_value = size_arr[0] - self._current_config['size'] = float(size_value) - - if max_num is not None: - self._current_config['max_num'] = int(max_num) - - '''debug params''' - for line in current_config['debug']: - if 'size' in line: - self._current_config['debug_size'] = float(line.split(' ')[-1]) - elif 'frequency' in line: - self._current_config['debug_frequency'] = line.split(' ')[-1] - elif 'size-pct' in line: - self._current_config['debug_size_pct'] = float(line.split(' ')[-1]) - elif 'max-num' in line: - self._current_config['debug_max_num'] = int(line.split(' ')[-1]) - - def get_required_config(self): - self._required_config = dict() - required_config = dict() - module_params = self._module.params - - delete_group = module_params.get('delete_group') - upload_file = module_params.get('upload_file') - rotation = module_params.get('rotation') - if delete_group: - required_config['delete_group'] = delete_group - if upload_file: - required_config.update({'upload_file': upload_file, - 'upload_url': module_params.get('upload_url')}) - if rotation: - required_config['rotation'] = rotation - required_config['debug'] = module_params['debug'] - - self.validate_param_values(required_config) - self._required_config = required_config - - def generate_commands(self): - required_config = self._required_config - current_config = self._current_config - - logging_files_type = 'debug-files' if required_config['debug'] else 'files' - debug_prefix = 'debug_' if required_config['debug'] else '' - - rotation = required_config.get('rotation') - if rotation: - for key in rotation: - if rotation.get(key) and current_config.get(debug_prefix + key) != rotation.get(key): - cmd = self.ROTATION_CMDS[key].format(logging_files_type, rotation[key]) if key != 'force' else\ - self.ROTATION_CMDS[key].format(logging_files_type) - self._commands.append(cmd) - - delete_group = required_config.get('delete_group') - if delete_group: - self._commands.append('logging {0} delete {1}'.format(logging_files_type, - delete_group)) - - upload_file = required_config.get('upload_file') - if upload_file: - self._commands.append('logging {0} upload {1} {2}'.format(logging_files_type, - upload_file, required_config.get('upload_url'))) - - -def main(): - """ main entry point for module execution - """ - OnyxSyslogFilesModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_syslog_remote.py b/plugins/modules/network/onyx/onyx_syslog_remote.py deleted file mode 100644 index 4b8085df..00000000 --- a/plugins/modules/network/onyx/onyx_syslog_remote.py +++ /dev/null @@ -1,346 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' -module: onyx_syslog_remote -version_added: '0.2.0' -author: "Anas Shami (@anass)" -short_description: Configure remote syslog module -description: - - This module provides declarative management of syslog - on Mellanox ONYX network devices. -notes: -options: - enabled: - description: - - Disable/Enable logging to given remote host - default: true - type: bool - host: - description: - - Send event logs to this server using the syslog protocol - required: true - type: str - port: - description: - - Set remote server destination port for log messages - type: int - trap: - description: - - Minimum severity level for messages to this syslog server - choices: ['none', 'debug', 'info', 'notice', 'alert', 'warning', 'err', 'emerg', 'crit'] - type: str - trap_override: - description: - - Override log levels for this sink on a per-class basis - type: list - suboptions: - override_class: - description: - - Specify a class whose log level to override - choices: ['mgmt-front', 'mgmt-back', 'mgmt-core', 'events', 'debug-module', 'sx-sdk', 'mlx-daemons', 'protocol-stack'] - required: True - type: str - override_priority: - description: - -Specify a priority whose log level to override - choices: ['none', 'debug', 'info', 'notice', 'alert', 'warning', 'err', 'emerg', 'crit'] - type: str - override_enabled: - description: - - disable override priorities for specific class. - default: True - type: bool - - filter: - description: - - Specify a filter type - choices: ['include', 'exclude'] - type: str - filter_str: - description: - - Specify a regex filter string - type: str -''' - -EXAMPLES = """ -- name: Remote logging port 8080 -- onyx_syslog_remote: - host: 10.10.10.10 - port: 8080 - -- name: Remote logging trap override -- onyx_syslog_remote: - host: 10.10.10.10 - trap_override: - - override_class: events - override_priority: emerg - -- name: Remote logging trap emerg -- onyx_syslog_remote: - host: 10.10.10.10 - trap: emerg - -- name: Remote logging filter include 'ERR' -- onyx_syslog_remote: - host: 10.10.10.10 - filter: include - filter_str: /ERR/ - -- name: Disable remote logging with class events -- onyx_syslog_remote: - enabled: False - host: 10.10.10.10 - class: events -- name : disable remote logging -- onyx_syslog_remote: - enabled: False - host: 10.10.10.10 - -- name : enable/disable override class -- onyx_syslog_remote: - host: 10.7.144.71 - trap_override: - - override_class: events - override_priority: emerg - override_enabled: False - - override_class: mgmt-front - override_priority: alert -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - logging x port 8080 - - logging 10.10.10.10 trap override class events priority emerg - - no logging 10.10.10.10 trap override class events - - logging 10.10.10.10 trap emerg - - logging 10.10.10.10 filter [include | exclude] ERR -""" - -import re -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxSyslogRemoteModule(BaseOnyxModule): - MAX_PORT = 65535 - LEVELS = ['none', 'debug', 'info', 'notice', 'alert', 'warning', 'err', 'emerg', 'crit'] - CLASSES = ['mgmt-front', 'mgmt-back', 'mgmt-core', 'events', 'debug-module', 'sx-sdk', 'mlx-daemons', 'protocol-stack'] - FILTER = ['include', 'exclude'] - - LOGGING_HOST = re.compile(r'^logging ([a-z0-9\.]+)$') - LOGGING_PORT = re.compile(r'^logging ([a-z0-9\.]+) port ([0-9]+)$') - LOGGING_TRAP = re.compile(r'^logging ([a-z0-9\.]+) trap ([a-z]+)$') - LOGGING_TRAP_OVERRIDE = re.compile(r'^logging ([a-z0-9\.]+) trap override class ([a-z\-]+) priority ([a-z]+)$') - LOGGING_FILTER = re.compile(r'^logging ([a-z0-9\.]+) filter (include|exclude) "([\D\d]+)"$') - - def init_module(self): - """" Ansible module initialization - """ - override_spec = dict(override_priority=dict(choices=self.LEVELS), - override_class=dict(choices=self.CLASSES, required=True), - override_enabled=dict(default=True, type="bool")) - - element_spec = dict(enabled=dict(type="bool", default=True), - host=dict(type="str", required=True), - port=dict(type="int"), - trap=dict(choices=self.LEVELS), - trap_override=dict(type="list", elements='dict', options=override_spec), - filter=dict(choices=self.FILTER), - filter_str=dict(type="str")) - - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_together=[ - ['filter', 'filter_str'] - ]) - - def validate_port(self, port): - if port and (port < 1 or port > self.MAX_PORT): - self._module.fail_json(msg='logging port must be between 1 and {0}'.format(self.MAX_PORT)) - - def show_logging(self): - # we can't use show logging it has lack of information - return show_cmd(self._module, "show running-config | include .*logging.*", json_fmt=False, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - current_config = self.show_logging().split('\n') - for line in current_config: - line = line.strip() - match = self.LOGGING_HOST.match(line) - if match: - host = match.group(1) - self._current_config[host] = dict() - continue - - match = self.LOGGING_PORT.match(line) - if match: - host = match.group(1) - port = int(match.group(2)) - if host in self._current_config: - self._current_config[host]['port'] = port - else: - self._current_config[host] = dict(port=port) - continue - - match = self.LOGGING_TRAP.match(line) - if match: - host = match.group(1) - trap = match.group(2) - host_config = self._current_config.get(host) - if host_config: - self._current_config[host]['trap'] = trap - else: - self._current_config[host] = dict(trap=trap) - continue - - match = self.LOGGING_TRAP_OVERRIDE.match(line) - if match: - host = match.group(1) - override_class = match.group(2) - override_priority = match.group(3) - host_config = self._current_config.get(host) - - if host_config: - if 'trap_override' in host_config: - self._current_config[host]['trap_override'].append(dict(override_class=override_class, override_priority=override_priority)) - else: - self._current_config[host]['trap_override'] = [dict(override_class=override_class, override_priority=override_priority)] - else: - self._current_config[host] = {'trap_override': [dict(override_class=override_class, override_priority=override_priority)]} - continue - - match = self.LOGGING_FILTER.match(line) - if match: - host = match.group(1) - filter_type = match.group(2) - filter_str = match.group(3) - if host in self._current_config: - self._current_config[host].update({'filter': filter_type, 'filter_str': filter_str}) - else: - self._current_config[host] = dict(filter=filter_type, filter_str=filter_str) - - def get_required_config(self): - self._required_config = dict() - required_config = dict() - module_params = self._module.params - port = module_params.get('port') - trap = module_params.get('trap') - trap_override = module_params.get('trap_override') - filtered = module_params.get('filter') - - required_config['host'] = module_params.get('host') - required_config['enabled'] = module_params.get('enabled') - - if port: - required_config['port'] = port - if trap: - required_config['trap'] = trap - if trap_override: - required_config['trap_override'] = trap_override - if filtered: - required_config['filter'] = filtered - required_config['filter_str'] = module_params.get('filter_str', '') - - self.validate_param_values(required_config) - self._required_config = required_config - - def generate_commands(self): - required_config = self._required_config - current_config = self._current_config - host = required_config.get('host') - enabled = required_config['enabled'] - ''' - cases: - if host in current config and current config != required config and its enable - if host in current config and its disable - if host in current and it has override_class with disable flag - ''' - host_config = current_config.get(host, dict()) - - if host in current_config and not enabled: - self._commands.append('no logging {0}'.format(host)) - else: - if host not in current_config: - self._commands.append('logging {0}'.format(host)) - if 'port' in required_config: - if required_config['port'] != host_config.get('port', None) or not host_config: - '''Edit/Create new one''' - self._commands.append('logging {0} port {1}'.format(host, required_config['port'])) - - if 'trap' in required_config or 'trap_override' in required_config: - trap_commands = self._get_trap_commands(host) - self._commands += trap_commands - - if 'filter' in required_config: - is_change = host_config.get('filter', None) != required_config['filter'] or \ - host_config.get('filter_str', None) != required_config['filter_str'] - if is_change or not host_config: - self._commands.append('logging {0} filter {1} {2}'.format(host, required_config['filter'], required_config['filter_str'])) - - ''' ********** private methods ********** ''' - def _get_trap_commands(self, host): - current_config = self._current_config - required_config = self._required_config - trap_commands = [] - host_config = current_config.get(host, dict()) - - override_list = required_config.get('trap_override') - if override_list: - current_override_list = host_config.get('trap_override', []) - - for override_trap in override_list: - override_class = override_trap.get('override_class') - override_priority = override_trap.get('override_priority') - override_enabled = override_trap.get('override_enabled') - found, found_class = False, False - for current_override in current_override_list: - if current_override.get('override_class') == override_class: - found_class = True - if not override_enabled: - break - if override_priority and current_override.get('override_priority') == override_priority: - found = True - break - - if override_enabled: - if not found and override_priority: - trap_commands.append('logging {0} trap override class {1} priority {2}'.format( - host, override_class, override_priority)) - elif found_class: # disabled option will use only class - trap_commands.append('no logging {0} trap override class {1}'.format( - host, override_class)) - - else: - if required_config['enabled']: # no disabled option for this, just override trap level can be disabled - trap = required_config.get('trap') - if trap and (trap != host_config.get('trap', None) or not host_config): - trap_commands.append('logging {0} trap {1}'.format( - host, trap)) - '''no disable for trap''' - - return trap_commands - - -def main(): - """ main entry point for module execution - """ - OnyxSyslogRemoteModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_traffic_class.py b/plugins/modules/network/onyx/onyx_traffic_class.py deleted file mode 100644 index 01ab30f2..00000000 --- a/plugins/modules/network/onyx/onyx_traffic_class.py +++ /dev/null @@ -1,321 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_traffic_class -author: "Anas Badaha (@anasb)" -short_description: Configures Traffic Class -description: - - This module provides declarative management of Traffic Class configuration - on Mellanox ONYX network devices. -options: - state: - description: - - enable congestion control on interface. - choices: ['enabled', 'disabled'] - default: enabled - interfaces: - description: - - list of interfaces name. - required: true - tc: - description: - - traffic class, range 0-7. - required: true - congestion_control: - description: - - configure congestion control on interface. - suboptions: - control: - description: - - congestion control type. - choices: ['red', 'ecn', 'both'] - required: true - threshold_mode: - description: - - congestion control threshold mode. - choices: ['absolute', 'relative'] - required: true - min_threshold: - description: - - Set minimum-threshold value (in KBs) for marking traffic-class queue. - required: true - max_threshold: - description: - - Set maximum-threshold value (in KBs) for marking traffic-class queue. - required: true - dcb: - description: - - configure dcb control on interface. - suboptions: - mode: - description: - - dcb control mode. - choices: ['strict', 'wrr'] - required: true - weight: - description: - - Relevant only for wrr mode. -''' - -EXAMPLES = """ -- name: Configure traffic class - onyx_traffic_class: - interfaces: - - Eth1/1 - - Eth1/2 - tc: 3 - congestion_control: - control: ecn - threshold_mode: absolute - min_threshold: 500 - max_threshold: 1500 - dcb: - mode: strict -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface ethernet 1/15 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500 - - interface ethernet 1/16 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500 - - interface mlag-port-channel 7 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500 - - interface port-channel 1 traffic-class 3 congestion-control ecn minimum-absolute 150 maximum-absolute 1500 - - interface ethernet 1/15 traffic-class 3 dcb ets strict - - interface ethernet 1/16 traffic-class 3 dcb ets strict - - interface mlag-port-channel 7 traffic-class 3 dcb ets strict - - interface port-channel 1 traffic-class 3 dcb ets strict -""" - -import re -from ansible.module_utils.six import iteritems -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxTrafficClassModule(BaseOnyxModule): - - IF_ETH_REGEX = re.compile(r"^Eth(\d+\/\d+|Eth\d+\/\d+\d+)$") - IF_PO_REGEX = re.compile(r"^Po(\d+)$") - MLAG_NAME_REGEX = re.compile(r"^Mpo(\d+)$") - - IF_TYPE_ETH = "ethernet" - PORT_CHANNEL = "port-channel" - MLAG_PORT_CHANNEL = "mlag-port-channel" - - IF_TYPE_MAP = { - IF_TYPE_ETH: IF_ETH_REGEX, - PORT_CHANNEL: IF_PO_REGEX, - MLAG_PORT_CHANNEL: MLAG_NAME_REGEX - } - - def init_module(self): - """ initialize module - """ - congestion_control_spec = dict(control=dict(choices=['red', 'ecn', 'both'], required=True), - threshold_mode=dict(choices=['absolute', 'relative'], required=True), - min_threshold=dict(type=int, required=True), - max_threshold=dict(type=int, required=True)) - - dcb_spec = dict(mode=dict(choices=['strict', 'wrr'], required=True), - weight=dict(type=int)) - - element_spec = dict( - interfaces=dict(type='list', required=True), - tc=dict(type=int, required=True), - congestion_control=dict(type='dict', options=congestion_control_spec), - dcb=dict(type='dict', options=dcb_spec), - state=dict(choices=['enabled', 'disabled'], default='enabled')) - - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def validate_tc(self, value): - if value and not 0 <= int(value) <= 7: - self._module.fail_json(msg='tc value must be between 0 and 7') - - def validate_param_values(self, obj, param=None): - dcb = obj.get("dcb") - if dcb is not None: - dcb_mode = dcb.get("mode") - weight = dcb.get("weight") - if dcb_mode == "wrr" and weight is None: - self._module.fail_json(msg='User should send weight attribute when dcb mode is wrr') - super(OnyxTrafficClassModule, self).validate_param_values(obj, param) - - def _get_interface_type(self, if_name): - if_type = None - if_id = None - for interface_type, interface_regex in iteritems(self.IF_TYPE_MAP): - match = interface_regex.match(if_name) - if match: - if_type = interface_type - if_id = match.group(1) - break - return if_type, if_id - - def _set_interface_congestion_control_config(self, interface_congestion_control_config, - interface, if_type, if_id): - tc = self._required_config.get("tc") - interface_dcb_ets = self._show_interface_dcb_ets(if_type, if_id)[0].get(interface) - if interface_dcb_ets is None: - dcb = dict() - else: - ets_per_tc = interface_dcb_ets[2].get("ETS per TC") - tc_config = ets_per_tc[0].get(str(tc)) - dcb_mode = tc_config[0].get("S.Mode") - dcb_weight = int(tc_config[0].get("W")) - dcb = dict(mode=dcb_mode.lower(), weight=dcb_weight) - - interface_congestion_control_config = interface_congestion_control_config[tc + 1] - mode = interface_congestion_control_config.get("Mode") - if mode == "none": - self._current_config[interface] = dict(state="disabled", dcb=dcb, if_type=if_type, if_id=if_id) - return - - threshold_mode = interface_congestion_control_config.get("Threshold mode") - max_threshold = interface_congestion_control_config.get("Maximum threshold") - min_threshold = interface_congestion_control_config.get("Minimum threshold") - - if threshold_mode == "absolute": - delimiter = ' ' - else: - delimiter = '%' - min_value = int(min_threshold.split(delimiter)[0]) - max_malue = int(max_threshold.split(delimiter)[0]) - congestion_control = dict(control=mode.lower(), threshold_mode=threshold_mode, - min_threshold=min_value, max_threshold=max_malue) - - self._current_config[interface] = dict(state="enabled", congestion_control=congestion_control, - dcb=dcb, if_type=if_type, if_id=if_id) - - def _show_interface_congestion_control(self, if_type, interface): - cmd = "show interfaces {0} {1} congestion-control".format(if_type, interface) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_interface_dcb_ets(self, if_type, interface): - cmd = "show dcb ets interface {0} {1}".format(if_type, interface) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - for interface in self._required_config.get("interfaces"): - if_type, if_id = self._get_interface_type(interface) - if not if_id: - self._module.fail_json( - msg='unsupported interface: {0}'.format(interface)) - interface_congestion_control_config = self._show_interface_congestion_control(if_type, if_id) - if interface_congestion_control_config is not None: - self._set_interface_congestion_control_config(interface_congestion_control_config, - interface, if_type, if_id) - else: - self._module.fail_json( - msg='Interface {0} does not exist on switch'.format(interface)) - - def generate_commands(self): - state = self._required_config.get("state") - tc = self._required_config.get("tc") - interfaces = self._required_config.get("interfaces") - for interface in interfaces: - current_interface = self._current_config.get(interface) - current_state = current_interface.get("state") - if_type = current_interface.get("if_type") - if_id = current_interface.get("if_id") - if state == "disabled": - if current_state == "enabled": - self._commands.append('interface {0} {1} no traffic-class {2} congestion-control'.format(if_type, if_id, tc)) - continue - - congestion_control = self._required_config.get("congestion_control") - - if congestion_control is not None: - control = congestion_control.get("control") - current_congestion_control = current_interface.get("congestion_control") - threshold_mode = congestion_control.get("threshold_mode") - min_threshold = congestion_control.get("min_threshold") - max_threshold = congestion_control.get("max_threshold") - if current_congestion_control is None: - self._threshold_mode_generate_cmds_mappers(threshold_mode, if_type, if_id, tc, - control, min_threshold, max_threshold) - else: - current_control = current_congestion_control.get("control") - curr_threshold_mode = current_congestion_control.get("threshold_mode") - curr_min_threshold = current_congestion_control.get("min_threshold") - curr_max_threshold = current_congestion_control.get("max_threshold") - - if control != current_control: - self._threshold_mode_generate_cmds_mappers(threshold_mode, if_type, if_id, tc, - control, min_threshold, max_threshold) - else: - if threshold_mode != curr_threshold_mode: - self._threshold_mode_generate_cmds_mappers(threshold_mode, if_type, if_id, tc, - control, min_threshold, max_threshold) - elif min_threshold != curr_min_threshold or max_threshold != curr_max_threshold: - self._threshold_mode_generate_cmds_mappers(threshold_mode, if_type, if_id, tc, - control, min_threshold, max_threshold) - - dcb = self._required_config.get("dcb") - if dcb is not None: - dcb_mode = dcb.get("mode") - current_dcb = current_interface.get("dcb") - current_dcb_mode = current_dcb.get("mode") - if dcb_mode == "strict" and dcb_mode != current_dcb_mode: - self._commands.append('interface {0} {1} traffic-class {2} ' - 'dcb ets {3}'.format(if_type, if_id, tc, dcb_mode)) - elif dcb_mode == "wrr": - weight = dcb.get("weight") - current_weight = current_dcb.get("weight") - if dcb_mode != current_dcb_mode or weight != current_weight: - self._commands.append('interface {0} {1} traffic-class {2} ' - 'dcb ets {3} {4}'.format(if_type, if_id, tc, dcb_mode, weight)) - - def _threshold_mode_generate_cmds_mappers(self, threshold_mode, if_type, if_id, tc, - control, min_threshold, max_threshold): - if threshold_mode == 'absolute': - self._generate_congestion_control_absolute_cmds(if_type, if_id, tc, control, - min_threshold, max_threshold) - else: - self._generate_congestion_control_relative_cmds(if_type, if_id, tc, control, - min_threshold, max_threshold) - - def _generate_congestion_control_absolute_cmds(self, if_type, if_id, tc, control, - min_absolute, max_absolute): - self._commands.append('interface {0} {1} traffic-class {2} ' - 'congestion-control {3} minimum-absolute {4} ' - 'maximum-absolute {5}'.format(if_type, if_id, tc, control, - min_absolute, max_absolute)) - - def _generate_congestion_control_relative_cmds(self, if_type, if_id, tc, control, - min_relative, max_relative): - self._commands.append('interface {0} {1} traffic-class {2} ' - 'congestion-control {3} minimum-relative {4} ' - 'maximum-relative {5}'.format(if_type, if_id, tc, control, - min_relative, max_relative)) - - -def main(): - """ main entry point for module execution - """ - OnyxTrafficClassModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_username.py b/plugins/modules/network/onyx/onyx_username.py deleted file mode 100644 index 79423937..00000000 --- a/plugins/modules/network/onyx/onyx_username.py +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_username -version_added: '0.2.0' -author: "Anas Shami (@anass)" -short_description: Configure username module -description: - - This module provides declarative management of users/roles - on Mellanox ONYX network devices. -notes: -options: - username: - description: - - Create/Edit user using username - type: str - required: True - full_name: - description: - - Set the full name of this user - type: str - nopassword: - description: - - Clear password for such user - type: bool - default: False - password: - description: - - Set password fot such user - type: str - encrypted_password: - description: - - Decide the type of setted password (plain text or encrypted) - type: bool - default: False - capability: - description: - - Grant capability to this user account - type: str - choices: ['monitor', 'unpriv', 'v_admin', 'admin'] - reset_capability: - description: - - Reset capability to this user account - type: bool - default: False - disconnected: - description: - - Disconnect all sessions of this user - type: bool - default: False - disabled: - description: - - Disable means of logging into this account - type: str - choices: ['none', 'login', 'password', 'all'] - state: - description: - - Set state of the given account - default: present - type: str - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Create new user - onyx_username: - username: anass - -- name: Set the user full-name - onyx_username: - username: anass - full_name: anasshami - -- name: Set the user encrypted password - onyx_username: - username: anass - password: 12345 - encrypted_password: True - -- name: Set the user capability - onyx_username: - username: anass - capability: monitor - -- name: Reset the user capability - onyx_username: - username: anass - reset_capability: True - -- name: Remove the user configuration - onyx_username: - username: anass - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - username * - - username * password * - - username * nopassword - - username * disable login - - username * capability admin - - no username * - - no username * disable - -""" -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule, show_cmd - - -class OnyxUsernameModule(BaseOnyxModule): - ACCOUNT_STATE = { - 'Account locked out': dict(disabled='all'), - 'No password required for login': dict(nopassword=True), - 'Local password login disabled': dict(disabled='password'), - 'Account disabled': dict(disabled='all') - } - ENCRYPTED_ID = 7 - - def init_module(self): - """ - module initialization - """ - element_spec = dict() - - argument_spec = dict(state=dict(choices=['absent', 'present'], default='present'), - username=dict(type='str', required=True), - disabled=dict(choices=['none', 'login', 'password', 'all']), - capability=dict(choices=['monitor', 'unpriv', 'v_admin', 'admin']), - nopassword=dict(type='bool', default=False), - password=dict(type='str', no_log=True), - encrypted_password=dict(type='bool', default=False), - reset_capability=dict(type="bool", default=False), - disconnected=dict(type='bool', default=False), - full_name=dict(type='str')) - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - mutually_exclusive=[['password', 'nopassword']]) - - def get_required_config(self): - self._required_config = dict() - module_params = self._module.params - params = {} - ''' Requred/Default fields ''' - params['username'] = module_params.get('username') - params['state'] = module_params.get('state') - params['encrypted_password'] = module_params.get('encrypted_password') - params['reset_capability'] = module_params.get('reset_capability') - ''' Other fields ''' - for key, value in module_params.items(): - if value is not None: - params[key] = value - self.validate_param_values(params) - self._required_config = params - - def _get_username_config(self): - return show_cmd(self._module, "show usernames", json_fmt=True, fail_on_error=False) - - def _set_current_config(self, users_config): - ''' - users_config ex: - { - admin": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "No password required for login", - "FULL NAME": "System Administrator" - } - ], - } - ''' - if not users_config: - return - current_config = self._current_config - for username, config in users_config.items(): - config_json = config[0] - current_config[username] = current_config.get(username, {}) - account_status = config_json.get('ACCOUNT STATUS') - status_value = self.ACCOUNT_STATE.get(account_status) - - if status_value is not None: - # None for enabled account with password account "Password set (SHA512 | MD5)" so we won't change any attribute here. - current_config[username].update(status_value) - current_config[username].update({ - 'capability': config_json.get('CAPABILITY'), - 'full_name': config_json.get('FULL NAME') - }) - - def load_current_config(self): - self._current_config = dict() - users_config = self._get_username_config() - self._set_current_config(users_config) - - def generate_commands(self): - current_config, required_config = self._current_config, self._required_config - username = required_config.get('username') - current_user = current_config.get(username) - if current_user is not None: - '''created account we just need to edit his attributes''' - full_name = required_config.get('full_name') - if full_name is not None and current_user.get('full_name') != full_name: - self._commands.append("username {0} full-name {1}".format(username, full_name)) - - disabled = required_config.get('disabled') - if disabled is not None and current_user.get('disabled') != disabled: - if disabled == 'none': - self._commands.append("no username {0} disable".format(username)) - elif disabled == 'all': - self._commands.append("username {0} disable".format(username)) - else: - self._commands.append("username {0} disable {1}".format(username, disabled)) - - state = required_config.get('state') - if state == 'absent': # this will remove the user - self._commands.append("no username {0}".format(username)) - - capability = required_config.get('capability') - if capability is not None and current_user.get('capability') != capability: - self._commands.append("username {0} capability {1}".format(username, capability)) - - reset_capability = required_config.get('reset_capability') - if reset_capability: - self._commands.append("no username {0} capability".format(username)) - - password = required_config.get('password') - if password is not None: - encrypted = required_config.get('encrypted_password') - if encrypted: - self._commands.append("username {0} password {1} {2}".format(username, self.ENCRYPTED_ID, password)) - else: - self._commands.append("username {0} password {1}".format(username, password)) - - nopassword = required_config.get('nopassword') - if nopassword and nopassword != current_user.get('nopassword', False): - self._commands.append("username {0} nopassword".format(username)) - - disconnected = required_config.get('disconnected') - if disconnected: - self._commands.append("username {0} disconnect".format(username)) - else: - '''create new account if we have valid inforamtion, just check for username, capability, full_name, password''' - - capability = required_config.get('capability') - password = required_config.get('password') - full_name = required_config.get('full_name') - if capability is not None or password is not None or full_name is not None: - if capability is not None: - self._commands.append("username {0} capability {1}".format(username, capability)) - - if password is not None: - encrypted = required_config.get('encrypted_password') - if encrypted: - self._commands.append("username {0} password {1} {2} ".format(username, self.ENCRYPTED_ID, password)) - else: - self._commands.append("username {0} password {1}".format(username, password)) - - if full_name is not None: - self._commands.append("username {0} full-name {1}".format(username, full_name)) - - else: - self._commands.append("username {0}".format(username)) - - -def main(): - """ main entry point for module execution - """ - OnyxUsernameModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_vlan.py b/plugins/modules/network/onyx/onyx_vlan.py deleted file mode 100644 index 44026514..00000000 --- a/plugins/modules/network/onyx/onyx_vlan.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_vlan -author: "Samer Deeb (@samerd) Alex Tabachnik (@atabachnik)" -short_description: Manage VLANs on Mellanox ONYX network devices -description: - - This module provides declarative management of VLANs - on Mellanox ONYX network devices. -options: - name: - description: - - Name of the VLAN. - vlan_id: - description: - - ID of the VLAN. - aggregate: - description: List of VLANs definitions. - purge: - description: - - Purge VLANs not defined in the I(aggregate) parameter. - default: no - type: bool - state: - description: - - State of the VLAN configuration. - default: present - choices: ['present', 'absent'] -''' - -EXAMPLES = """ -- name: Configure VLAN ID and name - onyx_vlan: - vlan_id: 20 - name: test-vlan - -- name: Remove configuration - onyx_vlan: - state: absent -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device - returned: always. - type: list - sample: - - vlan 20 - - name test-vlan - - exit -""" - -from copy import deepcopy - -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import remove_default_spec - -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd - - -class OnyxVlanModule(BaseOnyxModule): - _purge = False - - @classmethod - def _get_element_spec(cls): - return dict( - vlan_id=dict(type='int'), - name=dict(type='str'), - state=dict(default='present', choices=['present', 'absent']), - ) - - @classmethod - def _get_aggregate_spec(cls, element_spec): - aggregate_spec = deepcopy(element_spec) - aggregate_spec['vlan_id'] = dict(required=True) - - # remove default in aggregate spec, to handle common arguments - remove_default_spec(aggregate_spec) - return aggregate_spec - - def init_module(self): - """ module initialization - """ - element_spec = self._get_element_spec() - aggregate_spec = self._get_aggregate_spec(element_spec) - argument_spec = dict( - aggregate=dict(type='list', elements='dict', - options=aggregate_spec), - purge=dict(default=False, type='bool'), - ) - argument_spec.update(element_spec) - required_one_of = [['vlan_id', 'aggregate']] - mutually_exclusive = [['vlan_id', 'aggregate']] - self._module = AnsibleModule( - argument_spec=argument_spec, - required_one_of=required_one_of, - mutually_exclusive=mutually_exclusive, - supports_check_mode=True) - - def validate_vlan_id(self, value): - if value and not 1 <= int(value) <= 4094: - self._module.fail_json(msg='vlan id must be between 1 and 4094') - - def get_required_config(self): - self._required_config = list() - module_params = self._module.params - aggregate = module_params.get('aggregate') - self._purge = module_params.get('purge', False) - if aggregate: - for item in aggregate: - for key in item: - if item.get(key) is None: - item[key] = module_params[key] - self.validate_param_values(item, item) - req_item = item.copy() - req_item['vlan_id'] = int(req_item['vlan_id']) - self._required_config.append(req_item) - else: - params = { - 'vlan_id': module_params['vlan_id'], - 'name': module_params['name'], - 'state': module_params['state'], - } - self.validate_param_values(params) - self._required_config.append(params) - - def _create_vlan_data(self, vlan_id, vlan_data): - if self._os_version >= self.ONYX_API_VERSION: - vlan_data = vlan_data[0] - return { - 'vlan_id': vlan_id, - 'name': self.get_config_attr(vlan_data, 'Name') - } - - def _get_vlan_config(self): - return show_cmd(self._module, "show vlan") - - def load_current_config(self): - # called in base class in run function - self._os_version = self._get_os_version() - self._current_config = dict() - vlan_config = self._get_vlan_config() - if not vlan_config: - return - for vlan_id, vlan_data in iteritems(vlan_config): - try: - vlan_id = int(vlan_id) - except ValueError: - continue - self._current_config[vlan_id] = \ - self._create_vlan_data(vlan_id, vlan_data) - - def generate_commands(self): - req_vlans = set() - for req_conf in self._required_config: - state = req_conf['state'] - vlan_id = req_conf['vlan_id'] - if state == 'absent': - if vlan_id in self._current_config: - self._commands.append('no vlan %s' % vlan_id) - else: - req_vlans.add(vlan_id) - self._generate_vlan_commands(vlan_id, req_conf) - if self._purge: - for vlan_id in self._current_config: - if vlan_id not in req_vlans: - self._commands.append('no vlan %s' % vlan_id) - - def _generate_vlan_commands(self, vlan_id, req_conf): - curr_vlan = self._current_config.get(vlan_id, {}) - if not curr_vlan: - self._commands.append("vlan %s" % vlan_id) - self._commands.append("exit") - req_name = req_conf['name'] - curr_name = curr_vlan.get('name') - if req_name: - if req_name != curr_name: - self._commands.append("vlan %s name %s" % (vlan_id, req_name)) - elif req_name is not None: - if curr_name: - self._commands.append("vlan %s no name" % vlan_id) - - -def main(): - """ main entry point for module execution - """ - OnyxVlanModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_vxlan.py b/plugins/modules/network/onyx/onyx_vxlan.py deleted file mode 100644 index e0d80c16..00000000 --- a/plugins/modules/network/onyx/onyx_vxlan.py +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_vxlan -author: "Anas Badaha (@anasb)" -short_description: Configures Vxlan -description: - - This module provides declarative management of Vxlan configuration - on Mellanox ONYX network devices. -notes: - - Tested on ONYX evpn_dev.031. - - nve protocol must be enabled. -options: - nve_id: - description: - - nve interface ID. - required: true - loopback_id: - description: - - loopback interface ID. - bgp: - description: - - configure bgp on nve interface. - type: bool - default: true - mlag_tunnel_ip: - description: - - vxlan Mlag tunnel IP - vni_vlan_list: - description: - - Each item in the list has two attributes vlan_id, vni_id. - arp_suppression: - description: - - A flag telling if to configure arp suppression. - type: bool - default: false -''' - -EXAMPLES = """ -- name: Configure Vxlan - onyx_vxlan: - nve_id: 1 - loopback_id: 1 - bgp: yes - mlag-tunnel-ip: 100.0.0.1 - vni_vlan_list: - - vlan_id: 10 - vni_id: 10010 - - vlan_id: 6 - vni_id: 10060 - arp_suppression: yes -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - interface nve 1 - - interface nve 1 vxlan source interface loopback 1 - - interface nve 1 nve controller bgp - - interface nve 1 vxlan mlag-tunnel-ip 100.0.0.1 - - interface nve 1 nve vni 10010 vlan 10 - - interface nve 1 nve vni 10060 vlan 6 - - interface nve 1 nve neigh-suppression - - interface vlan 6 - - interface vlan 10 -""" - -import re -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import show_cmd -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule - - -class OnyxVxlanModule(BaseOnyxModule): - - LOOPBACK_REGEX = re.compile(r'^loopback (\d+).*') - NVE_ID_REGEX = re.compile(r'^Interface NVE (\d+).*') - - def init_module(self): - """ initialize module - """ - vni_vlan_spec = dict(vlan_id=dict(type=int), - vni_id=dict(type=int)) - element_spec = dict( - nve_id=dict(type=int), - loopback_id=dict(type=int), - bgp=dict(default=True, type='bool'), - mlag_tunnel_ip=dict(type='str'), - vni_vlan_list=dict(type='list', - elements='dict', - options=vni_vlan_spec), - arp_suppression=dict(default=False, type='bool') - ) - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True) - - def get_required_config(self): - module_params = self._module.params - self._required_config = dict(module_params) - self.validate_param_values(self._required_config) - - def _set_vxlan_config(self, vxlan_config): - vxlan_config = vxlan_config[0] - if not vxlan_config: - return - nve_header = vxlan_config.get("header") - match = self.NVE_ID_REGEX.match(nve_header) - if match: - current_nve_id = int(match.group(1)) - self._current_config['nve_id'] = current_nve_id - if int(current_nve_id) != self._required_config.get("nve_id"): - return - - self._current_config['mlag_tunnel_ip'] = vxlan_config.get("Mlag tunnel IP") - controller_mode = vxlan_config.get("Controller mode") - if controller_mode == "BGP": - self._current_config['bgp'] = True - else: - self._current_config['bgp'] = False - - loopback_str = vxlan_config.get("Source interface") - match = self.LOOPBACK_REGEX.match(loopback_str) - if match: - loopback_id = match.group(1) - self._current_config['loopback_id'] = int(loopback_id) - - self._current_config['global_neigh_suppression'] = vxlan_config.get("Global Neigh-Suppression") - - vni_vlan_mapping = self._current_config['vni_vlan_mapping'] = dict() - nve_detail = self._show_nve_detail() - - if nve_detail is not None: - nve_detail = nve_detail[0] - - if nve_detail: - for vlan_id in nve_detail: - vni_vlan_mapping[int(vlan_id)] = dict( - vni_id=int(nve_detail[vlan_id][0].get("VNI")), - arp_suppression=nve_detail[vlan_id][0].get("Neigh Suppression")) - - def _show_vxlan_config(self): - cmd = "show interfaces nve" - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def _show_nve_detail(self): - cmd = "show interface nve {0} detail".format(self._required_config.get("nve_id")) - return show_cmd(self._module, cmd, json_fmt=True, fail_on_error=False) - - def load_current_config(self): - self._current_config = dict() - vxlan_config = self._show_vxlan_config() - if vxlan_config: - self._set_vxlan_config(vxlan_config) - - def generate_commands(self): - nve_id = self._required_config.get("nve_id") - current_nve_id = self._current_config.get("nve_id") - - if current_nve_id is None: - self._add_nve_commands(nve_id) - elif current_nve_id != nve_id: - self._add_no_nve_commands(current_nve_id) - self._add_nve_commands(nve_id) - - bgp = self._required_config.get("bgp") - if bgp is not None: - curr_bgp = self._current_config.get("bgp") - if bgp and bgp != curr_bgp: - self._commands.append('interface nve {0} nve controller bgp'.format(nve_id)) - - loopback_id = self._required_config.get("loopback_id") - if loopback_id is not None: - curr_loopback_id = self._current_config.get("loopback_id") - if loopback_id != curr_loopback_id: - self._commands.append('interface nve {0} vxlan source interface ' - 'loopback {1} '.format(nve_id, loopback_id)) - - mlag_tunnel_ip = self._required_config.get("mlag_tunnel_ip") - if mlag_tunnel_ip is not None: - curr_mlag_tunnel_ip = self._current_config.get("mlag_tunnel_ip") - if mlag_tunnel_ip != curr_mlag_tunnel_ip: - self._commands.append('interface nve {0} vxlan ' - 'mlag-tunnel-ip {1}'.format(nve_id, mlag_tunnel_ip)) - - vni_vlan_list = self._required_config.get("vni_vlan_list") - arp_suppression = self._required_config.get("arp_suppression") - if vni_vlan_list is not None: - self._generate_vni_vlan_cmds(vni_vlan_list, nve_id, arp_suppression) - - def _generate_vni_vlan_cmds(self, vni_vlan_list, nve_id, arp_suppression): - - current_global_arp_suppression = self._current_config.get('global_neigh_suppression') - if arp_suppression is True and current_global_arp_suppression != "Enable": - self._commands.append('interface nve {0} nve neigh-suppression'.format(nve_id)) - - current_vni_vlan_mapping = self._current_config.get('vni_vlan_mapping') - if current_vni_vlan_mapping is None: - for vni_vlan in vni_vlan_list: - vlan_id = vni_vlan.get("vlan_id") - vni_id = vni_vlan.get("vni_id") - self._add_vni_vlan_cmds(nve_id, vni_id, vlan_id) - self._add_arp_suppression_cmds(arp_suppression, vlan_id) - else: - for vni_vlan in vni_vlan_list: - vlan_id = vni_vlan.get("vlan_id") - vni_id = vni_vlan.get("vni_id") - - currt_vlan_id = current_vni_vlan_mapping.get(vlan_id) - - if currt_vlan_id is None: - self._add_vni_vlan_cmds(nve_id, vni_id, vlan_id) - self._add_arp_suppression_cmds(arp_suppression, vlan_id) - else: - current_vni_id = currt_vlan_id.get("vni_id") - current_arp_suppression = currt_vlan_id.get("arp_suppression") - - if int(current_vni_id) != vni_id: - self._add_vni_vlan_cmds(nve_id, vni_id, vlan_id) - - if current_arp_suppression == "Disable": - self._add_arp_suppression_cmds(arp_suppression, vlan_id) - - def _add_no_nve_commands(self, current_nve_id): - self._commands.append('no interface nve {0}'.format(current_nve_id)) - - def _add_nve_commands(self, nve_id): - self._commands.append('interface nve {0}'.format(nve_id)) - self._commands.append('exit') - - def _add_vni_vlan_cmds(self, nve_id, vni_id, vlan_id): - self._commands.append('interface nve {0} nve vni {1} ' - 'vlan {2}'.format(nve_id, vni_id, vlan_id)) - - def _add_arp_suppression_cmds(self, arp_suppression, vlan_id): - if arp_suppression is True: - self._commands.append('interface vlan {0}'.format(vlan_id)) - self._commands.append('exit') - - -def main(): - """ main entry point for module execution - """ - OnyxVxlanModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/network/onyx/onyx_wjh.py b/plugins/modules/network/onyx/onyx_wjh.py deleted file mode 100644 index c3622cff..00000000 --- a/plugins/modules/network/onyx/onyx_wjh.py +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/python -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - -DOCUMENTATION = ''' ---- -module: onyx_wjh -author: "Anas Shami (@anass)" -short_description: Configure what-just-happend module -description: - - This module provides declarative management of wjh - on Mellanox ONYX network devices. -notes: -options: - group: - description: - - Name of wjh group. - choices: ['all', 'forwarding', 'acl'] - type: str - enabled: - description: - - wjh group status - type: bool - auto_export: - description: - - wjh group auto export pcap file status - type: bool - export_group: - description: - - wjh group auto export group - choices: ['all', 'forwarding', 'acl'] - type: str - clear_group: - description: - - clear pcap file by group - choices: ['all', 'user', 'auto-export'] - type: str -''' - -EXAMPLES = """ -- name: Enable wjh - onyx_wjh: - group: forwarding - enabled: True - -- name: Disable wjh - onyx_wjh: - group: forwarding - enabled: False - -- name: Enable auto-export - onyx_wjh: - auto_export: True - export_group: forwarding -- name: Disable auto-export - onyx_wjh: - auto_export: False - export_group: forwarding -- name: Clear pcap file - onyx_wjh: - clear_group: auto-export -""" - -RETURN = """ -commands: - description: The list of configuration mode commands to send to the device. - returned: always - type: list - sample: - - what-just-happend forwarding enable - - what-just-happend auto-export forwarding enable - - clear what-just-happend pcap-file user -""" -import re - -from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.network.plugins.module_utils.network.onyx.onyx import BaseOnyxModule, show_cmd - - -class OnyxWJHModule(BaseOnyxModule): - WJH_DISABLED_REGX = re.compile(r'^no what-just-happened ([a-z]+) enable.*') - WJH_DISABLED_AUTO_EXPORT_REGX = re.compile(r'^no what-just-happened auto-export ([a-z]+) enable.*') - - WJH_CMD_FMT = '{0}what-just-happened {1} enable' - WJH_EXPORT_CMD_FMT = '{0}what-just-happened auto-export {1} enable' - WJH_CLEAR_CMD_FMT = 'clear what-just-happened pcap-files {0}' - - WJH_GROUPS = ['all', 'forwarding', 'acl'] - CLEAR_GROUPS = ['all', 'user', 'auto-export'] - - def init_module(self): - """ - module initialization - """ - element_spec = dict(group=dict(choices=self.WJH_GROUPS), - enabled=dict(type='bool'), - auto_export=dict(type='bool'), - export_group=dict(choices=self.WJH_GROUPS), - clear_group=dict(choices=self.CLEAR_GROUPS)) - - argument_spec = dict() - argument_spec.update(element_spec) - self._module = AnsibleModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_together=[ - ['group', 'enabled'], - ['auto_export', 'export_group'] - ]) - - def get_required_config(self): - self._required_config = dict() - module_params = self._module.params - group = module_params.get('group') - export_group = module_params.get('export_group') - clear_group = module_params.get('clear_group') - - params = dict() - if group: - enabled = module_params.get('enabled') - params.update({ - 'group': group, - 'enabled': enabled - }) - - if export_group: - auto_export = module_params.get('auto_export') - params.update({ - 'export_group': export_group, - 'auto_export': auto_export - }) - - if clear_group: - params.update({ - 'clear_group': clear_group - }) - - self.validate_param_values(params) - self._required_config = params - - def _get_wjh_config(self): - return show_cmd(self._module, "show running-config | include .*what-just-happened.*", json_fmt=False, fail_on_error=False) - - def _set_current_config(self, config): - if not config: - return - current_config = self._current_config - lines = config.split('\n') - for line in lines: - if line.startswith('#'): - continue - match = self.WJH_DISABLED_REGX.match(line) - if match: - # wjh is disabled - group = match.group(1) - current_config[group] = False - - match = self.WJH_DISABLED_AUTO_EXPORT_REGX.match(line) - if match: - # wjh auto export is disabled - export_group = match.group(1) + '_export' - current_config[export_group] = False - - ''' - show running config will contains [no wjh * group enable] if disabled - default config is enabled - ''' - def load_current_config(self): - self._current_config = dict() - config_lines = self._get_wjh_config() - if config_lines: - self._set_current_config(config_lines) - - def wjh_group_status(self, current_config, group_value, suffix=''): - current_enabled = False - if group_value == 'all': - # no disabled group so all would be false - current_enabled = not all([ - (group + suffix) in current_config for group in self.WJH_GROUPS]) - else: - # if no current-value its enabled - current_enabled = current_config[group_value + suffix] if((group_value + suffix) in current_config) else True - return current_enabled - - ''' - wjh is enabled "by default" - when wjh disable we will find no wjh commands in running config - ''' - def generate_commands(self): - current_config, required_config = self._current_config, self._required_config - group = required_config.get('group') - export_group = required_config.get('export_group') - clear_group = required_config.get('clear_group') - if group: - current_enabled = self.wjh_group_status(current_config, group) - if(required_config['enabled'] != current_enabled): - self._commands.append(self.WJH_CMD_FMT - .format(('' if required_config['enabled'] else 'no '), group)) - if export_group: - current_enabled = self.wjh_group_status(current_config, required_config['export_group'], '_export') - if(required_config['auto_export'] != current_enabled): - self._commands.append(self.WJH_EXPORT_CMD_FMT - .format(('' if required_config['auto_export'] else 'no '), export_group)) - if clear_group: - # clear pcap files - self._commands.append(self.WJH_CLEAR_CMD_FMT.format(clear_group)) - - -def main(): - """ main entry point for module execution - """ - OnyxWJHModule.main() - - -if __name__ == '__main__': - main() diff --git a/plugins/modules/onyx_aaa.py b/plugins/modules/onyx_aaa.py deleted file mode 120000 index 341c36c0..00000000 --- a/plugins/modules/onyx_aaa.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_aaa.py \ No newline at end of file diff --git a/plugins/modules/onyx_bfd.py b/plugins/modules/onyx_bfd.py deleted file mode 120000 index b66e6b45..00000000 --- a/plugins/modules/onyx_bfd.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_bfd.py \ No newline at end of file diff --git a/plugins/modules/onyx_bgp.py b/plugins/modules/onyx_bgp.py deleted file mode 120000 index 5c3bf2d6..00000000 --- a/plugins/modules/onyx_bgp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_bgp.py \ No newline at end of file diff --git a/plugins/modules/onyx_buffer_pool.py b/plugins/modules/onyx_buffer_pool.py deleted file mode 120000 index c9cf3644..00000000 --- a/plugins/modules/onyx_buffer_pool.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_buffer_pool.py \ No newline at end of file diff --git a/plugins/modules/onyx_command.py b/plugins/modules/onyx_command.py deleted file mode 120000 index 85586208..00000000 --- a/plugins/modules/onyx_command.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_command.py \ No newline at end of file diff --git a/plugins/modules/onyx_config.py b/plugins/modules/onyx_config.py deleted file mode 120000 index 73017455..00000000 --- a/plugins/modules/onyx_config.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_config.py \ No newline at end of file diff --git a/plugins/modules/onyx_facts.py b/plugins/modules/onyx_facts.py deleted file mode 120000 index bcfa2fa3..00000000 --- a/plugins/modules/onyx_facts.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_facts.py \ No newline at end of file diff --git a/plugins/modules/onyx_igmp.py b/plugins/modules/onyx_igmp.py deleted file mode 120000 index c44ac036..00000000 --- a/plugins/modules/onyx_igmp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_igmp.py \ No newline at end of file diff --git a/plugins/modules/onyx_igmp_interface.py b/plugins/modules/onyx_igmp_interface.py deleted file mode 120000 index 00afb1ca..00000000 --- a/plugins/modules/onyx_igmp_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_igmp_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_igmp_vlan.py b/plugins/modules/onyx_igmp_vlan.py deleted file mode 120000 index 726e83d8..00000000 --- a/plugins/modules/onyx_igmp_vlan.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_igmp_vlan.py \ No newline at end of file diff --git a/plugins/modules/onyx_interface.py b/plugins/modules/onyx_interface.py deleted file mode 120000 index a8cd963f..00000000 --- a/plugins/modules/onyx_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_l2_interface.py b/plugins/modules/onyx_l2_interface.py deleted file mode 120000 index 9c5d066b..00000000 --- a/plugins/modules/onyx_l2_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_l2_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_l3_interface.py b/plugins/modules/onyx_l3_interface.py deleted file mode 120000 index 66f22b45..00000000 --- a/plugins/modules/onyx_l3_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_l3_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_linkagg.py b/plugins/modules/onyx_linkagg.py deleted file mode 120000 index c40e5508..00000000 --- a/plugins/modules/onyx_linkagg.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_linkagg.py \ No newline at end of file diff --git a/plugins/modules/onyx_lldp.py b/plugins/modules/onyx_lldp.py deleted file mode 120000 index 5ba91cc6..00000000 --- a/plugins/modules/onyx_lldp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_lldp.py \ No newline at end of file diff --git a/plugins/modules/onyx_lldp_interface.py b/plugins/modules/onyx_lldp_interface.py deleted file mode 120000 index 8e3cd5db..00000000 --- a/plugins/modules/onyx_lldp_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_lldp_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_magp.py b/plugins/modules/onyx_magp.py deleted file mode 120000 index e6065e89..00000000 --- a/plugins/modules/onyx_magp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_magp.py \ No newline at end of file diff --git a/plugins/modules/onyx_mlag_ipl.py b/plugins/modules/onyx_mlag_ipl.py deleted file mode 120000 index 317f2af4..00000000 --- a/plugins/modules/onyx_mlag_ipl.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_mlag_ipl.py \ No newline at end of file diff --git a/plugins/modules/onyx_mlag_vip.py b/plugins/modules/onyx_mlag_vip.py deleted file mode 120000 index 8a74fff8..00000000 --- a/plugins/modules/onyx_mlag_vip.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_mlag_vip.py \ No newline at end of file diff --git a/plugins/modules/onyx_ntp.py b/plugins/modules/onyx_ntp.py deleted file mode 120000 index b981284b..00000000 --- a/plugins/modules/onyx_ntp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_ntp.py \ No newline at end of file diff --git a/plugins/modules/onyx_ntp_servers_peers.py b/plugins/modules/onyx_ntp_servers_peers.py deleted file mode 120000 index 192cdf20..00000000 --- a/plugins/modules/onyx_ntp_servers_peers.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_ntp_servers_peers.py \ No newline at end of file diff --git a/plugins/modules/onyx_ospf.py b/plugins/modules/onyx_ospf.py deleted file mode 120000 index 8c6bd54a..00000000 --- a/plugins/modules/onyx_ospf.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_ospf.py \ No newline at end of file diff --git a/plugins/modules/onyx_pfc_interface.py b/plugins/modules/onyx_pfc_interface.py deleted file mode 120000 index 6bffce2a..00000000 --- a/plugins/modules/onyx_pfc_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_pfc_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_protocol.py b/plugins/modules/onyx_protocol.py deleted file mode 120000 index cb4f4522..00000000 --- a/plugins/modules/onyx_protocol.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_protocol.py \ No newline at end of file diff --git a/plugins/modules/onyx_ptp_global.py b/plugins/modules/onyx_ptp_global.py deleted file mode 120000 index 684a7f49..00000000 --- a/plugins/modules/onyx_ptp_global.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_ptp_global.py \ No newline at end of file diff --git a/plugins/modules/onyx_ptp_interface.py b/plugins/modules/onyx_ptp_interface.py deleted file mode 120000 index 7abb7829..00000000 --- a/plugins/modules/onyx_ptp_interface.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_ptp_interface.py \ No newline at end of file diff --git a/plugins/modules/onyx_qos.py b/plugins/modules/onyx_qos.py deleted file mode 120000 index b0404bd9..00000000 --- a/plugins/modules/onyx_qos.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_qos.py \ No newline at end of file diff --git a/plugins/modules/onyx_snmp.py b/plugins/modules/onyx_snmp.py deleted file mode 120000 index e943bd5d..00000000 --- a/plugins/modules/onyx_snmp.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_snmp.py \ No newline at end of file diff --git a/plugins/modules/onyx_snmp_hosts.py b/plugins/modules/onyx_snmp_hosts.py deleted file mode 120000 index 28648468..00000000 --- a/plugins/modules/onyx_snmp_hosts.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_snmp_hosts.py \ No newline at end of file diff --git a/plugins/modules/onyx_snmp_users.py b/plugins/modules/onyx_snmp_users.py deleted file mode 120000 index 1577de92..00000000 --- a/plugins/modules/onyx_snmp_users.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_snmp_users.py \ No newline at end of file diff --git a/plugins/modules/onyx_syslog_files.py b/plugins/modules/onyx_syslog_files.py deleted file mode 120000 index eb2c513f..00000000 --- a/plugins/modules/onyx_syslog_files.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_syslog_files.py \ No newline at end of file diff --git a/plugins/modules/onyx_syslog_remote.py b/plugins/modules/onyx_syslog_remote.py deleted file mode 120000 index 5b99c829..00000000 --- a/plugins/modules/onyx_syslog_remote.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_syslog_remote.py \ No newline at end of file diff --git a/plugins/modules/onyx_traffic_class.py b/plugins/modules/onyx_traffic_class.py deleted file mode 120000 index 96c7613e..00000000 --- a/plugins/modules/onyx_traffic_class.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_traffic_class.py \ No newline at end of file diff --git a/plugins/modules/onyx_username.py b/plugins/modules/onyx_username.py deleted file mode 120000 index 06c0110f..00000000 --- a/plugins/modules/onyx_username.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_username.py \ No newline at end of file diff --git a/plugins/modules/onyx_vlan.py b/plugins/modules/onyx_vlan.py deleted file mode 120000 index 681ec406..00000000 --- a/plugins/modules/onyx_vlan.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_vlan.py \ No newline at end of file diff --git a/plugins/modules/onyx_vxlan.py b/plugins/modules/onyx_vxlan.py deleted file mode 120000 index 72dbb9f8..00000000 --- a/plugins/modules/onyx_vxlan.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_vxlan.py \ No newline at end of file diff --git a/plugins/modules/onyx_wjh.py b/plugins/modules/onyx_wjh.py deleted file mode 120000 index 9d4d6bc4..00000000 --- a/plugins/modules/onyx_wjh.py +++ /dev/null @@ -1 +0,0 @@ -./network/onyx/onyx_wjh.py \ No newline at end of file diff --git a/plugins/terminal/onyx.py b/plugins/terminal/onyx.py deleted file mode 100644 index 52d630b9..00000000 --- a/plugins/terminal/onyx.py +++ /dev/null @@ -1,80 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import json -import re - -from ansible.errors import AnsibleConnectionFailure -from ansible.module_utils._text import to_text, to_bytes -from ansible.plugins.terminal import TerminalBase - - -class TerminalModule(TerminalBase): - - terminal_stdout_re = [ - re.compile(br"(?P(.*)( > | # )\Z)"), - ] - - terminal_stderr_re = [ - re.compile(br"\A%|\r\n%|\n%"), - ] - - init_commands = [b'no cli session paging enable', ] - - def on_open_shell(self): - try: - for cmd in self.init_commands: - self._exec_cli_command(cmd) - except AnsibleConnectionFailure: - raise AnsibleConnectionFailure('unable to set terminal parameters') - - def on_become(self, passwd=None): - if self._get_prompt().endswith(b'#'): - return - - cmd = {u'command': u'enable'} - if passwd: - # Note: python-3.5 cannot combine u"" and r"" together. Thus make - # an r string and use to_text to ensure it's text on both py2 and - # py3. - cmd[u'prompt'] = to_text(r"[\r\n]?password: $", - errors='surrogate_or_strict') - cmd[u'answer'] = passwd - - try: - self._exec_cli_command(to_bytes(json.dumps(cmd), - errors='surrogate_or_strict')) - except AnsibleConnectionFailure: - raise AnsibleConnectionFailure( - 'unable to elevate privilege to enable mode') - - def on_unbecome(self): - prompt = self._get_prompt() - if prompt is None: - # if prompt is None most likely the terminal is hung up at a prompt - return - - if b'(config' in prompt: - self._exec_cli_command(b'exit') - self._exec_cli_command(b'disable') - - elif prompt.endswith(b'#'): - self._exec_cli_command(b'disable') diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 1de0787f..2d463d55 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -8,7 +8,6 @@ plugins/action/enos.py action-plugin-docs # base class for deprecated network pl plugins/action/exos.py action-plugin-docs # undocumented action plugin to fix plugins/action/ironware.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/action/nos_config.py action-plugin-docs # undocumented action plugin to fix -plugins/action/onyx_config.py action-plugin-docs # undocumented action plugin to fix plugins/action/slxos.py action-plugin-docs # undocumented action plugin to fix plugins/action/sros.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/action/voss.py action-plugin-docs # undocumented action plugin to fix @@ -34,14 +33,10 @@ plugins/doc_fragments/netscaler.py future-import-boilerplate plugins/doc_fragments/netscaler.py metaclass-boilerplate plugins/doc_fragments/nso.py future-import-boilerplate plugins/doc_fragments/nso.py metaclass-boilerplate -plugins/doc_fragments/onyx.py future-import-boilerplate -plugins/doc_fragments/onyx.py metaclass-boilerplate plugins/doc_fragments/panos.py future-import-boilerplate plugins/doc_fragments/panos.py metaclass-boilerplate plugins/doc_fragments/sros.py future-import-boilerplate plugins/doc_fragments/sros.py metaclass-boilerplate -plugins/module_utils/f5_utils.py future-import-boilerplate -plugins/module_utils/f5_utils.py metaclass-boilerplate plugins/module_utils/network/a10/a10.py future-import-boilerplate plugins/module_utils/network/a10/a10.py metaclass-boilerplate plugins/module_utils/network/aireos/aireos.py future-import-boilerplate @@ -93,8 +88,6 @@ plugins/module_utils/network/nos/nos.py future-import-boilerplate plugins/module_utils/network/nos/nos.py metaclass-boilerplate plugins/module_utils/network/nso/nso.py future-import-boilerplate plugins/module_utils/network/nso/nso.py metaclass-boilerplate -plugins/module_utils/network/onyx/onyx.py future-import-boilerplate -plugins/module_utils/network/onyx/onyx.py metaclass-boilerplate plugins/module_utils/network/ordnance/ordnance.py future-import-boilerplate plugins/module_utils/network/ordnance/ordnance.py metaclass-boilerplate plugins/module_utils/network/routeros/routeros.py future-import-boilerplate @@ -1332,113 +1325,6 @@ plugins/modules/network/nuage/nuage_vspk.py validate-modules:missing-suboption-d plugins/modules/network/nuage/nuage_vspk.py validate-modules:parameter-list-no-elements plugins/modules/network/nuage/nuage_vspk.py validate-modules:parameter-type-not-in-doc plugins/modules/network/nuage/nuage_vspk.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_bgp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_bgp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_bgp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_buffer_pool.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_buffer_pool.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_command.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_command.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_command.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_command.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_config.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_config.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_config.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_config.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_facts.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_facts.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_igmp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_igmp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_interface.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-default-does-not-match-spec -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_lldp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_magp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_magp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_mlag_ipl.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:doc-default-does-not-match-spec -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_ntp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ntp_servers_peers.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ospf.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ospf.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ospf.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_protocol.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_global.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_global.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_ptp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_qos.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_qos.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_qos.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_snmp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_snmp_hosts.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_snmp_users.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_syslog_remote.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_vlan.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_vlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vlan.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:undocumented-parameter plugins/modules/network/opx/opx_cps.py validate-modules:doc-required-mismatch plugins/modules/network/opx/opx_cps.py validate-modules:parameter-type-not-in-doc plugins/modules/network/ordnance/ordnance_config.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 1de0787f..2d463d55 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -8,7 +8,6 @@ plugins/action/enos.py action-plugin-docs # base class for deprecated network pl plugins/action/exos.py action-plugin-docs # undocumented action plugin to fix plugins/action/ironware.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/action/nos_config.py action-plugin-docs # undocumented action plugin to fix -plugins/action/onyx_config.py action-plugin-docs # undocumented action plugin to fix plugins/action/slxos.py action-plugin-docs # undocumented action plugin to fix plugins/action/sros.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/action/voss.py action-plugin-docs # undocumented action plugin to fix @@ -34,14 +33,10 @@ plugins/doc_fragments/netscaler.py future-import-boilerplate plugins/doc_fragments/netscaler.py metaclass-boilerplate plugins/doc_fragments/nso.py future-import-boilerplate plugins/doc_fragments/nso.py metaclass-boilerplate -plugins/doc_fragments/onyx.py future-import-boilerplate -plugins/doc_fragments/onyx.py metaclass-boilerplate plugins/doc_fragments/panos.py future-import-boilerplate plugins/doc_fragments/panos.py metaclass-boilerplate plugins/doc_fragments/sros.py future-import-boilerplate plugins/doc_fragments/sros.py metaclass-boilerplate -plugins/module_utils/f5_utils.py future-import-boilerplate -plugins/module_utils/f5_utils.py metaclass-boilerplate plugins/module_utils/network/a10/a10.py future-import-boilerplate plugins/module_utils/network/a10/a10.py metaclass-boilerplate plugins/module_utils/network/aireos/aireos.py future-import-boilerplate @@ -93,8 +88,6 @@ plugins/module_utils/network/nos/nos.py future-import-boilerplate plugins/module_utils/network/nos/nos.py metaclass-boilerplate plugins/module_utils/network/nso/nso.py future-import-boilerplate plugins/module_utils/network/nso/nso.py metaclass-boilerplate -plugins/module_utils/network/onyx/onyx.py future-import-boilerplate -plugins/module_utils/network/onyx/onyx.py metaclass-boilerplate plugins/module_utils/network/ordnance/ordnance.py future-import-boilerplate plugins/module_utils/network/ordnance/ordnance.py metaclass-boilerplate plugins/module_utils/network/routeros/routeros.py future-import-boilerplate @@ -1332,113 +1325,6 @@ plugins/modules/network/nuage/nuage_vspk.py validate-modules:missing-suboption-d plugins/modules/network/nuage/nuage_vspk.py validate-modules:parameter-list-no-elements plugins/modules/network/nuage/nuage_vspk.py validate-modules:parameter-type-not-in-doc plugins/modules/network/nuage/nuage_vspk.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_bgp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_bgp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_bgp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_buffer_pool.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_buffer_pool.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_command.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_command.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_command.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_command.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_config.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_config.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_config.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_config.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_facts.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_facts.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_igmp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_igmp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_igmp_vlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_interface.py validate-modules:nonexistent-parameter-documented -plugins/modules/network/onyx/onyx_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_l2_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_l3_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-default-does-not-match-spec -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_linkagg.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_lldp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_lldp_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_magp.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_magp.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_mlag_ipl.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:doc-default-does-not-match-spec -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_mlag_vip.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_ntp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ntp_servers_peers.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ospf.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_ospf.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ospf.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_pfc_interface.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_protocol.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_global.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_global.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_ptp_interface.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_ptp_interface.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_qos.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_qos.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_qos.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_snmp.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_snmp_hosts.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_snmp_users.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_syslog_remote.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:parameter-list-no-elements -plugins/modules/network/onyx/onyx_traffic_class.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-missing-type -plugins/modules/network/onyx/onyx_vlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_vlan.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_vlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vlan.py validate-modules:undocumented-parameter -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:doc-elements-mismatch -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:doc-required-mismatch -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:missing-suboption-docs -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:parameter-type-not-in-doc -plugins/modules/network/onyx/onyx_vxlan.py validate-modules:undocumented-parameter plugins/modules/network/opx/opx_cps.py validate-modules:doc-required-mismatch plugins/modules/network/opx/opx_cps.py validate-modules:parameter-type-not-in-doc plugins/modules/network/ordnance/ordnance_config.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/unit/plugins/modules/network/f5/__init__.py b/tests/unit/plugins/modules/network/f5/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/unit/plugins/modules/network/f5/fixtures/MyApp-0.1.0-0001.noarch.rpm b/tests/unit/plugins/modules/network/f5/fixtures/MyApp-0.1.0-0001.noarch.rpm deleted file mode 100644 index 16928135..00000000 Binary files a/tests/unit/plugins/modules/network/f5/fixtures/MyApp-0.1.0-0001.noarch.rpm and /dev/null differ diff --git a/tests/unit/plugins/modules/network/f5/fixtures/basic-iapp.tmpl b/tests/unit/plugins/modules/network/f5/fixtures/basic-iapp.tmpl deleted file mode 100644 index 7f9a681b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/basic-iapp.tmpl +++ /dev/null @@ -1,25 +0,0 @@ -sys application template good_templ { - actions { - definition { - html-help { - # HTML Help for the template - } - implementation { - # TMSH implementation code - } - macro { - # TMSH macro code - } - presentation { - # APL presentation language - } - role-acl { admin manager resource-admin } - run-as none - } - } - description "My basic template" - partition Common - requires-modules { ltm } - ignore-verification true - requires-bigip-version-min 11.6.0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/cert1.crt b/tests/unit/plugins/modules/network/f5/fixtures/cert1.crt deleted file mode 100644 index 1d22f302..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/cert1.crt +++ /dev/null @@ -1,101 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: sha256WithRSAEncryption - Issuer: C=US, ST=New York, L=New York, O=ACME CA, OU=Coyote, CN=ourca.domain.local - Validity - Not Before: Jun 30 16:46:09 2016 GMT - Not After : Jun 25 16:46:09 2036 GMT - Subject: C=US, ST=New York, O=ACME, OU=Coyote, CN=cert1.domain.local - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:d6:0f:bd:26:ef:14:4d:09:f6:db:8b:01:f5:4e: - 6c:03:b1:35:20:16:b8:1b:7c:e6:b6:8d:97:1b:b0: - 4f:8a:b6:cb:54:7e:7a:ff:fd:af:02:db:bf:9d:cf: - 9a:4c:0d:87:93:8b:cc:61:f3:23:a9:6f:8e:d4:82: - 2c:93:b6:e2:fa:37:ed:8a:d3:23:8f:6d:b5:78:4a: - 38:ba:93:f9:4a:1c:40:06:33:d7:c0:98:20:d4:16: - ac:a4:a5:6b:41:20:4c:3a:55:7e:c7:50:e7:95:07: - 4e:86:15:86:7a:0f:6c:57:d2:07:1c:97:24:51:5b: - 4e:f5:52:3a:f8:4f:95:6b:6c:83:1f:34:4e:ee:b0: - ae:fe:46:90:38:f1:4d:85:72:8b:46:bc:d1:62:37: - 65:5a:de:bb:16:51:1e:f5:cb:a0:ef:d6:7b:11:6f: - 3b:0c:49:17:bc:4d:8c:f5:d9:f0:35:6b:f7:b6:4d: - 50:eb:47:81:e3:06:f2:bd:ec:67:4f:ab:2b:03:aa: - e2:1e:42:22:a9:c9:59:dc:0d:19:fb:c5:02:1d:d7: - 58:e4:04:53:0a:1d:79:bb:c1:33:f1:cd:b7:10:2e: - b4:6e:9b:dc:60:66:05:50:9f:20:66:a1:71:00:51: - 54:cf:0a:70:f4:7c:45:c6:f0:a7:1c:11:2f:3e:a3: - 1f:bf - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 2D:FB:27:C7:B4:32:FF:F7:87:DB:2D:A7:76:AE:F0:96:7E:DA:DC:17 - X509v3 Authority Key Identifier: - keyid:4F:2A:15:49:E6:CC:05:2F:2B:F4:0E:CC:BA:2E:4C:DF:13:90:F0:78 - - Signature Algorithm: sha256WithRSAEncryption - 3f:46:1c:3b:58:b4:99:f3:75:00:47:d2:fe:ba:ba:9a:04:46: - 62:b6:2d:a0:0f:8f:c0:95:2a:58:8b:61:f5:14:90:30:26:37: - 94:a1:a6:29:20:c9:b5:08:d7:f9:15:cb:9d:9c:19:ed:2f:a4: - e6:91:48:85:1a:f7:ab:17:5e:79:23:69:b8:3c:0c:48:ae:c8: - ba:90:d0:05:fb:33:7e:86:fd:12:f8:2d:0f:ff:16:15:9a:dc: - 76:48:7d:65:5b:4e:93:14:e8:be:37:d1:13:f7:a7:b1:cd:ad: - ae:4f:e1:72:b9:53:2d:cd:e6:42:76:44:93:21:28:58:c0:44: - ab:3c:da:5b:e5:55:ab:04:86:4d:9c:4c:33:f4:4e:13:98:e9: - 0f:d1:a3:70:2b:1d:11:20:47:26:f6:d8:45:7f:88:ad:f2:c1: - 81:0f:be:cd:6c:79:80:94:30:eb:8d:cc:f3:7d:a1:3e:6c:6f: - fa:8f:f3:1f:2e:76:97:3f:8a:1b:67:3b:e0:f9:b1:3c:6b:dc: - 64:1b:00:73:e9:89:81:f6:7f:51:f3:51:c8:b9:96:5f:fd:55: - f8:77:6f:88:bc:65:b3:e2:30:a4:00:7a:79:68:e0:36:8b:a9: - 1b:06:9b:20:fe:fe:98:aa:56:58:c8:08:a4:7b:12:59:ff:3d: - bd:5e:13:3b:c6:c7:8a:00:5b:cb:27:18:02:ee:cb:38:c2:b7: - a9:51:04:ef:31:ca:49:09:48:14:13:eb:91:e2:26:8c:88:5f: - 1c:78:e1:0d:90:29:d7:c1:fc:c8:89:fd:4d:53:0b:99:58:c2: - 1a:24:3d:c0:a2:4c:a3:d9:c7:95:c5:bc:72:fa:02:f1:ab:dd: - aa:2b:9e:a0:bb:1a:68:2d:09:8c:a2:99:0d:26:ec:9e:30:19: - 01:5a:41:45:63:b3:c5:db:24:32:4c:fe:7f:f3:ce:e9:4d:00: - 64:cf:bb:15:34:2d:31:6e:4f:c0:96:40:9b:32:35:65:92:01: - 29:7e:74:02:50:fd:3b:3b:3a:a3:9f:6a:c0:a5:be:3f:c3:07: - d6:8c:2a:c6:f4:0f:32:bd:3b:fc:45:90:d2:46:ee:6f:c3:2f: - 26:8c:97:0c:e8:da:9a:97:03:0b:86:17:45:a6:62:69:4e:8d: - cf:f8:bf:ea:2f:dc:ff:95:14:15:bd:92:2d:8a:08:cf:ce:8a: - b0:f6:34:0a:a2:0e:49:31:44:e1:47:fb:37:52:53:59:93:25: - 40:cc:ac:67:2d:a2:b6:9b:75:fd:13:a5:a7:93:4f:72:05:75: - cd:b1:37:f6:3b:69:3b:24:a1:1f:23:f0:cd:bb:ae:18:b3:aa: - eb:9f:d7:97:06:ba:fd:44 ------BEGIN CERTIFICATE----- -MIIExjCCAq6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBzMQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRAwDgYDVQQKDAdB -Q01FIENBMQ8wDQYDVQQLDAZDb3lvdGUxGzAZBgNVBAMMEm91cmNhLmRvbWFpbi5s -b2NhbDAeFw0xNjA2MzAxNjQ2MDlaFw0zNjA2MjUxNjQ2MDlaMF0xCzAJBgNVBAYT -AlVTMREwDwYDVQQIDAhOZXcgWW9yazENMAsGA1UECgwEQUNNRTEPMA0GA1UECwwG -Q295b3RlMRswGQYDVQQDDBJjZXJ0MS5kb21haW4ubG9jYWwwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDWD70m7xRNCfbbiwH1TmwDsTUgFrgbfOa2jZcb -sE+KtstUfnr//a8C27+dz5pMDYeTi8xh8yOpb47UgiyTtuL6N+2K0yOPbbV4Sji6 -k/lKHEAGM9fAmCDUFqykpWtBIEw6VX7HUOeVB06GFYZ6D2xX0gcclyRRW071Ujr4 -T5VrbIMfNE7usK7+RpA48U2FcotGvNFiN2Va3rsWUR71y6Dv1nsRbzsMSRe8TYz1 -2fA1a/e2TVDrR4HjBvK97GdPqysDquIeQiKpyVncDRn7xQId11jkBFMKHXm7wTPx -zbcQLrRum9xgZgVQnyBmoXEAUVTPCnD0fEXG8KccES8+ox+/AgMBAAGjezB5MAkG -A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp -ZmljYXRlMB0GA1UdDgQWBBQt+yfHtDL/94fbLad2rvCWftrcFzAfBgNVHSMEGDAW -gBRPKhVJ5swFLyv0Dsy6LkzfE5DweDANBgkqhkiG9w0BAQsFAAOCAgEAP0YcO1i0 -mfN1AEfS/rq6mgRGYrYtoA+PwJUqWIth9RSQMCY3lKGmKSDJtQjX+RXLnZwZ7S+k -5pFIhRr3qxdeeSNpuDwMSK7IupDQBfszfob9EvgtD/8WFZrcdkh9ZVtOkxTovjfR -E/ensc2trk/hcrlTLc3mQnZEkyEoWMBEqzzaW+VVqwSGTZxMM/ROE5jpD9GjcCsd -ESBHJvbYRX+IrfLBgQ++zWx5gJQw643M832hPmxv+o/zHy52lz+KG2c74PmxPGvc -ZBsAc+mJgfZ/UfNRyLmWX/1V+HdviLxls+IwpAB6eWjgNoupGwabIP7+mKpWWMgI -pHsSWf89vV4TO8bHigBbyycYAu7LOMK3qVEE7zHKSQlIFBPrkeImjIhfHHjhDZAp -18H8yIn9TVMLmVjCGiQ9wKJMo9nHlcW8cvoC8avdqiueoLsaaC0JjKKZDSbsnjAZ -AVpBRWOzxdskMkz+f/PO6U0AZM+7FTQtMW5PwJZAmzI1ZZIBKX50AlD9Ozs6o59q -wKW+P8MH1owqxvQPMr07/EWQ0kbub8MvJoyXDOjampcDC4YXRaZiaU6Nz/i/6i/c -/5UUFb2SLYoIz86KsPY0CqIOSTFE4Uf7N1JTWZMlQMysZy2itpt1/ROlp5NPcgV1 -zbE39jtpOyShHyPwzbuuGLOq65/Xlwa6/UQ= ------END CERTIFICATE----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/cert1.key b/tests/unit/plugins/modules/network/f5/fixtures/cert1.key deleted file mode 100644 index a89a2916..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/cert1.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEA1g+9Ju8UTQn224sB9U5sA7E1IBa4G3zmto2XG7BPirbLVH56 -//2vAtu/nc+aTA2Hk4vMYfMjqW+O1IIsk7bi+jftitMjj221eEo4upP5ShxABjPX -wJgg1BaspKVrQSBMOlV+x1DnlQdOhhWGeg9sV9IHHJckUVtO9VI6+E+Va2yDHzRO -7rCu/kaQOPFNhXKLRrzRYjdlWt67FlEe9cug79Z7EW87DEkXvE2M9dnwNWv3tk1Q -60eB4wbyvexnT6srA6riHkIiqclZ3A0Z+8UCHddY5ARTCh15u8Ez8c23EC60bpvc -YGYFUJ8gZqFxAFFUzwpw9HxFxvCnHBEvPqMfvwIDAQABAoIBAQCjQ7PP+y8vpvbp -8bbXoy2ND15mkA1xoazR9WIYEzxHny2rzx//GTyfYH1gXtPfR75tEYYb+vbrJxP4 -DyTysN2jXH7HkEwh+9oZ2fo0i+Hp3WwTjvzyftUjDfw1Q5lvPbQGFekxGgrXRpBk -ggxkEllfDeiwrLJdftfVEhe6BfD/0YibwQeHN7VoC4V8wOanKtDmx74W/1f7WhwQ -nKQnCrbYqNJa2nGvWiKU5Suvfb0v7tCnQYlfnCpUfj+wcnxlgmGkcyq1L+qC1qC8 -PO5i3T3LM5Yg8CSeGhO/q6gw/fUowuBN1cluTqN97oLHiEM5tLdjeVWwa1Vp0liv -1WXGT4eBAoGBAPtumMmyVTIorvV6KGNI/Eo6jfE0HOXVdXtm4iToDDuiYwto7/Ge -/kV+11Fpu0lV+eYPfZn175Of8FnQPwczQF1OOH/aQ/ViY8j87bZUbCy25mWrfNkh -2rRlyI3/OsSfL5SkyWpYB0yhSJZV9mSQJTZolB4GQRNPKtqi7NpB4WxBAoGBANnz -VS4JBJO75yeSG5BzPp5VVKm+nu0Betlva8GsHdEic8OM9bGpVozGysAW3Xdxp7q6 -gLJGyyuzpsxldCc/IdIlF5fz7gkLl4NoYanz9PSEr2XZLh9+2yXGkPFlC3IeHAUB -E+2UO9MFpWrmfKoAnYZCR6vJDxtQBpAlTUvJEYv/AoGBAPha62K32327P+7MJl7D -9ijgI9rwjebcbbpiCtlHuOWi5lCb6/7v/NvqiYcqeEvdOAXuoTNWAbsBTel5UPis -wFQp8pcfouccs9IRPEFQrLWSSIx+0sirrxtoOq1AQe18DAS4rRd1MmiYG1ocOVBm -LcvLixsJNHh9R6hFLM3+K0vBAoGANkmJ+gF9Bl9TYGPgQcay3jVa9Tzp0RcBRo+e -Q4tfkewG8bp2qF4JlN8fOWF4oHvKz5QM4lsH2EbTUS4kFHKBNhrPGaZEsDQW9UBW -s0J0zUMPfUrvViD+7RXcnIQSqcYeLJDsKc02aYWKgmoOuzmUAxEXUQ6vmJoCSH1C -F5JpsHkCgYEArwTSzb1+/ThQhK1JN8hJ4jMjQ8E7PzLTMILrdDALn2g1T4VzL7N7 -UG6oUieMlo/UH6cv6330dwaGVklXZbyDKSDROIafFcOpVfcvDUgJCjp3CaY9A2zG -+EPkRpeHKXAIgG+QuOwVOtYWcWltnBf61slTqiY2vKX1+ZGmrMrw1Zw= ------END RSA PRIVATE KEY----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/cert2.crt b/tests/unit/plugins/modules/network/f5/fixtures/cert2.crt deleted file mode 100644 index 30674bc8..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/cert2.crt +++ /dev/null @@ -1,101 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 2 (0x2) - Signature Algorithm: sha256WithRSAEncryption - Issuer: C=US, ST=New York, L=New York, O=ACME CA, OU=Coyote, CN=ourca.domain.local - Validity - Not Before: Jun 30 16:49:00 2016 GMT - Not After : Jun 25 16:49:00 2036 GMT - Subject: C=US, ST=New York, O=ACME, OU=Coyote, CN=cert2.domain.local - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:c6:9e:84:99:4d:69:98:c2:42:95:ed:43:ca:24: - 05:64:9d:67:81:1c:ff:56:7b:ad:d1:cb:09:39:28: - 4f:ac:aa:1b:34:61:3a:b1:e3:57:d4:9e:15:40:77: - 91:20:2b:e8:7e:d3:91:1e:46:50:6c:2f:4b:00:c2: - f2:3a:43:89:d9:81:73:84:5f:02:db:49:ac:3b:9e: - fe:c0:77:2e:53:ea:ce:da:ff:49:98:21:1d:31:4d: - 0f:14:20:30:36:9a:23:b4:28:08:06:59:81:30:03: - 86:09:0b:5b:e1:72:63:5e:54:ac:90:b1:82:55:b8: - 12:00:d5:01:26:be:6a:eb:fc:58:5b:8a:7a:fe:46: - 23:a3:eb:5d:6c:e0:f6:79:00:5d:5b:49:82:42:62: - e2:58:e8:65:54:14:be:99:25:8b:b7:df:cf:53:26: - f2:7a:fd:b9:f9:f3:d5:af:06:d6:1e:ba:66:4d:41: - 8c:5d:aa:23:41:7f:f4:27:21:a0:30:09:86:13:c4: - 57:1b:13:45:63:6b:3b:a3:7f:d1:1a:cd:fd:07:51: - 0f:1a:e1:d9:25:3e:d2:77:e1:c7:60:db:12:df:ef: - 71:65:c8:c7:1a:42:94:6f:57:2a:d7:67:30:0f:33: - 31:ba:90:4d:d1:80:38:08:e7:90:7a:04:0e:8f:b0: - 2a:73 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 43:71:A9:16:2B:DA:DC:5F:FD:82:87:78:26:48:4E:77:21:47:44:D6 - X509v3 Authority Key Identifier: - keyid:4F:2A:15:49:E6:CC:05:2F:2B:F4:0E:CC:BA:2E:4C:DF:13:90:F0:78 - - Signature Algorithm: sha256WithRSAEncryption - 15:ac:f9:cb:bc:88:c0:d3:74:83:88:cd:19:94:bb:87:7e:fd: - 4d:25:09:9b:08:84:64:c5:37:c7:99:b3:25:ee:6e:82:46:b0: - 13:f9:05:ad:4d:4a:b2:e3:29:5d:0d:55:9e:9c:62:1d:95:f2: - 19:49:5e:d3:5b:58:98:ce:e8:f5:e5:c1:ce:b5:a8:7a:b1:f8: - 14:fe:25:10:12:5b:41:53:d2:47:ab:20:e5:50:da:b6:ba:00: - 21:94:6b:dd:0b:24:15:dc:c0:4e:b8:1d:cc:9e:5f:10:5e:46: - 3f:96:c9:f8:28:bb:13:31:d6:d2:6c:48:41:bb:23:ab:23:64: - 73:d6:2b:2e:9a:77:d4:08:fb:e0:e8:50:2c:49:7f:98:9e:f6: - 37:30:2b:7c:97:c6:a7:1e:5b:dc:ce:bb:1e:58:e4:bd:05:4c: - ad:07:d6:03:c5:a9:57:a4:26:e2:10:f7:f9:63:1a:2a:6a:9c: - 52:98:33:bf:ea:70:cd:c0:86:32:80:6e:70:54:87:74:3c:41: - 53:a1:c6:53:44:c7:74:a6:11:b6:48:66:86:f9:04:ca:ec:5d: - 4f:ce:7f:64:51:34:52:53:98:a8:70:62:f7:3b:fb:39:11:9a: - e1:e2:d3:00:0b:6b:d2:33:3c:44:de:c3:6b:e1:6f:c9:be:d2: - 2c:8a:f0:b3:d3:4c:12:2f:ad:9d:6b:40:89:23:94:93:6d:12: - 6c:38:89:fa:fe:ad:02:55:55:8b:c3:86:7f:15:c4:3a:a9:70: - e9:06:6c:26:09:28:9f:6e:94:f2:a1:27:5c:89:4c:42:ac:65: - 90:92:d2:6d:09:7c:d8:a1:bf:5b:25:e4:db:ed:71:41:d7:e2: - 61:47:89:9e:46:29:9d:f9:f4:94:cf:f5:b3:e8:df:6a:47:34: - d1:ed:fc:a4:58:fe:82:e1:6e:e9:05:65:f5:d2:57:9a:d1:42: - 64:ae:0c:bb:07:14:39:a2:c0:85:e4:25:a5:c4:e6:3f:e6:da: - d0:18:4f:e0:01:ba:99:2e:1f:75:35:c3:fa:a3:e7:e1:75:1b: - 1c:19:93:cc:96:eb:3f:ce:8b:10:40:36:63:f5:66:dc:6d:75: - 31:ba:db:27:21:b4:15:00:e9:ce:d0:08:e3:b0:1c:e3:29:c9: - 63:5a:c8:5c:ca:db:ce:51:b7:87:22:c6:ba:42:d7:ab:29:b4: - 87:fa:27:9a:18:22:90:9f:da:c0:90:c4:49:64:38:38:2e:a2: - ea:87:c1:8b:4e:8b:ff:a7:53:45:4f:d8:8b:86:69:ea:87:1d: - f6:e6:44:14:1f:69:ee:2c:de:5a:a1:df:a8:57:13:65:4d:5b: - ce:6e:f2:15:2a:c5:32:08 ------BEGIN CERTIFICATE----- -MIIExjCCAq6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBzMQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRAwDgYDVQQKDAdB -Q01FIENBMQ8wDQYDVQQLDAZDb3lvdGUxGzAZBgNVBAMMEm91cmNhLmRvbWFpbi5s -b2NhbDAeFw0xNjA2MzAxNjQ5MDBaFw0zNjA2MjUxNjQ5MDBaMF0xCzAJBgNVBAYT -AlVTMREwDwYDVQQIDAhOZXcgWW9yazENMAsGA1UECgwEQUNNRTEPMA0GA1UECwwG -Q295b3RlMRswGQYDVQQDDBJjZXJ0Mi5kb21haW4ubG9jYWwwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDGnoSZTWmYwkKV7UPKJAVknWeBHP9We63Rywk5 -KE+sqhs0YTqx41fUnhVAd5EgK+h+05EeRlBsL0sAwvI6Q4nZgXOEXwLbSaw7nv7A -dy5T6s7a/0mYIR0xTQ8UIDA2miO0KAgGWYEwA4YJC1vhcmNeVKyQsYJVuBIA1QEm -vmrr/Fhbinr+RiOj611s4PZ5AF1bSYJCYuJY6GVUFL6ZJYu3389TJvJ6/bn589Wv -BtYeumZNQYxdqiNBf/QnIaAwCYYTxFcbE0Vjazujf9Eazf0HUQ8a4dklPtJ34cdg -2xLf73FlyMcaQpRvVyrXZzAPMzG6kE3RgDgI55B6BA6PsCpzAgMBAAGjezB5MAkG -A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp -ZmljYXRlMB0GA1UdDgQWBBRDcakWK9rcX/2Ch3gmSE53IUdE1jAfBgNVHSMEGDAW -gBRPKhVJ5swFLyv0Dsy6LkzfE5DweDANBgkqhkiG9w0BAQsFAAOCAgEAFaz5y7yI -wNN0g4jNGZS7h379TSUJmwiEZMU3x5mzJe5ugkawE/kFrU1KsuMpXQ1VnpxiHZXy -GUle01tYmM7o9eXBzrWoerH4FP4lEBJbQVPSR6sg5VDatroAIZRr3QskFdzATrgd -zJ5fEF5GP5bJ+Ci7EzHW0mxIQbsjqyNkc9YrLpp31Aj74OhQLEl/mJ72NzArfJfG -px5b3M67HljkvQVMrQfWA8WpV6Qm4hD3+WMaKmqcUpgzv+pwzcCGMoBucFSHdDxB -U6HGU0THdKYRtkhmhvkEyuxdT85/ZFE0UlOYqHBi9zv7ORGa4eLTAAtr0jM8RN7D -a+Fvyb7SLIrws9NMEi+tnWtAiSOUk20SbDiJ+v6tAlVVi8OGfxXEOqlw6QZsJgko -n26U8qEnXIlMQqxlkJLSbQl82KG/WyXk2+1xQdfiYUeJnkYpnfn0lM/1s+jfakc0 -0e38pFj+guFu6QVl9dJXmtFCZK4MuwcUOaLAheQlpcTmP+ba0BhP4AG6mS4fdTXD -+qPn4XUbHBmTzJbrP86LEEA2Y/Vm3G11MbrbJyG0FQDpztAI47Ac4ynJY1rIXMrb -zlG3hyLGukLXqym0h/onmhgikJ/awJDESWQ4OC6i6ofBi06L/6dTRU/Yi4Zp6ocd -9uZEFB9p7izeWqHfqFcTZU1bzm7yFSrFMgg= ------END CERTIFICATE----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/cert2.key b/tests/unit/plugins/modules/network/f5/fixtures/cert2.key deleted file mode 100644 index 6d4bdf15..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/cert2.key +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-256-CBC,C56C8101A9C8D6B9AD0975807D4793BB - -rhV1cJee3XAlY83zIXytJOlvXFrsHmzyTVoOn26eOwgza8CuE5gQQzLXiT12zK0q -YAbYyyyEXJJogVU61s1vuCQRNiezUCwT4SBj7ni4rXqu5BYUxKh0wD0gjE519yNP -nqnPUYKdLkFY7I6RJjqCqkk8xnJm64g5zCqN58aR98Mkqr1898+lZ2OHqAsAYBNH -dM/SE7B7E4Mr1sAjpsn6L4PJ93WSwmEtH3nZTnPF9qtFuJwjUcHCN/r/s3QXki95 -eFX+7qW460lBfDeRUKXKqz4gO017AXu1kccrlHhdQoJGf3D+x9zwofG/uFeAH3iN -f9IRaiR2IN6SS67QFmOkI9S95tsFb4N8bmmfGV4w8wfxvDzGJuxzIb4gByX5xov4 -S22pDpkfn5YqxgC5ItSiFYpg01HEi2l79HwZqAn1kowLsuF1JJKAYL5IMS3DlrdH -AyA9CN28G6pYEjwFBbFgpOg64UNmrkxRncHxC4FuH7iGZNJL9+HQve/J5nlrnx6M -IU2myiZZhgbsl/V45ddXBDSlEdWFLHtEhcG+ICJP3EZAXHR0e9vyrWDk7T5zKhLP -ch9PNmIw+5zzpRuPu5NYw7V0ax8UOf2AydyBHeIQWuY52bai+QMDyQauomqpPXRY -tpCcW85P9jstY/F6TV32XQu/cHWolziJXI/QzWF5+uvnLMAsb3p5mriCG4DOTWF3 -KFSytTGnDQUUCLgaYSSKXL5Z52PVYmTjoqX8M6cvqSEdjK84wILQE0JMItQjGSIM -y5qHD7Mthf9YOJy1D86qtVumbaOBLw/rGPQS5QlK/m256xZ10LUslYczMpw1orN3 -3Uv8zHKk790XduHTllR0LwQXMJXG59hgiWAu3V3rsAkVSRpC3MI6IUZ2cfJvZ0Ds -FmUhCJ34JQxD4E/sT9uGAk6VIq/fAmM7/gq0oF4oqOFg4Zy1r3rc1Kvdoy1yKUi6 -JCI5bKCkgIthx4XUKQVtFMkHBDZAHr6i5Lzy4nM6I4S4/qL3JH4Q+739D1rjGVlq -OWcaeOzkkbJrE8h+A94UQao4R50LavKgq/o2n56tHG0RhXXyV5MC/X9rbSVipihR -rwNKnogdhAjY96IrOzdiHTArg8qZBGvHPoGUl3zjWFqNbHEs4NLSrEl6oEs6F/vC -zEZmi8gxqraw4u1GJnpoMuLO45PuhcxcXgJSvTh/OKDaR1u0ggEn7TxfAygm0ahP -i6NBgoZ/upTHAWqWht2JjSmQHQW7doVkp/BgNJq13oYF7FEUEg/ZtBTPKPR3CjM0 -ZKDGvKqWRVRyrw9FSwXn6WlSFfT3vhPMoW2jq1Kq5o/ZyhcquCVE8i+xq6hilcb5 -sNiV1tPWsZOFHx4T5hBVK+QnC8t7pCj38YpyEoY4/gffMtY85jsrLMlPYd5bmJ6O -x1tKiQauK+aX6IMu38YnHjCGnCkw1fF2OMSohbG2QfaKsmfkt8YLRuf2PTtjLtke -xGt0Irjac/sEZPc4SEIqnehNfXadiuMV3+4v6ey9vf782r76KH8gInY2gDsQ4X6d -1LVNCNAd/AGlitopL4hYomaeTjTzqIy5fMlGmTrpZjokenu/ILXsljZVAX2iyOAs ------END RSA PRIVATE KEY----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/chain1.crt b/tests/unit/plugins/modules/network/f5/fixtures/chain1.crt deleted file mode 100644 index 38dd8dc9..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/chain1.crt +++ /dev/null @@ -1,68 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIF2DCCA8CgAwIBAgIJAKql/ua7JdaGMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNV -BAYTAkdCMRAwDgYDVQQIDAdFbmdsYW5kMRIwEAYDVQQKDAlBbGljZSBMdGQxKDAm -BgNVBAsMH0FsaWNlIEx0ZCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxGjAYBgNVBAMM -EUFsaWNlIEx0ZCBSb290IENBMB4XDTE3MDcyNTAzMTcwNloXDTM3MDcyMDAzMTcw -NloweTELMAkGA1UEBhMCR0IxEDAOBgNVBAgMB0VuZ2xhbmQxEjAQBgNVBAoMCUFs -aWNlIEx0ZDEoMCYGA1UECwwfQWxpY2UgTHRkIENlcnRpZmljYXRlIEF1dGhvcml0 -eTEaMBgGA1UEAwwRQWxpY2UgTHRkIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQC7grIMGI9e11lKh++bhyhTAU4qsKgM52xkl4sctSkK5hyT -jY8YYfD9ERrrJov6LLCt8QiwFypoqdILTht4g6sGACoVGXigFbLNyhEhX64kIWwT -PNFFXezYJv87qxPeT0I+6oHwai3smrUsPzsK73vwWOlnAW0mxvSzWpzvc3CgCB1J -+vRhdPm0VgT5HuR20WDPvx0T+ftQRrhIHz/UZSTHo/CEcuJ9zjhEmQlZRhfxZiBW -FY8Mgs6bgAKC+KtAsFTqRAuXq++xOnIIBzXACluFxp7Fee1CZh2GPxmtzFSIJVH0 -pH6wf9Kxkr0zuiAt3nq3xQcQZVdRP3bWscxp0lYG8BjuMZppI+r+gG1k/7WsRU/A -SUiHi4EogznIuJ7o1LbcULpIKjHsHVKXYz+ff+hx7npisHIE9BoyBe9SbalJxIcS -7n9/Mw6UmKk/zxspXCwMLraaeoyy2vUoC/zXW2WQHq67IarSAVbCPEPliqydVZ9k -y1ZQKGdrpxxLdsbasNv3xnS50DBd4GsSnxdhzCXUUhvLQ8dZ/NRXvZ6wwcdeQ6PV -5+dQNgnm7yd4mxyBbqv6RBAa37uNKWNf4yAQ9j9QN8pzW+qzuusAcLxTdDbtyeMi -Dz5UHzF912m3KLlF/Aad2TbjrCR4K0CEozVT8lhFpZlNl+IdZyuSbZQ6tYrJ0wID -AQABo2MwYTAdBgNVHQ4EFgQUk2h12cau/s1k/IGR0OAUWZbf8a8wHwYDVR0jBBgw -FoAUk2h12cau/s1k/IGR0OAUWZbf8a8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B -Af8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBADSBpj8O7Wrs0gpciOmJ7cmVUIoX -XTd+WgzustaUJoqpeCmzkeC7O9/a9Eat2LrmKIBoY6uzH1hnYwOxSdSdodBuUcOv -6hBl7rFCgg+ACRn7zaaInFRPdx4P+ovbfFFetKmg54XA8ZDb7YRpwj3zMtlV38Ca -WC1jP36ocn8UZ8av1ki7KNz/0PqzJ4sVs6IZrj2Lo0lDcu+29Nh5VJ7AZnOfUeas -4sQr3dPHPaMQBxz0rKr/FN4qx63kd9GmoGz4DEDnPeUl2v52i/48ym0Q7JrntD5J -qJaaoU4uxUMkmnD8wOmBBtXQ3eRpHE6W8ZcJGWkL8bRPrFnwxMk71N1guetetzoY -xX7E3/CtSV7CSJMF74hE/ULNG8XdWAYY3zojSStA8UzYzO/pCA/PcmxBzxnkch4W -3LetTSKH9mN9k2p51jGLWIbRGod5qffmtb76xRzhyhgryCV/afwfJxKeXwjDz8ty -J6qFBXclDjTWVHHOU8hGvu4Z4PD6cbQ68tLlfFoDRq6nqKufFKpxOyw9ioLcPWbz -+rJsnqE1+5QR4tisplmSQtQ5nI45Wns+UCmsEJm+gPkyp9pBQVudkEo1OSyCSSwZ -evwZgkD2YclUpxcQRQR/Sy4Kvrwv3D+6zfgovClqpI3SHvQ1v/TXa3wB/RTB1H0q -0Qn4FWp63AaOBNrC ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF3TCCA8WgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAweTELMAkGA1UEBhMCR0Ix -EDAOBgNVBAgMB0VuZ2xhbmQxEjAQBgNVBAoMCUFsaWNlIEx0ZDEoMCYGA1UECwwf -QWxpY2UgTHRkIENlcnRpZmljYXRlIEF1dGhvcml0eTEaMBgGA1UEAwwRQWxpY2Ug -THRkIFJvb3QgQ0EwHhcNMTcwNzI1MDMxNzE0WhcNMjcwNzIzMDMxNzE0WjCBgTEL -MAkGA1UEBhMCR0IxEDAOBgNVBAgMB0VuZ2xhbmQxEjAQBgNVBAoMCUFsaWNlIEx0 -ZDEoMCYGA1UECwwfQWxpY2UgTHRkIENlcnRpZmljYXRlIEF1dGhvcml0eTEiMCAG -A1UEAwwZQWxpY2UgTHRkIEludGVybWVkaWF0ZSBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBAL1whyll1+/qWhAUdy6U5vtopX0wzJrg3dk8tIlpDChh -khTEK779aQNapRKpZmJ6hnCkg7buVOSBP2WqqGQ1s9cakBSFkDyy5hrqeSzIR93w -9n2sTc4EBD0b8QWn5D0hdoWLT3+OwFHCBf/vb+qA9Vz0P/PRPYUnKttQH6nXTj9C -+AzegfS4SbfDJ4XdhbzCewgUvr3rqP61AQuEwZq7qoVCA3bFSASUfbJgMBxJgfBG -KynueJ62L+wbZLXUDq9G3T0KIUlxgGIcPQ0tu2kW7uSeY5wZazuvNJCHM9HKsjUf -wb8GgavQRlgunE9zXAEr+iP2DQrmZXdhJkkb4EyG1vuTMK3DtGjlpXAVGsiuuZ1o -PVYZDVKhfKFN9tyop/dppxDTHyJlp2prtsudhtqwzYDqrUsMu4/LMWvxgUcTK4U7 -mPSBcvOb4fTqXirNRYsqi8BK/nxt/hUBVG0vEnoIH0ppzqWvMcsMtMi3535sErUJ -k8IVKYIGB9OKb9SzpERYT6+BH9sUURZ/xyhRd2pj7EiVAEVxrrVoedZJzLRuXH99 -qhFG2HnDAaDC9LX09GveTzgUVUfif5fJgGBkzslpM3z8t3THz9RjrqtrzKOCHcZF -cgt46oQByT0UjhIPCz3/6h04XzSszue8aTAwi1JaYhHoXEPolgJRoLeuFdsJtfyt -AgMBAAGjZjBkMB0GA1UdDgQWBBSiTrrHxly7SsSV+MqprYstABOIjDAfBgNVHSME -GDAWgBSTaHXZxq7+zWT8gZHQ4BRZlt/xrzASBgNVHRMBAf8ECDAGAQH/AgEAMA4G -A1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAakyu4lsOWz2+VHI0S6xb -M/afSDgnmI+i/1lSQ7UHM1XIvuINIzAcWndU1XuHyFjT7p9ZDPZ52gcseIenrKOD -EsJWKO3u33to3YUMfBCJi9VbTCtd6rkjuFggN6EKM1esqs0kgenWmvEQSv73OOii -UCAbif4fSva6C5PhgK7X0zE+hTsPxRZnN8baRlL01IHEraG+PfYCEpjvzExzoaW6 -aLNS0DAS1escb9K5u6Cf4KIxkdqpcYIW7v7tehj5KS3E0cRv3QAaMUBkMWTWlSP3 -irzC0OB8BFuYZ1OxDYnxhSY1mfwfI8kWrvA83okS8qwfjq/rty53VG3tON9GzGXg -P1SQ3xB/6yxSvskcbN1blfHJfJRpOIxBvAydhdBCh7PO0WJzTP8kmffMhOiT5AdE -jcJVxWSjwqUetomlNiErEvo7ZmxEwQZQE5wnuGM4eAbV87zLVrnj+viRo1dP7RFN -iRUwjrxKpozUY5AGY2hZdFrWObBe1AvLDQcNDUc+oMwgnIBC2YtO1cTKJ3IFru0f -Av48lyJ88AfO2W7pEfoVqAAZszu2s0VZB5W9fBOQLizvkjK8s5YeUPdhW3epEYF9 -I1PsTSNdN+abV5qNdIjgRVtNlV63+1y0Ez7J7RvO847ZYTuqHnfaRG03p10YnxBs -WcSe5ozInV3EZ9TxFcGQR+E= ------END CERTIFICATE----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_gtm_irule.tcl b/tests/unit/plugins/modules/network/f5/fixtures/create_gtm_irule.tcl deleted file mode 100644 index d2283646..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_gtm_irule.tcl +++ /dev/null @@ -1,8 +0,0 @@ -when LB_SELECTED { - # Capture IP address chosen by WIP load balancing - set wipHost [LB::server addr] -} - -when LB_FAILED { - set wipHost [LB::server addr] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_service_parameters_f5_http.json b/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_service_parameters_f5_http.json deleted file mode 100644 index 31fce52a..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_service_parameters_f5_http.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "name": "http_example", - "partition": "Common", - "template": "/Common/f5.http", - "inheritedDevicegroup": "true", - "deviceGroup": "none", - "inheritedTrafficGroup": "true", - "trafficGroup": "/Common/traffic-group-local-only", - "lists": [ - { - "name": "irules__irules", - "encrypted": "no", - "value": [ - "/Common/lgyft" - ] - }, - { - "name": "net__client_vlan", - "encrypted": "no", - "value": [ - "/Common/net2" - ] - } - ], - "tables": [ - { - "columnNames": [ - "name" - ], - "name": "pool__hosts", - "rows": [ - { - "row": [ - "demo.example.com" - ] - } - ] - }, - { - "columnNames": [ - "addr", - "connection_limit" - ], - "name": "pool__members", - "rows": [ - { - "row": [ - "10.1.1.1", - "0" - ] - }, - { - "row": [ - "10.1.1.2", - "0" - ] - } - ] - } - ], - "variables": [ - { - "name": "afm__policy", - "value": "/#do_not_use#" - }, - { - "name": "afm__dos_security_profile", - "value": "/#do_not_use#" - }, - { - "name": "afm__protocol_security_profile", - "value": "/#do_not_use#" - }, - { - "name": "asm__use_asm", - "value": "/#do_not_use#" - }, - { - "name": "client__http_compression", - "value": "/#do_not_use#" - }, - { - "name": "client__standard_caching_without_wa", - "value": "/#do_not_use#" - }, - { - "name": "client__tcp_wan_opt", - "value": "/#create_new#" - }, - { - "name": "monitor__monitor", - "value": "/#create_new#" - }, - { - "name": "monitor__frequency", - "value": "30" - }, - { - "name": "monitor__uri", - "value": "/my/path" - }, - { - "name": "monitor__response", - "value": "" - }, - { - "name": "net__client_mode", - "value": "wan" - }, - { - "name": "net__server_mode", - "value": "lan" - }, - { - "name": "net__vlan_mode", - "value": "all" - }, - { - "name": "pool__addr", - "value": "10.10.10.10" - }, - { - "name": "pool__http", - "value": "/#create_new#" - }, - { - "name": "pool__mask", - "value": "" - }, - { - "name": "pool__persist", - "value": "/#cookie#" - }, - { - "name": "pool__lb_method", - "value": "least-connections-member" - }, - { - "name": "pool__pool_to_use", - "value": "/#create_new#" - }, - { - "name": "pool__port_secure", - "value": "443" - }, - { - "name": "pool__redirect_port", - "value": "80" - }, - { - "name": "pool__redirect_to_https", - "value": "yes" - }, - { - "name": "pool__xff", - "value": "yes" - }, - { - "name": "server__oneconnect", - "value": "/#create_new#" - }, - { - "name": "server__tcp_lan_opt", - "value": "/#create_new#" - }, - { - "name": "ssl__cert", - "value": "/Common/default.crt" - }, - { - "name": "ssl__client_ssl_profile", - "value": "/#create_new#" - }, - { - "name": "ssl__key", - "value": "/Common/default.key" - }, - { - "name": "ssl__mode", - "value": "client_ssl" - }, - { - "name": "ssl__use_chain_cert", - "value": "/#do_not_use#" - }, - { - "name": "ssl_encryption_questions__advanced", - "value": "yes" - }, - { - "name": "stats__analytics", - "value": "/#do_not_use#" - }, - { - "name": "stats__request_logging", - "value": "/#do_not_use#" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_template.iapp b/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_template.iapp deleted file mode 100644 index 995bd4d6..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_iapp_template.iapp +++ /dev/null @@ -1,56 +0,0 @@ -cli admin-partitions { - update-partition Common -} - -sys application template foo.iapp { - - actions { - definition { - - implementation { - set cfg { ltm virtual forwarding-repro { - destination 0.0.0.0:any - description "something 1" - mask any - profiles { - fastL4 { } - } - source 1.1.1.1/32 - translate-address disabled - translate-port disabled - vlans { __forwarding_vlans__ } - vlans-enabled -} } - - - if {![info exists {::var__forwarding_vlans}] || (${::var__forwarding_vlans} == "")} { - set {::var__forwarding_vlans} "{}" - puts "Info: assigning empty string to variable {::var__forwarding_vlans}" - } - - - set cfg [string map "__forwarding_vlans__ ${::var__forwarding_vlans} __app_service__ $tmsh::app_name.app/$tmsh::app_name " $cfg] - set fileId [open /var/tmp/demo.repro.cfg "w"] - puts -nonewline $fileId $cfg - close $fileId - - - tmsh::load sys config merge file /var/tmp/demo.repro.cfg - } - - presentation { - - include "/Common/f5.apl_common" - section var { - string forwarding_vlans display "xxlarge" - } - - text { - var "General variables" - var.forwarding_vlans "__var__forwarding_vlans__" - } - } - role-acl { admin manager resource-admin } - } - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_cert1.crt b/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_cert1.crt deleted file mode 100644 index 1d22f302..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_cert1.crt +++ /dev/null @@ -1,101 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 1 (0x1) - Signature Algorithm: sha256WithRSAEncryption - Issuer: C=US, ST=New York, L=New York, O=ACME CA, OU=Coyote, CN=ourca.domain.local - Validity - Not Before: Jun 30 16:46:09 2016 GMT - Not After : Jun 25 16:46:09 2036 GMT - Subject: C=US, ST=New York, O=ACME, OU=Coyote, CN=cert1.domain.local - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) - Modulus: - 00:d6:0f:bd:26:ef:14:4d:09:f6:db:8b:01:f5:4e: - 6c:03:b1:35:20:16:b8:1b:7c:e6:b6:8d:97:1b:b0: - 4f:8a:b6:cb:54:7e:7a:ff:fd:af:02:db:bf:9d:cf: - 9a:4c:0d:87:93:8b:cc:61:f3:23:a9:6f:8e:d4:82: - 2c:93:b6:e2:fa:37:ed:8a:d3:23:8f:6d:b5:78:4a: - 38:ba:93:f9:4a:1c:40:06:33:d7:c0:98:20:d4:16: - ac:a4:a5:6b:41:20:4c:3a:55:7e:c7:50:e7:95:07: - 4e:86:15:86:7a:0f:6c:57:d2:07:1c:97:24:51:5b: - 4e:f5:52:3a:f8:4f:95:6b:6c:83:1f:34:4e:ee:b0: - ae:fe:46:90:38:f1:4d:85:72:8b:46:bc:d1:62:37: - 65:5a:de:bb:16:51:1e:f5:cb:a0:ef:d6:7b:11:6f: - 3b:0c:49:17:bc:4d:8c:f5:d9:f0:35:6b:f7:b6:4d: - 50:eb:47:81:e3:06:f2:bd:ec:67:4f:ab:2b:03:aa: - e2:1e:42:22:a9:c9:59:dc:0d:19:fb:c5:02:1d:d7: - 58:e4:04:53:0a:1d:79:bb:c1:33:f1:cd:b7:10:2e: - b4:6e:9b:dc:60:66:05:50:9f:20:66:a1:71:00:51: - 54:cf:0a:70:f4:7c:45:c6:f0:a7:1c:11:2f:3e:a3: - 1f:bf - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 2D:FB:27:C7:B4:32:FF:F7:87:DB:2D:A7:76:AE:F0:96:7E:DA:DC:17 - X509v3 Authority Key Identifier: - keyid:4F:2A:15:49:E6:CC:05:2F:2B:F4:0E:CC:BA:2E:4C:DF:13:90:F0:78 - - Signature Algorithm: sha256WithRSAEncryption - 3f:46:1c:3b:58:b4:99:f3:75:00:47:d2:fe:ba:ba:9a:04:46: - 62:b6:2d:a0:0f:8f:c0:95:2a:58:8b:61:f5:14:90:30:26:37: - 94:a1:a6:29:20:c9:b5:08:d7:f9:15:cb:9d:9c:19:ed:2f:a4: - e6:91:48:85:1a:f7:ab:17:5e:79:23:69:b8:3c:0c:48:ae:c8: - ba:90:d0:05:fb:33:7e:86:fd:12:f8:2d:0f:ff:16:15:9a:dc: - 76:48:7d:65:5b:4e:93:14:e8:be:37:d1:13:f7:a7:b1:cd:ad: - ae:4f:e1:72:b9:53:2d:cd:e6:42:76:44:93:21:28:58:c0:44: - ab:3c:da:5b:e5:55:ab:04:86:4d:9c:4c:33:f4:4e:13:98:e9: - 0f:d1:a3:70:2b:1d:11:20:47:26:f6:d8:45:7f:88:ad:f2:c1: - 81:0f:be:cd:6c:79:80:94:30:eb:8d:cc:f3:7d:a1:3e:6c:6f: - fa:8f:f3:1f:2e:76:97:3f:8a:1b:67:3b:e0:f9:b1:3c:6b:dc: - 64:1b:00:73:e9:89:81:f6:7f:51:f3:51:c8:b9:96:5f:fd:55: - f8:77:6f:88:bc:65:b3:e2:30:a4:00:7a:79:68:e0:36:8b:a9: - 1b:06:9b:20:fe:fe:98:aa:56:58:c8:08:a4:7b:12:59:ff:3d: - bd:5e:13:3b:c6:c7:8a:00:5b:cb:27:18:02:ee:cb:38:c2:b7: - a9:51:04:ef:31:ca:49:09:48:14:13:eb:91:e2:26:8c:88:5f: - 1c:78:e1:0d:90:29:d7:c1:fc:c8:89:fd:4d:53:0b:99:58:c2: - 1a:24:3d:c0:a2:4c:a3:d9:c7:95:c5:bc:72:fa:02:f1:ab:dd: - aa:2b:9e:a0:bb:1a:68:2d:09:8c:a2:99:0d:26:ec:9e:30:19: - 01:5a:41:45:63:b3:c5:db:24:32:4c:fe:7f:f3:ce:e9:4d:00: - 64:cf:bb:15:34:2d:31:6e:4f:c0:96:40:9b:32:35:65:92:01: - 29:7e:74:02:50:fd:3b:3b:3a:a3:9f:6a:c0:a5:be:3f:c3:07: - d6:8c:2a:c6:f4:0f:32:bd:3b:fc:45:90:d2:46:ee:6f:c3:2f: - 26:8c:97:0c:e8:da:9a:97:03:0b:86:17:45:a6:62:69:4e:8d: - cf:f8:bf:ea:2f:dc:ff:95:14:15:bd:92:2d:8a:08:cf:ce:8a: - b0:f6:34:0a:a2:0e:49:31:44:e1:47:fb:37:52:53:59:93:25: - 40:cc:ac:67:2d:a2:b6:9b:75:fd:13:a5:a7:93:4f:72:05:75: - cd:b1:37:f6:3b:69:3b:24:a1:1f:23:f0:cd:bb:ae:18:b3:aa: - eb:9f:d7:97:06:ba:fd:44 ------BEGIN CERTIFICATE----- -MIIExjCCAq6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBzMQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxETAPBgNVBAcMCE5ldyBZb3JrMRAwDgYDVQQKDAdB -Q01FIENBMQ8wDQYDVQQLDAZDb3lvdGUxGzAZBgNVBAMMEm91cmNhLmRvbWFpbi5s -b2NhbDAeFw0xNjA2MzAxNjQ2MDlaFw0zNjA2MjUxNjQ2MDlaMF0xCzAJBgNVBAYT -AlVTMREwDwYDVQQIDAhOZXcgWW9yazENMAsGA1UECgwEQUNNRTEPMA0GA1UECwwG -Q295b3RlMRswGQYDVQQDDBJjZXJ0MS5kb21haW4ubG9jYWwwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDWD70m7xRNCfbbiwH1TmwDsTUgFrgbfOa2jZcb -sE+KtstUfnr//a8C27+dz5pMDYeTi8xh8yOpb47UgiyTtuL6N+2K0yOPbbV4Sji6 -k/lKHEAGM9fAmCDUFqykpWtBIEw6VX7HUOeVB06GFYZ6D2xX0gcclyRRW071Ujr4 -T5VrbIMfNE7usK7+RpA48U2FcotGvNFiN2Va3rsWUR71y6Dv1nsRbzsMSRe8TYz1 -2fA1a/e2TVDrR4HjBvK97GdPqysDquIeQiKpyVncDRn7xQId11jkBFMKHXm7wTPx -zbcQLrRum9xgZgVQnyBmoXEAUVTPCnD0fEXG8KccES8+ox+/AgMBAAGjezB5MAkG -A1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRp -ZmljYXRlMB0GA1UdDgQWBBQt+yfHtDL/94fbLad2rvCWftrcFzAfBgNVHSMEGDAW -gBRPKhVJ5swFLyv0Dsy6LkzfE5DweDANBgkqhkiG9w0BAQsFAAOCAgEAP0YcO1i0 -mfN1AEfS/rq6mgRGYrYtoA+PwJUqWIth9RSQMCY3lKGmKSDJtQjX+RXLnZwZ7S+k -5pFIhRr3qxdeeSNpuDwMSK7IupDQBfszfob9EvgtD/8WFZrcdkh9ZVtOkxTovjfR -E/ensc2trk/hcrlTLc3mQnZEkyEoWMBEqzzaW+VVqwSGTZxMM/ROE5jpD9GjcCsd -ESBHJvbYRX+IrfLBgQ++zWx5gJQw643M832hPmxv+o/zHy52lz+KG2c74PmxPGvc -ZBsAc+mJgfZ/UfNRyLmWX/1V+HdviLxls+IwpAB6eWjgNoupGwabIP7+mKpWWMgI -pHsSWf89vV4TO8bHigBbyycYAu7LOMK3qVEE7zHKSQlIFBPrkeImjIhfHHjhDZAp -18H8yIn9TVMLmVjCGiQ9wKJMo9nHlcW8cvoC8avdqiueoLsaaC0JjKKZDSbsnjAZ -AVpBRWOzxdskMkz+f/PO6U0AZM+7FTQtMW5PwJZAmzI1ZZIBKX50AlD9Ozs6o59q -wKW+P8MH1owqxvQPMr07/EWQ0kbub8MvJoyXDOjampcDC4YXRaZiaU6Nz/i/6i/c -/5UUFb2SLYoIz86KsPY0CqIOSTFE4Uf7N1JTWZMlQMysZy2itpt1/ROlp5NPcgV1 -zbE39jtpOyShHyPwzbuuGLOq65/Xlwa6/UQ= ------END CERTIFICATE----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_key1.key b/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_key1.key deleted file mode 100644 index a89a2916..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_insecure_key1.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEA1g+9Ju8UTQn224sB9U5sA7E1IBa4G3zmto2XG7BPirbLVH56 -//2vAtu/nc+aTA2Hk4vMYfMjqW+O1IIsk7bi+jftitMjj221eEo4upP5ShxABjPX -wJgg1BaspKVrQSBMOlV+x1DnlQdOhhWGeg9sV9IHHJckUVtO9VI6+E+Va2yDHzRO -7rCu/kaQOPFNhXKLRrzRYjdlWt67FlEe9cug79Z7EW87DEkXvE2M9dnwNWv3tk1Q -60eB4wbyvexnT6srA6riHkIiqclZ3A0Z+8UCHddY5ARTCh15u8Ez8c23EC60bpvc -YGYFUJ8gZqFxAFFUzwpw9HxFxvCnHBEvPqMfvwIDAQABAoIBAQCjQ7PP+y8vpvbp -8bbXoy2ND15mkA1xoazR9WIYEzxHny2rzx//GTyfYH1gXtPfR75tEYYb+vbrJxP4 -DyTysN2jXH7HkEwh+9oZ2fo0i+Hp3WwTjvzyftUjDfw1Q5lvPbQGFekxGgrXRpBk -ggxkEllfDeiwrLJdftfVEhe6BfD/0YibwQeHN7VoC4V8wOanKtDmx74W/1f7WhwQ -nKQnCrbYqNJa2nGvWiKU5Suvfb0v7tCnQYlfnCpUfj+wcnxlgmGkcyq1L+qC1qC8 -PO5i3T3LM5Yg8CSeGhO/q6gw/fUowuBN1cluTqN97oLHiEM5tLdjeVWwa1Vp0liv -1WXGT4eBAoGBAPtumMmyVTIorvV6KGNI/Eo6jfE0HOXVdXtm4iToDDuiYwto7/Ge -/kV+11Fpu0lV+eYPfZn175Of8FnQPwczQF1OOH/aQ/ViY8j87bZUbCy25mWrfNkh -2rRlyI3/OsSfL5SkyWpYB0yhSJZV9mSQJTZolB4GQRNPKtqi7NpB4WxBAoGBANnz -VS4JBJO75yeSG5BzPp5VVKm+nu0Betlva8GsHdEic8OM9bGpVozGysAW3Xdxp7q6 -gLJGyyuzpsxldCc/IdIlF5fz7gkLl4NoYanz9PSEr2XZLh9+2yXGkPFlC3IeHAUB -E+2UO9MFpWrmfKoAnYZCR6vJDxtQBpAlTUvJEYv/AoGBAPha62K32327P+7MJl7D -9ijgI9rwjebcbbpiCtlHuOWi5lCb6/7v/NvqiYcqeEvdOAXuoTNWAbsBTel5UPis -wFQp8pcfouccs9IRPEFQrLWSSIx+0sirrxtoOq1AQe18DAS4rRd1MmiYG1ocOVBm -LcvLixsJNHh9R6hFLM3+K0vBAoGANkmJ+gF9Bl9TYGPgQcay3jVa9Tzp0RcBRo+e -Q4tfkewG8bp2qF4JlN8fOWF4oHvKz5QM4lsH2EbTUS4kFHKBNhrPGaZEsDQW9UBW -s0J0zUMPfUrvViD+7RXcnIQSqcYeLJDsKc02aYWKgmoOuzmUAxEXUQ6vmJoCSH1C -F5JpsHkCgYEArwTSzb1+/ThQhK1JN8hJ4jMjQ8E7PzLTMILrdDALn2g1T4VzL7N7 -UG6oUieMlo/UH6cv6330dwaGVklXZbyDKSDROIafFcOpVfcvDUgJCjp3CaY9A2zG -+EPkRpeHKXAIgG+QuOwVOtYWcWltnBf61slTqiY2vKX1+ZGmrMrw1Zw= ------END RSA PRIVATE KEY----- diff --git a/tests/unit/plugins/modules/network/f5/fixtures/create_ltm_irule.tcl b/tests/unit/plugins/modules/network/f5/fixtures/create_ltm_irule.tcl deleted file mode 100644 index 5f7624a3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/create_ltm_irule.tcl +++ /dev/null @@ -1,18 +0,0 @@ -when RULE_INIT { - set static::FormBaseURL "/sp-ofba-form" - set static::FormReturnURL "/sp-ofba-completed" - set static::HeadAuthReq "X-FORMS_BASED_AUTH_REQUIRED" - set static::HeadAuthRet "X-FORMS_BASED_AUTH_RETURN_URL" - set static::HeadAuthSize "X-FORMS_BASED_AUTH_DIALOG_SIZE" - set static::HeadAuthSizeVal "800x600" - set static::ckname "MRHSession_SP" - set static::Basic_Realm_Text "SharePoint Authentication" -} - -when HTTP_REQUEST { - set apmsessionid [HTTP::cookie value MRHSession] -} - -when HTTP_RESPONSE { - # Insert persistent cookie for html content type and private session -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/data-group-address.txt b/tests/unit/plugins/modules/network/f5/fixtures/data-group-address.txt deleted file mode 100644 index d2f5a168..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/data-group-address.txt +++ /dev/null @@ -1,5 +0,0 @@ -network 10.0.0.0 prefixlen 8 := "Network1", -network 172.16.0.0 prefixlen 12 := "Network2", -network 192.168.0.0 prefixlen 16 := "Network3", -host 192.168.20.1 := "Host1", -host 172.16.1.1 := "Host2", diff --git a/tests/unit/plugins/modules/network/f5/fixtures/data-group-integer.txt b/tests/unit/plugins/modules/network/f5/fixtures/data-group-integer.txt deleted file mode 100644 index 711ac198..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/data-group-integer.txt +++ /dev/null @@ -1,6 +0,0 @@ -1 := alpha -2 := bravo -3 := charlie -4 := x-ray -5 := yankee -6 := zulu diff --git a/tests/unit/plugins/modules/network/f5/fixtures/data-group-string.txt b/tests/unit/plugins/modules/network/f5/fixtures/data-group-string.txt deleted file mode 100644 index c30fca28..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/data-group-string.txt +++ /dev/null @@ -1,6 +0,0 @@ -a := alpha -b := bravo -c := charlie -x := x-ray -y := yankee -z := zulu diff --git a/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.tar.gz b/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.tar.gz deleted file mode 100644 index cdc62027..00000000 Binary files a/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.tar.gz and /dev/null differ diff --git a/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.xml b/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.xml deleted file mode 100644 index 590944a4..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/fake_policy.xml +++ /dev/null @@ -1,12174 +0,0 @@ - - - - 2017-04-11T08:05:22Z - ltm4restlab.lab.local - /Common/fake_policy - Allowed Response Code 503 [add]: Response Code was set to 503. - - utf-8 - 8192 - 8192 - - Disabled - false - false - false - false - false - as parameters - true - false - - policy based - - - false - false - enforcing - 0 - - 400 - 401 - 404 - 407 - 417 - 503 - - 100 - 100 - 2000 - 1000 - 5 - false - false - false - false - false - false - false - false - 500 - 50 - 25 - 1800 - false - 500 - 400 - 200 - 1800 - true - true - 3 - 600 - 2 - 600 - 1800 - false - 120 - true - false - false - false - false - 5 - 600 - false - 300 - - - transparent - 2 - 20 - 500 - - default - HTTP/1.1 200 OK -Cache-Control: no-cache -Pragma: no-cache -Connection: close - <html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: <%TS.request.ID()%></body></html> - - - soap fault - HTTP/1.1 200 OK -Cache-Control: no-cache -Pragma: no-cache -Content-type: text/xml -Connection: close - <?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>The requested operation was rejected. Please consult with your administrator.Your support ID is: <%TS.request.ID()%></faultstring><detail/></soap:Fault></soap:Body></soap:Envelope> - - - default - HTTP/1.1 200 OK -Cache-Control: no-cache -Pragma: no-cache -Connection: close - <html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: <%TS.request.ID()%></body></html> - alert_popup - The requested URL was rejected. Please consult with your administrator. Your support ID is: <%TS.request.ID()%> - - - default - HTTP/1.1 200 OK -Cache-Control: no-cache -Pragma: no-cache -Connection: close - <html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: <%TS.request.ID()%></body></html> - alert_popup - The requested URL was rejected. Please consult with your administrator. Your support ID is: <%TS.request.ID()%> - - - disabled - - - - false - false - 900 - false - - 5 - 5 - 20 - true - false - true - - - 15 - 15 - 60 - false - false - false - - - 5 - 5 - 20 - true - false - true - - 600 - 600 - 600 - false - false - - - - - - - - - - - - - Always - 100 - 5000 - 1000 - 1000 - false - false - 2017-04-11T08:05:13Z - false - false - false - false - - - - - Never - false - false - false - false - basic - true - true - 2017-04-11T08:05:13Z - - false - N/A - - false - true - unmodified - allow - false - 1800 - unmodified - unmodified - unmodified - unmodified - true - - - * - * - 0 - http - false - - - - Never - false - false - false - false - basic - true - true - 2017-04-11T08:05:13Z - - false - N/A - - false - true - unmodified - allow - false - 1800 - unmodified - unmodified - unmodified - unmodified - true - - - * - * - 0 - http - false - - - - - - - When Violation Detected - false - true - user input - - - false - true - 2017-04-11T08:05:13Z - - true - - false - true - true - false - false - true - false - - - - - - - - password - - - - 0 - - default - HTTP/1.1 200 OK -Cache-Control: no-cache -Pragma: no-cache -Connection: close - <html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: <%TS.request.ID()%></body></html> - - - - - - GET - basic - - - POST - basic - - - GET - basic - - - - - When Violation Detected - true - allow - false - false - true - false - - - - - - - true - true - true - - true - 7 - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - false - false - false - false - false - false - false - enforce_all_except_url_list - - - false - true - true - Always - true - true - Never - false - When Violation Detected - When Violation Detected - Always - 100 - false - false - false - true - false - true - false - 250 - 10000 - 10000 - 100 - false - false - - - true - 10 - 10 - 300 - 604800 - - - true - 1 - 1 - 0 - 604800 - - - - - 20 - 20 - 3600 - 604800 - - - 1 - 1 - 0 - 604800 - - - - - 500 - 500 - 5000 - 86400 - - - 500 - 500 - 5000 - 86400 - - - - 10 - false - false - false - - global - 10 - list - true - false - true - false - false - false - true - 500 - 2 - 1xx - 2xx - 3xx - bmp - gif - ico - jpeg - jpg - pcx - pdf - png - swf - wav - - - - disallow - - - - false - - - false - APM Usernames and Session ID - -
- false - true - false - false - false - false - false - true -
-
- false - true - false - false - true - false - true - true -
-
- false - false - false - false - false - false - false - true -
-
- false - true - false - false - false - false - false - true -
- - false - Always - - - true - -
diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_global_network_log_network.json b/tests/unit/plugins/modules/network/f5/fixtures/load_afm_global_network_log_network.json deleted file mode 100644 index cc4ef0d3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_global_network_log_network.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "kind": "tm:security:log:profile:network:networkstate", - "name": "global-network", - "fullPath": "global-network", - "generation": 839, - "selfLink": "https://localhost/mgmt/tm/security/log/profile/~Common~global-network/network/global-network?ver=12.1.4", - "filter": { - "logAclMatchAccept": "disabled", - "logAclMatchDrop": "disabled", - "logAclMatchReject": "disabled", - "logAclToBoxDeny": "disabled", - "logGeoAlways": "disabled", - "logIpErrors": "disabled", - "logTcpErrors": "disabled", - "logTcpEvents": "disabled", - "logTranslationFields": "disabled" - }, - "format": { - "fieldListDelimiter": ",", - "type": "none" - }, - "rateLimit": { - "aclMatchAccept": 4294967295, - "aclMatchDrop": 4294967295, - "aclMatchReject": 4294967295, - "aggregateRate": 4294967295, - "ipErrors": 4294967295, - "tcpErrors": 4294967295, - "tcpEvents": 4294967295 - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_log_global_network_profile.json b/tests/unit/plugins/modules/network/f5/fixtures/load_afm_log_global_network_profile.json deleted file mode 100644 index 205af5b8..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_log_global_network_profile.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "kind": "tm:security:log:profile:profilestate", - "name": "global-network", - "partition": "Common", - "fullPath": "/Common/global-network", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/security/log/profile/~Common~global-network?ver=12.1.4", - "description": "Default logging profile for network events", - "ipIntelligence": { - "aggregateRate": 4294967295, - "logRtbh": "disabled", - "logShun": "disabled", - "logTranslationFields": "disabled" - }, - "nat": { - "endInboundSession": "disabled", - "endOutboundSession": { - "action": "disabled" - }, - "errors": "disabled", - "lsnLegacyMode": "disabled", - "quotaExceeded": "disabled", - "startInboundSession": "disabled", - "startOutboundSession": { - "action": "disabled" - } - }, - "portMisuse": { - "aggregateRate": 4294967295 - }, - "trafficStatistics": { - "activeFlows": "disabled", - "missedFlows": "disabled", - "reapedFlows": "disabled", - "syncookies": "disabled", - "syncookiesWhitelist": "disabled" - }, - "networkReference": { - "link": "https://localhost/mgmt/tm/security/log/profile/~Common~global-network/network?ver=12.1.4", - "isSubcollection": true - }, - "protocolDnsReference": { - "link": "https://localhost/mgmt/tm/security/log/profile/~Common~global-network/protocol-dns?ver=12.1.4", - "isSubcollection": true - }, - "protocolSipReference": { - "link": "https://localhost/mgmt/tm/security/log/profile/~Common~global-network/protocol-sip?ver=12.1.4", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_schedule.json b/tests/unit/plugins/modules/network/f5/fixtures/load_afm_schedule.json deleted file mode 100644 index c9d51ebf..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_afm_schedule.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:security:firewall:schedule:schedulestate", - "name": "foobar", - "partition": "Common", - "fullPath": "/Common/foobar", - "generation": 1835, - "selfLink": "https://localhost/mgmt/tm/security/firewall/schedule/~Common~foobar?ver=12.1.4", - "dailyHourEnd": "12:00", - "dailyHourStart": "6:00", - "dateValidEnd": "2019-06-13T16:00:00Z", - "dateValidStart": "2019-05-31T07:00:00Z", - "daysOfWeek": [ - "sunday", - "monday", - "friday", - "saturday" - ], - "description": "some description" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_apm_acl.json b/tests/unit/plugins/modules/network/f5/fixtures/load_apm_acl.json deleted file mode 100644 index 564784db..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_apm_acl.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "kind": "tm:apm:acl:aclstate", - "name": "lastone", - "partition": "Common", - "fullPath": "/Common/lastone", - "generation": 495, - "selfLink": "https://localhost/mgmt/tm/apm/acl/~Common~lastone?ver=12.1.4", - "aclOrder": 2, - "description": "foobar", - "locationSpecific": "true", - "pathMatchCase": "false", - "type": "static", - "entries": [ - { - "action": "discard", - "dstEndPort": 0, - "dstStartPort": 0, - "dstSubnet": "0.0.0.0/0", - "log": "none", - "protocol": 1, - "scheme": "any", - "srcEndPort": 0, - "srcStartPort": 0, - "srcSubnet": "0.0.0.0/0" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_apm_network_access.json b/tests/unit/plugins/modules/network/f5/fixtures/load_apm_network_access.json deleted file mode 100644 index 9c8b897f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_apm_network_access.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "kind": "tm:apm:resource:network-access:network-accessstate", - "name": "test", - "partition": "Common", - "fullPath": "/Common/test", - "generation": 1140, - "selfLink": "https://localhost/mgmt/tm/apm/resource/network-access/~Common~test?ver=12.1.4", - "addressSpaceDhcpRequestsExcluded": "true", - "addressSpaceExcludeDnsName": [ - "baz.com", - "bazfoo.com" - ], - "addressSpaceIncludeDnsName": [ - "foo.com", - "bar.com" - ], - "addressSpaceLocDnsServersExcluded": "true", - "addressSpaceLocalSubnetsExcluded": "true", - "addressSpaceProtect": "false", - "applicationLaunchWarning": "true", - "autoLaunch": "false", - "clientInterfaceSpeed": 100000000, - "clientIpFilterEngine": "false", - "clientPowerManagement": "ignore", - "clientProxy": "false", - "clientProxyAddress": "any6", - "clientProxyEnforceSubnets": "true", - "clientProxyIgnoreAutoConfigError": "false", - "clientProxyLocalBypass": "false", - "clientProxyPort": 0, - "clientProxyUseHttpPac": "false", - "clientProxyUseLocalProxy": "false", - "clientTrayIcon": "true", - "compression": "none", - "customizationGroup": "/Common/test_resource_network_access_customization", - "customizationGroupReference": { - "link": "https://localhost/mgmt/tm/apm/policy/customization-group/~Common~test_resource_network_access_customization?ver=12.1.4" - }, - "dnsEnforceSearchOrder": "true", - "dnsPrimary": "any6", - "dnsRegisterConnection": "false", - "dnsSecondary": "any6", - "dnsUseDnsSuffixForRegistration": "false", - "dtls": "false", - "dtlsPort": 4433, - "executeLogoffScripts": "false", - "idleTimeoutThreshold": 0, - "idleTimeoutWindow": 0, - "ipv6DnsPrimary": "any6", - "ipv6DnsSecondary": "any6", - "ipv6LeasepoolName": "/Common/ipv6lease", - "ipv6LeasepoolNameReference": { - "link": "https://localhost/mgmt/tm/apm/resource/ipv6-leasepool/~Common~ipv6lease?ver=12.1.4" - }, - "leasepoolName": "/Common/ipv4lease", - "leasepoolNameReference": { - "link": "https://localhost/mgmt/tm/apm/resource/leasepool/~Common~ipv4lease?ver=12.1.4" - }, - "locationSpecific": "true", - "microsoftNetworkClient": "true", - "microsoftNetworkServer": "false", - "networkTunnel": "enabled", - "preserveSourcePortStrict": "none", - "provideClientCert": "true", - "proxyArp": "false", - "snat": "automap", - "splitTunneling": "true", - "supportedIpVersion": "ipv4-ipv6", - "syncWithActiveDirectory": "false", - "type": "network-access", - "winsPrimary": "any6", - "winsSecondary": "any6", - "addressSpaceExcludeSubnet": [ - { - "subnet": "192.168.1.0/24" - }, - { - "subnet": "192.168.2.1/32" - } - ], - "addressSpaceIncludeSubnet": [ - { - "subnet": "10.10.10.1/32" - }, - { - "subnet": "10.11.11.0/24" - } - ], - "ipv6AddressSpaceIncludeSubnet": [ - { - "subnet": "2607:f0d0:1002:51::4/128" - } - ], - "optimizedAppReference": { - "link": "https://localhost/mgmt/tm/apm/resource/network-access/~Common~test/optimized-app?ver=12.1.4", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_dos.json b/tests/unit/plugins/modules/network/f5/fixtures/load_asm_dos.json deleted file mode 100644 index cab7b71f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_dos.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "kind": "tm:security:dos:profile:application:applicationstate", - "name": "test", - "fullPath": "test", - "generation": 1442, - "selfLink": "https://localhost/mgmt/tm/security/dos/profile/~Common~test/application/test?ver=13.1.1.4", - "botDefense": { - "browserLegitCaptcha": "enabled", - "browserLegitEnabled": "enabled", - "crossDomainRequests": "allow-all", - "gracePeriod": 300, - "mode": "disabled" - }, - "botSignatures": { - "check": "disabled", - "categories": [ - { - "name": "DOS Tool", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~DOS%20Tool?ver=13.1.1.4" - } - }, - { - "name": "E-Mail Collector", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~E-Mail%20Collector?ver=13.1.1.4" - } - }, - { - "name": "Exploit Tool", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Exploit%20Tool?ver=13.1.1.4" - } - }, - { - "name": "Network Scanner", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Network%20Scanner?ver=13.1.1.4" - } - }, - { - "name": "Search Engine", - "partition": "Common", - "action": "report", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Search%20Engine?ver=13.1.1.4" - } - }, - { - "name": "Spam Bot", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Spam%20Bot?ver=13.1.1.4" - } - }, - { - "name": "Spyware", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Spyware?ver=13.1.1.4" - } - }, - { - "name": "Vulnerability Scanner", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Vulnerability%20Scanner?ver=13.1.1.4" - } - }, - { - "name": "Web Spider", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Web%20Spider?ver=13.1.1.4" - } - }, - { - "name": "Webserver Stress Tool", - "partition": "Common", - "action": "block", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/dos/bot-signature-category/~Common~Webserver%20Stress%20Tool?ver=13.1.1.4" - } - } - ] - }, - "captchaResponse": { - "failure": { - "body": "You have entered an invalid answer for the question. Please, try again.\n
\n%DOSL7.captcha.image% %DOSL7.captcha.change%\n
\nWhat code is in the image\\?\n%DOSL7.captcha.solution%\n
\n%DOSL7.captcha.submit%\n
\n
\nYour support ID is: %DOSL7.captcha.support_id%.", - "type": "default" - }, - "first": { - "body": "This question is for testing whether you are a human visitor and to prevent automated spam submission.\n
\n%DOSL7.captcha.image% %DOSL7.captcha.change%\n
\nWhat code is in the image\\?\n%DOSL7.captcha.solution%\n
\n%DOSL7.captcha.submit%\n
\n
\nYour support ID is: %DOSL7.captcha.support_id%.", - "type": "default" - } - }, - "heavyUrls": { - "automaticDetection": "enabled", - "exclude": [ - "/exclude.html" - ], - "latencyThreshold": 1000, - "protection": "disabled", - "includeList": [ - { - "name": "URL/test.htm", - "threshold": "auto", - "url": "/test.htm" - }, - { - "name": "URL/testy.htm", - "threshold": "auto", - "url": "/testy.htm" - } - ] - }, - "mobileDetection": { - "allowAndroidRootedDevice": "false", - "allowAnyAndroidPackage": "false", - "allowAnyIosPackage": "false", - "allowEmulators": "true", - "allowJailbrokenDevices": "true", - "clientSideChallengeMode": "pass", - "enabled": "disabled", - "iosAllowedPackageNames": [ - "foobarapp" - ], - "androidPublishers": [ - { - "name": "ca-bundle.crt", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~ca-bundle.crt?ver=13.1.1.4" - } - } - ] - }, - "rtbhDurationSec": 300, - "rtbhEnable": "enabled", - "scrubbingDurationSec": 60, - "scrubbingEnable": "enabled", - "singlePageApplication": "enabled", - "stressBased": { - "behavioral": { - "dosDetection": "disabled", - "mitigationMode": "none", - "signatures": "disabled", - "signaturesApprovedOnly": "disabled" - }, - "deEscalationPeriod": 7200, - "deviceCaptchaChallenge": "disabled", - "deviceClientSideDefense": "disabled", - "deviceMaximumAutoTps": 5000, - "deviceMaximumTps": 200, - "deviceMinimumAutoTps": 5, - "deviceMinimumTps": 40, - "deviceRateLimiting": "disabled", - "deviceRequestBlockingMode": "rate-limit", - "deviceTpsIncreaseRate": 500, - "escalationPeriod": 120, - "geoCaptchaChallenge": "disabled", - "geoClientSideDefense": "disabled", - "geoMaximumAutoTps": 20000, - "geoMinimumAutoTps": 50, - "geoMinimumShare": 10, - "geoRateLimiting": "disabled", - "geoRequestBlockingMode": "rate-limit", - "geoShareIncreaseRate": 500, - "ipCaptchaChallenge": "disabled", - "ipClientSideDefense": "disabled", - "ipMaximumAutoTps": 5000, - "ipMaximumTps": 200, - "ipMinimumAutoTps": 5, - "ipMinimumTps": 40, - "ipRateLimiting": "enabled", - "ipRequestBlockingMode": "rate-limit", - "ipTpsIncreaseRate": 500, - "mode": "off", - "siteCaptchaChallenge": "disabled", - "siteClientSideDefense": "disabled", - "siteMaximumAutoTps": 20000, - "siteMaximumTps": 10000, - "siteMinimumAutoTps": 50, - "siteMinimumTps": 2000, - "siteRateLimiting": "disabled", - "siteTpsIncreaseRate": 500, - "thresholdsMode": "manual", - "urlCaptchaChallenge": "disabled", - "urlClientSideDefense": "disabled", - "urlEnableHeavy": "enabled", - "urlMaximumAutoTps": 5000, - "urlMaximumTps": 1000, - "urlMinimumAutoTps": 50, - "urlMinimumTps": 200, - "urlRateLimiting": "enabled", - "urlTpsIncreaseRate": 500 - }, - "tcpDump": { - "maximumDuration": 30, - "maximumSize": 10, - "recordTraffic": "disabled", - "repetitionInterval": "120" - }, - "tpsBased": { - "deEscalationPeriod": 7200, - "deviceCaptchaChallenge": "disabled", - "deviceClientSideDefense": "disabled", - "deviceMaximumAutoTps": 5000, - "deviceMaximumTps": 200, - "deviceMinimumAutoTps": 5, - "deviceMinimumTps": 40, - "deviceRateLimiting": "disabled", - "deviceRequestBlockingMode": "rate-limit", - "deviceTpsIncreaseRate": 500, - "escalationPeriod": 120, - "geoCaptchaChallenge": "disabled", - "geoClientSideDefense": "disabled", - "geoMaximumAutoTps": 20000, - "geoMinimumAutoTps": 50, - "geoMinimumShare": 10, - "geoRateLimiting": "disabled", - "geoRequestBlockingMode": "rate-limit", - "geoShareIncreaseRate": 500, - "ipCaptchaChallenge": "disabled", - "ipClientSideDefense": "disabled", - "ipMaximumAutoTps": 5000, - "ipMaximumTps": 200, - "ipMinimumAutoTps": 5, - "ipMinimumTps": 40, - "ipRateLimiting": "enabled", - "ipRequestBlockingMode": "rate-limit", - "ipTpsIncreaseRate": 500, - "mode": "off", - "siteCaptchaChallenge": "disabled", - "siteClientSideDefense": "disabled", - "siteMaximumAutoTps": 20000, - "siteMaximumTps": 10000, - "siteMinimumAutoTps": 50, - "siteMinimumTps": 2000, - "siteRateLimiting": "disabled", - "siteTpsIncreaseRate": 500, - "thresholdsMode": "manual", - "urlCaptchaChallenge": "disabled", - "urlClientSideDefense": "disabled", - "urlEnableHeavy": "enabled", - "urlMaximumAutoTps": 5000, - "urlMaximumTps": 1000, - "urlMinimumAutoTps": 50, - "urlMinimumTps": 200, - "urlRateLimiting": "enabled", - "urlTpsIncreaseRate": 500 - }, - "triggerIrule": "enabled", - "geolocations": [ - { - "name": "Afghanistan", - "blackListed": true - }, - { - "name": "Aland Islands", - "whiteListed": true - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_active.json b/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_active.json deleted file mode 100644 index 001daa75..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_active.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "plainTextProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/plain-text-profiles?ver=12.1.2", - "isSubCollection": true - }, - "learningMode": "manual", - "dataGuardReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/data-guard?ver=12.1.2" - }, - "stagingSettings": { - "signatureStaging": true, - "placeSignaturesInStaging": false, - "enforcementReadinessPeriod": 7 - }, - "createdDatetime": "2017-09-21T11:52:24Z", - "geolocationEnforcementReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/geolocation-enforcement?ver=12.1.2" - }, - "versionLastChange": "Allowed Response Code 503 [add]: Response Code was set to 503.", - "name": "fake_policy", - "caseInsensitive": false, - "loginPageReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/login-pages?ver=12.1.2", - "isSubCollection": true - }, - "fullPath": "/Common/fake_policy", - "description": "", - "attributes": { - "pathParameterHandling": "as-parameters", - "triggerAsmIruleEvent": "disabled", - "inspectHttpUploads": false, - "maskCreditCardNumbersInRequest": true, - "maximumHttpHeaderLength": "8192", - "useDynamicSessionIdInUrl": false, - "maximumCookieHeaderLength": "8192" - }, - "partition": "Common", - "webScrapingReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/web-scraping?ver=12.1.2" - }, - "csrfProtectionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/csrf-protection?ver=12.1.2" - }, - "customXffHeaders": [], - "kind": "tm:asm:policies:policystate", - "virtualServers": [], - "ipIntelligenceReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/ip-intelligence?ver=12.1.2" - }, - "protocolIndependent": false, - "sessionAwarenessSettingsReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/session-tracking?ver=12.1.2" - }, - "signatureSetReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/signature-sets?ver=12.1.2", - "isSubCollection": true - }, - "parameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/parameters?ver=12.1.2", - "isSubCollection": true - }, - "allowedResponseCodes": [ - 400, - 401, - 404, - 407, - 417, - 503 - ], - "applicationLanguage": "utf-8", - "enforcementMode": "transparent", - "loginEnforcementReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/login-enforcement?ver=12.1.2" - }, - "navigationParameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/navigation-parameters?ver=12.1.2", - "isSubCollection": true - }, - "gwtProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/gwt-profiles?ver=12.1.2", - "isSubCollection": true - }, - "whitelistIpReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/whitelist-ips?ver=12.1.2", - "isSubCollection": true - }, - "historyRevisionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/history-revisions?ver=12.1.2", - "isSubCollection": true - }, - "policyBuilderReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/policy-builder?ver=12.1.2" - }, - "responsePageReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/response-pages?ver=12.1.2", - "isSubCollection": true - }, - "vulnerabilityAssessmentReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/vulnerability-assessment?ver=12.1.2" - }, - "blockingSettingReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/blocking-settings?ver=12.1.2", - "isSubCollection": true - }, - "cookieReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/cookies?ver=12.1.2", - "isSubCollection": true - }, - "hostNameReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/host-names?ver=12.1.2", - "isSubCollection": true - }, - "versionDeviceName": "ltm4restlab.lab.local", - "selfLink": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw?ver=12.1.2", - "signatureReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/signatures?ver=12.1.2", - "isSubCollection": true - }, - "filetypeReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/filetypes?ver=12.1.2", - "isSubCollection": true - }, - "id": "0EHlYeS5noAOZLY3YsJjEw", - "manualVirtualServers": [], - "modifierName": "admin", - "versionDatetime": "2017-04-11T08:05:22Z", - "subPath": "/Common", - "sessionTrackingStatusReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/session-tracking-statuses?ver=12.1.2", - "isSubCollection": true - }, - "active": true, - "auditLogReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/audit-logs?ver=12.1.2", - "isSubCollection": true - }, - "trustXff": false, - "websocketUrlReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/websocket-urls?ver=12.1.2", - "isSubCollection": true - }, - "xmlProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/xml-profiles?ver=12.1.2", - "isSubCollection": true - }, - "methodReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/methods?ver=12.1.2", - "isSubCollection": true - }, - "redirectionProtectionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/redirection-protection?ver=12.1.2" - }, - "vulnerabilityReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/vulnerabilities?ver=12.1.2", - "isSubCollection": true - }, - "creatorName": "SYSTEM", - "urlReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/urls?ver=12.1.2", - "isSubCollection": true - }, - "headerReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/headers?ver=12.1.2", - "isSubCollection": true - }, - "xmlValidationFileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/xml-validation-files?ver=12.1.2", - "isSubCollection": true - }, - "lastUpdateMicros": 1.506250903e+15, - "jsonProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/json-profiles?ver=12.1.2", - "isSubCollection": true - }, - "bruteForceAttackPreventionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/brute-force-attack-preventions?ver=12.1.2", - "isSubCollection": true - }, - "extractionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/extractions?ver=12.1.2", - "isSubCollection": true - }, - "characterSetReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/character-sets?ver=12.1.2", - "isSubCollection": true - }, - "isModified": false, - "suggestionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/suggestions?ver=12.1.2", - "isSubCollection": true - }, - "sensitiveParameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/sensitive-parameters?ver=12.1.2", - "isSubCollection": true - }, - "versionPolicyName": "/Common/fake_policy" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_inactive.json b/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_inactive.json deleted file mode 100644 index 51988881..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_asm_policy_inactive.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "plainTextProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/plain-text-profiles?ver=12.1.2", - "isSubCollection": true - }, - "learningMode": "manual", - "dataGuardReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/data-guard?ver=12.1.2" - }, - "stagingSettings": { - "signatureStaging": true, - "placeSignaturesInStaging": false, - "enforcementReadinessPeriod": 7 - }, - "createdDatetime": "2017-09-21T11:52:24Z", - "geolocationEnforcementReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/geolocation-enforcement?ver=12.1.2" - }, - "versionLastChange": "Allowed Response Code 503 [add]: Response Code was set to 503.", - "name": "fake_policy", - "caseInsensitive": false, - "loginPageReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/login-pages?ver=12.1.2", - "isSubCollection": true - }, - "fullPath": "/Common/fake_policy", - "description": "", - "attributes": { - "pathParameterHandling": "as-parameters", - "triggerAsmIruleEvent": "disabled", - "inspectHttpUploads": false, - "maskCreditCardNumbersInRequest": true, - "maximumHttpHeaderLength": "8192", - "useDynamicSessionIdInUrl": false, - "maximumCookieHeaderLength": "8192" - }, - "partition": "Common", - "webScrapingReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/web-scraping?ver=12.1.2" - }, - "csrfProtectionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/csrf-protection?ver=12.1.2" - }, - "customXffHeaders": [], - "kind": "tm:asm:policies:policystate", - "virtualServers": [], - "ipIntelligenceReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/ip-intelligence?ver=12.1.2" - }, - "protocolIndependent": false, - "sessionAwarenessSettingsReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/session-tracking?ver=12.1.2" - }, - "signatureSetReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/signature-sets?ver=12.1.2", - "isSubCollection": true - }, - "parameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/parameters?ver=12.1.2", - "isSubCollection": true - }, - "allowedResponseCodes": [ - 400, - 401, - 404, - 407, - 417, - 503 - ], - "applicationLanguage": "utf-8", - "enforcementMode": "transparent", - "loginEnforcementReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/login-enforcement?ver=12.1.2" - }, - "navigationParameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/navigation-parameters?ver=12.1.2", - "isSubCollection": true - }, - "gwtProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/gwt-profiles?ver=12.1.2", - "isSubCollection": true - }, - "whitelistIpReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/whitelist-ips?ver=12.1.2", - "isSubCollection": true - }, - "historyRevisionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/history-revisions?ver=12.1.2", - "isSubCollection": true - }, - "policyBuilderReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/policy-builder?ver=12.1.2" - }, - "responsePageReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/response-pages?ver=12.1.2", - "isSubCollection": true - }, - "vulnerabilityAssessmentReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/vulnerability-assessment?ver=12.1.2" - }, - "blockingSettingReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/blocking-settings?ver=12.1.2", - "isSubCollection": true - }, - "cookieReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/cookies?ver=12.1.2", - "isSubCollection": true - }, - "hostNameReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/host-names?ver=12.1.2", - "isSubCollection": true - }, - "versionDeviceName": "ltm4restlab.lab.local", - "selfLink": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw?ver=12.1.2", - "signatureReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/signatures?ver=12.1.2", - "isSubCollection": true - }, - "filetypeReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/filetypes?ver=12.1.2", - "isSubCollection": true - }, - "id": "0EHlYeS5noAOZLY3YsJjEw", - "manualVirtualServers": [], - "modifierName": "", - "versionDatetime": "2017-04-11T08:05:22Z", - "subPath": "/Common", - "sessionTrackingStatusReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/session-tracking-statuses?ver=12.1.2", - "isSubCollection": true - }, - "active": false, - "auditLogReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/audit-logs?ver=12.1.2", - "isSubCollection": true - }, - "trustXff": false, - "websocketUrlReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/websocket-urls?ver=12.1.2", - "isSubCollection": true - }, - "xmlProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/xml-profiles?ver=12.1.2", - "isSubCollection": true - }, - "methodReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/methods?ver=12.1.2", - "isSubCollection": true - }, - "redirectionProtectionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/redirection-protection?ver=12.1.2" - }, - "vulnerabilityReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/vulnerabilities?ver=12.1.2", - "isSubCollection": true - }, - "creatorName": "SYSTEM", - "urlReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/urls?ver=12.1.2", - "isSubCollection": true - }, - "headerReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/headers?ver=12.1.2", - "isSubCollection": true - }, - "xmlValidationFileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/xml-validation-files?ver=12.1.2", - "isSubCollection": true - }, - "lastUpdateMicros": 0, - "jsonProfileReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/json-profiles?ver=12.1.2", - "isSubCollection": true - }, - "bruteForceAttackPreventionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/brute-force-attack-preventions?ver=12.1.2", - "isSubCollection": true - }, - "extractionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/extractions?ver=12.1.2", - "isSubCollection": true - }, - "characterSetReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/character-sets?ver=12.1.2", - "isSubCollection": true - }, - "isModified": false, - "suggestionReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/suggestions?ver=12.1.2", - "isSubCollection": true - }, - "sensitiveParameterReference": { - "link": "https://localhost/mgmt/tm/asm/policies/0EHlYeS5noAOZLY3YsJjEw/sensitive-parameters?ver=12.1.2", - "isSubCollection": true - }, - "versionPolicyName": "/Common/fake_policy" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_remote_role_role_info_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_auth_remote_role_role_info_1.json deleted file mode 100644 index b4d6038e..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_remote_role_role_info_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:auth:remote-role:role-info:role-infostate", - "name": "/Common/ldap_group", - "fullPath": "/Common/ldap_group", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/auth/remote-role/role-info/~Common~ldap_group?ver=13.1.0.7", - "attribute": "memberOf=cn=ldap_group,cn=ldap.group,ou=ldap", - "console": "disable", - "deny": "enabled", - "lineOrder": 1, - "role": "firewallmanager", - "userPartition": "All", - "userPartitionReference": { - "link": "https://localhost/mgmt/tm/auth/partition/All?ver=13.1.0.7" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_no_pass.json b/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_no_pass.json deleted file mode 100644 index 79a51a79..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_no_pass.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:auth:user:userstate", - "name": "someuser", - "fullPath": "someuser", - "generation": 76, - "selfLink": "https://localhost/mgmt/tm/auth/user/someuser?ver=13.0.0", - "description": "someuser", - "encryptedPassword": "!!", - "partitionAccess": [ - { - "name": "Common", - "role": "guest", - "nameReference": { - "link": "https://localhost/mgmt/tm/auth/partition/Common?ver=13.0.0" - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_with_pass.json b/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_with_pass.json deleted file mode 100644 index 8c8256c2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_auth_user_with_pass.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:auth:user:userstate", - "name": "someuser", - "fullPath": "someuser", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/auth/user/someuser?ver=13.0.0", - "description": "someuser", - "encryptedPassword": "$6$PiA0g2.L$M02nqo3eVvj22PbEUONdzFQq4tXp930FsBB0sZ94OJTDruobY/BhyEN1rHfw2udVKKlGtom1rNiCP/3nIVfde1", - "shell": "bash", - "partitionAccess": [ - { - "name": "all-partitions", - "role": "admin", - "nameReference": { - "link": "https://localhost/mgmt/tm/auth/partition/all-partitions?ver=13.0.0" - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_parser.json b/tests/unit/plugins/modules/network/f5/fixtures/load_generic_parser.json deleted file mode 100644 index c7bdc5fb..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_parser.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:ltm:message-routing:generic:protocol:protocolstate", - "name": "foobar", - "partition": "Common", - "fullPath": "/Common/foobar", - "generation": 534, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/protocol/~Common~foobar?ver=14.1.0.3", - "defaultsFrom": "/Common/genericmsg", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/message-routing/generic/protocol/~Common~genericmsg?ver=14.1.0.3" - }, - "disableParser": "no", - "maxEgressBuffer": 32768, - "maxMessageSize": 32768, - "noResponse": "no" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_peer.json b/tests/unit/plugins/modules/network/f5/fixtures/load_generic_peer.json deleted file mode 100644 index bda5b8e5..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_peer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "kind": "tm:ltm:message-routing:generic:peer:peerstate", - "name": "test", - "partition": "Common", - "fullPath": "/Common/test", - "generation": 177, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/peer/~Common~test?ver=14.1.0.3", - "autoInitialization": "disabled", - "autoInitializationInterval": 5000, - "connectionMode": "per-peer", - "description": "foobar", - "numberConnections": 1, - "pool": "/Common/example", - "poolReference": { - "link": "https://localhost/mgmt/tm/ltm/pool/~Common~example?ver=14.1.0.3" - }, - "ratio": 1, - "transportConfig": "/Common/test_tranport", - "transportConfigReference": { - "link": "https://localhost/mgmt/tm/ltm/message-routing/generic/transport-config/~Common~test_tranport?ver=14.1.0.3" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_route.json b/tests/unit/plugins/modules/network/f5/fixtures/load_generic_route.json deleted file mode 100644 index f8299f02..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_route.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:ltm:message-routing:generic:route:routestate", - "name": "some", - "partition": "Common", - "fullPath": "/Common/some", - "generation": 228, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/route/~Common~some?ver=14.1.0.3", - "destinationAddress": "annoying_user", - "peerSelectionMode": "sequential", - "sourceAddress": "99.99.99.99", - "peers": [ - "/Common/testy" - ], - "peersReference": [ - { - "link": "https://localhost/mgmt/tm/ltm/message-routing/generic/peer/~Common~testy?ver=14.1.0.3" - } - ] - } diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_router.json b/tests/unit/plugins/modules/network/f5/fixtures/load_generic_router.json deleted file mode 100644 index 45c67222..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_router.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "kind": "tm:ltm:message-routing:generic:router:routerstate", - "name": "messagerouter", - "partition": "Common", - "fullPath": "/Common/messagerouter", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/router/~Common~messagerouter?ver=14.1.0.3", - "ignoreClientPort": "no", - "inheritedTrafficGroup": "true", - "iruleScopeMessage": "no", - "maxPayloadPendingBytes": 32768, - "maxPendingBytes": 23768, - "maxPendingMessages": 64, - "maxRetries": 1, - "mirror": "disabled", - "mirroredMessageSweeperInterval": 1000, - "trafficGroup": "/Common/traffic-group-1", - "trafficGroupReference": { - "link": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-1?ver=14.1.0.3" - }, - "useLocalConnection": "yes" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_transport_config.json b/tests/unit/plugins/modules/network/f5/fixtures/load_generic_transport_config.json deleted file mode 100644 index 15121910..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_generic_transport_config.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "kind": "tm:ltm:message-routing:generic:transport-config:transport-configstate", - "name": "gen1", - "partition": "Common", - "fullPath": "/Common/gen1", - "generation": 643, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/transport-config/~Common~gen1?expandSubcollections=true&ver=14.1.0.3", - "ipProtocol": "tcp", - "sourceAddressTranslation": { - "pool": "/Common/test_snat", - "poolReference": { - "link": "https://localhost/mgmt/tm/ltm/snatpool/~Common~test_snat?ver=14.1.0.3" - }, - "type": "snat" - }, - "sourcePort": 0, - "rules": [ - "/Common/test" - ], - "rulesReference": [ - { - "link": "https://localhost/mgmt/tm/ltm/rule/~Common~test?ver=14.1.0.3" - } - ], - "profilesReference": { - "link": "https://localhost/mgmt/tm/ltm/message-routing/generic/transport-config/~Common~gen1/profiles?ver=14.1.0.3", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:message-routing:generic:transport-config:profiles:profilesstate", - "name": "diametersession", - "partition": "Common", - "fullPath": "/Common/diametersession", - "generation": 626, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/transport-config/~Common~gen1/profiles/~Common~diametersession?ver=14.1.0.3", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/message-routing/diameter/profile/session/~Common~diametersession?ver=14.1.0.3" - } - }, - { - "kind": "tm:ltm:message-routing:generic:transport-config:profiles:profilesstate", - "name": "tcp", - "partition": "Common", - "fullPath": "/Common/tcp", - "generation": 626, - "selfLink": "https://localhost/mgmt/tm/ltm/message-routing/generic/transport-config/~Common~gen1/profiles/~Common~tcp?ver=14.1.0.3", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver=14.1.0.3" - } - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_default.json deleted file mode 100644 index 9e1f3b8d..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_default.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "kind": "tm:gtm:datacenter:datacenterstate", - "name": "asd", - "partition": "Common", - "fullPath": "/Common/asd", - "generation": 278, - "selfLink": "https://localhost/mgmt/tm/gtm/datacenter/~Common~asd?ver=12.1.2", - "enabled": true -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_disabled.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_disabled.json deleted file mode 100644 index 8373ac82..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_datacenter_disabled.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "kind": "tm:gtm:datacenter:datacenterstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 303, - "selfLink": "https://localhost/mgmt/tm/gtm/datacenter/~Common~foo?ver=12.1.2", - "contact": "admin@root.local", - "description": "This is a foo description", - "disabled": true, - "location": "New York" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_global_settings_general_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_global_settings_general_1.json deleted file mode 100644 index 68032876..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_global_settings_general_1.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:gtm:global-settings:general:generalstate", - "selfLink": "https://localhost/mgmt/tm/gtm/global-settings/general?ver=13.1.0.4", - "autoDiscovery": "yes", - "autoDiscoveryInterval": 30, - "automaticConfigurationSaveTimeout": 15, - "cacheLdnsServers": "yes", - "domainNameCheck": "allow-underscore", - "drainPersistentRequests": "yes", - "forwardStatus": "disabled", - "gtmSetsRecursion": "no", - "heartbeatInterval": 10, - "monitorDisabledObjects": "no", - "nethsmTimeout": 20, - "sendWildcardRrs": "disabled", - "staticPersistCidrIpv4": 32, - "staticPersistCidrIpv6": 128, - "synchronization": "no", - "synchronizationGroupName": "default", - "synchronizationTimeTolerance": 10, - "synchronizationTimeout": 180, - "synchronizeZoneFiles": "no", - "synchronizeZoneFilesTimeout": 300, - "virtualsDependOnServerState": "yes" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_irules.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_irules.json deleted file mode 100644 index 7ca9da1b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_irules.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "kind": "tm:gtm:rule:rulestate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 92, - "selfLink": "https://localhost/mgmt/tm/gtm/rule/~Common~asdf?ver=12.1.2", - "apiAnonymous": "when DNS_REQUEST {\n if { [IP::addr [IP::remote_addr] equals 10.254.254.0/24] } {\n cname test.affilate.example.com\n\n } elseif { [IP::addr [IP::remote_addr] equals 10.0.0.0/8] } {\n cname test.internal.example.com\n\n }\n #everything else will be handled by the default pools in the main WIP\n}" - }, - { - "kind": "tm:gtm:rule:rulestate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 93, - "selfLink": "https://localhost/mgmt/tm/gtm/rule/~Common~foo?ver=12.1.2", - "apiAnonymous": "when LB_SELECTED {\n # Capture IP address chosen by WIP load balancing\n set wipHost [LB::server addr]\n}\n\nwhen LB_FAILED {\n set wipHost [LB::server addr]\n}" - } - ] diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_firepass_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_firepass_1.json deleted file mode 100644 index 4b0f8f72..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_firepass_1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:gtm:monitor:firepass:firepassstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/gtm/monitor/firepass/~Common~foo?ver=13.1.0.4", - "cipherlist": "HIGH:!ADH", - "concurrencyLimit": 95, - "defaultsFrom": "/Common/firepass_gtm", - "destination": "1.1.1.1:80", - "ignoreDownResponse": "enabled", - "interval": 30, - "maxLoadAverage": 12, - "password": "secret", - "probeTimeout": 5, - "timeout": 90, - "username": "gtmuser" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_http_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_http_1.json deleted file mode 100644 index 98151e51..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_http_1.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "kind": "tm:gtm:monitor:http:httpstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/gtm/monitor/http/~Common~foo?ver=13.1.0.4", - "defaultsFrom": "/Common/http", - "description": "my description", - "destination": "3.3.3.3:8080", - "ignoreDownResponse": "disabled", - "interval": 30, - "password": "secret", - "probeTimeout": 5, - "recv": "the receive string", - "reverse": "enabled", - "send": "GET /", - "timeout": 120, - "transparent": "enabled", - "username": "user1" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_tcp_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_tcp_1.json deleted file mode 100644 index d0d90152..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_monitor_tcp_1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:gtm:monitor:tcp:tcpstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/gtm/monitor/tcp/~Common~foo?ver=13.1.0.4", - "defaultsFrom": "/Common/tcp", - "destination": "1.1.1.1:80", - "ignoreDownResponse": "disabled", - "interval": 30, - "probeTimeout": 5, - "recv": "the receive string", - "reverse": "enabled", - "send": "the send string", - "timeout": 120, - "transparent": "enabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_collection.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_collection.json deleted file mode 100644 index 7ed53445..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_collection.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "kind": "tm:gtm:pool:a:acollectionstate", - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a?expandSubcollections=true&ver=13.0.0", - "items": [ - { - "kind": "tm:gtm:pool:a:astate", - "name": "foo.pool", - "partition": "Common", - "fullPath": "/Common/foo.pool", - "generation": 216, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo.pool?ver=13.0.0", - "alternateMode": "round-robin", - "dynamicRatio": "disabled", - "enabled": true, - "fallbackIp": "any", - "fallbackMode": "return-to-dns", - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "loadBalancingMode": "round-robin", - "manualResume": "disabled", - "maxAnswersReturned": 1, - "monitor": "default", - "qosHitRatio": 5, - "qosHops": 0, - "qosKilobytesSecond": 3, - "qosLcs": 30, - "qosPacketRate": 1, - "qosRtt": 50, - "qosTopology": 0, - "qosVsCapacity": 0, - "qosVsScore": 0, - "ttl": 30, - "verifyMemberAvailability": "enabled", - "membersReference": { - "link": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo.pool/members?ver=13.0.0", - "isSubcollection": true - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_default.json deleted file mode 100644 index f90a84b2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_default.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "kind": "tm:gtm:pool:a:astate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 94, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~asdf?ver=12.1.2", - "alternateMode": "round-robin", - "dynamicRatio": "disabled", - "enabled": true, - "fallbackIp": "any", - "fallbackMode": "return-to-dns", - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "loadBalancingMode": "round-robin", - "manualResume": "disabled", - "maxAnswersReturned": 1, - "monitor": "default", - "qosHitRatio": 5, - "qosHops": 0, - "qosKilobytesSecond": 3, - "qosLcs": 30, - "qosPacketRate": 1, - "qosRtt": 50, - "qosTopology": 0, - "qosVsCapacity": 0, - "qosVsScore": 0, - "ttl": 30, - "verifyMemberAvailability": "enabled", - "membersReference": { - "link": "https://localhost/mgmt/tm/gtm/pool/a/~Common~asdf/members?ver=12.1.2", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_example_stats.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_example_stats.json deleted file mode 100644 index 70388c91..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_example_stats.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "kind": "tm:gtm:pool:a:astats", - "generation": 216, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo.pool/stats?ver=13.0.0", - "entries": { - "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo.pool/~Common~foo.pool:A/stats": { - "nestedStats": { - "kind": "tm:gtm:pool:a:astats", - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo.pool/~Common~foo.pool:A/stats?ver=13.0.0", - "entries": { - "alternate": { - "value": 0 - }, - "dropped": { - "value": 0 - }, - "fallback": { - "value": 0 - }, - "tmName": { - "description": "/Common/foo.pool" - }, - "poolType": { - "description": "A" - }, - "preferred": { - "value": 0 - }, - "returnFromDns": { - "value": 0 - }, - "returnToDns": { - "value": 0 - }, - "status.availabilityState": { - "description": "offline" - }, - "status.enabledState": { - "description": "enabled" - }, - "status.statusReason": { - "description": "No enabled pool members available" - } - } - } - } - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_member_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_member_1.json deleted file mode 100644 index 44ae64a6..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_member_1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:gtm:pool:a:members:membersstate", - "name": "foo_gtm_server:bar", - "partition": "Common", - "fullPath": "/Common/foo_gtm_server:bar", - "generation": 398, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo-pool/members/~Common~foo_gtm_server:bar?ver=13.0.0", - "enabled": true, - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "memberOrder": 1, - "monitor": "default", - "ratio": 1 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_with_members_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_with_members_1.json deleted file mode 100644 index ba2ac716..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_a_with_members_1.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "kind": "tm:gtm:pool:a:astate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 142, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo?expandSubcollections=true&ver=12.0.0", - "alternateMode": "round-robin", - "dynamicRatio": "disabled", - "enabled": true, - "fallbackIp": "any", - "fallbackMode": "return-to-dns", - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "loadBalancingMode": "round-robin", - "manualResume": "disabled", - "maxAnswersReturned": 1, - "monitor": "default", - "qosHitRatio": 5, - "qosHops": 0, - "qosKilobytesSecond": 3, - "qosLcs": 30, - "qosPacketRate": 1, - "qosRtt": 50, - "qosTopology": 0, - "qosVsCapacity": 0, - "qosVsScore": 0, - "ttl": 30, - "verifyMemberAvailability": "enabled", - "membersReference": { - "link": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members?ver=12.0.0", - "isSubcollection": true, - "items": [ - { - "kind": "tm:gtm:pool:a:members:membersstate", - "name": "server1:vs1", - "partition": "Common", - "fullPath": "/Common/server1:vs1", - "generation": 141, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs1?ver=12.0.0", - "enabled": true, - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "memberOrder": 0, - "monitor": "default", - "ratio": 1 - }, - { - "kind": "tm:gtm:pool:a:members:membersstate", - "name": "server1:vs2", - "partition": "Common", - "fullPath": "/Common/server1:vs2", - "generation": 142, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs1?ver=12.0.0", - "enabled": true, - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "memberOrder": 1, - "monitor": "/Common/tcp ", - "ratio": 1 - }, - { - "kind": "tm:gtm:pool:a:members:membersstate", - "name": "server1:vs3", - "partition": "Common", - "fullPath": "/Common/server1:vs3", - "generation": 141, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/a/~Common~foo/members/~Common~server1:vs3?ver=12.0.0", - "enabled": true, - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "memberOrder": 2, - "monitor": "default", - "ratio": 1 - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_untyped_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_untyped_default.json deleted file mode 100644 index c4ecb1dd..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_pool_untyped_default.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "kind": "tm:gtm:pool:poolstate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 92, - "selfLink": "https://localhost/mgmt/tm/gtm/pool/~Common~asdf?ver=11.6.1", - "alternateMode": "round-robin", - "dynamicRatio": "disabled", - "enabled": true, - "fallbackIpv4": "any", - "fallbackIpv6": "any6", - "fallbackMode": "return-to-dns", - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "loadBalancingMode": "round-robin", - "manualResume": "disabled", - "maxAddressReturned": 1, - "monitor": "default", - "qosHitRatio": 5, - "qosHops": 0, - "qosKilobytesSecond": 3, - "qosLcs": 30, - "qosPacketRate": 1, - "qosRtt": 50, - "qosTopology": 0, - "qosVsCapacity": 0, - "qosVsScore": 0, - "ttl": 30, - "verifyMemberAvailability": "enabled", - "membersReference": { - "link": "https://localhost/mgmt/tm/gtm/pool/~Common~asdf/members?ver=11.6.1", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_1.json deleted file mode 100644 index 4a14d9f2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_1.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "kind": "tm:gtm:server:serverstate", - "name": "baz", - "partition": "Common", - "fullPath": "/Common/baz", - "generation": 270, - "selfLink": "https://localhost/mgmt/tm/gtm/server/~Common~baz?ver=13.0.0", - "datacenter": "/Common/foo", - "datacenterReference": { - "link": "https://localhost/mgmt/tm/gtm/datacenter/~Common~foo?ver=13.0.0" - }, - "enabled": true, - "exposeRouteDomains": "no", - "iqAllowPath": "yes", - "iqAllowServiceCheck": "yes", - "iqAllowSnmp": "yes", - "limitCpuUsage": 0, - "limitCpuUsageStatus": "disabled", - "limitMaxBps": 0, - "limitMaxBpsStatus": "disabled", - "limitMaxConnections": 0, - "limitMaxConnectionsStatus": "disabled", - "limitMaxPps": 0, - "limitMaxPpsStatus": "disabled", - "limitMemAvail": 0, - "limitMemAvailStatus": "disabled", - "linkDiscovery": "disabled", - "monitor": "/Common/bigip ", - "proberFallback": "inherit", - "proberPreference": "inherit", - "product": "bigip", - "virtualServerDiscovery": "disabled", - "addresses": [ - { - "name": "1.1.1.1", - "deviceName": "bigip1", - "translation": "10.10.10.10" - }, - { - "name": "2.2.2.2", - "deviceName": "bigip2", - "translation": "20.20.20.20" - }, - { - "name": "3.3.3.3", - "deviceName": "bigip2", - "translation": "20.20.20.20" - }, - { - "name": "4.4.4.4", - "deviceName": "bigip3", - "translation": "none" - }, - { - "name": "5.5.5.5", - "deviceName": "bigip3", - "translation": "none" - } - ], - "devicesReference": { - "link": "https://localhost/mgmt/tm/gtm/server/~Common~baz/devices?ver=13.0.0", - "isSubcollection": true - }, - "virtualServersReference": { - "link": "https://localhost/mgmt/tm/gtm/server/~Common~baz/virtual-servers?ver=13.0.0", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_virtual_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_virtual_2.json deleted file mode 100644 index 336c391b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_server_virtual_2.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:gtm:server:virtual-servers:virtual-serversstate", - "name": "vs2", - "fullPath": "vs2", - "generation": 129, - "selfLink": "https://localhost/mgmt/tm/gtm/server/~Common~server1/virtual-servers/vs2?ver=13.0.0", - "destination": "6.6.6.6:8080", - "enabled": true, - "limitMaxBps": 100, - "limitMaxBpsStatus": "enabled", - "limitMaxConnections": 300, - "limitMaxConnectionsStatus": "enabled", - "limitMaxPps": 200, - "limitMaxPpsStatus": "enabled", - "monitor": "/Common/gtp ", - "translationAddress": "none", - "translationPort": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_wide_ip_with_pools.json b/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_wide_ip_with_pools.json deleted file mode 100644 index a7be079c..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_gtm_wide_ip_with_pools.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "kind": "tm:gtm:wideip:a:astate", - "name": "foo.bar.com", - "partition": "Common", - "fullPath": "/Common/foo.bar.com", - "generation": 135, - "selfLink": "https://localhost/mgmt/tm/gtm/wideip/a/~Common~foo.bar.com?ver=13.0.0", - "enabled": true, - "failureRcode": "noerror", - "failureRcodeResponse": "disabled", - "failureRcodeTtl": 0, - "lastResortPool": "", - "minimalResponse": "enabled", - "persistCidrIpv4": 32, - "persistCidrIpv6": 128, - "persistence": "disabled", - "poolLbMode": "round-robin", - "ttlPersistence": 3600, - "pools": [ - { - "name": "baz", - "partition": "Common", - "order": 0, - "ratio": 10, - "nameReference": { - "link": "https://localhost/mgmt/tm/gtm/pool/a/~Common~baz?ver=13.0.0" - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_imish_output_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_imish_output_1.json deleted file mode 100644 index a2b72a2a..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_imish_output_1.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "kind": "tm:util:bash:runstate", - "command": "run", - "utilCmdArgs": "-c 'imish -r 0 -e \"show running-config\"'", - "commandResult": "!\nno service password-encryption\n!\nline con 0\n login\nline vty 0 39\n login\n!\nend\n\n" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_cache_resolver_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_cache_resolver_1.json deleted file mode 100644 index 5a0e9b75..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_cache_resolver_1.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "kind": "tm:ltm:dns:cache:resolver:resolverstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 666, - "selfLink": "https://localhost/mgmt/tm/ltm/dns/cache/resolver/~Common~foo?ver=13.1.0.7", - "allowedQueryTime": 200, - "answerDefaultZones": "no", - "maxConcurrentQueries": 1024, - "maxConcurrentTcp": 20, - "maxConcurrentUdp": 8192, - "msgCacheSize": 1048576, - "nameserverCacheCount": 16536, - "randomizeQueryNameCase": "yes", - "routeDomain": "/Common/0", - "routeDomainReference": { - "link": "https://localhost/mgmt/tm/net/route-domain/~Common~0?ver=13.1.0.7" - }, - "rrsetCacheSize": 10485760, - "rrsetRotate": "none", - "unwantedQueryReplyThreshold": 0, - "useIpv4": "yes", - "useIpv6": "yes", - "useTcp": "yes", - "useUdp": "yes", - "forwardZones": [ - { - "name": "foo1", - "nameservers": [ - { - "name": "1.1.1.1:53" - }, - { - "name": "2.2.2.2:53" - } - ] - }, - { - "name": "foo2" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_nameserver_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_nameserver_1.json deleted file mode 100644 index e012103b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_nameserver_1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:ltm:dns:nameserver:nameserverstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 8076, - "selfLink": "https://localhost/mgmt/tm/ltm/dns/nameserver/~Common~foo?ver=13.1.0.7", - "address": "127.0.0.1", - "port": 53, - "routeDomain": "/Common/0", - "routeDomainReference": { - "link": "https://localhost/mgmt/tm/net/route-domain/~Common~0?ver=13.1.0.7" - }, - "tsigKey": "/Common/key1", - "tsigKeyReference": { - "link": "https://localhost/mgmt/tm/ltm/dns/tsig-key/~Common~key1?ver=13.1.0.7" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_zone_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_zone_1.json deleted file mode 100644 index 686de99b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_dns_zone_1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "kind": "tm:ltm:dns:zone:zonestate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 812, - "selfLink": "https://localhost/mgmt/tm/ltm/dns/zone/~Common~foo?ver=13.1.0.8", - "dnsExpressAllowNotify": [ - "1.1.1.1" - ], - "dnsExpressEnabled": "yes", - "dnsExpressNotifyAction": "consume", - "dnsExpressNotifyTsigVerify": "yes", - "dnsExpressServer": "/Common/asd", - "dnsExpressServerReference": { - "link": "https://localhost/mgmt/tm/ltm/dns/nameserver/~Common~asd?ver=13.1.0.8" - }, - "responsePolicy": "no", - "serverTsigKey": "/Common/asd", - "serverTsigKeyReference": { - "link": "https://localhost/mgmt/tm/ltm/dns/tsig-key/~Common~asd?ver=13.1.0.8" - }, - "transferClients": [ - "/Common/asd" - ], - "transferClientsReference": [ - { - "link": "https://localhost/mgmt/tm/ltm/dns/nameserver/~Common~asd?ver=13.1.0.8" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_fastl4_profile_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_fastl4_profile_1.json deleted file mode 100644 index 2667968c..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_fastl4_profile_1.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "kind": "tm:ltm:profile:fastl4:fastl4state", - "name": "fastL4", - "partition": "Common", - "fullPath": "/Common/fastL4", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/fastl4/~Common~fastL4?ver=13.1.0.8", - "appService": "none", - "clientTimeout": 30, - "defaultsFrom": "none", - "description": "none", - "explicitFlowMigration": "disabled", - "hardwareSynCookie": "disabled", - "idleTimeout": "300", - "ipDfMode": "preserve", - "ipTosToClient": "pass-through", - "ipTosToServer": "pass-through", - "ipTtlMode": "decrement", - "ipTtlV4": 255, - "ipTtlV6": 64, - "keepAliveInterval": "disabled", - "lateBinding": "disabled", - "linkQosToClient": "pass-through", - "linkQosToServer": "pass-through", - "looseClose": "disabled", - "looseInitialization": "disabled", - "mssOverride": 0, - "priorityToClient": "pass-through", - "priorityToServer": "pass-through", - "pvaAcceleration": "full", - "pvaDynamicClientPackets": 1, - "pvaDynamicServerPackets": 0, - "pvaFlowAging": "enabled", - "pvaFlowEvict": "enabled", - "pvaOffloadDynamic": "enabled", - "pvaOffloadState": "embryonic", - "reassembleFragments": "disabled", - "receiveWindowSize": 0, - "resetOnTimeout": "enabled", - "rttFromClient": "disabled", - "rttFromServer": "disabled", - "serverSack": "disabled", - "serverTimestamp": "disabled", - "softwareSynCookie": "disabled", - "synCookieEnable": "enabled", - "synCookieMss": 0, - "synCookieWhitelist": "disabled", - "tcpCloseTimeout": "5", - "tcpGenerateIsn": "disabled", - "tcpHandshakeTimeout": "5", - "tcpStripSack": "disabled", - "tcpTimeWaitTimeout": 0, - "tcpTimestampMode": "preserve", - "tcpWscaleMode": "preserve", - "timeoutRecovery": "disconnect" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http2_profile.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http2_profile.json deleted file mode 100644 index 3d8c9bce..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http2_profile.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "kind": "tm:ltm:profile:http2:http2state", - "name": "test", - "partition": "Common", - "fullPath": "/Common/test", - "generation": 5852, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/http2/~Common~test?ver=13.1.0.8", - "activationModes": [ - "always" - ], - "appService": "none", - "concurrentStreamsPerConnection": 10, - "connectionIdleTimeout": 300, - "defaultsFrom": "/Common/http2", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/http2/~Common~http2?ver=13.1.0.8" - }, - "description": "this is awful documentation", - "enforceTlsRequirements": "enabled", - "frameSize": 2048, - "headerTableSize": 4096, - "includeContentLength": "disabled", - "insertHeader": "disabled", - "insertHeaderName": "X-HTTP2", - "receiveWindow": 32, - "writeSize": 16384 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http_profile_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http_profile_1.json deleted file mode 100644 index 0d8f83c7..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_http_profile_1.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "kind": "tm:ltm:profile:http:httpstate", - "name": "http", - "partition": "Common", - "fullPath": "/Common/http", - "generation": 1405, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/http/~Common~http?ver=13.1.0.6", - "acceptXff": "disabled", - "appService": "none", - "basicAuthRealm": "none", - "defaultsFrom": "none", - "description": "none", - "encryptCookies": [], - "enforcement": { - "excessClientHeaders": "reject", - "excessServerHeaders": "reject", - "knownMethods": [ - "CONNECT", - "DELETE", - "GET", - "HEAD", - "LOCK", - "OPTIONS", - "POST", - "PROPFIND", - "PUT", - "TRACE", - "UNLOCK" - ], - "maxHeaderCount": 64, - "maxHeaderSize": 32768, - "maxRequests": 0, - "oversizeClientHeaders": "reject", - "oversizeServerHeaders": "reject", - "pipeline": "allow", - "truncatedRedirects": "disabled", - "unknownMethod": "allow" - }, - "explicitProxy": { - "badRequestMessage": "none", - "badResponseMessage": "none", - "connectErrorMessage": "none", - "defaultConnectHandling": "deny", - "dnsErrorMessage": "none", - "dnsResolver": "none", - "hostNames": [], - "ipv6": "no", - "routeDomain": "none", - "tunnelName": "none" - }, - "fallbackHost": "none", - "fallbackStatusCodes": [], - "headerErase": "none", - "headerInsert": "none", - "hsts": { - "includeSubdomains": "enabled", - "maximumAge": 16070400, - "mode": "disabled", - "preload": "disabled" - }, - "insertXforwardedFor": "disabled", - "lwsSeparator": "none", - "lwsWidth": 80, - "oneconnectTransformations": "enabled", - "proxyType": "reverse", - "redirectRewrite": "none", - "requestChunking": "preserve", - "responseChunking": "selective", - "responseHeadersPermitted": [], - "serverAgentName": "BigIP", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes", - "samplingRate": 0, - "samplingRateGlobal": "yes" - }, - "viaHostName": "none", - "viaRequest": "preserve", - "viaResponse": "preserve", - "xffAlternativeNames": [] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_irules.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_irules.json deleted file mode 100644 index b3e026a1..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_irules.json +++ /dev/null @@ -1,179 +0,0 @@ -[ - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_ExchangeSupport_OA_BasicAuth", - "partition": "Common", - "fullPath": "/Common/_sys_APM_ExchangeSupport_OA_BasicAuth", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_ExchangeSupport_OA_BasicAuth?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \n # Global variables\n # static::POLICY_RESULT_CACHE_AUTHFAILED\n # Administrator can set this into 1, when there is a necessity to cache failed policy result.\n # This may be needed to avoid account locked caused by the Active Sync device when it uses wrong passwords.\n # One possible scenario, is that when the user changes the password in Active Directory, but missed to changed in their devices.\n # Responses\n # On denied result\n # Administrator can customize the responses to the device depends on more complex conditions when necessary.\n # In those cases, please use ACCESS::respond command.\n # The following is the syntax of ACCESS::respond\n # ACCESS::respond [ content ] [ * ]\n # e.g. ACCESS::respond 401 content \"Error: Denied\" WWW-Authenticate \"basic realm=\\\"f5.com\\\"\" Connection close\n when RULE_INIT {\n # Please set the following global variables for customized responses.\n set static::actsync_401_http_body \"Authentication FailuredError: Authentication Failure\"\n set static::actsync_503_http_body \"Service is not availableError: Service is not available\"\n set static::ACCESS_LOG_PREFIX \"01490000:7:\"\n\n # Second Virtual Server name for 401 NTLM responder\n set static::ACCESS_SECOND_VIRTUAL_NAME \"_ACCESS_401_NTLM_responder_HTTPS\"\n\n set static::POLICY_INPROGRESS \"policy_inprogress\"\n set static::POLICY_AUTHFAILED \"policy_authfailed\"\n # The request with huge content length can not be used for starting ACCESS session.\n # This kind of request will be put on hold, and this iRule will try to use another\n # request to start the session. The following value is used for Outlook Anywhere.\n set static::OA_MAGIC_CONTENT_LEN 1073741824\n\n # Similar with OutlookAnywhere case, ACCESS can not use the request which is\n # larger then following size. This becomes an issue with application that using\n # Exchange Web Service as its main protocol such as Mac OS X applications\n # (e.g. Mail app, Microsoft Entourage, etc)\n # This kind of request will be put on hold, and this iRule will try to use another\n # request to start the session.\n set static::FIRST_BIG_POST_CONTENT_LEN 640000\n\n # Set it into 1 if the backend EWS handler accepts HTTP Basic Authentication.\n set static::EWS_BKEND_BASIC_AUTH 0\n # The following variable controls the polling mechanism.\n set static::POLICY_RESULT_POLL_INTERVAL 250\n set static::POLICY_RESULT_POLL_MAXRETRYCYCLE 600\n\n # Set this global variable to 1 for caching authentication failure\n # Useful for avoiding account locked out.\n set static::POLICY_RESULT_CACHE_AUTHFAILED 0\n\n # set this global variable to set alternative timeout for particular session\n set static::POLICY_ALT_INACTIVITY_TIMEOUT 120\n\n set static::ACCESS_USERKEY_TBLNAME \"_access_userkey\"\n\n\n set static::ACCESS_DEL_COOKIE_HDR_VAL \"MRHSession=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/\"\n\n log -noname accesscontrol.local1.debug \"01490000:7: EWS_BKEND_BASIC_AUTH = $static::EWS_BKEND_BASIC_AUTH\"\n }\n when ACCESS_ACL_ALLOWED {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX [HTTP::method] [HTTP::uri] [HTTP::header Content-Length]\"\n\n # MSFT Exchange's EWS request handler always requesting NTLM even the connection has been\n # already authenticated if there is a HTTP Basic Auth in the request.\n if { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 } {\n if { $static::EWS_BKEND_BASIC_AUTH == 0 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Removing HTTP Basic Authorization header\"\n HTTP::header remove Authorization\n }\n }\n }\n\n when HTTP_REQUEST {\n set http_path [ string tolower [HTTP::path] ]\n set f_clientless_mode 0\n set f_alt_inactivity_timeout 0\n set f_rpc_over_http 0\n set f_exchange_web_service 0\n set f_auto_discover 0\n set f_activesync 0\n set f_offline_address_book 0\n set f_availability_service 0\n\n # Here put appropriate pool when necessary.\n switch -glob $http_path {\n \"/rpc/rpcproxy.dll\" {\n # Supports for RPC over HTTP. (Outlook Anywhere)\n set f_rpc_over_http 1\n }\n \"/autodiscover/autodiscover.xml\" {\n # Supports for Auto Discover protocol.\n set f_auto_discover 1\n # This request does not require long inactivity timeout.\n # Don't use this for now\n set f_alt_inactivity_timeout 0\n }\n \"/microsoft-server-activesync\" {\n # Supports for ActiveSync\n set f_activesync 1\n }\n \"/oab/*\" {\n # Supports for Offline Address Book\n set f_offline_address_book 1\n # Don't use this for now\n set f_alt_inactivity_timeout 0\n }\n \"/ews/*\" {\n # Support for Exchange Web Service\n # Outlook's Availability Service borrows this protocol.\n set f_exchange_web_service 1\n }\n \"/as/*\" {\n # Support for Availability Service.\n # do nothing for now. (Untested)\n set f_availability_service 1\n }\n default {\n return\n }\n }\n\n set f_reqside_set_sess_id 0\n set http_method [HTTP::method]\n set http_hdr_host [HTTP::host]\n set http_hdr_uagent [HTTP::header User-Agent]\n set http_uri [HTTP::uri]\n set http_content_len [HTTP::header Content-Length]\n set MRHSession_cookie [HTTP::cookie value MRHSession]\n set auth_info_b64enc \"\"\n\n if { ! [ info exists src_ip ] } {\n set src_ip [IP::remote_addr]\n }\n if { ! [ info exists PROFILE_POLICY_TIMEOUT ] } {\n set PROFILE_POLICY_TIMEOUT [PROFILE::access access_policy_timeout]\n }\n if { ! [ info exists PROFILE_MAX_SESS_TIMEOUT ] } {\n set PROFILE_MAX_SESS_TIMEOUT [PROFILE::access max_session_timeout]\n }\n if { ! [ info exists PROFILE_RESTRICT_SINGLE_IP ] } {\n set PROFILE_RESTRICT_SINGLE_IP 1\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX method: $http_method\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Src IP: $src_ip\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX User-Agent: $http_hdr_uagent\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP uri: $http_uri\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP len: $http_content_len\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Restrict-to-single-client-ip: $PROFILE_RESTRICT_SINGLE_IP\"\n\n # First, do we have valid MRHSession cookie.\n if { $MRHSession_cookie != \"\" } {\n if { [ACCESS::session exists -state_allow -sid $MRHSession_cookie] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n }\n\n set http_hdr_auth [HTTP::header Authorization]\n if { [ string match -nocase {basic *} $http_hdr_auth ] != 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Not basic authentication. Ignore received auth header\"\n set http_hdr_auth \"\"\n }\n\n if { $http_hdr_auth == \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX No/Empty Auth header\"\n # clean up the cookie\n if { $MRHSession_cookie == \"\" } {\n HTTP::respond 401 content $static::actsync_401_http_body WWW-Authenticate \"Basic realm=\\\"[HTTP::header Host]\\\"\" Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection Close\n return\n }\n # Do nothing if we have a valid MRHSession cookie.\n }\n\n set f_release_request 0\n # Optimization for clients which support cookie\n if { $MRHSession_cookie != \"\" } {\n # Default profile access setting is false\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n set f_release_request 1\n }\n elseif { [ IP::addr $src_ip equals [ ACCESS::session data get -sid $MRHSession_cookie \"session.user.clientip\" ] ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP matched\"\n set f_release_request 1\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP does not matched\"\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n }\n\n if { $f_release_request == 0 } {\n set apm_username [string tolower [HTTP::username]]\n set apm_password [HTTP::password]\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n binary scan [md5 \"$apm_password\"] H* user_hash\n }\n else {\n binary scan [md5 \"$apm_password$src_ip\"] H* user_hash\n }\n set user_key \"$apm_username.$user_hash\"\n unset user_hash\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP Hdr Auth: $http_hdr_auth\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX apm_username: $apm_username\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX user_key = $user_key\"\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set apm_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $apm_cookie != \"\" } {\n HTTP::cookie insert name MRHSession value $apm_cookie\n set f_release_request 1\n }\n }\n }\n\n if { $http_content_len == $static::OA_MAGIC_CONTENT_LEN } {\n set f_oa_magic_content_len 1\n }\n\n set f_sleep_here 0\n set retry 1\n\n while { $f_release_request == 0 && $retry <= $static::POLICY_RESULT_POLL_MAXRETRYCYCLE } {\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Trying #$retry for $http_method $http_uri $http_content_len\"\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Reading $user_key from table $static::ACCESS_USERKEY_TBLNAME\"\n\n set apm_cookie [table lookup -subtable $static::ACCESS_USERKEY_TBLNAME -notouch $user_key]\n if { $apm_cookie != \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Verifying table cookie = $apm_cookie\"\n\n # Accessing SessionDB is not that cheap. Here we are trying to check known value.\n if { $apm_cookie == \"policy_authfailed\" || $apm_cookie == \"policy_inprogress\"} {\n # Do nothing\n } elseif { ! [ ACCESS::session exists $apm_cookie ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX table cookie = $apm_cookie is out-of-sync\"\n # Table value is out of sync. Ignores it.\n set apm_cookie \"\"\n }\n }\n\n switch $apm_cookie {\n \"\" {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX NO APM Cookie found\"\n\n if { [ info exists f_oa_magic_content_len ] && $f_oa_magic_content_len == 1 } {\n # Outlook Anywhere request comes in pair. The one with 1G payload is not usable\n # for creating new session since 1G content-length is intended for client to upload\n # the data when needed.\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Start to wait $static::POLICY_RESULT_POLL_INTERVAL ms for request with magic content-len\"\n set f_sleep_here 1\n } elseif { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 && $http_content_len > $static::FIRST_BIG_POST_CONTENT_LEN } {\n # Here we are getting large EWS request, which can't be used for starting new session\n # in clientless-mode. Have it here waiting for next smaller one.\n # We are holding the request here in HTTP filter, and HTTP filter automatically\n # clamping down the TCP window when necessary.\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Start to wait $static::POLICY_RESULT_POLL_INTERVAL ms for big EWS request\"\n set f_sleep_here 1\n } else {\n set apm_cookie \"policy_inprogress\"\n set f_reqside_set_sess_id 1\n set f_release_request 1\n }\n }\n \"policy_authfailed\" {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Found $user_key with AUTH_FAILED\"\n HTTP::respond 401 content $static::actsync_401_http_body\n set f_release_request 1\n }\n \"policy_inprogress\" {\n if { [ info exists f_activesync ] && ($f_activesync == 1) } {\n # For ActiveSync requests, aggressively starts new session.\n set f_reqside_set_sess_id 1\n set f_release_request 1\n } else {\n set f_sleep_here 1\n }\n }\n default {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Using MRHSession = $apm_cookie\"\n HTTP::header insert Cookie \"MRHSession=$apm_cookie\"\n set f_release_request 1\n }\n }\n\n if { $f_reqside_set_sess_id == 1 } {\n set f_reqside_set_sess_id 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key=$apm_cookie $PROFILE_POLICY_TIMEOUT $PROFILE_POLICY_TIMEOUT\"\n set f_clientless_mode 1\n HTTP::cookie remove MRHSession\n HTTP::header insert \"clientless-mode\" 1\n HTTP::header insert \"username\" $apm_username\n HTTP::header insert \"password\" $apm_password\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $apm_cookie $PROFILE_POLICY_TIMEOUT $PROFILE_POLICY_TIMEOUT\n }\n\n if { $f_sleep_here == 1 } {\n set f_sleep_here 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Waiting $static::POLICY_RESULT_POLL_INTERVAL ms for $http_method $http_uri\"\n after $static::POLICY_RESULT_POLL_INTERVAL\n }\n\n incr retry\n }\n\n if { ($f_release_request == 0) && ($retry >= $static::POLICY_RESULT_POLL_MAXRETRYCYCLE) } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Policy did not finish in [expr { $static::POLICY_RESULT_POLL_MAXRETRYCYCLE * $static::POLICY_RESULT_POLL_INTERVAL } ] ms. Close connection for $http_method $http_uri\"\n\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n ACCESS::disable\n TCP::close\n return\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Releasing request $http_method $http_uri\"\n }\n\n when ACCESS_SESSION_STARTED {\n if { [ info exists user_key ] } {\n\n ACCESS::session data set \"session.user.uuid\" $user_key\n ACCESS::session data set \"session.user.microsoft-exchange-client\" 1\n\n if { [ info exists f_activesync ] && $f_activesync == 1 } {\n ACCESS::session data set \"session.user.microsoft-activesync\" 1\n }\n elseif { [ info exists f_auto_discover ] && $f_auto_discover == 1 } {\n ACCESS::session data set \"session.user.microsoft-autodiscover\" 1\n }\n elseif { [ info exists f_availability_service ] && $f_availability_service == 1 } {\n ACCESS::session data set \"session.user.microsoft-availabilityservice\" 1\n }\n elseif { [ info exists f_rpc_over_http ] && $f_rpc_over_http == 1 } {\n ACCESS::session data set \"session.user.microsoft-rpcoverhttp\" 1\n }\n elseif { [ info exists f_offline_address_book ] && $f_offline_address_book == 1 } {\n ACCESS::session data set \"session.user.microsoft-offlineaddressbook\" 1\n }\n elseif { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 } {\n ACCESS::session data set \"session.user.microsoft-exchangewebservice\" 1\n }\n }\n if { [ info exists f_alt_inactivity_timeout ] && $f_alt_inactivity_timeout == 1 } {\n ACCESS::session data set \"session.inactivity_timeout\" $static::POLICY_ALT_INACTIVITY_TIMEOUT\n }\n }\n\n when ACCESS_POLICY_COMPLETED {\n if { ! [ info exists user_key ] } {\n return\n }\n\n set user_key_value \"\"\n set f_delete_session 0\n set policy_result [ACCESS::policy result]\n set sid [ ACCESS::session sid ]\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX ACCESS_POLICY_COMPLETED: policy_result = \\\"$policy_result\\\" user_key = \\\"$user_key\\\" sid = \\\"$sid\\\"\"\n\n set inactivity_timeout [ACCESS::session data get \"session.inactivity_timeout\"]\n set max_sess_timeout [ACCESS::session data get \"session.max_session_timeout\"]\n if { $max_sess_timeout == \"\" } {\n set max_sess_timeout $PROFILE_MAX_SESS_TIMEOUT\n }\n\n switch $policy_result {\n \"allow\" {\n # We depends on this table record self-cleanup capability in order to\n # indirectly sync with session DB.\n set user_key_value $sid\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Result: Allow: $user_key => $sid $inactivity_timeout $max_sess_timeout\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX user_key_value = $user_key_value\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX sid = $sid\"\n }\n \"deny\" {\n # When necessary the admin here can check appropriate session variable\n # and decide what response more appropriate then this default response.\n ACCESS::respond 401 content $static::actsync_401_http_body Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection Close\n if { $static::POLICY_RESULT_CACHE_AUTHFAILED == 1 } {\n set user_key_value $static::POLICY_AUTHFAILED\n } else {\n set f_delete_session 1\n }\n }\n default {\n ACCESS::respond 503 content $static::actsync_503_http_body Connection Close\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Got unsupported policy result for $user_key ($sid)\"\n set f_delete_session 1\n }\n }\n if { $user_key_value != \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key => $user_key_value $inactivity_timeout $max_sess_timeout in table $static::ACCESS_USERKEY_TBLNAME\"\n\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $user_key_value $inactivity_timeout $max_sess_timeout\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Deleting $user_key in table $static::ACCESS_USERKEY_TBLNAME\"\n\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n }\n\n if { $f_delete_session == 1 } {\n ACCESS::session remove\n set f_delete_session 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Removing the session for $user_key.\"\n }\n }\ndefinition-signature CZnUb3niz9wZPWvOmjDB0Dy4ixqjBEhIZrAVGt8VYe7+wZkhcBUFTADz3S1y5uomVwhRkGL20PLH7tfanDlpr3+IppgAGQlp98sPUl5ndEoWA4Rr90QiRGNRl/V7jWK58SOdJCQOirnutVMoeYjBWLwuprXGts08PO0WML5s0xJNOY7WPuGNeG+7Ht2pIB0vu80CgnCNGZJGZH0QR3kMVOx3yUN0ro5bAOmQ/XWel4qkj0F5DN9ufvsmKtTvb+Lc3y+5PHGbbFAQIrZ7lntZUJl/F8e/d26HE3spmZzQpPzi16qYWaMOxbvT6oedxpyhwbmJLiRNGyZmnT6kHj93FA==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_ExchangeSupport_OA_NtlmAuth", - "partition": "Common", - "fullPath": "/Common/_sys_APM_ExchangeSupport_OA_NtlmAuth", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_ExchangeSupport_OA_NtlmAuth?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen RULE_INIT {\n set static::POLICY_INPROGRESS \"policy_inprogress\"\n set static::POLICY_FAILED \"policy_failed\"\n set static::POLICY_SUCCEED \"policy_succeed\"\n set static::POLICY_DONE_WAIT_SEC 5\n\n set static::FIRST_BIG_POST_CONTENT_LEN 640000\n set static::POLICY_RESULT_POLL_INTERVAL 100\n set static::POLICY_RESULT_POLL_MAXRETRYCYCLE 100\n set static::ACCESS_USERKEY_TBLNAME \"_access_userkey\"\n set static::ACCESS_LOG_PREFIX \"01490000:7:\"\n\n set static::USE_NTLM_AUTH 0\n set static::USE_BASIC_AUTH 1\n set static::USE_NTLM_BASIC_AUTH 2\n\n set static::URL_DEFAULT 0\n set static::URL_RPC_OVER_HTTP 1\n set static::URL_AUTODISCOVER 2\n set static::URL_ACTIVE_SYNC 3\n set static::URL_OFFLINEADDRESSBOOK 4\n set static::URL_EXCHANGEWEBSERVICE 5\n\n set static::RECVD_AUTH_NONE 0\n set static::RECVD_AUTH_NTLM 1\n set static::RECVD_AUTH_BASIC 2\n\n set static::ACCESS_DEL_COOKIE_HDR_VAL \"MRHSession=deleted; \\\n expires=Thu, 01-Jan-1970 00:00:01 GMT;\\\n path=/\"\n\n }\n\n when HTTP_REQUEST {\n set http_path [string tolower [HTTP::path]]\n set url_path $static::URL_DEFAULT\n set use_auth $static::USE_NTLM_AUTH\n set f_disable_sso 0\n\n switch -glob $http_path {\n \"/rpc/rpcproxy.dll\" {\n set url_path $static::URL_RPC_OVER_HTTP\n }\n \"/autodiscover/autodiscover.xml\" {\n set url_path $static::URL_ACTIVE_SYNC\n # Need to support both NTLM and Basic authentication for this URL\n set use_auth $static::USE_NTLM_BASIC_AUTH\n }\n \"/microsoft-server-activesync*\" {\n set url_path $static::URL_ACTIVE_SYNC\n # Use only Basic authentication for this URL\n set use_auth $static::USE_BASIC_AUTH\n set f_disable_sso 1\n }\n \"/oab*\" {\n set url_path $static::URL_OFFLINEADDRESSBOOK\n }\n \"/ews*\" {\n set url_path $static::URL_EXCHANGEWEBSERVICE\n }\n default {\n ECA::disable\n return\n }\n }\n\n if { ! [ info exists f_ntlm_auth_succeed ] } {\n set f_ntlm_auth_succeed 0\n }\n if { ! [ info exists sid_cache ] } {\n set sid_cache \"\"\n }\n if { ! [ info exists PROFILE_POLICY_TIMEOUT ] } { \n set PROFILE_POLICY_TIMEOUT [PROFILE::access access_policy_timeout]\n }\n if { ! [ info exists PROFILE_MAX_SESS_TIMEOUT ] } {\n set PROFILE_MAX_SESS_TIMEOUT [PROFILE::access max_session_timeout]\n }\n if { ! [ info exists src_ip ] } {\n set src_ip [IP::remote_addr]\n }\n if { ! [ info exists PROFILE_RESTRICT_SINGLE_IP ] } {\n set PROFILE_RESTRICT_SINGLE_IP 1\n }\n\n set http_method [HTTP::method]\n set http_hdr_host [HTTP::host]\n set http_hdr_uagent [HTTP::header User-Agent]\n set http_uri [HTTP::uri]\n set http_content_len [HTTP::header Content-Length]\n set MRHSession_cookie [HTTP::cookie value MRHSession]\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX method: $http_method\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Src IP: $src_ip\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX User-Agent: $http_hdr_uagent\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP uri: $http_uri\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP len: $http_content_len\"\n\n if { ! [ info exists ECA_METADATA_ARG ] } {\n # Generating argument for ECA::metadata\n # The NTLM configuration name is derived from assigned virtual name with the algorithm as follows:\n # ::= \"/\" as \"/\" is the last \"/\" char.\n # ::= \"/\" \"exch_ntlm\" \"_\" \n # e.g. Let us say the virtual name is \"/prod/exch/vs1\", The folder path is \"/prod/exch/\",\n # then object name will be \"/prod/exch/exch_ntlm_vs1\".\n set vs_name [virtual name]\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX virtual: $vs_name\"\n set slash_index [ string last / $vs_name ]\n if { $slash_index == -1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Error: the virtual name does not contain folder information\"\n ACCESS::disable\n TCP::close\n return\n }\n set ECA_METADATA_ARG \"select_ntlm:\"\n append ECA_METADATA_ARG [ string range $vs_name 0 $slash_index ]\n append ECA_METADATA_ARG \"exch_ntlm_\"\n append ECA_METADATA_ARG [ string range $vs_name [ expr { $slash_index + 1 } ] end ]\n unset slash_index\n unset vs_name\n }\n\n if { $use_auth == $static::USE_NTLM_AUTH } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Enable ECA: $ECA_METADATA_ARG\"\n ECA::enable\n ECA::select $ECA_METADATA_ARG\n return\n } else {\n set recvd_auth $static::RECVD_AUTH_NONE\n set http_hdr_auth [HTTP::header Authorization]\n set auth_data [split $http_hdr_auth \" \"]\n if { $http_hdr_auth != \"\" } {\n if { [ llength $auth_data ] == 2 } {\n set auth_scheme [ lindex $auth_data 0]\n if { [string equal -nocase $auth_scheme \"ntlm\" ] == 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Recv'd HTTP NTLM Authentication\"\n set recvd_auth $static::RECVD_AUTH_NTLM\n } elseif { [ string equal -nocase [ lindex $auth_data 0] \"basic\" ] == 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Recv'd HTTP Basic Authentication\"\n set recvd_auth $static::RECVD_AUTH_BASIC\n set user [string tolower [HTTP::username]]\n set password [HTTP::password]\n }\n }\n }\n if { $use_auth == $static::USE_BASIC_AUTH } {\n if { $recvd_auth == $static::RECVD_AUTH_BASIC } {\n # Defer the process until later\n } else {\n HTTP::respond 401 -version 1.1 noserver WWW-Authenticate \"Basic realm=\\\"$http_hdr_host\\\"\" \\\n Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection Close\n return\n }\n } elseif { $use_auth == $static::USE_NTLM_BASIC_AUTH } {\n if { ($recvd_auth == $static::RECVD_AUTH_NTLM) || ($f_ntlm_auth_succeed == 1) } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Enable ECA: $ECA_METADATA_ARG\"\n ECA::enable\n ECA::select $ECA_METADATA_ARG\n return\n } elseif { $recvd_auth == $static::RECVD_AUTH_BASIC } {\n # Defer the process until later\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Request Authorization: NTLM + Basic\"\n HTTP::respond 401 -version 1.1 noserver WWW-Authenticate \"Basic realm=\\\"$http_hdr_host\\\"\" \\\n WWW-Authenticate \"NTLM\" Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection Close\n return\n }\n }\n\n # Disable NTLM auth\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Disable ECA\"\n ECA::disable\n # Disable KCD sso\n set f_disable_sso 1\n\n if { $MRHSession_cookie != \"\" } {\n if { [ACCESS::session exists -state_allow -sid $MRHSession_cookie] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n # Default profile access setting is false\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Release the request\"\n return\n }\n elseif { [ IP::addr $src_ip equals [ ACCESS::session data get -sid $MRHSession_cookie \"session.user.clientip\" ] ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP matched. Release the request\"\n return\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP does not matched\"\n }\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n }\n\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n\n set user_key {}\n if { $PROFILE_RESTRICT_SINGLE_IP == 1 } {\n append user_key $src_ip\n }\n append user_key $password\n binary scan [md5 $user_key ] H* user_key\n set user_key \"$user.$user_key\"\n\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set MRHSession_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $MRHSession_cookie != \"\" } {\n HTTP::cookie remove MRHSession \n HTTP::cookie insert name MRHSession value $MRHSession_cookie\n return\n }\n }\n\n HTTP::cookie remove MRHSession\n HTTP::header insert \"clientless-mode\" 1\n HTTP::header insert \"username\" $user\n HTTP::header insert \"password\" $password\n return\n }\n }\n\n when ECA_REQUEST_ALLOWED {\n set f_ntlm_auth_succeed 1\n\n if { $MRHSession_cookie == \"\" } {\n # Retrieve from SID cache\n set MRHSession_cookie $sid_cache\n HTTP::cookie insert name MRHSession value $sid_cache\n }\n\n if { $MRHSession_cookie != \"\" } {\n # Destroy session ID cache. This client should not need session ID cache \n if { ($sid_cache != \"\") && ($sid_cache != $MRHSession_cookie) } {\n set sid_cache \"\"\n }\n if { [ ACCESS::session exists -state_allow $MRHSession_cookie ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n # Default profile access setting is false\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Release the request\"\n return\n }\n elseif { [ IP::addr $src_ip equals [ ACCESS::session data get -sid $MRHSession_cookie \"session.user.clientip\" ] ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP matched. Release the request\"\n return\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP does not matched\"\n }\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n }\n }\n\n set MRHSession \"\"\n set sid_cache \"\"\n HTTP::cookie remove MRHSession\n\n # Build user_key\n set user_key {}\n append user_key [string tolower [ECA::username]] \"@\" [ string tolower [ECA::domainname] ]\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n append user_key \":\" $src_ip\n }\n append user_key \":\" [ECA::client_machine_name]\n\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set MRHSession_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $MRHSession_cookie != \"\" } {\n set sid_cache $MRHSession_cookie\n HTTP::cookie insert name MRHSession value $MRHSession_cookie\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX APM Cookie found: $sid_cache\"\n return\n }\n }\n unset apm_cookie_list\n\n set try 1\n set start_policy_str $src_ip\n append start_policy_str [TCP::client_port]\n\n while { $try <= $static::POLICY_RESULT_POLL_MAXRETRYCYCLE } {\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX NO APM Cookie found\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Trying #$try for $http_method $http_uri $http_content_len\"\n\n if { $http_content_len > $static::FIRST_BIG_POST_CONTENT_LEN } {\n # Wait at below\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX EXEC: table set -notouch -subtable $static::ACCESS_USERKEY_TBLNAME -excl $user_key $start_policy_str $PROFILE_POLICY_TIMEOUT $PROFILE_MAX_SESS_TIMEOUT\"\n set policy_status [table set -notouch -subtable $static::ACCESS_USERKEY_TBLNAME -excl $user_key $start_policy_str $PROFILE_POLICY_TIMEOUT $PROFILE_MAX_SESS_TIMEOUT]\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX DONE: table set -notouch -subtable $static::ACCESS_USERKEY_TBLNAME -excl $user_key $start_policy_str $PROFILE_POLICY_TIMEOUT $PROFILE_MAX_SESS_TIMEOUT\"\n if { $policy_status == $start_policy_str } {\n # ACCESS Policy has not started. Start one\n HTTP::header insert \"clientless-mode\" 1\n break\n } elseif { $policy_status == $static::POLICY_SUCCEED } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX table is out-of-sync retry\"\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n continue\n } elseif { $policy_status == $static::POLICY_FAILED } {\n ACCESS::disable\n TCP::close\n return\n }\n # Wait at below\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Waiting $static::POLICY_RESULT_POLL_INTERVAL ms for $http_method $http_uri\"\n # Touch the entry table\n table lookup -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n after $static::POLICY_RESULT_POLL_INTERVAL\n\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set MRHSession_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $MRHSession_cookie != \"\" } {\n set sid_cache $MRHSession_cookie\n HTTP::cookie insert name MRHSession value $MRHSession_cookie\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX APM Cookie found: $sid_cache\"\n return\n }\n }\n\n incr try\n }\n\n if { $try > $static::POLICY_RESULT_POLL_MAXRETRYCYCLE } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Policy did not finish in [ expr { $static::POLICY_RESULT_POLL_MAXRETRYCYCLE * $static::POLICY_RESULT_POLL_INTERVAL } ] ms. Close connection for $http_method $http_uri\"\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n ACCESS::disable\n TCP::close\n return\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Releasing request $http_method $http_uri\"\n\n unset try\n unset start_policy_str\n }\n\n when ECA_REQUEST_DENIED {\n set f_ntlm_auth_succeed 0\n }\n\n when HTTP_RESPONSE_RELEASE {\n if { ! [info exists user_key] } {\n return\n }\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP response: status: [HTTP::status]\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP response: Server: [HTTP::header Server]\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP response: Content-Length: [HTTP::header Content-Length]\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP response: WWW-Authenticate: [HTTP::header WWW-Authenticate]\"\n }\n\n when ACCESS_SESSION_STARTED {\n if { [ info exists user_key ] } {\n ACCESS::session data set \"session.user.uuid\" $user_key\n ACCESS::session data set \"session.user.microsoft-exchange-client\" 1\n }\n }\n\n when ACCESS_ACL_ALLOWED {\n if { [ info exists f_disable_sso ] && $f_disable_sso == 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Disable WEBSSO\"\n WEBSSO::disable\n }\n }\n\n when ACCESS_POLICY_COMPLETED {\n if { ! [ info exists user_key ] } {\n return\n }\n\n set user_key_value \"\"\n set f_delete_session 0\n set policy_result [ACCESS::policy result]\n set sid [ ACCESS::session sid ]\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX ACCESS_POLICY_COMPLETED: policy_result = \\\"$policy_result\\\" user_key = \\\"$user_key\\\" sid = \\\"$sid\\\"\"\n\n switch $policy_result {\n \"allow\" {\n set user_key_value $sid\n set sid_cache $user_key_value\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Result: Allow: $user_key\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX sid = $sid\"\n\n }\n \"deny\" {\n ACCESS::respond 401 content $static::actsync_401_http_body Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection Close\n set f_delete_session 1\n }\n default {\n ACCESS::respond 503 content $static::actsync_503_http_body Connection Close\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Got unsupported policy result for $user_key ($sid)\"\n set f_delete_session 1\n }\n }\n\n if { $f_ntlm_auth_succeed == 1 } {\n if { $user_key_value != \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key => $static::POLICY_SUCCEED\"\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $static::POLICY_SUCCEED\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key => $static::POLICY_FAILED $static::POLICY_DONE_WAIT_SEC $static::POLICY_DONE_WAIT_SEC_in table $static::ACCESS_USERKEY_TBLNAME\"\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $static::POLICY_FAILED $static::POLICY_DONE_WAIT_SEC $static::POLICY_DONE_WAIT_SEC\n }\n }\n\n if { $f_delete_session == 1 } {\n ACCESS::session remove\n set f_delete_session 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Removing the session for $user_key.\"\n }\n }\ndefinition-signature d/SlmwsO4YeDlh3eJpLqam9ytq0/EkWnAce1XTQ5bxOyla0x/VHjkr9dvoo3awaxp7lEjAenIgwGpS2jL5R1hq48WGZN2nu9LDKVjTosrq7j1MHbeKiIW8yXc3IEUtbbkhkAGNnMmfDYMD8Vg7l+iBx6B/WvRTZLr+tmppFf0BIr2Z7FWWU6c9OVl8YH1VuqqFX/lKICn2EXDhebRDRVvuXobLvbjZQxj+tqdUU2vuLzXYot/RUgClXHrg6Z2ZC6/WuAq4pp/XA2kvzWotQiY9gEceQdMC7/BxPSR8xo4VPNqkFkEPjh5hehZP0tFONTZaMaH1klVg4QbvHH5MRiBQ==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_ExchangeSupport_helper", - "partition": "Common", - "fullPath": "/Common/_sys_APM_ExchangeSupport_helper", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_ExchangeSupport_helper?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \n # The purpose of this iRule is for help the main virtual for the timing of the HTTP request retry\n # during the SSO process for OutlookAnywhere protocol request which has a Content-Length value of 1GB.\n\n when HTTP_REQUEST {\n # Waiting for the first chunk of data.\n HTTP::collect 1\n }\n\n when HTTP_REQUEST_DATA {\n # Respond 401 and close the connection once we received the data.\n HTTP::respond 401 WWW-Authenticate NTLM Connection close\n }\ndefinition-signature fnJWcC75FIDV4savxGjyZ5sTdRTen+3mItejhseH06qn+qBXjOl/j7wYRSLDv1IcFezF8BunbDftMHXrW7QRuPuxhjMIc4vaALE2CCGkO0xcs258F+nkPeeJKoR5mTHY/E5BWpOAISinUBUSA3/nUm8blXkMwVg/Q95360jcCOoi6csgJa97OSKIF9h9OQCylh1qGBsDRHEXCR3ycw5Eb4T2QQSdBn09vr8Hgdpi/9fUER97nzJe8T/RuoG+nQ7bc8F9yzG6nFa/CQtRYDybDrcNgllCfVloXZAHZS3dCpq6FnS/FaEWfSIujmV+lXkxY23Xz9Wf6i1h/feW9fEUiQ==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_ExchangeSupport_main", - "partition": "Common", - "fullPath": "/Common/_sys_APM_ExchangeSupport_main", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_ExchangeSupport_main?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \n # Global variables\n # static::POLICY_RESULT_CACHE_AUTHFAILED\n # Administrator can set this into 1, when there is a necessity to cache failed policy result.\n # This may be needed to avoid account locked caused by the Active Sync device when it uses wrong passwords.\n # One possible scenario, is that when the user changes the password in Active Directory, but missed to changed in their devices.\n # Responses\n # On denied result\n # Administrator can customize the responses to the device depends on more complex conditions when necessary.\n # In those cases, please use ACCESS::respond command.\n # The following is the syntax of ACCESS::respond\n # ACCESS::respond [ content ] [ * ]\n # e.g. ACCESS::respond 401 content \"Error: Denied\" WWW-Authenticate \"basic realm=\\\"f5.com\\\"\" Connection close\n when RULE_INIT {\n # Please set the following global variables for customized responses.\n set static::actsync_401_http_body \"Authentication FailuredError: Authentication Failure\"\n set static::actsync_503_http_body \"Service is not availableError: Service is not available\"\n set static::ACCESS_LOG_PREFIX \"01490000:7:\"\n\n # Second Virtual Server name for 401 NTLM responder\n set static::ACCESS_SECOND_VIRTUAL_NAME \"_ACCESS_401_NTLM_responder_HTTPS\"\n\n set static::POLICY_INPROGRESS \"policy_inprogress\"\n set static::POLICY_AUTHFAILED \"policy_authfailed\"\n # The request with huge content length can not be used for starting ACCESS session.\n # This kind of request will be put on hold, and this iRule will try to use another\n # request to start the session. The following value is used for Outlook Anywhere.\n set static::OA_MAGIC_CONTENT_LEN 1073741824\n\n # Similar with OutlookAnywhere case, ACCESS can not use the request which is\n # larger then following size. This becomes an issue with application that using\n # Exchange Web Service as its main protocol such as Mac OS X applications\n # (e.g. Mail app, Microsoft Entourage, etc)\n # This kind of request will be put on hold, and this iRule will try to use another\n # request to start the session.\n set static::FIRST_BIG_POST_CONTENT_LEN 640000\n\n # Set it into 1 if the backend EWS handler accepts HTTP Basic Authentication.\n set static::EWS_BKEND_BASIC_AUTH 0\n # Set it into 1 if the backend RPC-over-HTTP handler accepts HTTP Basic Authentication.\n set static::RPC_OVER_HTTP_BKEND_BASIC_AUTH 0\n # The following variable controls the polling mechanism.\n set static::POLICY_RESULT_POLL_INTERVAL 250\n set static::POLICY_RESULT_POLL_MAXRETRYCYCLE 600\n\n # Set this global variable to 1 for caching authentication failure\n # Useful for avoiding account locked out.\n set static::POLICY_RESULT_CACHE_AUTHFAILED 0\n\n # set this global variable to set alternative timeout for particular session\n set static::POLICY_ALT_INACTIVITY_TIMEOUT 120\n\n set static::ACCESS_USERKEY_TBLNAME \"_access_userkey\"\n\n\n set static::ACCESS_DEL_COOKIE_HDR_VAL \"MRHSession=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/\"\n\n log -noname accesscontrol.local1.debug \"01490000:7: RPC_OVER_HTTP_BKEND_BASIC_AUTH = $static::RPC_OVER_HTTP_BKEND_BASIC_AUTH\"\n log -noname accesscontrol.local1.debug \"01490000:7: EWS_BKEND_BASIC_AUTH = $static::EWS_BKEND_BASIC_AUTH\"\n }\n when ACCESS_ACL_ALLOWED {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX [HTTP::method] [HTTP::uri] [HTTP::header Content-Length]\"\n\n if { [ info exists f_rpc_over_http ] && $f_rpc_over_http == 1 } {\n if { $static::RPC_OVER_HTTP_BKEND_BASIC_AUTH == 0 } {\n if { [ info exists f_oa_magic_content_len ] && $f_oa_magic_content_len == 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Use this virtual $static::ACCESS_SECOND_VIRTUAL_NAME just once. Will be reset back after disconnection.\"\n use virtual $static::ACCESS_SECOND_VIRTUAL_NAME\n }\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Remove HTTP Auth header\"\n HTTP::header remove Authorization\n }\n }\n # MSFT Exchange's EWS request handler always requesting NTLM even the connection has been\n # already authenticated if there is a HTTP Basic Auth in the request.\n if { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 } {\n if { $static::EWS_BKEND_BASIC_AUTH == 0 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Removing HTTP Basic Authorization header\"\n HTTP::header remove Authorization\n }\n }\n }\n\n when HTTP_REQUEST {\n set http_path [ string tolower [HTTP::path] ]\n set f_clientless_mode 0\n set f_alt_inactivity_timeout 0\n set f_rpc_over_http 0\n set f_exchange_web_service 0\n set f_auto_discover 0\n set f_activesync 0\n set f_offline_address_book 0\n set f_availability_service 0\n\n # Here put appropriate pool when necessary.\n switch -glob $http_path {\n \"/rpc/rpcproxy.dll\" {\n # Supports for RPC over HTTP. (Outlook Anywhere)\n set f_rpc_over_http 1\n }\n \"/autodiscover/autodiscover.xml\" {\n # Supports for Auto Discover protocol.\n set f_auto_discover 1\n # This request does not require long inactivity timeout.\n # Don't use this for now\n set f_alt_inactivity_timeout 0\n }\n \"/microsoft-server-activesync\" {\n # Supports for ActiveSync\n set f_activesync 1\n }\n \"/oab/*\" {\n # Supports for Offline Address Book\n set f_offline_address_book 1\n }\n \"/ews/*\" {\n # Support for Exchange Web Service\n # Outlook's Availability Service borrows this protocol.\n set f_exchange_web_service 1\n }\n \"/as/*\" {\n # Support for Availability Service.\n # do nothing for now. (Untested)\n set f_availability_service 1\n }\n default {\n return\n }\n }\n\n set f_reqside_set_sess_id 0\n set http_method [HTTP::method]\n set http_hdr_host [HTTP::host]\n set http_hdr_uagent [HTTP::header User-Agent]\n set src_ip [IP::remote_addr]\n set http_uri [HTTP::uri]\n set http_content_len [HTTP::header Content-Length]\n set MRHSession_cookie [HTTP::cookie value MRHSession]\n set auth_info_b64enc \"\"\n\n if { ! [ info exists PROFILE_POLICY_TIMEOUT ] } {\n set PROFILE_POLICY_TIMEOUT [PROFILE::access access_policy_timeout]\n }\n if { ! [ info exists PROFILE_MAX_SESS_TIMEOUT ] } {\n set PROFILE_MAX_SESS_TIMEOUT [PROFILE::access max_session_timeout]\n }\n if { ! [ info exists PROFILE_RESTRICT_SINGLE_IP ] } {\n set PROFILE_RESTRICT_SINGLE_IP 1\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX method: $http_method\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Src IP: $src_ip\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX User-Agent: $http_hdr_uagent\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP uri: $http_uri\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP len: $http_content_len\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Restrict-to-single-client-ip: $PROFILE_RESTRICT_SINGLE_IP\"\n\n # First, do we have valid MRHSession cookie.\n if { $MRHSession_cookie != \"\" } {\n if { [ACCESS::session exists -state_allow -sid $MRHSession_cookie] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n }\n\n set http_hdr_auth [HTTP::header Authorization]\n if { [ string match -nocase {basic *} $http_hdr_auth ] != 1 } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Not basic authentication. Ignore received auth header\"\n set http_hdr_auth \"\"\n }\n\n if { $http_hdr_auth == \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX No/Empty Auth header\"\n # clean up the cookie\n if { $MRHSession_cookie == \"\" } {\n HTTP::respond 401 content $static::actsync_401_http_body WWW-Authenticate \"Basic realm=\\\"[HTTP::header Host]\\\"\" Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection close\n return\n }\n # Do nothing if we have a valid MRHSession cookie.\n }\n\n set f_release_request 0\n # Optimization for clients which support cookie\n if { $MRHSession_cookie != \"\" } {\n # Default profile access setting is false\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n set f_release_request 1\n }\n elseif { [ IP::addr $src_ip equals [ ACCESS::session data get -sid $MRHSession_cookie \"session.user.clientip\" ] ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP matched\"\n set f_release_request 1\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP does not matched\"\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n }\n\n if { $f_release_request == 0 } {\n set apm_username [ string tolower [HTTP::username]]\n set apm_password [HTTP::password]\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n binary scan [md5 \"$apm_password\"] H* user_hash\n } else {\n binary scan [md5 \"$apm_password$src_ip\"] H* user_hash\n }\n\n set user_key {}\n append user_key $apm_username \".\" $user_hash\n unset user_hash\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP Hdr Auth: $http_hdr_auth\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX apm_username: $apm_username\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX user_key = $user_key\"\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set apm_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $apm_cookie != \"\" } {\n HTTP::cookie insert name MRHSession value $apm_cookie\n set f_release_request 1\n }\n }\n }\n\n if { $http_content_len == $static::OA_MAGIC_CONTENT_LEN } {\n set f_oa_magic_content_len 1\n }\n\n set f_sleep_here 0\n set retry 1\n\n while { $f_release_request == 0 && $retry <= $static::POLICY_RESULT_POLL_MAXRETRYCYCLE } {\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Trying #$retry for $http_method $http_uri $http_content_len\"\n\n # This is also going to touch the table entry timer.\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Reading $user_key from table $static::ACCESS_USERKEY_TBLNAME\"\n\n set apm_cookie [table lookup -subtable $static::ACCESS_USERKEY_TBLNAME -notouch $user_key]\n if { $apm_cookie != \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Verifying table cookie = $apm_cookie\"\n\n # Accessing SessionDB is not that cheap. Here we are trying to check known value.\n if { $apm_cookie == \"policy_authfailed\" || $apm_cookie == \"policy_inprogress\"} {\n # Do nothing\n } elseif { ! [ ACCESS::session exists $apm_cookie ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX table cookie = $apm_cookie is out-of-sync\"\n # Table value is out of sync. Ignores it.\n set apm_cookie \"\"\n }\n }\n\n switch $apm_cookie {\n \"\" {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX NO APM Cookie found\"\n\n if { [ info exists f_oa_magic_content_len ] && $f_oa_magic_content_len == 1 } {\n # Outlook Anywhere request comes in pair. The one with 1G payload is not usable\n # for creating new session since 1G content-length is intended for client to upload\n # the data when needed.\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Start to wait $static::POLICY_RESULT_POLL_INTERVAL ms for request with magic content-len\"\n set f_sleep_here 1\n } elseif { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 && $http_content_len > $static::FIRST_BIG_POST_CONTENT_LEN } {\n # Here we are getting large EWS request, which can't be used for starting new session\n # in clientless-mode. Have it here waiting for next smaller one.\n # We are holding the request here in HTTP filter, and HTTP filter automatically\n # clamping down the TCP window when necessary.\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Start to wait $static::POLICY_RESULT_POLL_INTERVAL ms for big EWS request\"\n set f_sleep_here 1\n } else {\n set apm_cookie \"policy_inprogress\"\n set f_reqside_set_sess_id 1\n set f_release_request 1\n }\n }\n \"policy_authfailed\" {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Found $user_key with AUTH_FAILED\"\n HTTP::respond 401 content $static::actsync_401_http_body\n set f_release_request 1\n }\n \"policy_inprogress\" {\n if { [ info exists f_activesync ] && ($f_activesync == 1) } {\n # For ActiveSync requests, aggressively starts new session.\n set f_reqside_set_sess_id 1\n set f_release_request 1\n } else {\n set f_sleep_here 1\n }\n }\n default {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Using MRHSession = $apm_cookie\"\n HTTP::header insert Cookie \"MRHSession=$apm_cookie\"\n set f_release_request 1\n }\n }\n\n if { $f_reqside_set_sess_id == 1 } {\n set f_reqside_set_sess_id 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key=$apm_cookie $PROFILE_POLICY_TIMEOUT $PROFILE_MAX_SESS_TIMEOUT\"\n set f_clientless_mode 1\n HTTP::cookie remove MRHSession\n HTTP::header insert \"clientless-mode\" 1\n HTTP::header insert \"username\" $apm_username\n HTTP::header insert \"password\" $apm_password\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $apm_cookie $PROFILE_POLICY_TIMEOUT $PROFILE_MAX_SESS_TIMEOUT\n }\n\n if { $f_sleep_here == 1 } {\n set f_sleep_here 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Waiting $static::POLICY_RESULT_POLL_INTERVAL ms for $http_method $http_uri\"\n after $static::POLICY_RESULT_POLL_INTERVAL\n }\n\n incr retry\n }\n\n if { $f_release_request == 0 && $retry >= $static::POLICY_RESULT_POLL_MAXRETRYCYCLE } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Policy did not finish in [expr { $static::POLICY_RESULT_POLL_MAXRETRYCYCLE * $static::POLICY_RESULT_POLL_INTERVAL } ] ms. Close connection for $http_method $http_uri\"\n\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n ACCESS::disable\n TCP::close\n return\n }\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Releasing request $http_method $http_uri\"\n }\n\n when ACCESS_SESSION_STARTED {\n if { [ info exists user_key ] } {\n ACCESS::session data set \"session.user.uuid\" $user_key\n ACCESS::session data set \"session.user.microsoft-exchange-client\" 1\n\n if { [ info exists f_activesync ] && $f_activesync == 1 } {\n ACCESS::session data set \"session.user.microsoft-activesync\" 1\n }\n elseif { [ info exists f_auto_discover ] && $f_auto_discover == 1 } {\n ACCESS::session data set \"session.user.microsoft-autodiscover\" 1\n }\n elseif { [ info exists f_availability_service ] && $f_availability_service == 1 } {\n ACCESS::session data set \"session.user.microsoft-availabilityservice\" 1\n }\n elseif { [ info exists f_rpc_over_http ] && $f_rpc_over_http == 1 } {\n ACCESS::session data set \"session.user.microsoft-rpcoverhttp\" 1\n }\n elseif { [ info exists f_offline_address_book ] && $f_offline_address_book == 1 } {\n ACCESS::session data set \"session.user.microsoft-offlineaddressbook\" 1\n }\n elseif { [ info exists f_exchange_web_service ] && $f_exchange_web_service == 1 } {\n ACCESS::session data set \"session.user.microsoft-exchangewebservice\" 1\n }\n }\n if { [ info exists f_alt_inactivity_timeout ] && $f_alt_inactivity_timeout == 1 } {\n ACCESS::session data set \"session.inactivity_timeout\" $static::POLICY_ALT_INACTIVITY_TIMEOUT\n }\n }\n\n when HTTP_RESPONSE {\n if { [ info exists f_auto_discover ] && $f_auto_discover == 1 } {\n set content_len [ HTTP::header Content-Length ]\n if { $content_len > 0 } {\n HTTP::collect $content_len\n }\n }\n }\n when HTTP_RESPONSE_DATA {\n if { [ info exists f_auto_discover ] && $f_auto_discover == 1 } {\n if { [ regsub -line {Ntlm} [ HTTP::payload ] {Basic} payload ] != 0 } {\n HTTP::payload replace 0 $content_len $payload\n }\n }\n }\n when ACCESS_POLICY_COMPLETED {\n if { ! [ info exists user_key ] } {\n return\n }\n\n set user_key_value \"\"\n set f_delete_session 0\n set policy_result [ACCESS::policy result]\n set sid [ ACCESS::session sid ]\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX ACCESS_POLICY_COMPLETED: policy_result = \\\"$policy_result\\\" user_key = \\\"$user_key\\\" sid = \\\"$sid\\\"\"\n\n set inactivity_timeout [ACCESS::session data get \"session.inactivity_timeout\"]\n set max_sess_timeout [ACCESS::session data get \"session.max_session_timeout\"]\n if { $max_sess_timeout == \"\" } {\n set max_sess_timeout $PROFILE_MAX_SESS_TIMEOUT\n }\n\n switch $policy_result {\n \"allow\" {\n # We depends on this table record self-cleanup capability in order to\n # indirectly sync with session DB.\n set user_key_value $sid\n\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Result: Allow: $user_key => $sid $inactivity_timeout $max_sess_timeout\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX user_key_value = $user_key_value\"\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX sid = $sid\"\n }\n \"deny\" {\n # When necessary the admin here can check appropriate session variable\n # and decide what response more appropriate then this default response.\n ACCESS::respond 401 content $static::actsync_401_http_body Set-Cookie $static::ACCESS_DEL_COOKIE_HDR_VAL Connection close\n if { $static::POLICY_RESULT_CACHE_AUTHFAILED == 1 } {\n set user_key_value $static::POLICY_AUTHFAILED\n } else {\n set f_delete_session 1\n }\n }\n default {\n ACCESS::respond 503 content $static::actsync_503_http_body Connection close\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Got unsupported policy result for $user_key ($sid)\"\n set f_delete_session 1\n }\n }\n if { $user_key_value != \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Setting $user_key => $user_key_value $inactivity_timeout $max_sess_timeout in table $static::ACCESS_USERKEY_TBLNAME\"\n\n table set -subtable $static::ACCESS_USERKEY_TBLNAME $user_key $user_key_value $inactivity_timeout $max_sess_timeout\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Deleting $user_key in table $static::ACCESS_USERKEY_TBLNAME\"\n\n table delete -subtable $static::ACCESS_USERKEY_TBLNAME $user_key\n }\n\n if { $f_delete_session == 1 } {\n ACCESS::session remove\n set f_delete_session 0\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Removing the session for $user_key.\"\n }\n }\ndefinition-signature feX9LM+vB6YOEdVF+EA1JtNyVkPaB7gwdW0JzaB083MXl4yPP2nZnjm+WAx3YQhsmLttq5UkPl1zHpr5H9cwJX1bu9BNMi/+n0bIqWOipDHhhSYQ+TH+a5jQUSeftISr52BSQxh0cQKZkzM3rFU/qRZn9D9Dbf0kDGiDC1KWwVosrdjp5tVHOiQXWx8zybbGPFfgBcIBE6IvOvGbh5ohebVL2ADZm0URRj2NM4ZvZ2T3C14k2rHGXnDdRsvhmf5USZ+FH1hoKtWRxqtFjkWIaqw8leenXeot1j2bdKy92/AVTC9oZj1HJN1ePuQo5v414zlUhMEtkVy/gaxvj1+vPQ==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_Office365_SAML_BasicAuth", - "partition": "Common", - "fullPath": "/Common/_sys_APM_Office365_SAML_BasicAuth", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_Office365_SAML_BasicAuth?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen RULE_INIT {\n set static::ACCESS_LOG_ECP_PREFIX \"014d0002:7: ECP client\"\n }\n when HTTP_REQUEST {\n set http_path [string tolower [HTTP::path]]\n set http_hdr_auth [HTTP::header Authorization]\n set http_hdr_client_app [HTTP::header X-MS-Client-Application]\n set http_hdr_client_ip [HTTP::header X-MS-Forwarded-Client-IP]\n set MRHSession_cookie [HTTP::cookie value MRHSession]\n\n if { ($http_path == \"/saml/idp/profile/redirectorpost/sso\") &&\n ($http_hdr_client_app != \"\") &&\n ($http_hdr_client_app contains \"Microsoft.Exchange\") } {\n HTTP::uri \"/saml/idp/profile/ecp/sso\"\n } elseif { ($http_path != \"/saml/idp/profile/ecp/sso\") } {\n return\n }\n set f_saml_ecp_request 1\n unset http_path\n\n # If MRHSession cookie from client is present, skip further processing.\n if { $MRHSession_cookie != \"\" } {\n if { [ACCESS::session exists -state_allow -sid $MRHSession_cookie] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_ECP_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n } else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_ECP_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n }\n return\n }\n\n if { ($http_hdr_client_app != \"\") &&\n ($http_hdr_client_app contains \"Microsoft.Exchange\") &&\n ($http_hdr_client_ip != \"\") } {\n\t set src_ip $http_hdr_client_ip\n\t}\n unset http_hdr_client_app\n unset http_hdr_client_ip\n\n if { ! [ info exists src_ip ] } {\n set src_ip [IP::remote_addr]\n }\n\n # Only allow HTTP Basic Authentication.\n if { ($http_hdr_auth == \"\") || ([ string match -nocase {basic *} $http_hdr_auth ] != 1 ) } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_ECP_PREFIX ECP request does not contain HTTP Basic Authorization header.\"\n unset http_hdr_auth\n return\n }\n\n set apm_username [ string tolower [HTTP::username] ]\n set apm_password [HTTP::password]\n\n binary scan [md5 \"$apm_password$src_ip\"] H* user_hash\n set user_key {}\n append user_key $apm_username \".\" $user_hash\n unset user_hash\n\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set apm_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $apm_cookie != \"\" } {\n HTTP::cookie insert name MRHSession value $apm_cookie\n }\n }\n\n HTTP::header insert \"clientless-mode\" 1\n HTTP::header insert \"username\" $apm_username\n HTTP::header insert \"password\" $apm_password\n unset apm_username\n unset apm_password\n unset http_hdr_auth\n }\n\n when ACCESS_SESSION_STARTED {\n if { [ info exists f_saml_ecp_request ] && $f_saml_ecp_request == 1 } {\n if { [ info exists user_key ] } {\n ACCESS::session data set \"session.user.uuid\" $user_key\n }\n if { [ info exists src_ip ] } {\n ACCESS::session data set \"session.user.clientip\" $src_ip\n }\n }\n }\n\n when HTTP_RESPONSE {\n if { [ info exists f_saml_ecp_request ] && $f_saml_ecp_request == 1 } {\n unset f_saml_ecp_request\n unset apm_cookie\n }\n }\ndefinition-signature hbkbqtFWuaW9oegh6SzMveAg8WY7+tJBg32EgZs3djEixBoxjXoktrb/mcfl3FmsQXRgE6LgrZCeIvjqLdk/8/wq/4wnd4naYm2VALVoBPeETuCpWdmiyiwuvFC5G4VlYhqhYhRsx9mQhbRWm8/YvoBpvNnCCSdyx/wL+KcYQGU7Zv4woZrtruq4RiLCm6ohutAWdS2NbeIQHG37NFXT6wV6pR9EIqrkNetbXAdi6OZGuuthSXMSXMz64+CwkzpptxP3bhOsFvM/gq8FfWR8rsRJfxaHg+njkkgKSkH3TL7vhDnL3pXcHhH1/9P6qDU++YAyiXzppOlLHib33Rv0yw==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_APM_activesync", - "partition": "Common", - "fullPath": "/Common/_sys_APM_activesync", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_APM_activesync?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen RULE_INIT {\n set static::actsync_401_http_body \"Authentication FailedError: Authentication Failure\"\n set static::actsync_503_http_body \"Service is not availableError: Service is not available\"\n set static::ACCESS_LOG_PREFIX \"01490000:7:\"\n }\n when HTTP_REQUEST {\n set http_path [string tolower [HTTP::path]]\n set f_clientless_mode 0\n\n if { $http_path == \"/microsoft-server-activesync\" } {\n }\n elseif { $http_path == \"/autodiscover/autodiscover.xml\" } {\n set f_auto_discover 1\n }\n else return\n\n if { ! [ info exists src_ip ] } {\n set src_ip [IP::remote_addr]\n }\n if { ! [ info exists PROFILE_RESTRICT_SINGLE_IP ] } {\n set PROFILE_RESTRICT_SINGLE_IP \t 1\n }\n # Only allow HTTP Basic Authentication.\n set auth_info_b64enc \"\"\n set http_hdr_auth [HTTP::header Authorization]\n regexp -nocase {Basic (.*)} $http_hdr_auth match auth_info_b64enc\n if { $auth_info_b64enc == \"\" } {\n set http_hdr_auth \"\"\n }\n\n if { $http_hdr_auth == \"\" } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX Empty/invalid HTTP Basic Authorization header\"\n HTTP::respond 401 content $static::actsync_401_http_body Connection close\n return\n }\n\n set MRHSession_cookie [HTTP::cookie value MRHSession]\n # Do we have valid MRHSession cookie.\n if { $MRHSession_cookie != \"\" } {\n if { [ACCESS::session exists -state_allow -sid $MRHSession_cookie] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *VALID* MRHSession cookie: $MRHSession_cookie\"\n # Default profile access setting is false\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n return\n }\n elseif { [ IP::addr $src_ip equals [ ACCESS::session data get -sid $MRHSession_cookie \"session.user.clientip\" ] ] } {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP matched\"\n return\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX source IP does not matched\"\n }\n }\n else {\n log -noname accesscontrol.local1.debug \"$static::ACCESS_LOG_PREFIX HTTP *INVALID* MRHSession cookie: $MRHSession_cookie\"\n }\n set MRHSession_cookie \"\"\n HTTP::cookie remove MRHSession\n }\n\n set apm_username [ string tolower [HTTP::username] ]\n set apm_password [HTTP::password]\n\n if { $PROFILE_RESTRICT_SINGLE_IP == 0 } {\n binary scan [md5 \"$apm_password$\"] H* user_hash\n } else {\n binary scan [md5 \"$apm_password$src_ip\"] H* user_hash\n }\n set user_key {}\n append user_key $apm_username \".\" $user_hash\n unset user_hash\n\n set f_insert_clientless_mode 0\n set apm_cookie_list [ ACCESS::user getsid $user_key ]\n if { [ llength $apm_cookie_list ] != 0 } {\n set apm_cookie [ ACCESS::user getkey [ lindex $apm_cookie_list 0 ] ]\n if { $apm_cookie != \"\" } {\n HTTP::cookie insert name MRHSession value $apm_cookie\n } else {\n set f_insert_clientless_mode 1\n }\n } else {\n set f_insert_clientless_mode 1\n }\n\n if { $f_insert_clientless_mode == 1 } {\n HTTP::header insert \"clientless-mode\" 1\n HTTP::header insert \"username\" $apm_username\n HTTP::header insert \"password\" $apm_password\n }\n unset f_insert_clientless_mode\n }\n when ACCESS_SESSION_STARTED {\n if { [ info exists user_key ] } {\n ACCESS::session data set \"session.user.uuid\" $user_key\n ACCESS::session data set \"session.user.microsoft-exchange-client\" 1\n ACCESS::session data set \"session.user.activesync\" 1\n if { [ info exists f_auto_discover ] && $f_auto_discover == 1 } {\n set f_auto_discover 0\n ACCESS::session data set \"session.user.microsoft-autodiscover\" 1\n }\n }\n }\n when ACCESS_POLICY_COMPLETED {\n if { ! [ info exists user_key ] } {\n return\n }\n\n set policy_result [ACCESS::policy result]\n switch $policy_result {\n \"allow\" {\n }\n \"deny\" {\n ACCESS::respond 401 content $static::actsync_401_http_body Connection close\n ACCESS::session remove\n }\n default {\n ACCESS::respond 503 content $static::actsync_503_http_body Connection close\n ACCESS::session remove\n }\n }\n\n unset user_key\n }\ndefinition-signature jaSGZiyISQHfZu1LLt3cmS5U/vOKRUOkQZ6ZHyc0fdnKtv+VsbRUIgzQwpV1dsN+wzuFhWxEsvSzleGZSrRmlBRbO63jjeBg9jzCqj8/hfOHhPCMSP59w3/opbCnAlqt+TyCFDY1cJ6/b/SWS+irPeAt6gAl0kmw2TIBlJvxm93zTu8aWyBgQV+205oBEPjYVHjaFPGFPk5+5LnZWrBO1fC0jBqpkCT+LWxBGeVHRTC8sGup0SuhXFPfWu3oB1uTTo5SKr8ZxRUFUrLTHNj/W8RKWg2C34958TFngZNQhpxg+XGWEFJXpCkeM2fVJXN3mymRWxuanYLU26ZKXuNNxw==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_krbdelegate", - "partition": "Common", - "fullPath": "/Common/_sys_auth_krbdelegate", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_krbdelegate?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen HTTP_REQUEST {\n set thecert \"\"\n set ckname F5KRBAUTH\n set ckpass abc123\n set authprofiles [PROFILE::list auth]\n # Search the auth profiles for the krbdelegate(7) and grab cookie info\n foreach profname $authprofiles {\n if { [PROFILE::auth $profname type] == 7 } {\n set tmpckname [PROFILE::auth $profname cookie_name]\n set tmpckpass [PROFILE::auth $profname cookie_key]\n if {[PROFILE::auth $profname cookie_name] != \"\" } {\n set ckname $tmpckname\n set ckpass $tmpckpass\n break\n }\n }\n }\n set seecookie 0\n set insertcookie 0\n # check for the cookie\n if {not [info exists tmm_auth_http_sids(krbdelegate)]} {\n set tmm_auth_sid [AUTH::start pam default_krbdelegate]\n set tmm_auth_http_sids(krbdelegate) $tmm_auth_sid\n AUTH::subscribe $tmm_auth_sid\n } else {\n set tmm_auth_sid $tmm_auth_http_sids(krbdelegate)\n }\n if { [PROFILE::exists clientssl] } {\n set certcmd \"SSL::cert 0\"\n set thecert [ eval $certcmd ]\n }\n if { $thecert == \"\" } {\n # if no cert, assume old kerb delegation\n # if there is no Authorization header and no cookie, get one.\n if { ([HTTP::header Authorization] == \"\") and\n (not [HTTP::cookie exists $ckname])} {\n HTTP::respond 401 WWW-Authenticate Negotiate\n return\n }\n }\n if {[HTTP::cookie exists $ckname]} {\n set ckval [HTTP::cookie decrypt $ckname $ckpass]\n AUTH::username_credential $tmm_auth_sid \"cookie\"\n AUTH::password_credential $tmm_auth_sid $ckval\n set seecookie 1\n } else {\n if { $thecert == \"\" } {\n # Kerberos Delegation - set username\n # Strip off the Negotiate before the base64d goodness\n AUTH::username_credential $tmm_auth_sid [lindex [HTTP::header Authorization] 1]\n }\n else {\n # Protocol Transition - set ttm_auth_sid\n AUTH::username_credential $tmm_auth_sid \"krpprottran\"\n AUTH::cert_credential $tmm_auth_sid $thecert\n }\n AUTH::password_credential $tmm_auth_sid \"xxxx\"\n }\n AUTH::authenticate $tmm_auth_sid\n\n if {not [info exists tmm_auth_http_collect_count]} {\n HTTP::collect\n set tmm_auth_http_successes 0\n set tmm_auth_http_collect_count 1\n } else {\n incr tmm_auth_http_collect_count\n }\n }\n when AUTH_RESULT {\n if {not [info exists tmm_auth_http_sids(krbdelegate)] or \\\n ($tmm_auth_http_sids(krbdelegate) != [AUTH::last_event_session_id]) or \\\n (not [info exists tmm_auth_http_collect_count])} {\n return\n }\n if {[AUTH::status] == 0} {\n incr tmm_auth_http_successes\n }\n # If multiple auth sessions are pending and\n # one failure results in termination and this is a failure\n # or enough successes have now occurred\n if {([array size tmm_auth_http_sids] > 1) and \\\n ((not [info exists tmm_auth_http_sufficient_successes] or \\\n ($tmm_auth_http_successes >= $tmm_auth_http_sufficient_successes)))} {\n # Abort the other auth sessions\n foreach {type sid} [array get tmm_auth_http_sids] {\n unset tmm_auth_http_sids($type)\n if {($type ne \"krbdelegate\") and ($sid != -1)} {\n AUTH::abort $sid\n incr tmm_auth_http_collect_count -1\n }\n }\n }\n # If this is the last outstanding auth then either\n # release or respond to this session\n incr tmm_auth_http_collect_count -1\n if {$tmm_auth_http_collect_count == 0} {\n unset tmm_auth_http_collect_count\n if { [AUTH::status] == 0 } {\n array set pamout [AUTH::response_data]\n HTTP::header replace Authorization \"Negotiate $pamout(krbdelegate:attr:SPNEGO)\"\n if {$seecookie == 0} {\n set insertcookie $pamout(krbdelegate:attr:KRB5CCNAME)\n }\n HTTP::release\n } else {\n HTTP::respond 401 WWW-Authenticate Negotiate \"Set-Cookie\" \"$ckname= ; expires=Wed Dec 31 16:00:00 1969\"\n }\n }\n }\n # When the response goes out, if we need to insert a cookie, do it.\n when HTTP_RESPONSE {\n if {$insertcookie != 0} {\n HTTP::cookie insert name $ckname value $insertcookie\n HTTP::cookie encrypt $ckname $ckpass\n }\n }\ndefinition-signature mILi/VF69pqpNg+XJ4nClBl8+zq4v9FsiBYnKjX3zLZOChRWKt5CwkwpsbCRzx5DnvHglp9uXDYrjqcAFvM5aRA2R5LAhKQSq6pVPwHdZUJluYv0t3n6af/vSyc7KYsx6gga1jLuiFZaEzmG8c+r4igxwEee874iQBjYaWhHyKYGhlhly/Ez2FE9DNRpRepz2sq/jaKzEmmMod3CCXurXVGlC/Pk8qnbNid1yC15DGosrAKW1d8lhYbVBaXVQ1ahrr/UPYnDdHB1BiWUzRSS4uOKuUyUmT/xPI14/Nwv8zdFvlu+AnnD543zH6KhdSHhJ3zCVy2HSZ5wPuN3YswcBA==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_ldap", - "partition": "Common", - "fullPath": "/Common/_sys_auth_ldap", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_ldap?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen HTTP_REQUEST {\n if {not [info exists tmm_auth_http_sids(ldap)]} {\n set tmm_auth_sid [AUTH::start pam default_ldap]\n set tmm_auth_http_sids(ldap) $tmm_auth_sid\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_sid\n }\n } else {\n set tmm_auth_sid $tmm_auth_http_sids(ldap)\n }\n AUTH::username_credential $tmm_auth_sid [HTTP::username]\n AUTH::password_credential $tmm_auth_sid [HTTP::password]\n AUTH::authenticate $tmm_auth_sid\n\n if {not [info exists tmm_auth_http_collect_count]} {\n HTTP::collect\n set tmm_auth_http_successes 0\n set tmm_auth_http_collect_count 1\n } else {\n incr tmm_auth_http_collect_count\n }\n }\n when AUTH_RESULT {\n if {not [info exists tmm_auth_http_sids(ldap)] or \\\n ($tmm_auth_http_sids(ldap) != [AUTH::last_event_session_id]) or \\\n (not [info exists tmm_auth_http_collect_count])} {\n return\n }\n if {[AUTH::status] == 0} {\n incr tmm_auth_http_successes\n }\n # If multiple auth sessions are pending and\n # one failure results in termination and this is a failure\n # or enough successes have now occurred\n if {([array size tmm_auth_http_sids] > 1) and \\\n ((not [info exists tmm_auth_http_sufficient_successes] or \\\n ($tmm_auth_http_successes >= $tmm_auth_http_sufficient_successes)))} {\n # Abort the other auth sessions\n foreach {type sid} [array get tmm_auth_http_sids] {\n unset tmm_auth_http_sids($type)\n if {($type ne \"ldap\") and ($sid != -1)} {\n AUTH::abort $sid\n incr tmm_auth_http_collect_count -1\n }\n }\n }\n\n # If this is the last outstanding auth then either\n # release or respond to this session\n incr tmm_auth_http_collect_count -1\n if {$tmm_auth_http_collect_count == 0} {\n unset tmm_auth_http_collect_count\n if {[AUTH::status] == 0} {\n HTTP::release\n } else {\n HTTP::respond 401\n }\n }\n }\ndefinition-signature d+BwFQlDUIY7Jf5jfpCFuEkwn/jJ+3ZjEQLQej71v7TxzQpxJps4rDaU2YxBNyM9CTAIWT3DRdLqYZAnIHqVpOIRIE/ALk0v0o79IxJIES4nUTE9UTHKM8GN13VBkihf1I8O9DmwOHgB1s0HV+A/dy5mDiyBFpbamyv6rJCASItyPp2Y7iKfcMHEFe+qgvZFA2B131QVAosIn6pFribwU5LSvArIul5pIgX1tcuI+BLPkaJy6xoN9AQcah/ufgUCOmAvkc/K5LteBkxG3ItldFNaxOtAPXDt5IDhrBuMxsvRs7P+vMbfNiGb+QSakipxML2EmwCRiacxQTZn/0DDrw==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_radius", - "partition": "Common", - "fullPath": "/Common/_sys_auth_radius", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_radius?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen HTTP_REQUEST {\n if {not [info exists tmm_auth_http_sids(radius)]} {\n set tmm_auth_sid [AUTH::start pam default_radius]\n set tmm_auth_http_sids(radius) $tmm_auth_sid\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_sid\n }\n } else {\n set tmm_auth_sid $tmm_auth_http_sids(radius)\n }\n AUTH::username_credential $tmm_auth_sid [HTTP::username]\n AUTH::password_credential $tmm_auth_sid [HTTP::password]\n AUTH::authenticate $tmm_auth_sid\n\n if {not [info exists tmm_auth_http_collect_count]} {\n HTTP::collect\n set tmm_auth_http_successes 0\n set tmm_auth_http_collect_count 1\n } else {\n incr tmm_auth_http_collect_count\n }\n }\n when AUTH_RESULT {\n if {not [info exists tmm_auth_http_sids(radius)] or \\\n ($tmm_auth_http_sids(radius) != [AUTH::last_event_session_id]) or \\\n (not [info exists tmm_auth_http_collect_count])} {\n return\n }\n if {[AUTH::status] == 0} {\n incr tmm_auth_http_successes\n }\n # If multiple auth sessions are pending and\n # one failure results in termination and this is a failure\n # or enough successes have now occurred\n if {([array size tmm_auth_http_sids] > 1) and \\\n ((not [info exists tmm_auth_http_sufficient_successes] or \\\n ($tmm_auth_http_successes >= $tmm_auth_http_sufficient_successes)))} {\n # Abort the other auth sessions\n foreach {type sid} [array get tmm_auth_http_sids] {\n unset tmm_auth_http_sids($type)\n if {($type ne \"radius\") and ($sid != -1)} {\n AUTH::abort $sid\n incr tmm_auth_http_collect_count -1\n }\n }\n }\n # If this is the last outstanding auth then either\n # release or respond to this session\n incr tmm_auth_http_collect_count -1\n if {$tmm_auth_http_collect_count == 0} {\n unset tmm_auth_http_collect_count\n if { [AUTH::status] == 0 } {\n HTTP::release\n } else {\n HTTP::respond 401\n }\n }\n }\ndefinition-signature m0ZhOZjHe7lvErKAbir601WnOlWEPfEh/Qc5wayIKc6B16E4IF4F+Jh8QGdYRgNOrk3Qc3Gid6zQZcCcbIzfR3NKOxfVX+tl0KfiEN1lqBQMLu3/AooE+/YTC5oCPuvV6TK/JHRLiMiexYgRx6G+AFU7xg/w/YzgvV0bjsd9OxdIUB3WO5JOUweCG6q24zhVgN+3QIIiBnuKaMeHtRSw29xVpuQqgNKVG7RaPu15loA0xp8s4fxMF0YHDYPuQuu0PLfvYTqsSP0cI3Kdbsg5JgAIAcdHlFIW3NaUJBPMGRLOAvSGibIMVhFmUfC52LNQ4iORtokInaHyYUtPQ/yHIw==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_ssl_cc_ldap", - "partition": "Common", - "fullPath": "/Common/_sys_auth_ssl_cc_ldap", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_ssl_cc_ldap?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen CLIENT_ACCEPTED {\n set tmm_auth_ssl_cc_ldap_sid 0\n set tmm_auth_ssl_cc_ldap_done 0\n }\n when CLIENTSSL_CLIENTCERT {\n if {[SSL::cert count] == 0} {\n return\n }\n set tmm_auth_ssl_cc_ldap_done 0\n if {$tmm_auth_ssl_cc_ldap_sid == 0} {\n set tmm_auth_ssl_cc_ldap_sid [AUTH::start pam default_ssl_cc_ldap]\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_ssl_cc_ldap_sid\n }\n }\n AUTH::cert_credential $tmm_auth_ssl_cc_ldap_sid [SSL::cert 0]\n AUTH::authenticate $tmm_auth_ssl_cc_ldap_sid\n SSL::handshake hold\n }\n when CLIENTSSL_HANDSHAKE {\n set tmm_auth_ssl_cc_ldap_done 1\n }\n when AUTH_RESULT {\n if {[info exists tmm_auth_ssl_cc_ldap_sid] and \\\n ($tmm_auth_ssl_cc_ldap_sid == [AUTH::last_event_session_id])} {\n set tmm_auth_status [AUTH::status]\n if {$tmm_auth_status == 0} {\n set tmm_auth_ssl_cc_ldap_done 1\n SSL::handshake resume\n } elseif {$tmm_auth_status != -1 || $tmm_auth_ssl_cc_ldap_done == 0} {\n reject\n }\n }\n }\ndefinition-signature O2ctQteahGXIbb4l9/vERvtwKeyl51hGNNGgccddtwme/6opsgPJu5gaiVGUXYYDkbcjFdfgDTU9oDPkLl5JmZ3VcExnlnvxLpVDuM/fKqxbgoRQZ6nl0mEceHmWxRY9AlhrODtJZxNRbQBu4OOCYS+yWioKgKkrBwQaEoIFBPSSUmeIPZHTXdNnLXwxxkY75O5Sc4sTkYQ3BvTrlu/frnwweed6qw9bWatN865CIzP3Spq0ELY0Q4bvxo+0JdLheFv2BfKUethrjEXcxiD9Ros0fnvQ83qaCHqt18xEyhakdKAf4gKZJt9UApkRn+1ZTPNJFzgQyPPYQGvU/y9JAQ==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_ssl_crldp", - "partition": "Common", - "fullPath": "/Common/_sys_auth_ssl_crldp", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_ssl_crldp?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen CLIENT_ACCEPTED {\n set tmm_auth_ssl_crldp_sid 0\n set tmm_auth_ssl_crldp_done 0\n }\n when CLIENTSSL_CLIENTCERT {\n if {[SSL::cert count] == 0} {\n return\n }\n set tmm_auth_ssl_crldp_done 0\n if {$tmm_auth_ssl_crldp_sid == 0} {\n set tmm_auth_ssl_crldp_sid [AUTH::start pam default_ssl_crldp]\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_ssl_crldp_sid\n }\n }\n AUTH::cert_credential $tmm_auth_ssl_crldp_sid [SSL::cert 0]\n AUTH::cert_issuer_credential $tmm_auth_ssl_crldp_sid [SSL::cert issuer 0]\n AUTH::authenticate $tmm_auth_ssl_crldp_sid\n SSL::handshake hold\n }\n when CLIENTSSL_HANDSHAKE {\n set tmm_auth_ssl_crldp_done 1\n }\n when AUTH_RESULT {\n if {[info exists tmm_auth_ssl_crldp_sid] and \\\n ($tmm_auth_ssl_crldp_sid == [AUTH::last_event_session_id])} {\n set tmm_auth_status [AUTH::status]\n if {$tmm_auth_status == 0} {\n set tmm_auth_ssl_crldp_done 1\n SSL::handshake resume\n } elseif {$tmm_auth_status != -1 || $tmm_auth_ssl_crldp_done == 0} {\n reject\n }\n }\n }\ndefinition-signature PhTy24ctbtx0d4kFIFO6+Fr9W3a/7OetZ7nlh18mpH6BB9t1dB2LNayATLZ3q4iT4wLLdyyxA+g4jdrNBeuZVpM2JOBlhwcyIcTBFLQN4H/mkWErH4Vz9ZMxVduUxHN6fIh8zDQuJJYoRVlz087/vIVvk6ygbPwS9KqTdYBa3Nn79YmIVn1NXKyVoCg/40EZ3iNklwIfKctwqGU5ELKbhwk8CGCvexDbJcwRqv8nAETC4B/nc61jpGcihpOJchJFb3buTiAKwfxSYkx90UG4EnwsyA4GqUNIfS02Dj5rYSMH403CNNBKG2AA+ZGy9by2O3bb9lq/VNGPDmsnMEff1g==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_ssl_ocsp", - "partition": "Common", - "fullPath": "/Common/_sys_auth_ssl_ocsp", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_ssl_ocsp?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen CLIENT_ACCEPTED {\n set tmm_auth_ssl_ocsp_sid 0\n set tmm_auth_ssl_ocsp_done 0\n }\n when CLIENTSSL_CLIENTCERT {\n if {[SSL::cert count] == 0} {\n return\n }\n set tmm_auth_ssl_ocsp_done 0\n if {$tmm_auth_ssl_ocsp_sid == 0} {\n set tmm_auth_ssl_ocsp_sid [AUTH::start pam default_ssl_ocsp]\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_ssl_ocsp_sid\n }\n }\n AUTH::cert_credential $tmm_auth_ssl_ocsp_sid [SSL::cert 0]\n AUTH::cert_issuer_credential $tmm_auth_ssl_ocsp_sid [SSL::cert issuer 0]\n AUTH::authenticate $tmm_auth_ssl_ocsp_sid\n SSL::handshake hold\n }\n when CLIENTSSL_HANDSHAKE {\n set tmm_auth_ssl_ocsp_done 1\n }\n when AUTH_RESULT {\n if {[info exists tmm_auth_ssl_ocsp_sid] and \\\n ($tmm_auth_ssl_ocsp_sid == [AUTH::last_event_session_id])} {\n set tmm_auth_status [AUTH::status]\n if {$tmm_auth_status == 0} {\n set tmm_auth_ssl_ocsp_done 1\n SSL::handshake resume\n } elseif {$tmm_auth_status != -1 || $tmm_auth_ssl_ocsp_done == 0} {\n reject\n }\n }\n }\ndefinition-signature mHRNmZiszQh85wPdt5PxM2ASLXyW47LE3CM5tS11M1lTe9ttjlWDc6yBdy5VFjC6H2O2DJ+fyrBmeMen16RVWPhUoq8YOJC9ZiuuLc6T/rW9GsopSHFPBLRjL/EPulNkuGB/DtxYvwXfXOyBuVRw+E/TYkKVi6cIrk4+e9mOnCo9biWycrRfemWwYyDCqouEaDK2huYnQ1rKyYAvIWxfd3rXXw6+jdpuvL/6RFXJjaLTJ/f1pVMHP5kuI2K/dkeojqDDgr1d1GnjIFFX2Azh5qZpaL1urPfn/M6C/7sXzew1PU0ow10MQtKKqAno5IpEpn+cPZlCs3d2Y1khtMqUug==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_auth_tacacs", - "partition": "Common", - "fullPath": "/Common/_sys_auth_tacacs", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_auth_tacacs?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen HTTP_REQUEST {\n if {not [info exists tmm_auth_http_sids(tacacs)]} {\n set tmm_auth_sid [AUTH::start pam default_tacacs]\n set tmm_auth_http_sids(tacacs) $tmm_auth_sid\n if {[info exists tmm_auth_subscription]} {\n AUTH::subscribe $tmm_auth_sid\n }\n } else {\n set tmm_auth_sid $tmm_auth_http_sids(tacacs)\n }\n AUTH::username_credential $tmm_auth_sid [HTTP::username]\n AUTH::password_credential $tmm_auth_sid [HTTP::password]\n AUTH::authenticate $tmm_auth_sid\n\n if {not [info exists tmm_auth_http_collect_count]} {\n HTTP::collect\n set tmm_auth_http_successes 0\n set tmm_auth_http_collect_count 1\n } else {\n incr tmm_auth_http_collect_count\n }\n }\n when AUTH_RESULT {\n if {not [info exists tmm_auth_http_sids(tacacs)] or \\\n ($tmm_auth_http_sids(tacacs) != [AUTH::last_event_session_id]) or \\\n (not [info exists tmm_auth_http_collect_count])} {\n return\n }\n if {[AUTH::status] == 0} {\n incr tmm_auth_http_successes\n }\n # If multiple auth sessions are pending and\n # one failure results in termination and this is a failure\n # or enough successes have now occurred\n if {([array size tmm_auth_http_sids] > 1) and \\\n ((not [info exists tmm_auth_http_sufficient_successes] or \\\n ($tmm_auth_http_successes >= $tmm_auth_http_sufficient_successes)))} {\n # Abort the other auth sessions\n foreach {type sid} [array get tmm_auth_http_sids] {\n unset tmm_auth_http_sids($type)\n if {($type ne \"tacacs\") and ($sid != -1)} {\n AUTH::abort $sid\n incr tmm_auth_http_collect_count -1\n }\n }\n }\n # If this is the last outstanding auth then either\n # release or respond to this session\n incr tmm_auth_http_collect_count -1\n if {$tmm_auth_http_collect_count == 0} {\n unset tmm_auth_http_collect_count\n if { [AUTH::status] == 0 } {\n HTTP::release\n } else {\n HTTP::respond 401\n }\n }\n }\ndefinition-signature GHNO23blFC/AnIkRk9DSySYK2LiesD7h2DliAMIsVIjBk/RFL8XvZ+8WuKMVibuCiAhPWWvUu6nKsTnk9pX5/kc4yV6qRHcaaO+UaqT1/KQZsVXShCf0YCzqjRQIduJhUFFn0MUDhDmo/8ti0Upo6loKBxW3TODx5y8Jf3dTKmX2oRMfrkiMEyVtv38O7MDwJ1H5/xF2z1r2+nWGUJThZq/ILpfzcdnI7X5j/PxnAGuL1zciRIZ/0RIyMvYch0GaoXaKLVaONzDm0nHEJ+hZ7Vp8mQZiRitc8MGs1Ku9yLamxosUFAdRVnNQOLXGrlvEm94oU6XR3mq0oeqx9+dnOQ==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "_sys_https_redirect", - "partition": "Common", - "fullPath": "/Common/_sys_https_redirect", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~_sys_https_redirect?ver=12.1.2", - "apiAnonymous": "nodelete nowrite \nwhen HTTP_REQUEST {\n HTTP::redirect https://[getfield [HTTP::host] \":\" 1][HTTP::uri]\n }\ndefinition-signature mwyl4XlRKRMQc0prWs7RtpgPcNfocOKb+MaFwAnQgAuUZZyG68OaGZsOCN3poUOFdHOc6fk2XAdGRmTRiP/7BCT7thsOX5zLFzA1N1wcr57KWVzEZt3ezxVXn2Z974OmbWm7P5Lclcr7N3adrLJMWfyfPPVF1tUYn0IQPD2QNMmfbcbr1oCuO93n/5dn0s6/EacHZGG53hVibW7xQuJXdMtoQ6ArSZ4U3n4vCDTb6NLYbAj6PirVzKY2pcsWFHFUSVrphSFwERc8+0XGHUE6Cb3ihzygoZc2cQ5jk3frFY70MkDluPTShFRbHd7PlMPRezrfkVZVeUHA/iBPcYcD+w==", - "apiRawValues": { - "verificationStatus": "signature-verified" - } - }, - { - "kind": "tm:ltm:rule:rulestate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 94, - "selfLink": "https://localhost/mgmt/tm/ltm/rule/~Common~foo?ver=12.1.2", - "apiAnonymous": "when RULE_INIT {\n set static::FormBaseURL \"/sp-ofba-form\"\n set static::FormReturnURL \"/sp-ofba-completed\"\n set static::HeadAuthReq \"X-FORMS_BASED_AUTH_REQUIRED\"\n set static::HeadAuthRet \"X-FORMS_BASED_AUTH_RETURN_URL\"\n set static::HeadAuthSize \"X-FORMS_BASED_AUTH_DIALOG_SIZE\"\n set static::HeadAuthSizeVal \"800x600\"\n set static::ckname \"MRHSession_SP\"\n set static::Basic_Realm_Text \"SharePoint Authentication\"\n}\n\nwhen HTTP_REQUEST {\n set apmsessionid [HTTP::cookie value MRHSession]\n}\n\nwhen HTTP_RESPONSE {\n # Insert persistent cookie for html content type and private session\n}" - } -] diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_http.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_http.json deleted file mode 100644 index 79121b2b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_http.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "kind": "tm:ltm:monitor:http:httpstate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/http/~Common~asdf?ver=13.0.0", - "adaptive": "disabled", - "adaptiveDivergenceType": "relative", - "adaptiveDivergenceValue": 25, - "adaptiveLimit": 200, - "adaptiveSamplingTimespan": 300, - "defaultsFrom": "/Common/http", - "description": "this is a description", - "destination": "1.1.1.1:389", - "interval": 5, - "ipDscp": 0, - "manualResume": "disabled", - "password": "$M$7T$DpzEUVHt5rKkAfqrBh1PTA==", - "recv": "hello world", - "reverse": "enabled", - "send": "GET /\\r\\n", - "timeUntilUp": 0, - "timeout": 16, - "transparent": "disabled", - "upInterval": 0, - "username": "john" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_https.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_https.json deleted file mode 100644 index ff4f53f2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_https.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "kind": "tm:ltm:monitor:https:httpsstate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/https/~Common~asdf?ver=13.0.0", - "adaptive": "disabled", - "adaptiveDivergenceType": "relative", - "adaptiveDivergenceValue": 25, - "adaptiveLimit": 200, - "adaptiveSamplingTimespan": 300, - "cipherlist": "DEFAULT:+SHA:+3DES:+kEDH", - "compatibility": "enabled", - "defaultsFrom": "/Common/https", - "description": "this is a description", - "destination": "1.1.1.1:389", - "interval": 5, - "ipDscp": 0, - "manualResume": "disabled", - "password": "$M$7F$+F0VTCeKM4LbGkpC/u8pwg==", - "recv": "hello world", - "reverse": "disabled", - "send": "GET /\\r\\n", - "timeUntilUp": 0, - "timeout": 16, - "transparent": "disabled", - "upInterval": 0, - "username": "john" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp.json deleted file mode 100644 index fb9572f7..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:monitor:tcp:tcpstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/tcp/~Common~foo?ver=12.1.0", - "adaptive": "disabled", - "adaptiveDivergenceType": "relative", - "adaptiveDivergenceValue": 25, - "adaptiveLimit": 200, - "adaptiveSamplingTimespan": 300, - "defaultsFrom": "/Common/tcp", - "destination": "10.10.10.10:80", - "interval": 20, - "ipDscp": 0, - "manualResume": "disabled", - "recv": "this is a receive string", - "reverse": "disabled", - "send": "this is a send string", - "timeUntilUp": 60, - "timeout": 30, - "transparent": "disabled", - "upInterval": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_echo.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_echo.json deleted file mode 100644 index 1a518346..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_echo.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "kind": "tm:ltm:monitor:tcp-echo:tcp-echostate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/tcp-echo/~Common~foo?ver=13.0.0", - "adaptive": "disabled", - "adaptiveDivergenceType": "relative", - "adaptiveDivergenceValue": 25, - "adaptiveLimit": 200, - "adaptiveSamplingTimespan": 300, - "defaultsFrom": "/Common/tcp_echo", - "destination": "10.10.10.10", - "interval": 20, - "manualResume": "disabled", - "timeUntilUp": 60, - "timeout": 30, - "transparent": "disabled", - "upInterval": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_half_open.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_half_open.json deleted file mode 100644 index ff99c31e..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_tcp_half_open.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:ltm:monitor:tcp-half-open:tcp-half-openstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/tcp-half-open/~Common~foo?ver=13.0.0", - "defaultsFrom": "/Common/tcp_half_open", - "destination": "10.10.10.10:80", - "interval": 20, - "manualResume": "disabled", - "timeUntilUp": 60, - "timeout": 30, - "transparent": "disabled", - "upInterval": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_udp.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_udp.json deleted file mode 100644 index 636619a2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_monitor_udp.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:monitor:udp:udpstate", - "name": "asdf", - "partition": "Common", - "fullPath": "/Common/asdf", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/ltm/monitor/udp/~Common~asdf?ver=13.0.0", - "adaptive": "disabled", - "adaptiveDivergenceType": "relative", - "adaptiveDivergenceValue": 25, - "adaptiveLimit": 200, - "adaptiveSamplingTimespan": 300, - "debug": "no", - "defaultsFrom": "/Common/udp", - "destination": "1.1.1.1:389", - "interval": 5, - "manualResume": "disabled", - "recv": "hello world", - "reverse": "disabled", - "send": "default send string", - "timeUntilUp": 0, - "timeout": 16, - "transparent": "disabled", - "upInterval": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_1.json deleted file mode 100644 index 96d25b03..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_1.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:node:nodestate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 158, - "selfLink": "https://localhost/mgmt/tm/ltm/node/~Common~foo?ver=13.0.0", - "address": "1.2.3.4", - "connectionLimit": 0, - "description": "my description of node", - "dynamicRatio": 1, - "ephemeral": "false", - "fqdn": { - "addressFamily": "ipv4", - "autopopulate": "disabled", - "downInterval": 5, - "interval": "3600" - }, - "logging": "disabled", - "monitor": "default", - "rateLimit": "disabled", - "ratio": 1, - "session": "user-enabled", - "state": "unchecked" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_2.json deleted file mode 100644 index f23f6b5f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "kind": "tm:ltm:node:nodestate", - "name": "fqdn-foo", - "partition": "Common", - "fullPath": "/Common/fqdn-foo", - "generation": 161, - "selfLink": "https://localhost/mgmt/tm/ltm/node/~Common~fqdn-foo?ver=13.0.0", - "address": "any6", - "connectionLimit": 0, - "description": "another node but with fqdn", - "dynamicRatio": 1, - "ephemeral": "false", - "fqdn": { - "addressFamily": "ipv4", - "autopopulate": "disabled", - "downInterval": 5, - "interval": "3600", - "tmName": "google.com" - }, - "logging": "disabled", - "monitor": "/Common/icmp and /Common/tcp_echo ", - "rateLimit": "disabled", - "ratio": 1, - "session": "user-enabled", - "state": "fqdn-up" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_3.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_3.json deleted file mode 100644 index c6e30cf3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_node_3.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "kind": "tm:ltm:node:nodestate", - "name": "mytestserver", - "partition": "Common", - "fullPath": "/Common/mytestserver", - "generation": 2286, - "selfLink": "https://localhost/mgmt/tm/ltm/node/~Common~mytestserver?ver=13.0.0", - "address": "10.20.30.40", - "connectionLimit": 0, - "dynamicRatio": 1, - "ephemeral": "false", - "fqdn": { - "addressFamily": "ipv4", - "autopopulate": "disabled", - "downInterval": 5, - "interval": "3600" - }, - "logging": "disabled", - "monitor": "/Common/icmp ", - "rateLimit": "disabled", - "ratio": 1, - "session": "monitor-enabled", - "state": "down" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_policy_draft_rule_http-uri_forward.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_policy_draft_rule_http-uri_forward.json deleted file mode 100644 index 53aa0c34..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_policy_draft_rule_http-uri_forward.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "kind": "tm:ltm:policy:rules:rulesstate", - "name": "foo", - "fullPath": "foo", - "generation": 739, - "selfLink": "https://localhost/mgmt/tm/ltm/policy/~Common~Drafts~Bondticker-DRN/rules/foo?expandSubcollections=true&ver=13.0.0", - "ordinal": 0, - "actionsReference": { - "link": "https://localhost/mgmt/tm/ltm/policy/~Common~Drafts~Bondticker-DRN/rules/foo/actions?ver=13.0.0", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:policy:rules:actions:actionsstate", - "name": "0", - "fullPath": "0", - "generation": 739, - "selfLink": "https://localhost/mgmt/tm/ltm/policy/~Common~Drafts~Bondticker-DRN/rules/foo/actions/0?ver=13.0.0", - "code": 0, - "expirySecs": 0, - "forward": true, - "length": 0, - "node": "1.1.1.1", - "offset": 0, - "port": 0, - "request": true, - "select": true, - "snat": "disable", - "status": 0, - "timeout": 0, - "vlan": "/Common/net1", - "vlanId": 0 - } - ] - }, - "conditionsReference": { - "link": "https://localhost/mgmt/tm/ltm/policy/~Common~Drafts~Bondticker-DRN/rules/foo/conditions?ver=13.0.0", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:policy:rules:conditions:conditionsstate", - "name": "0", - "fullPath": "0", - "generation": 739, - "selfLink": "https://localhost/mgmt/tm/ltm/policy/~Common~Drafts~Bondticker-DRN/rules/foo/conditions/0?ver=13.0.0", - "caseInsensitive": true, - "external": true, - "httpUri": true, - "index": 0, - "path": true, - "present": true, - "remote": true, - "request": true, - "startsWith": true, - "values": [ - "foo" - ] - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_pool.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_pool.json deleted file mode 100644 index cd5be5e1..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_pool.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "kind": "tm:ltm:pool:poolstate", - "name": "test_pool", - "partition": "Common", - "fullPath": "/Common/test_pool", - "generation": 1452, - "selfLink": "https://localhost/mgmt/tm/ltm/pool/~Common~test_pool?ver=11.5.4", - "allowNat": "yes", - "allowSnat": "yes", - "description": "test", - "ignorePersistedWeight": "disabled", - "ipTosToClient": "pass-through", - "ipTosToServer": "pass-through", - "linkQosToClient": "pass-through", - "linkQosToServer": "pass-through", - "loadBalancingMode": "round-robin", - "minActiveMembers": 0, - "minUpMembers": 0, - "minUpMembersAction": "failover", - "minUpMembersChecking": "disabled", - "monitor": "min 1 of { /Common/http /Common/inband }", - "queueDepthLimit": 0, - "queueOnConnectionLimit": "disabled", - "queueTimeLimit": 0, - "reselectTries": 0, - "serviceDownAction": "reselect", - "slowRampTime": 10, - "membersReference": { - "link": "https://localhost/mgmt/tm/ltm/pool/~Common~test_pool/members?ver=11.5.4", - "isSubcollection": true - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_analytics_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_analytics_1.json deleted file mode 100644 index 3e3fa2c0..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_analytics_1.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "kind": "tm:ltm:profile:analytics:analyticsstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 339, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/analytics/~Common~foo?ver=13.1.1", - "appService": "none", - "capturedTrafficExternalLogging": "disabled", - "capturedTrafficInternalLogging": "disabled", - "collectGeo": "disabled", - "collectHttpTimingMetrics": "disabled", - "collectIp": "disabled", - "collectMaxTpsAndThroughput": "disabled", - "collectMethods": "enabled", - "collectOsAndBrowser": "enabled", - "collectPageLoadTime": "disabled", - "collectResponseCodes": "enabled", - "collectSubnets": "disabled", - "collectUrl": "disabled", - "collectUserAgent": "disabled", - "collectUserSessions": "disabled", - "collectedStatsExternalLogging": "disabled", - "collectedStatsInternalLogging": "enabled", - "countriesForStatCollection": [], - "defaultsFrom": "/Common/analytics", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/analytics/~Common~analytics?ver=13.1.1" - }, - "description": "none", - "externalLoggingPublisher": "none", - "ipsForStatCollection": [], - "notificationByEmail": "disabled", - "notificationBySnmp": "disabled", - "notificationBySyslog": "disabled", - "notificationEmailAddresses": [], - "publishIruleStatistics": "disabled", - "sampling": "enabled", - "sessionCookieSecurity": "ssl-only", - "sessionTimeoutMinutes": "5", - "smtpConfig": "none", - "subnetsForStatCollection": [], - "urlsForStatCollection": [], - "alertsReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/analytics/~Common~foo/alerts?ver=13.1.1", - "isSubcollection": true - }, - "trafficCaptureReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/analytics/~Common~foo/traffic-capture?ver=13.1.1", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_clientssl.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_clientssl.json deleted file mode 100644 index 923f6f72..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_clientssl.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "kind": "tm:ltm:profile:client-ssl:client-sslstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 351, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/client-ssl/~Common~foo?ver=13.0.0", - "alertTimeout": "indefinite", - "allowDynamicRecordSizing": "disabled", - "allowExpiredCrl": "disabled", - "allowNonSsl": "disabled", - "appService": "none", - "authenticate": "once", - "authenticateDepth": 9, - "bypassOnClientCertFail": "disabled", - "bypassOnHandshakeAlert": "disabled", - "caFile": "none", - "cacheSize": 262144, - "cacheTimeout": 3600, - "cert": "/Common/default.crt", - "certReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~default.crt?ver=13.0.0" - }, - "certExtensionIncludes": [ - "basic-constraints", - "subject-alternative-name" - ], - "certLifespan": 30, - "certLookupByIpaddrPort": "disabled", - "chain": "none", - "cipherGroup": "none", - "ciphers": "DEFAULT", - "clientCertCa": "none", - "crlFile": "none", - "defaultsFrom": "/Common/clientssl", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/client-ssl/~Common~clientssl?ver=13.0.0" - }, - "description": "none", - "destinationIpBlacklist": "none", - "destinationIpWhitelist": "none", - "forwardProxyBypassDefaultAction": "intercept", - "genericAlert": "enabled", - "handshakeTimeout": "10", - "hostnameBlacklist": "none", - "hostnameWhitelist": "none", - "inheritCertkeychain": "true", - "key": "/Common/default.key", - "keyReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-key/~Common~default.key?ver=13.0.0" - }, - "maxActiveHandshakes": "indefinite", - "maxAggregateRenegotiationPerMinute": "indefinite", - "maxRenegotiationsPerMinute": 5, - "maximumRecordSize": 16384, - "modSslMethods": "disabled", - "mode": "enabled", - "notifyCertStatusToVirtualServer": "disabled", - "ocspStapling": "disabled", - "tmOptions": [ - "dont-insert-empty-fragments" - ], - "peerCertMode": "ignore", - "peerNoRenegotiateTimeout": "10", - "proxyCaCert": "none", - "proxyCaKey": "none", - "proxySsl": "disabled", - "proxySslPassthrough": "disabled", - "renegotiateMaxRecordDelay": "indefinite", - "renegotiatePeriod": "indefinite", - "renegotiateSize": "indefinite", - "renegotiation": "enabled", - "retainCertificate": "true", - "secureRenegotiation": "require", - "serverName": "none", - "sessionMirroring": "disabled", - "sessionTicket": "disabled", - "sessionTicketTimeout": 0, - "sniDefault": "false", - "sniRequire": "false", - "sourceIpBlacklist": "none", - "sourceIpWhitelist": "none", - "sslForwardProxy": "disabled", - "sslForwardProxyBypass": "disabled", - "sslSignHash": "any", - "strictResume": "disabled", - "uncleanShutdown": "enabled", - "certKeyChain": [ - { - "name": "default", - "appService": "none", - "cert": "/Common/default.crt", - "certReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~default.crt?ver=13.0.0" - }, - "chain": "none", - "key": "/Common/default.key", - "keyReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-key/~Common~default.key?ver=13.0.0" - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_dns_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_dns_1.json deleted file mode 100644 index 41736147..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_dns_1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "kind": "tm:ltm:profile:dns:dnsstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 1211, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/dns/~Common~foo?ver=13.1.0.4", - "appService": "none", - "avrDnsstatSampleRate": 0, - "cache": "none", - "defaultsFrom": "/Common/dns", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/dns/~Common~dns?ver=13.1.0.4" - }, - "description": "none", - "dnsSecurity": "none", - "dns64": "disabled", - "dns64AdditionalSectionRewrite": "disabled", - "dns64Prefix": "any6", - "enableCache": "no", - "enableDnsExpress": "no", - "enableDnsFirewall": "yes", - "enableDnssec": "no", - "enableGtm": "no", - "enableHardwareQueryValidation": "no", - "enableHardwareResponseCache": "no", - "enableLogging": "no", - "enableRapidResponse": "no", - "logProfile": "none", - "processRd": "yes", - "processXfr": "yes", - "rapidResponseLastAction": "drop", - "unhandledQueryAction": "allow", - "useLocalBind": "no" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_http_compression_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_http_compression_1.json deleted file mode 100644 index a9873f20..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_http_compression_1.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "kind": "tm:ltm:profile:http-compression:http-compressionstate", - "name": "profile1", - "partition": "Common", - "fullPath": "/Common/profile1", - "generation": 132, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/http-compression/~Common~profile1?ver=13.1.0.4", - "allowHttp_10": "disabled", - "appService": "none", - "browserWorkarounds": "disabled", - "bufferSize": 4096, - "contentTypeExclude": [], - "contentTypeInclude": [ - "text/", - "application/(xml|x-javascript)" - ], - "cpuSaver": "enabled", - "cpuSaverHigh": 90, - "cpuSaverLow": 75, - "defaultsFrom": "/Common/httpcompression", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/http-compression/~Common~httpcompression?ver=13.1.0.4" - }, - "description": "my profile", - "gzipLevel": 1, - "gzipMemoryLevel": 8192, - "gzipWindowSize": 16384, - "keepAcceptEncoding": "disabled", - "methodPrefer": "gzip", - "minSize": 1024, - "selective": "disabled", - "uriExclude": [], - "uriInclude": [ - ".*" - ], - "varyHeader": "enabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_oneconnect_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_oneconnect_1.json deleted file mode 100644 index d2b05acf..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_oneconnect_1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "kind": "tm:ltm:profile:one-connect:one-connectstate", - "name": "oneconnect", - "partition": "Common", - "fullPath": "/Common/oneconnect", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/one-connect/~Common~oneconnect?ver=13.1.0.4", - "appService": "none", - "defaultsFrom": "none", - "description": "none", - "idleTimeoutOverride": "disabled", - "limitType": "none", - "maxAge": 86400, - "maxReuse": 1000, - "maxSize": 10000, - "sharePools": "disabled", - "sourceMask": "any" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_cookie_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_cookie_1.json deleted file mode 100644 index 771a26e9..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_cookie_1.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "kind": "tm:ltm:persistence:cookie:cookiestate", - "name": "cookie", - "partition": "Common", - "fullPath": "/Common/cookie", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/persistence/cookie/~Common~cookie?ver=13.1.0.7", - "alwaysSend": "disabled", - "appService": "none", - "cookieEncryption": "disabled", - "cookieName": "none", - "defaultsFrom": "none", - "description": "none", - "encryptCookiePoolname": "disabled", - "expiration": "0", - "hashLength": 0, - "hashOffset": 0, - "httponly": "enabled", - "matchAcrossPools": "disabled", - "matchAcrossServices": "disabled", - "matchAcrossVirtuals": "disabled", - "method": "insert", - "mirror": "disabled", - "overrideConnectionLimit": "disabled", - "secure": "enabled", - "timeout": "180" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_src_addr_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_src_addr_1.json deleted file mode 100644 index 2ee6df9b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_persistence_src_addr_1.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "kind": "tm:ltm:persistence:source-addr:source-addrstate", - "name": "source_addr", - "partition": "Common", - "fullPath": "/Common/source_addr", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/persistence/source-addr/~Common~source_addr?ver=13.1.0.7", - "appService": "none", - "defaultsFrom": "none", - "description": "none", - "hashAlgorithm": "default", - "mapProxies": "enabled", - "mapProxyAddress": "none", - "mapProxyClass": "none", - "mask": "none", - "matchAcrossPools": "disabled", - "matchAcrossServices": "disabled", - "matchAcrossVirtuals": "disabled", - "mirror": "disabled", - "overrideConnectionLimit": "disabled", - "timeout": "180" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_serverssl_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_serverssl_1.json deleted file mode 100644 index 94e6019f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_serverssl_1.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "kind": "tm:ltm:profile:server-ssl:server-sslstate", - "name": "asda", - "partition": "Common", - "fullPath": "/Common/asda", - "generation": 160, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/server-ssl/~Common~asda?ver=13.1.0.8", - "alertTimeout": "indefinite", - "allowExpiredCrl": "disabled", - "appService": "none", - "authenticate": "once", - "authenticateDepth": 9, - "authenticateName": "none", - "bypassOnClientCertFail": "disabled", - "bypassOnHandshakeAlert": "disabled", - "c3dCaCert": "none", - "c3dCaKey": "none", - "c3dCertExtensionCustomOids": [], - "c3dCertExtensionIncludes": [ - "basic-constraints", - "extended-key-usage", - "key-usage", - "subject-alternative-name" - ], - "c3dCertLifespan": 24, - "caFile": "none", - "cacheSize": 262144, - "cacheTimeout": 3600, - "cert": "none", - "chain": "/Common/default.crt", - "chainReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~default.crt?ver=13.1.0.8" - }, - "cipherGroup": "none", - "ciphers": "DEFAULT", - "crlFile": "none", - "defaultsFrom": "/Common/serverssl", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/server-ssl/~Common~serverssl?ver=13.1.0.8" - }, - "description": "none", - "expireCertResponseControl": "drop", - "genericAlert": "enabled", - "handshakeTimeout": "10", - "key": "none", - "maxActiveHandshakes": "indefinite", - "modSslMethods": "disabled", - "mode": "enabled", - "ocsp": "none", - "tmOptions": [ - "dont-insert-empty-fragments" - ], - "peerCertMode": "ignore", - "proxySsl": "disabled", - "proxySslPassthrough": "disabled", - "renegotiatePeriod": "indefinite", - "renegotiateSize": "indefinite", - "renegotiation": "enabled", - "retainCertificate": "true", - "secureRenegotiation": "require-strict", - "serverName": "none", - "sessionMirroring": "disabled", - "sessionTicket": "disabled", - "sniDefault": "false", - "sniRequire": "false", - "sslC3d": "disabled", - "sslForwardProxy": "disabled", - "sslForwardProxyBypass": "disabled", - "sslSignHash": "any", - "strictResume": "disabled", - "uncleanShutdown": "enabled", - "untrustedCertResponseControl": "drop" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_tcp_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_tcp_1.json deleted file mode 100644 index 03ada3cb..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_tcp_1.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "kind": "tm:ltm:profile:tcp:tcpstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 92, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~foo?ver=13.1.0.4", - "abc": "enabled", - "ackOnPush": "enabled", - "appService": "none", - "autoProxyBufferSize": "disabled", - "autoReceiveWindowSize": "disabled", - "autoSendBufferSize": "disabled", - "closeWaitTimeout": 5, - "cmetricsCache": "enabled", - "cmetricsCacheTimeout": 0, - "congestionControl": "high-speed", - "defaultsFrom": "/Common/tcp", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver=13.1.0.4" - }, - "deferredAccept": "disabled", - "delayWindowControl": "disabled", - "delayedAcks": "enabled", - "description": "none", - "dsack": "disabled", - "earlyRetransmit": "enabled", - "ecn": "enabled", - "enhancedLossRecovery": "disabled", - "fastOpen": "disabled", - "fastOpenCookieExpiration": 21600, - "finWait_2Timeout": 300, - "finWaitTimeout": 5, - "hardwareSynCookie": "enabled", - "idleTimeout": 300, - "initCwnd": 3, - "initRwnd": 3, - "ipDfMode": "pmtu", - "ipTosToClient": "0", - "ipTtlMode": "proxy", - "ipTtlV4": 255, - "ipTtlV6": 64, - "keepAliveInterval": 1800, - "limitedTransmit": "enabled", - "linkQosToClient": "0", - "maxRetrans": 8, - "maxSegmentSize": 1460, - "md5Signature": "disabled", - "minimumRto": 1000, - "mptcp": "disabled", - "mptcpCsum": "disabled", - "mptcpCsumVerify": "disabled", - "mptcpDebug": "disabled", - "mptcpFallback": "reset", - "mptcpFastjoin": "disabled", - "mptcpIdleTimeout": 300, - "mptcpJoinMax": 5, - "mptcpMakeafterbreak": "disabled", - "mptcpNojoindssack": "disabled", - "mptcpRtomax": 5, - "mptcpRxmitmin": 1000, - "mptcpSubflowmax": 6, - "mptcpTimeout": 3600, - "nagle": "disabled", - "pktLossIgnoreBurst": 0, - "pktLossIgnoreRate": 0, - "proxyBufferHigh": 49152, - "proxyBufferLow": 32768, - "proxyMss": "enabled", - "proxyOptions": "disabled", - "pushFlag": "default", - "ratePace": "disabled", - "ratePaceMaxRate": 0, - "receiveWindowSize": 65535, - "resetOnTimeout": "enabled", - "rexmtThresh": 3, - "selectiveAcks": "enabled", - "selectiveNack": "disabled", - "sendBufferSize": 65535, - "slowStart": "enabled", - "synCookieEnable": "enabled", - "synCookieWhitelist": "disabled", - "synMaxRetrans": 3, - "synRtoBase": 3000, - "tailLossProbe": "disabled", - "tcpOptions": "none", - "timeWaitRecycle": "enabled", - "timeWaitTimeout": "2000", - "timestamps": "enabled", - "verifiedAccept": "disabled", - "zeroWindowTimeout": 20000 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_udp_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_udp_1.json deleted file mode 100644 index a07307a0..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_profile_udp_1.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "kind": "tm:ltm:profile:udp:udpstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 107, - "selfLink": "https://localhost/mgmt/tm/ltm/profile/udp/~Common~foo?ver=13.1.0.4", - "allowNoPayload": "disabled", - "appService": "none", - "bufferMaxBytes": 655350, - "bufferMaxPackets": 0, - "datagramLoadBalancing": "disabled", - "defaultsFrom": "/Common/udp", - "defaultsFromReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/udp/~Common~udp?ver=13.1.0.4" - }, - "description": "none", - "idleTimeout": "60", - "ipDfMode": "pmtu", - "ipTosToClient": "0", - "ipTtlMode": "proxy", - "ipTtlV4": 255, - "ipTtlV6": 64, - "linkQosToClient": "0", - "noChecksum": "disabled", - "proxyMss": "disabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snat_translation_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snat_translation_default.json deleted file mode 100644 index 836866a1..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snat_translation_default.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "address": "1.1.1.1", - "arp": "no", - "connectionLimit": 0, - "description": "My description", - "ip_idle_timeout":"50", - "kind": "tm:ltm:snat-translation:snat-translationstate", - "name": "my-snat-translation", - "partition": "Common", - "state":"present", - "enabled":"true", - "tcp_idle_timeout":"20", - "trafficGroup": "/Common/test", - "udp_idle_timeout":"100" -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snatpool.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snatpool.json deleted file mode 100644 index fcea1dd2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_snatpool.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "kind": "tm:ltm:snatpool:snatpoolstate", - "name": "asdasd", - "partition": "Common", - "fullPath": "/Common/asdasd", - "generation": 40, - "selfLink": "https://localhost/mgmt/tm/ltm/snatpool/~Common~asdasd?ver=12.1.2", - "members": [ - "/Common/1.1.1.1", - "/Common/2.2.2.2" - ], - "membersReference": [ - { - "link": "https://localhost/mgmt/tm/ltm/snat-translation/~Common~1.1.1.1?ver=12.1.2" - }, - { - "link": "https://localhost/mgmt/tm/ltm/snat-translation/~Common~2.2.2.2?ver=12.1.2" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1.json deleted file mode 100644 index aaf48ab8..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "kind": "tm:ltm:virtual:virtualstate", - "name": "my-virtual-server", - "partition": "Common", - "fullPath": "/Common/my-virtual-server", - "generation": 65, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server?ver=12.1.2", - "addressStatus": "yes", - "autoLasthop": "default", - "cmpEnabled": "yes", - "connectionLimit": 0, - "destination": "/Common/10.10.10.10:443", - "enabled": true, - "gtmScore": 0, - "ipProtocol": "any", - "mask": "255.255.255.255", - "mirror": "disabled", - "mobileAppTunnel": "disabled", - "nat64": "disabled", - "rateLimit": "disabled", - "rateLimitDstMask": 0, - "rateLimitMode": "object", - "rateLimitSrcMask": 0, - "serviceDownImmediateAction": "none", - "source": "0.0.0.0/0", - "sourceAddressTranslation": { - "type": "automap" - }, - "sourcePort": "preserve", - "synCookieStatus": "not-activated", - "translateAddress": "enabled", - "translatePort": "enabled", - "vlansDisabled": true, - "vsIndex": 2, - "policiesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/policies?ver=12.1.2", - "isSubcollection": true - }, - "profilesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles?ver=12.1.2", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1_address.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1_address.json deleted file mode 100644 index 297afc91..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_1_address.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:virtual-address:virtual-addressstate", - "name": "10.10.10.10", - "partition": "Common", - "fullPath": "/Common/10.10.10.10", - "generation": 116, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual-address/~Common~10.10.10.10?ver=12.1.2", - "address": "10.10.10.10", - "arp": "enabled", - "autoDelete": "true", - "connectionLimit": 0, - "enabled": "yes", - "floating": "enabled", - "icmpEcho": "enabled", - "inheritedTrafficGroup": "false", - "mask": "255.255.255.255", - "routeAdvertisement": "enabled", - "serverScope": "any", - "spanning": "disabled", - "trafficGroup": "/Common/traffic-group-1", - "trafficGroupReference": { - "link": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-1?ver=12.1.2" - }, - "unit": 1 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_2.json deleted file mode 100644 index 712b19e3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_2.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "kind": "tm:ltm:virtual:virtualstate", - "name": "my-virtual-server", - "partition": "Common", - "fullPath": "/Common/my-virtual-server", - "generation": 152, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server?ver=12.1.2", - "addressStatus": "yes", - "autoLasthop": "default", - "cmpEnabled": "yes", - "connectionLimit": 0, - "destination": "/Common/10.10.10.10:443", - "enabled": true, - "gtmScore": 0, - "ipProtocol": "any", - "mask": "255.255.255.255", - "mirror": "disabled", - "mobileAppTunnel": "disabled", - "nat64": "disabled", - "rateLimit": "disabled", - "rateLimitDstMask": 0, - "rateLimitMode": "object", - "rateLimitSrcMask": 0, - "serviceDownImmediateAction": "none", - "source": "0.0.0.0/0", - "sourceAddressTranslation": { - "type": "automap" - }, - "sourcePort": "preserve", - "synCookieStatus": "not-activated", - "translateAddress": "enabled", - "translatePort": "enabled", - "vlansDisabled": true, - "vsIndex": 19, - "vlans": [ - "/Common/net1" - ], - "vlansReference": [ - { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~net1?ver=12.1.2" - } - ], - "policiesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/policies?ver=12.1.2", - "isSubcollection": true - }, - "profilesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles?ver=12.1.2", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:virtual:profiles:profilesstate", - "name": "fastL4", - "partition": "Common", - "fullPath": "/Common/fastL4", - "generation": 148, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles/~Common~fastL4?ver=12.1.2", - "context": "all", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/fastl4/~Common~fastL4?ver=12.1.2" - } - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_3.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_3.json deleted file mode 100644 index e1b0c7c2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_3.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "kind": "tm:ltm:virtual:virtualstate", - "name": "my-virtual-server", - "partition": "Common", - "fullPath": "/Common/my-virtual-server", - "generation": 340, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server?expandSubcollections=true&ver=12.0.0", - "addressStatus": "yes", - "autoLasthop": "default", - "cmpEnabled": "yes", - "connectionLimit": 0, - "description": "Test Virtual Server", - "destination": "/Common/10.10.10.10:443", - "enabled": true, - "gtmScore": 0, - "ipProtocol": "tcp", - "mask": "255.255.255.255", - "mirror": "disabled", - "mobileAppTunnel": "disabled", - "nat64": "disabled", - "rateLimit": "disabled", - "rateLimitDstMask": 0, - "rateLimitMode": "object", - "rateLimitSrcMask": 0, - "serviceDownImmediateAction": "none", - "source": "0.0.0.0/0", - "sourceAddressTranslation": { - "type": "automap" - }, - "sourcePort": "preserve", - "synCookieStatus": "not-activated", - "translateAddress": "enabled", - "translatePort": "enabled", - "vlansDisabled": true, - "vsIndex": 38, - "rules": [ - "/Common/web_logging" - ], - "rulesReference": [ - { - "link": "https://localhost/mgmt/tm/ltm/rule/~Common~web_logging?ver=12.0.0" - } - ], - "policiesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/policies?ver=12.0.0", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:virtual:policies:policiesstate", - "name": "policy1", - "partition": "Common", - "fullPath": "/Common/policy1", - "generation": 340, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/policies/~Common~policy1?ver=12.0.0", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/policy/~Common~policy1?ver=12.0.0" - } - } - ] - }, - "profilesReference": { - "link": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles?ver=12.0.0", - "isSubcollection": true, - "items": [ - { - "kind": "tm:ltm:virtual:profiles:profilesstate", - "name": "clientssl", - "partition": "Common", - "fullPath": "/Common/clientssl", - "generation": 338, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles/~Common~clientssl?ver=12.0.0", - "context": "clientside", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/client-ssl/~Common~clientssl?ver=12.0.0" - } - }, - { - "kind": "tm:ltm:virtual:profiles:profilesstate", - "name": "http", - "partition": "Common", - "fullPath": "/Common/http", - "generation": 338, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles/~Common~http?ver=12.0.0", - "context": "all", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/http/~Common~http?ver=12.0.0" - } - }, - { - "kind": "tm:ltm:virtual:profiles:profilesstate", - "name": "tcp", - "partition": "Common", - "fullPath": "/Common/tcp", - "generation": 338, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles/~Common~tcp?ver=12.0.0", - "context": "clientside", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp?ver=12.0.0" - } - }, - { - "kind": "tm:ltm:virtual:profiles:profilesstate", - "name": "tcp-legacy", - "partition": "Common", - "fullPath": "/Common/tcp-legacy", - "generation": 338, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual/~Common~my-virtual-server/profiles/~Common~tcp-legacy?ver=12.0.0", - "context": "serverside", - "nameReference": { - "link": "https://localhost/mgmt/tm/ltm/profile/tcp/~Common~tcp-legacy?ver=12.0.0" - } - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_collection_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_collection_1.json deleted file mode 100644 index 810e659f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_collection_1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "kind": "tm:ltm:virtual-address:virtual-addresscollectionstate", - "selfLink": "https://localhost/mgmt/tm/ltm/virtual-address?ver=13.1.0.4", - "items": [ - { - "kind": "tm:ltm:virtual-address:virtual-addressstate", - "name": "2.3.4.5", - "partition": "Common", - "fullPath": "/Common/2.3.4.5", - "generation": 1074, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual-address/~Common~2.3.4.5?ver=13.1.0.4", - "address": "2.3.4.5", - "arp": "enabled", - "autoDelete": "true", - "connectionLimit": 0, - "enabled": "yes", - "floating": "enabled", - "icmpEcho": "enabled", - "inheritedTrafficGroup": "false", - "mask": "255.255.255.255", - "routeAdvertisement": "disabled", - "serverScope": "any", - "spanning": "disabled", - "trafficGroup": "/Common/traffic-group-1", - "trafficGroupReference": { - "link": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-1?ver=13.1.0.4" - }, - "unit": 1 - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_default.json deleted file mode 100644 index a2b87012..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ltm_virtual_address_default.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:virtual-address:virtual-addressstate", - "name": "1.1.1.1", - "partition": "Common", - "fullPath": "/Common/1.1.1.1", - "generation": 116, - "selfLink": "https://localhost/mgmt/tm/ltm/virtual-address/~Common~1.1.1.1?ver=12.1.2", - "address": "1.1.1.1", - "arp": "enabled", - "autoDelete": "true", - "connectionLimit": 0, - "enabled": "yes", - "floating": "enabled", - "icmpEcho": "enabled", - "inheritedTrafficGroup": "false", - "mask": "255.255.255.255", - "routeAdvertisement": "disabled", - "serverScope": "any", - "spanning": "disabled", - "trafficGroup": "/Common/traffic-group-1", - "trafficGroupReference": { - "link": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-1?ver=12.1.2" - }, - "unit": 1 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_machine_resolver.json b/tests/unit/plugins/modules/network/f5/fixtures/load_machine_resolver.json deleted file mode 100644 index 2422ca6d..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_machine_resolver.json +++ /dev/null @@ -1,187 +0,0 @@ - { - "uuid": "4dd9f559-c1b9-4e05-8d17-2345a6a3d459", - "deviceUri": "https://10.144.74.229:443", - "machineId": "4dd9f559-c1b9-4e05-8d17-2345a6a3d459", - "state": "ACTIVE", - "address": "10.144.74.229", - "httpsPort": 443, - "hostname": "ansible_test_lab12.lab.local", - "version": "12.1.3", - "product": "BIG-IP", - "edition": "Final", - "build": "0.0.378", - "restFrameworkVersion": "12.1.3-0.0.378", - "managementAddress": "10.144.74.229", - "mcpDeviceName": "/Common/ansible_test_lab12.lab.local", - "trustDomainGuid": "44135337-f809-480d-ab6ffa163edc9ff6", - "properties": { - "cm:gui:module": [ - "asmsecurity", - "adc", - "BigIPDevice", - "sharedsecurity" - ], - "modules": [ - "Web Application Security Group", - "Security" - ], - "cm-bigip-allBigIpDevices": { - "cm:gui:module": [ - "asmsecurity", - "adc", - "BigIPDevice", - "sharedsecurity" - ], - "shared:resolver:device-groups:discoverer": "13446925-efb3-47f4-b32c-ed705d29e878", - "modules": [ - "Web Application Security Group", - "Security" - ] - }, - "cm-asm-allDevices": { - "cm:gui:module": [], - "modules": [] - }, - "cm-bigip-allDevices": { - "shared:resolver:device-groups:discoverer": "13446925-efb3-47f4-b32c-ed705d29e878", - "cm:gui:module": [], - "modules": [] - }, - "cm-adccore-allDevices": { - "cm:gui:module": [], - "modules": [] - }, - "cm-security-shared-allSharedDevices": { - "discovered": true, - "imported": true, - "supportsAlpineDosDeviceConfig": true, - "supports_14_0_Enhs": false, - "supportsRest": true, - "supportsAlpineDosProfileEnhs": true, - "requiresDhcpProfileInDhcpVirtualServer": true, - "supportsAfmSubscribers": false, - "supportsAlpineEnhs": true, - "supports_13_0_Enhs": false, - "supportsFirewallRuleIdentifiers": false, - "supportsBadgerEnhs": true, - "supportsAlpineDosDeviceWhitelistIpProcotol": true, - "supportsSshProfile": true, - "supportsPortMisusePolicy": true, - "supportsAlpineLogProfileEnhs": true, - "supportsCascadeEnhs": true, - "supportUdpPortList": true, - "supports_13_1_Enhs": false, - "supportsIncrementalDiscovery": false, - "lastDiscoveredDateTime": "2019-02-12T13:53:06.541Z", - "lastUserDiscoveredDateTime": "2019-02-12T13:53:06.541Z", - "importedDateTime": "2019-02-12T13:53:24.885Z", - "discoveryStatus": "FINISHED", - "importStatus": "FINISHED", - "cm:gui:module": [ - "sharedsecurity" - ], - "modules": [ - "Security" - ] - }, - "cm-adccore-allbigipDevices": { - "discovered": true, - "imported": true, - "supportsRest": true, - "requiresDhcpProfileInDhcpVirtualServer": true, - "supportsAlpineEnhs": true, - "supports_13_0_Enhs": false, - "supportsFirewallRuleIdentifiers": false, - "supportsBadgerEnhs": true, - "restrictsPortTranslationStatelessVirtual": true, - "supportsClassification": true, - "supports_13_1_Enhs": false, - "supportsIncrementalDiscovery": false, - "supports_12_1_2_Enhs": true, - "lastDiscoveredDateTime": "2019-02-12T13:53:03.963Z", - "lastUserDiscoveredDateTime": "2019-02-12T13:53:03.963Z", - "importedDateTime": "2019-02-12T13:53:18.975Z", - "discoveryStatus": "FINISHED", - "importStatus": "FINISHED", - "cm:gui:module": [ - "adc" - ], - "modules": [] - }, - "cm-security-shared-allDevices": { - "cm:gui:module": [], - "modules": [] - }, - "cm-asm-allAsmDevices": { - "discovered": true, - "imported": true, - "supportsHostNameEnforcementMode": false, - "supportsRest": true, - "supportsServerTechnologies": false, - "supportsCpb": false, - "supportsUrlCascadeFeatures": true, - "supportsSessionTrackingAllLoginPagesUsernameSource": true, - "supportsLoginEnforcementCascadeFeatures": true, - "suppportsXmlValidationFiles": true, - "supportsExtractions": true, - "supportsWebSocketSecurity": true, - "supportsWhitelistIpBlockRequestAlways": false, - "supportsSessionTrackingSessionHijackingByDeviceId": true, - "supportsLoginPagesHeaderOmits": false, - "supportsBruteForceAttackPreventionsCascadeFeatures": true, - "supportsPlainTextProfile": true, - "supportsIncrementalDiscovery": false, - "supportsRedirectionProtection": true, - "supportsHeaderSignaturesOverride": false, - "supportsIpIntelligence": true, - "supports_13_0_Enhs": false, - "supportsFirewallRuleIdentifiers": false, - "supportsSessionTrackingDeviceIdThresholds": true, - "supportsLoginEnforcement": true, - "supportsCsrfProtection": true, - "supportsSessionTracking": true, - "supportsJsonProfiles": true, - "supportsBruteForceAttackPreventions": true, - "supportsWebScraping": true, - "supportsLoginPagesCascadeFeatures": true, - "supportsGwtProfiles": true, - "supportsXmlProfiles": true, - "supportsAsmDisallowedGeolocation": true, - "supportsCsrfUrls": false, - "supportsDataProtection": false, - "supportsLoginPages": true, - "supportsBruteForceAttackPreventionsBadgerFeatures": true, - "supportsUrlSignaturesOverride": false, - "signatureAutoUpdateState": true, - "signatureFileVersion": 1.450112674E12, - "signatureFilename": "Attack Signature Database packaged with version 12.1.3", - "lastDiscoveredDateTime": "2019-02-12T13:53:09.188Z", - "lastUserDiscoveredDateTime": "2019-02-12T13:53:09.188Z", - "importedDateTime": "2019-02-12T13:53:29.730Z", - "discoveryStatus": "FINISHED", - "importStatus": "FINISHED", - "cm:gui:module": [ - "asmsecurity" - ], - "modules": [ - "Web Application Security Group" - ] - } - }, - "isClustered": false, - "isVirtual": true, - "isLicenseExpired": false, - "slots": [ - { - "volume": "HD1.1", - "product": "BIG-IP", - "version": "12.1.3", - "build": "0.0.378", - "isActive": true - } - ], - "generation": 4, - "lastUpdateMicros": 1549979318078796, - "kind": "shared:resolver:device-groups:restdeviceresolverdevicestate", - "selfLink": "https://localhost/mgmt/cm/system/machineid-resolver/4dd9f559-c1b9-4e05-8d17-2345a6a3d459" - } diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_dns_resolver_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_dns_resolver_1.json deleted file mode 100644 index bdf3f755..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_dns_resolver_1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:net:dns-resolver:dns-resolverstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 173, - "selfLink": "https://localhost/mgmt/tm/net/dns-resolver/~Common~foo?ver=13.1.0.8", - "answerDefaultZones": "no", - "cacheSize": 5767168, - "randomizeQueryNameCase": "yes", - "routeDomain": "/Common/0", - "routeDomainReference": { - "link": "https://localhost/mgmt/tm/net/route-domain/~Common~0?ver=13.1.0.8" - }, - "useIpv4": "no", - "useIpv6": "yes", - "useTcp": "yes", - "useUdp": "yes" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_interfaces.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_interfaces.json deleted file mode 100644 index 2cc3032f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_interfaces.json +++ /dev/null @@ -1,424 +0,0 @@ -[ - { - "kind": "tm:net:interface:interfacestate", - "name": "1.1", - "fullPath": "1.1", - "generation": 7767, - "selfLink": "https://localhost/mgmt/tm/net/interface/1.1?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 176, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:02", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "1000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "1.2", - "fullPath": "1.2", - "generation": 7770, - "selfLink": "https://localhost/mgmt/tm/net/interface/1.2?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 192, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:03", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "1000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "1.3", - "fullPath": "1.3", - "generation": 7773, - "selfLink": "https://localhost/mgmt/tm/net/interface/1.3?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 208, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:04", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "1000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "1.4", - "fullPath": "1.4", - "generation": 7776, - "selfLink": "https://localhost/mgmt/tm/net/interface/1.4?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 224, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:05", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "1000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.1", - "fullPath": "2.1", - "generation": 7859, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.1?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 240, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:06", - "mediaActive": "10000SR-FD", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "moduleDescription": "F5 compatible optics", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "serial": "ARP2LGU", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto", - "vendor": "F5 NETWORKS INC.", - "vendorOui": "009065", - "vendorPartnum": "OPT-0016", - "vendorRevision": "A0" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.2", - "fullPath": "2.2", - "generation": 7746, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.2?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 256, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:07", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.3", - "fullPath": "2.3", - "generation": 7749, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.3?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 272, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:08", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.4", - "fullPath": "2.4", - "generation": 7752, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.4?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 288, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:09", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.5", - "fullPath": "2.5", - "generation": 7755, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.5?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 304, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:0a", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.6", - "fullPath": "2.6", - "generation": 7758, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.6?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 320, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:0b", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.7", - "fullPath": "2.7", - "generation": 7761, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.7?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 336, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:0c", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "2.8", - "fullPath": "2.8", - "generation": 7764, - "selfLink": "https://localhost/mgmt/tm/net/interface/2.8?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 352, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:0d", - "mediaActive": "none", - "mediaFixed": "auto", - "mediaMax": "10000T-FD", - "mediaSfp": "auto", - "mtu": 9198, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - }, - { - "kind": "tm:net:interface:interfacestate", - "name": "mgmt", - "fullPath": "mgmt", - "generation": 7651, - "selfLink": "https://localhost/mgmt/tm/net/interface/mgmt?ver=12.1.0", - "bundle": "not-supported", - "bundleSpeed": "not-supported", - "enabled": true, - "flowControl": "tx-rx", - "forceGigabitFiber": "disabled", - "forwardErrorCorrection": "not-supported", - "ifIndex": 96, - "lldpAdmin": "txonly", - "lldpTlvmap": 130943, - "macAddress": "00:23:e9:f1:e4:01", - "mediaActive": "1000T-FD", - "mediaFixed": "auto", - "mediaMax": "1000T-FD", - "mediaSfp": "auto", - "mtu": 1500, - "preferPort": "sfp", - "qinqEthertype": "0x8100", - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes" - }, - "stp": "enabled", - "stpAutoEdgePort": "enabled", - "stpEdgePort": "true", - "stpLinkType": "auto" - } - ] diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_fqdn.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_fqdn.json deleted file mode 100644 index 67c02568..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_fqdn.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:ltm:node:nodestate", - "name": "foo.bar.com", - "partition": "Common", - "fullPath": "/Common/foo.bar.com", - "generation": 157, - "selfLink": "https://localhost/mgmt/tm/ltm/node/~Common~foo.bar.com?ver=12.0.0", - "address": "any6", - "connectionLimit": 0, - "dynamicRatio": 1, - "ephemeral": "false", - "fqdn": { - "addressFamily": "ipv4", - "autopopulate": "enabled", - "downInterval": 5, - "interval": "3600", - "tmName": "foo.bar.com" - }, - "logging": "disabled", - "monitor": "default", - "rateLimit": "disabled", - "ratio": 1, - "session": "user-enabled", - "state": "fqdn-up-no-addr" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_ipv4_address.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_ipv4_address.json deleted file mode 100644 index 9e3be889..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_node_with_ipv4_address.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "kind": "tm:ltm:node:nodestate", - "name": "7.3.67.8", - "partition": "Common", - "fullPath": "/Common/7.3.67.8", - "generation": 162, - "selfLink": "https://localhost/mgmt/tm/ltm/node/~Common~7.3.67.8?ver=12.0.0", - "address": "7.3.67.8", - "connectionLimit": 0, - "dynamicRatio": 1, - "ephemeral": "false", - "fqdn": { - "addressFamily": "ipv4", - "autopopulate": "disabled", - "downInterval": 5, - "interval": "3600" - }, - "logging": "disabled", - "monitor": "default", - "rateLimit": "disabled", - "ratio": 1, - "session": "user-enabled", - "state": "unchecked" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_description.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_description.json deleted file mode 100644 index a7c47bc8..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_description.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:net:route:routestate", - "name": "asdasd", - "partition": "Common", - "fullPath": "/Common/asdasd", - "generation": 113, - "selfLink": "https://localhost/mgmt/tm/net/route/~Common~asdasd?ver=12.1.0", - "description": "asdasd", - "mtu": 0, - "network": "2.2.2.2/32", - "pool": "/Common/adsasd", - "poolReference": { - "link": "https://localhost/mgmt/tm/ltm/pool/~Common~adsasd?ver=12.1.0" - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_domain_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_domain_1.json deleted file mode 100644 index 6ff8c5df..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_route_domain_1.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "kind": "tm:net:route-domain:route-domainstate", - "name": "0", - "partition": "Common", - "fullPath": "/Common/0", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/net/route-domain/~Common~0?ver=13.1.0", - "connectionLimit": 0, - "id": 0, - "strict": "enabled", - "throughputCapacity": 0, - "vlans": [ - "/Common/net1", - "/Common/internal", - "/Common/net2", - "/Common/socks-tunnel", - "/Common/http-tunnel" - ], - "vlansReference": [ - { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~net1?ver=13.1.0" - }, - { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~internal?ver=13.1.0" - }, - { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~net2?ver=13.1.0" - }, - { - "link": "https://localhost/mgmt/tm/net/tunnels/tunnel/~Common~socks-tunnel?ver=13.1.0" - }, - { - "link": "https://localhost/mgmt/tm/net/tunnels/tunnel/~Common~http-tunnel?ver=13.1.0" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_service_policy_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_service_policy_1.json deleted file mode 100644 index a89ca59f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_service_policy_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "kind": "tm:net:service-policy:service-policystate", - "name": "baz", - "partition": "Common", - "fullPath": "/Common/baz", - "generation": 581, - "selfLink": "https://localhost/mgmt/tm/net/service-policy/~Common~baz?ver=13.1.0.4", - "description": "my description", - "portMisusePolicy": "/Common/bar", - "portMisusePolicyReference": { - "link": "https://localhost/mgmt/tm/security/firewall/port-misuse-policy/~Common~bar?ver=13.1.0.4" - }, - "timerPolicy": "/Common/foo", - "timerPolicyReference": { - "link": "https://localhost/mgmt/tm/net/timer-policy/~Common~foo?ver=13.1.0.4" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_timer_policy_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_timer_policy_1.json deleted file mode 100644 index 4b6f550a..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_timer_policy_1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "kind": "tm:net:timer-policy:timer-policystate", - "name": "timer1", - "partition": "Common", - "fullPath": "/Common/timer1", - "generation": 148, - "selfLink": "https://localhost/mgmt/tm/net/timer-policy/~Common~timer1?ver=13.1.0.4", - "description": "my description" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_net_tunnel_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_net_tunnel_1.json deleted file mode 100644 index dd0e4842..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_net_tunnel_1.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "kind": "tm:net:tunnels:tunnel:tunnelstate", - "name": "tunnel1", - "partition": "Common", - "fullPath": "/Common/tunnel1", - "generation": 3713, - "selfLink": "https://localhost/mgmt/tm/net/tunnels/tunnel/~Common~tunnel1?ver=13.1.0.7", - "autoLasthop": "default", - "description": "my other tunnel", - "idleTimeout": 300, - "ifIndex": 736, - "key": 0, - "localAddress": "3.3.3.3", - "mode": "bidirectional", - "mtu": 1000, - "profile": "/Common/ipip", - "profileReference": { - "link": "https://localhost/mgmt/tm/net/tunnels/ipip/~Common~ipip?ver=13.1.0.7" - }, - "remoteAddress": "4.4.4.4", - "secondaryAddress": "any6", - "tos": "preserve", - "transparent": "disabled", - "usePmtu": "enabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_ntp.json b/tests/unit/plugins/modules/network/f5/fixtures/load_ntp.json deleted file mode 100644 index 3b55b487..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_ntp.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "kind": "tm:sys:ntp:ntpstate", - "selfLink": "https://localhost/mgmt/tm/sys/ntp?ver=12.1.0", - "servers": [ - "192.168.1.1", - "192.168.1.2" - ], - "timezone": "America/Los_Angeles", - "restrictReference": { - "link": "https://localhost/mgmt/tm/sys/ntp/restrict?ver=12.1.0", - "isSubcollection": true - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_key.json b/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_key.json deleted file mode 100644 index 8a781d1d..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_key.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "description": "foo bar baz", - "dossier": "5d54d976", - "encryptedPrivateKey": [ - 27, - -10, - 12, - 58, - 75 - ], - "generation": 2, - "internalPrivateKey": "sKpXEU7", - "kind": "cm:device:licensing:pool:regkey:licenses:item:offerings:regkeypoollicenseofferingstate", - "lastUpdateMicros": 1513107721123304, - "licenseState": { - "vendor": "F5 Networks, Inc.", - "licensedDateTime": "2017-12-12T00:00:00-08:00", - "licensedVersion": "5.3.0", - "evaluationStartDateTime": "2017-12-11T00:00:00-08:00", - "evaluationEndDateTime": "2018-01-12T00:00:00-08:00", - "licenseEndDateTime": "2018-01-12T00:00:00-08:00", - "licenseStartDateTime": "2017-12-11T00:00:00-08:00", - "registrationKey": "XXXX-XXXX-XXXX-XXXX-XXXX", - "dossier": "1a44262799bc", - "authorization": "03fc41d1e8666", - "usage": "F5 Internal Product Development", - "platformId": "Z100", - "authVers": "5b", - "serviceCheckDateTime": "2017-12-12T00:00:00-08:00", - "serviceStatus": "As of 2017-12-12 there is no active service contract. This may inhibit your ability to upgrade your software.", - "exclusivePlatform": [ - "Z100", - "Z100A", - "Z100AzureCloud", - "Z100GoogleCloud", - "Z100K", - "Z100x", - "Z100H" - ], - "activeModules": [ - "APM, Max, VE (2500 CCU, 10000 Access Sessions)|P961057-1761515|Anti-Virus Checks", - "LTM, 10 Gbps, VE|T487107-2453693|, VE|DNSSEC", - "PEM, VE|X895364-1851682" - ], - "optionalModules": [ - "APM, Base, VE (50 CCU / 200 AS)", - "App Mode (TMSH Only, No Root/Bash)", - "Concurrent Users", - "Concurrent Users and Access Sessions, VE", - "FIPS 140-2 Level 1, BIG-IP VE-1G to 10G", - "IP Intelligence, 1Yr, VE", - "IP Intelligence, 1Yr, VE-10G", - "IP Intelligence, 3Yr, VE-10G", - "LTM to Better Bundle Upgrade, 10Gbps", - "PEM URL Filtering, 1Yr, HIGH PERF", - "PEM URL Filtering, 3Yr, HIGH PERF", - "Routing Bundle", - "Secure Web Gateway, 1Yr, VE", - "URL Filtering, 1Yr, VE" - ], - "moduleEvaluations": [ - { - "moduleName": "IP Intelligence, 3Yr, VE|SUBSCRIPTION", - "endDate": "soon" - }, - { - "moduleName": "Secure Web Gateway, 3Yr, VE|SUBSCRIPTION", - "endDate": "soon" - }, - { - "moduleName": "URL Filtering, 3Yr, VE|SUBSCRIPTION", - "endDate": "soon" - } - ], - "featureFlags": [ - { - "featureName": "gtm_rate_limit", - "featureValue": "12345" - } - ], - "generation": 0, - "lastUpdateMicros": 0 - }, - "licenseText": "#Auth vers : BIG-IQ Product License File#", - "message": "License XXXX-XXXX-XXXX-XXXX-XXXX ready", - "name": "License for XXXX-XXXX-XXXX-XXXX-XXXX", - "publicKey": [ - 48, - 0, - 1 - ], - "regKey": "XXXX-XXXX-XXXX-XXXX-XXXX", - "selfLink": "https://localhost/mgmt/cm/device/licensing/pool/regkey/licenses/452f8628-1e56-4b4d-946c-0e68f5780aa1/offerings/XXXX-XXXX-XXXX-XXXX-XXXX", - "sortName": "Registration Key Pool Item", - "status": "READY" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_pool.json b/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_pool.json deleted file mode 100644 index f711817f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_regkey_license_pool.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "description": "this is a description", - "generation": 2, - "id": "452f8628-1e56-4b4d-946c-0e68f5780aa1", - "kind": "cm:device:licensing:pool:regkey:licenses:regkeypoollicensestate", - "lastUpdateMicros": 1513371645532221, - "name": "asd", - "selfLink": "https://localhost/mgmt/cm/device/licensing/pool/regkey/licenses/452f8628-1e56-4b4d-946c-0e68f5780aa1", - "sortName": "Registration Key Pool" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_remote_user_settings.json b/tests/unit/plugins/modules/network/f5/fixtures/load_remote_user_settings.json deleted file mode 100644 index 296f462f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_remote_user_settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "kind": "tm:auth:remote-user:remote-userstate", - "selfLink": "https://localhost/mgmt/tm/auth/remote-user?ver=12.1.4", - "defaultPartition": "all", - "defaultPartitionReference": { - "link": "https://localhost/mgmt/tm/auth/partition/all?ver=12.1.4" - }, - "defaultRole": "no-access", - "remoteConsoleAccess": "disabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_security_address_list_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_security_address_list_1.json deleted file mode 100644 index 45aca1e3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_security_address_list_1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "kind": "tm:security:firewall:address-list:address-liststate", - "name": "bar", - "partition": "Common", - "fullPath": "/Common/bar", - "generation": 135, - "selfLink": "https://localhost/mgmt/tm/security/firewall/address-list/~Common~bar?ver=12.1.2", - "addressLists": [ - { - "name": "foo", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/firewall/address-list/~Common~foo?ver=12.1.2" - } - } - ], - "addresses": [ - { - "name": "1.1.1.1" - }, - { - "name": "2.2.2.2-3.3.3.3" - }, - { - "name": "5.5.5.5-6.6.6.6" - }, - { - "name": "2700:bc00:1f10:101::6" - } - ], - "fqdns": [ - { - "name": "google.com" - } - ], - "geo": [ - { - "name": "AF:Baghlan" - }, - { - "name": "AF:Helmand" - }, - { - "name": "BS" - }, - { - "name": "EU" - }, - { - "name": "GE:Marneulis Raioni" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_global_rules_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_global_rules_1.json deleted file mode 100644 index 80f475eb..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_global_rules_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:security:firewall:global-rules:global-rulesstate", - "selfLink": "https://localhost/mgmt/tm/security/firewall/global-rules?ver=13.1.0.7", - "enforcedPolicy": "/Common/foo", - "enforcedPolicyReference": { - "link": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo?ver=13.1.0.7" - }, - "servicePolicy": "/Common/bar", - "servicePolicyReference": { - "link": "https://localhost/mgmt/tm/net/service-policy/~Common~bar?ver=13.1.0.7" - }, - "stagedPolicy": "/Common/baz", - "stagedPolicyReference": { - "link": "https://localhost/mgmt/tm/security/firewall/policy/~Common~baz?ver=13.1.0.7" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_policy_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_policy_1.json deleted file mode 100644 index 9c246058..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_security_firewall_policy_1.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "kind": "tm:security:firewall:policy:policystate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 2075, - "selfLink": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo?expandSubcollections=true&ver=13.1.0.7", - "description": "my description", - "rulesReference": { - "link": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo/rules?ver=13.1.0.7", - "isSubcollection": true, - "items": [ - { - "kind": "tm:security:firewall:policy:rules:rulesstate", - "name": "rule1", - "fullPath": "rule1", - "generation": 2075, - "selfLink": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo/rules/rule1?ver=13.1.0.7", - "action": "accept", - "ipProtocol": "any", - "iruleSampleRate": 1, - "log": "no", - "status": "enabled" - }, - { - "kind": "tm:security:firewall:policy:rules:rulesstate", - "name": "rule2", - "fullPath": "rule2", - "generation": 2075, - "selfLink": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo/rules/rule2?ver=13.1.0.7", - "action": "accept", - "ipProtocol": "any", - "iruleSampleRate": 1, - "log": "no", - "status": "enabled" - }, - { - "kind": "tm:security:firewall:policy:rules:rulesstate", - "name": "rule3", - "fullPath": "rule3", - "generation": 2074, - "selfLink": "https://localhost/mgmt/tm/security/firewall/policy/~Common~foo/rules/rule3?ver=13.1.0.7", - "action": "accept", - "ipProtocol": "any", - "iruleSampleRate": 1, - "log": "no", - "status": "enabled" - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_security_port_list_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_security_port_list_1.json deleted file mode 100644 index ec639dac..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_security_port_list_1.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "kind": "tm:security:firewall:port-list:port-liststate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 119, - "description": "this is a description", - "selfLink": "https://localhost/mgmt/tm/security/firewall/port-list/~Common~foo?ver=12.1.0", - "portLists": [ - { - "name": "_sys_self_allow_tcp_defaults", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/security/firewall/port-list/~Common~_sys_self_allow_tcp_defaults?ver=12.1.0" - } - } - ], - "ports": [ - { - "name": "1" - }, - { - "name": "2" - }, - { - "name": "3" - }, - { - "name": "4" - }, - { - "name": "10-20" - }, - { - "name": "30-40" - }, - { - "name": "50-60" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_shared_system_setup_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_shared_system_setup_1.json deleted file mode 100644 index 8f886e14..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_shared_system_setup_1.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "isSystemSetup": true, - "isAdminPasswordChanged": false, - "isRootPasswordChanged": true, - "generation": 7, - "lastUpdateMicros": 1536357209120972, - "kind": "shared:system:setup:systemsetupworkerstate", - "selfLink": "https://localhost/mgmt/shared/system/setup" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_new_checksum.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_new_checksum.json deleted file mode 100644 index 57f3c375..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_new_checksum.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "kind": "tm:sys:application:template:templatestate", - "name": "good_templ", - "partition": "Common", - "fullPath": "/Common/good_templ", - "generation": 410, - "selfLink": "https://localhost/mgmt/tm/sys/application/template/~Common~good_templ?ver=13.0.0", - "description": "My basic template", - "ignoreVerification": "false", - "requiresBigipVersionMin": "11.6.0", - "requiresModules": [ - "ltm" - ], - "tmplChecksum": "90c46acee5ca08e300da0bcdb9130745", - "totalSigningStatus": "checksum", - "verificationStatus": "checksum-verified", - "actionsReference": { - "link": "https://localhost/mgmt/tm/sys/application/template/~Common~good_templ/actions?ver=13.0.0", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_old_checksum.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_old_checksum.json deleted file mode 100644 index da477515..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_application_template_w_old_checksum.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "kind": "tm:sys:application:template:templatestate", - "name": "good_templ", - "partition": "Common", - "fullPath": "/Common/good_templ", - "generation": 410, - "selfLink": "https://localhost/mgmt/tm/sys/application/template/~Common~good_templ?ver=13.0.0", - "description": "My basic foo bar", - "ignoreVerification": "false", - "requiresBigipVersionMin": "12.0.0", - "requiresModules": [ - "ltm" - ], - "tmplChecksum": "eee01710dbe330d380d1a4fa30eeabdb", - "totalSigningStatus": "checksum", - "verificationStatus": "checksum-verified", - "actionsReference": { - "link": "https://localhost/mgmt/tm/sys/application/template/~Common~good_templ/actions?ver=13.0.0", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_crypto_cert_validator_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_crypto_cert_validator_1.json deleted file mode 100644 index 59da203a..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_crypto_cert_validator_1.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "kind": "tm:sys:crypto:cert-validator:ocsp:ocspstate", - "name": "asd", - "partition": "Common", - "fullPath": "/Common/asd", - "generation": 151, - "selfLink": "https://localhost/mgmt/tm/sys/crypto/cert-validator/ocsp/~Common~asd?ver=13.1.0.8", - "cacheErrorTimeout": 3600, - "cacheTimeout": "indefinite", - "clockSkew": 300, - "concurrentConnectionsLimit": 500, - "dnsResolver": "/Common/foo", - "dnsResolverReference": { - "link": "https://localhost/mgmt/tm/net/dns-resolver/~Common~foo?ver=13.1.0.8" - }, - "routeDomain": "/Common/0", - "routeDomainReference": { - "link": "https://localhost/mgmt/tm/net/route-domain/~Common~0?ver=13.1.0.8" - }, - "signHash": "sha256", - "signerCert": "/Common/default.crt", - "signerCertReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~default.crt?ver=13.1.0.8" - }, - "signerKey": "/Common/default.key", - "signerKeyReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-key/~Common~default.key?ver=13.1.0.8" - }, - "signerKeyPassphrase": "secret", - "statusAge": 0, - "strictRespCertCheck": "enabled", - "timeout": 8 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_external-monitor_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_external-monitor_1.json deleted file mode 100644 index 70dcbc23..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_external-monitor_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "kind": "tm:sys:file:external-monitor:external-monitorstate", - "name": "arg_example", - "partition": "Common", - "fullPath": "/Common/arg_example", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/sys/file/external-monitor/~Common~arg_example?ver=13.1.0.8", - "checksum": "SHA1:3159:0c78e6641632e47d11802b29cfd119d2233cb80a", - "createTime": "2018-06-16T06:49:11Z", - "createdBy": "root", - "lastUpdateTime": "2018-06-16T06:49:11Z", - "mode": 33261, - "revision": 1, - "size": 3159, - "systemPath": "/config/monitors/arg_example", - "updatedBy": "root" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_ssl_cert_with_issuer_cert.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_ssl_cert_with_issuer_cert.json deleted file mode 100644 index bb77ca33..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_file_ssl_cert_with_issuer_cert.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "kind": "tm:sys:file:ssl-cert:ssl-certstate", - "name": "ocsp.example.com.crt", - "partition": "Common", - "fullPath": "/Common/ocsp.example.com.crt", - "generation": 548, - "selfLink": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~ocsp.example.com.crt?ver=13.0.0", - "certValidationOptions": [ - "ocsp" - ], - "certificateKeyCurveName": "none", - "certificateKeySize": 4096, - "checksum": "SHA1:2113:b84ae5ed7e236b35206b2ff61289df9547d5afa3", - "createTime": "2017-10-25T20:56:09Z", - "createdBy": "admin", - "expirationDate": 1545199767, - "expirationString": "Dec 19 06:09:27 2018 GMT", - "isBundle": "false", - "issuer": "CN=Alice Ltd Intermediate CA,OU=Alice Ltd Certificate Authority,O=Alice Ltd,ST=England,C=GB", - "issuerCert": "/Common/intermediate.crt", - "issuerCertReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~intermediate.crt?ver=13.0.0" - }, - "keyType": "rsa-public", - "lastUpdateTime": "2017-10-25T20:56:09Z", - "mode": 33188, - "revision": 1, - "serialNumber": "4096", - "size": 2113, - "sourcePath": "file:///var/config/rest/downloads/ocsp.example.com.crt", - "subject": "CN=ocsp.example.com,OU=Alice Ltd Certificate Authority,O=Alice Ltd,ST=England,C=GB", - "updatedBy": "admin", - "version": 3, - "bundleCertificatesReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~ocsp.example.com.crt/bundle-certificates?ver=13.0.0", - "isSubcollection": true - }, - "certValidatorsReference": { - "link": "https://localhost/mgmt/tm/sys/file/ssl-cert/~Common~ocsp.example.com.crt/cert-validators?ver=13.0.0", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_global_settings.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_global_settings.json deleted file mode 100644 index 191d8178..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_global_settings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "kind": "tm:sys:global-settings:global-settingsstate", - "selfLink": "https://localhost/mgmt/tm/sys/global-settings?ver=13.0.0", - "awsApiMaxConcurrency": 1, - "consoleInactivityTimeout": 0, - "customAddr": "none", - "failsafeAction": "go-offline-restart-tm", - "fileBlacklistPathPrefix": "{/shared/3dns/} {/shared/bin/} {/shared/core/} {/shared/datasync/} {/shared/em/} {/shared/GeoIP/} {/shared/images/} {/shared/lib/} {/shared/lib64/} {/shared/log/} {/shared/lost+found/} {/shared/mgmt/} {/shared/nfb/} {/shared/ssh/} {/shared/statsd/} {/shared/tmstat/} {/shared/vadc/} {/config/aaa/} {/config/big3d/} {/config/bigip/} {/config/filestore/} {/config/gtm/} {/config/httpd/} {/config/ntp.conf} {/config/rndc.key} {/config/ssh/} {/config/ssl/}", - "fileBlacklistReadOnlyPathPrefix": "{/etc/shadow}", - "fileLocalPathPrefix": "{/shared/} {/tmp/}", - "fileWhitelistPathPrefix": "{/var/local/scf} {/tmp/} {/shared/} {/config/} {/usr/share/aws/}", - "guiSecurityBanner": "enabled", - "guiSecurityBannerText": "Welcome to the BIG-IP Configuration Utility.\n\nLog in with your username and password using the fields on the left.", - "guiSetup": "disabled", - "hostAddrMode": "management", - "hostname": "bigip1", - "lcdDisplay": "enabled", - "ledLocator": "disabled", - "mgmtDhcp": "enabled", - "netReboot": "disabled", - "passwordPrompt": "Password", - "quietBoot": "enabled", - "usernamePrompt": "Username" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd.json deleted file mode 100644 index 38d76168..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "kind": "tm:sys:httpd:httpdstate", - "selfLink": "https://localhost/mgmt/tm/sys/httpd?ver=12.1.2", - "allow": [ - "All" - ], - "authName": "BIG-IP", - "authPamDashboardTimeout": "off", - "authPamIdleTimeout": 1200, - "authPamValidateIp": "on", - "fastcgiTimeout": 300, - "fipsCipherVersion": 0, - "hostnameLookup": "off", - "logLevel": "warn", - "maxClients": 10, - "redirectHttpToHttps": "disabled", - "requestBodyMaxTimeout": 0, - "requestBodyMinRate": 500, - "requestBodyTimeout": 60, - "requestHeaderMaxTimeout": 40, - "requestHeaderMinRate": 500, - "requestHeaderTimeout": 20, - "sslCertfile": "/etc/httpd/conf/ssl.crt/server.crt", - "sslCertkeyfile": "/etc/httpd/conf/ssl.key/server.key", - "sslCiphersuite": "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA:AES128-SHA256:AES256-SHA256:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:DES-CBC3-SHA", - "sslOcspDefaultResponder": "http://127.0.0.1", - "sslOcspEnable": "off", - "sslOcspOverrideResponder": "off", - "sslOcspResponderTimeout": 300, - "sslOcspResponseMaxAge": -1, - "sslOcspResponseTimeSkew": 300, - "sslPort": 443, - "sslProtocol": "all -SSLv2 -SSLv3", - "sslVerifyClient": "no", - "sslVerifyDepth": 10 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd_non_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd_non_default.json deleted file mode 100644 index 05051b9c..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_httpd_non_default.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "kind": "tm:sys:httpd:httpdstate", - "selfLink": "https://localhost/mgmt/tm/sys/httpd?ver=12.1.2", - "allow": [ - "All" - ], - "authName": "BIG-IP", - "authPamDashboardTimeout": "off", - "authPamIdleTimeout": 1200, - "authPamValidateIp": "on", - "fastcgiTimeout": 300, - "fipsCipherVersion": 0, - "hostnameLookup": "off", - "logLevel": "warn", - "maxClients": 10, - "redirectHttpToHttps": "disabled", - "requestBodyMaxTimeout": 0, - "requestBodyMinRate": 500, - "requestBodyTimeout": 60, - "requestHeaderMaxTimeout": 40, - "requestHeaderMinRate": 500, - "requestHeaderTimeout": 20, - "sslCertfile": "/etc/httpd/conf/ssl.crt/server.crt", - "sslCertkeyfile": "/etc/httpd/conf/ssl.key/server.key", - "sslCiphersuite": "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384", - "sslOcspDefaultResponder": "http://127.0.0.1", - "sslOcspEnable": "off", - "sslOcspOverrideResponder": "off", - "sslOcspResponderTimeout": 300, - "sslOcspResponseMaxAge": -1, - "sslOcspResponseTimeSkew": 300, - "sslPort": 443, - "sslProtocol": "all -SSLv2", - "sslVerifyClient": "no", - "sslVerifyDepth": 10 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_destination_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_destination_1.json deleted file mode 100644 index 5288ed25..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_destination_1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:sys:log-config:destination:remote-syslog:remote-syslogstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 1767, - "selfLink": "https://localhost/mgmt/tm/sys/log-config/destination/remote-syslog/~Common~foo?ver=13.1.0.4", - "defaultFacility": "local0", - "defaultSeverity": "info", - "format": "rfc5424", - "remoteHighSpeedLog": "/Common/pool1", - "remoteHighSpeedLogReference": { - "link": "https://localhost/mgmt/tm/sys/log-config/destination/remote-high-speed-log/~Common~pool1?ver=13.1.0.4" - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_publisher_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_publisher_1.json deleted file mode 100644 index 54dd8891..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_log_config_publisher_1.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "kind": "tm:sys:log-config:publisher:publisherstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 5400, - "selfLink": "https://localhost/mgmt/tm/sys/log-config/publisher/~Common~foo?ver=13.1.0.4", - "description": "my description", - "destinations": [ - { - "name": "SECURITYLOGSERVERS-LOGGING", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/sys/log-config/destination/remote-high-speed-log/~Common~SECURITYLOGSERVERS-LOGGING?ver=13.1.0.4" - } - }, - { - "name": "local-db", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/sys/log-config/destination/local-database/~Common~local-db?ver=13.1.0.4" - } - }, - { - "name": "local-syslog", - "partition": "Common", - "nameReference": { - "link": "https://localhost/mgmt/tm/sys/log-config/destination/local-syslog/~Common~local-syslog?ver=13.1.0.4" - } - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_management_route_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_management_route_1.json deleted file mode 100644 index da3f5fcd..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_management_route_1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "kind": "tm:sys:management-route:management-routestate", - "name": "default", - "partition": "Common", - "fullPath": "/Common/default", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/sys/management-route/~Common~default?ver=13.1.0.4", - "description": "configured-by-dhcp", - "gateway": "10.0.2.2", - "mtu": 0, - "network": "default" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_provision_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_provision_default.json deleted file mode 100644 index 7be868a3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_provision_default.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "level": "dedicated", - "memory": "medium", - "module": "urldb" -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_smtp_server.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_smtp_server.json deleted file mode 100644 index 9ed191ea..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_smtp_server.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:sys:smtp-server:smtp-serverstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 54, - "selfLink": "https://localhost/mgmt/tm/sys/smtp-server/~Common~foo?ver=13.0.0", - "authenticationEnabled": true, - "encryptedConnection": "ssl", - "fromAddress": "no-reply@foo.bar", - "localHostName": "mail-host.foo.bar", - "passwordEncrypted": "$M$Ch$this-is-encrypted==", - "smtpServerHostName": "mail.foo.bar", - "smtpServerPort": 465, - "username": "admin" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_1.json deleted file mode 100644 index f45c3465..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "kind": "tm:sys:snmp:communities:communitiesstate", - "name": "/Common/foo", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/sys/snmp/communities/~Common~foo?ver=13.0.0", - "access": "ro", - "communityName": "foo", - "ipv6": "disabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_2.json deleted file mode 100644 index 32c29325..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "kind": "tm:sys:snmp:communities:communitiesstate", - "name": "/Common/foo", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/sys/snmp/communities/~Common~foo?ver=13.0.0", - "access": "rw", - "communityName": "foo", - "ipv6": "disabled", - "oidSubset": ".1", - "source": "1.1.1.1" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_3.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_3.json deleted file mode 100644 index d9a9ef12..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_3.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "kind": "tm:sys:snmp:communities:communitiesstate", - "name": "/Common/foo", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/sys/snmp/communities/~Common~foo?ver=13.0.0", - "access": "ro", - "communityName": "foo", - "ipv6": "enabled", - "oidSubset": ".1", - "source": "2001:0db8:85a3:0000:0000:8a2e:0370:7334" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_4.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_4.json deleted file mode 100644 index 38bf487d..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_communities_4.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "kind": "tm:sys:snmp:communities:communitiesstate", - "name": "/Common/foo", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/sys/snmp/communities/~Common~foo?ver=13.0.0", - "access": "ro", - "communityName": "foo", - "ipv6": "enabled" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_users_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_users_1.json deleted file mode 100644 index 4b0aac8f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_snmp_users_1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:sys:snmp:users:usersstate", - "name": "/Common/foo", - "fullPath": "/Common/foo", - "generation": 0, - "selfLink": "https://localhost/mgmt/tm/sys/snmp/users/~Common~foo?ver=13.0.0", - "access": "ro", - "authPasswordEncrypted": "secret", - "authProtocol": "sha", - "oidSubset": ".1", - "privacyPasswordEncrypted": "secret", - "privacyProtocol": "aes", - "securityLevel": "auth-privacy", - "username": "foo" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_image_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_image_1.json deleted file mode 100644 index 32a9afe0..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_image_1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:sys:software:image:imagestate", - "name": "foo.iso", - "fullPath": "foo.iso", - "generation": 113, - "selfLink": "https://localhost/mgmt/tm/sys/software/image/foo.iso?ver=13.1.0.4", - "build": "0.0.3", - "buildDate": "Sat Jun 16 00 03 03 PDT 2018", - "checksum": "8cdbd094195fab4b2b47ff4285577b70", - "fileSize": "1948 MB", - "lastModified": "Thu May 17 16:19:34 2018", - "product": "BIG-IP", - "verified": "yes", - "version": "13.1.0.8" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_update.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_update.json deleted file mode 100644 index f1617ff2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_software_update.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "kind": "tm:sys:software:update:updatestate", - "selfLink": "https://localhost/mgmt/tm/sys/software/update?ver=13.0.0", - "autoCheck": "enabled", - "autoPhonehome": "enabled", - "checkStatus": "none", - "errors": 0, - "frequency": "weekly" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_syslog_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_sys_syslog_1.json deleted file mode 100644 index 3e4d2576..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_sys_syslog_1.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "kind": "tm:sys:syslog:syslogstate", - "selfLink": "https://localhost/mgmt/tm/sys/syslog?ver=13.1.0.7", - "authPrivFrom": "notice", - "authPrivTo": "emerg", - "clusteredHostSlot": "enabled", - "clusteredMessageSlot": "disabled", - "consoleLog": "enabled", - "cronFrom": "warning", - "cronTo": "emerg", - "daemonFrom": "notice", - "daemonTo": "emerg", - "isoDate": "disabled", - "kernFrom": "debug", - "kernTo": "emerg", - "local6From": "notice", - "local6To": "emerg", - "mailFrom": "notice", - "mailTo": "emerg", - "messagesFrom": "notice", - "messagesTo": "warning", - "userLogFrom": "notice", - "userLogTo": "emerg" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tg_ha_order.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tg_ha_order.json deleted file mode 100644 index a1ff91c8..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tg_ha_order.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "kind": "tm:cm:traffic-group:traffic-groupstate", - "name": "traffic-group-2", - "partition": "Common", - "fullPath": "/Common/traffic-group-2", - "generation": 227, - "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-2?ver=12.1.4", - "autoFailbackEnabled": "true", - "autoFailbackTime": 60, - "haLoadFactor": 1, - "isFloating": "true", - "mac": "none", - "unitId": 1, - "haOrder": [ - "/Common/v12-1.ansible.local" - ], - "haOrderReference": [ - { - "link": "https://localhost/mgmt/tm/cm/device/~Common~v12-1.ansible.local?ver=12.1.4" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_partition.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_partition.json deleted file mode 100644 index 386c30f7..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_partition.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "kind": "tm:auth:partition:partitionstate", - "name": "foo", - "fullPath": "foo", - "generation": 212, - "selfLink": "https://localhost/mgmt/tm/auth/partition/foo?ver=13.0.0", - "defaultRouteDomain": 0, - "description": "my description" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_password_policy_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_password_policy_1.json deleted file mode 100644 index 7d5aac7b..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_password_policy_1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:auth:password-policy:password-policystate", - "selfLink": "https://localhost/mgmt/tm/auth/password-policy?ver=13.1.0.7", - "expirationWarning": 7, - "maxDuration": 99999, - "maxLoginFailures": 0, - "minDuration": 0, - "minimumLength": 6, - "passwordMemory": 0, - "policyEnforcement": "disabled", - "requiredLowercase": 0, - "requiredNumeric": 0, - "requiredSpecial": 0, - "requiredUppercase": 0 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_tacacs_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_tacacs_1.json deleted file mode 100644 index 24622605..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_auth_tacacs_1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:auth:tacacs:tacacsstate", - "name": "system-auth", - "partition": "Common", - "fullPath": "/Common/system-auth", - "generation": 484, - "selfLink": "https://localhost/mgmt/tm/auth/tacacs/~Common~system-auth?ver=13.1.0.1", - "accounting": "send-to-first-server", - "authentication": "use-first-server", - "debug": "disabled", - "encryption": "enabled", - "protocol": "ftp", - "secret": "secret", - "servers": [ - "11.11.11.11" - ], - "service": "ppp", - "timeout": 10 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_alias_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_alias_1.json deleted file mode 100644 index bb9b0e90..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_alias_1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "kind": "tm:cli:alias:shared:sharedstate", - "name": "bash", - "partition": "Common", - "fullPath": "/Common/bash", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/cli/alias/shared/~Common~bash?ver=13.1.0.7", - "tmCommand": "run /util bash", - "description": "Run the bash shell" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_script_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_script_1.json deleted file mode 100644 index dd1beb55..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cli_script_1.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "kind": "tm:cli:script:scriptstate", - "name": "foo", - "partition": "Common", - "fullPath": "/Common/foo", - "generation": 62, - "selfLink": "https://localhost/mgmt/tm/cli/script/~Common~foo?ver=12.1.3", - "apiAnonymous": "proc script::run {} {}\n", - "ignoreVerification": "false", - "scriptChecksum": "2a7a57176f8d6ef585ea3cd0db787718", - "totalSigningStatus": "checksum", - "verificationStatus": "checksum-verified" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device.json deleted file mode 100644 index c99890d3..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "kind": "tm:cm:device:devicestate", - "name": "bigip1", - "partition": "Common", - "fullPath": "/Common/bigip1", - "generation": 65, - "selfLink": "https://localhost/mgmt/tm/cm/device/~Common~bigip1?ver=12.1.2", - "activeModules": [ - "APM, Max, VE (2500 CCU, 10000 Access Sessions)|P961057-1761515|Anti-Virus Checks|Base Endpoint Security Checks|Firewall Checks|Machine Certificate Checks|Network Access|Protected Workspace|Secure Virtual Keyboard|APM, Web Application|App Tunnel|Remote Desktop", - "LTM, 10 Gbps, VE|T487107-2453693|IPV6 Gateway|Rate Shaping|Ram Cache|External Interface and Network HSM, VE|SSL, Forward Proxy, VE|DENY-VER-GBB|Application Acceleration Manager, Core|PEM, Quota Management, VE|BIG-IP, iAppsLX (Node.js)|Max Compression, VE|BIG-IP VE, Multicast Routing|Recycle, BIG-IP, VE|APM, Limited|LTM to Best Bundle Upgrade, 10Gbps|BIG-IP, iRulesLX (Node.js)|SSL, VE|Anti-Virus Checks|Base Endpoint Security Checks|Firewall Checks|Machine Certificate Checks|Network Access|Protected Workspace|Secure Virtual Keyboard|APM, Web Application|App Tunnel|Remote Desktop|SDN Services, VE|Acceleration Manager, VE|AFM, VE|APM, Base, VE GBB (500 CCU)|ASM, VE|DNS-GTM, Base, 10Gbps|DNS Licensed Objects, Unlimited|GTM Licensed Objects, Unlimited|GTM Rate, 250K|DNS Rate Fallback, 250K|DNS Rate Limit, 250K QPS|GTM Rate Fallback, 250K|CGN, BIG-IP VE, AFM ONLY|PSM, VE|Routing Bundle, VE|DNSSEC", - "PEM, VE|X895364-1851682" - ], - "baseMac": "08:00:27:27:74:82", - "build": "0.0.249", - "cert": "/Common/dtdi.crt", - "certReference": { - "link": "https://localhost/mgmt/tm/cm/cert/~Common~dtdi.crt?ver=12.1.2" - }, - "chassisId": "2d37dfa6-c0e8-4e4a-ae983c67356d", - "chassisType": "individual", - "configsyncIp": "10.2.2.2", - "edition": "Final", - "failoverState": "active", - "haCapacity": 0, - "hostname": "bigip1", - "key": "/Common/dtdi.key", - "keyReference": { - "link": "https://localhost/mgmt/tm/cm/key/~Common~dtdi.key?ver=12.1.2" - }, - "managementIp": "10.0.2.15", - "marketingName": "BIG-IP Virtual Edition", - "mirrorIp": "10.2.2.2", - "mirrorSecondaryIp": "10.2.3.2", - "multicastInterface": "eth0", - "multicastIp": "224.0.0.245", - "multicastPort": 62960, - "optionalModules": [ - "APM, Base, VE (50 CCU / 200 Access Sessions)", - "App Mode (TMSH Only, No Root/Bash)", - "Concurrent Users", - "Concurrent Users and Access Sessions, VE", - "IPI Subscription, 1Yr, VE", - "IPI Subscription, 1Yr, VE-10G", - "IPI Subscription, 3Yr, VE-10G", - "LTM to Better Bundle Upgrade, 10Gbps", - "PEM URL Filtering, 1Yr, HIGH PERF", - "PEM URL Filtering, 3Yr, HIGH PERF", - "Routing Bundle", - "SWG Subscription, 1Yr, VE", - "URL Filtering Subscription, 1Yr, VE" - ], - "platformId": "Z100", - "product": "BIG-IP", - "selfDevice": "true", - "timeLimitedModules": [ - "IPI Subscription, 3Yr, VE|E430735-0717882|20170429|20170511|SUBSCRIPTION", - "SWG Subscription, 3Yr, VE|W797718-6984294|20170429|20170511|SUBSCRIPTION", - "URL Filtering Subscription, 3Yr, VE|G132953-9613041|20170429|20170511|SUBSCRIPTION" - ], - "timeZone": "America/Los_Angeles", - "version": "12.1.2", - "unicastAddress": [ - { - "effectiveIp": "management-ip", - "effectivePort": 1026, - "ip": "management-ip", - "port": 1026 - }, - { - "effectiveIp": "10.2.2.2", - "effectivePort": 1026, - "ip": "10.2.2.2", - "port": 1026 - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_default.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_default.json deleted file mode 100644 index 13d77f75..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_default.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "kind": "tm:cm:device:devicestate", - "name": "bigip1", - "partition": "Common", - "fullPath": "/Common/bigip1", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/cm/device/~Common~bigip1?ver=12.1.2", - "activeModules": [ - "APM, Max, VE (2500 CCU, 10000 Access Sessions)|P961057-1761515|Anti-Virus Checks|Base Endpoint Security Checks|Firewall Checks|Machine Certificate Checks|Network Access|Protected Workspace|Secure Virtual Keyboard|APM, Web Application|App Tunnel|Remote Desktop", - "LTM, 10 Gbps, VE|T487107-2453693|IPV6 Gateway|Rate Shaping|Ram Cache|External Interface and Network HSM, VE|SSL, Forward Proxy, VE|DENY-VER-GBB|Application Acceleration Manager, Core|PEM, Quota Management, VE|BIG-IP, iAppsLX (Node.js)|Max Compression, VE|BIG-IP VE, Multicast Routing|Recycle, BIG-IP, VE|APM, Limited|LTM to Best Bundle Upgrade, 10Gbps|BIG-IP, iRulesLX (Node.js)|SSL, VE|Anti-Virus Checks|Base Endpoint Security Checks|Firewall Checks|Machine Certificate Checks|Network Access|Protected Workspace|Secure Virtual Keyboard|APM, Web Application|App Tunnel|Remote Desktop|SDN Services, VE|Acceleration Manager, VE|AFM, VE|APM, Base, VE GBB (500 CCU)|ASM, VE|DNS-GTM, Base, 10Gbps|DNS Licensed Objects, Unlimited|GTM Licensed Objects, Unlimited|GTM Rate, 250K|DNS Rate Fallback, 250K|DNS Rate Limit, 250K QPS|GTM Rate Fallback, 250K|CGN, BIG-IP VE, AFM ONLY|PSM, VE|Routing Bundle, VE|DNSSEC", - "PEM, VE|X895364-1851682" - ], - "baseMac": "08:00:27:27:74:82", - "build": "0.0.249", - "cert": "/Common/dtdi.crt", - "certReference": { - "link": "https://localhost/mgmt/tm/cm/cert/~Common~dtdi.crt?ver=12.1.2" - }, - "chassisId": "42d93eba-35bb-4f01-4663fb03951a", - "chassisType": "individual", - "configsyncIp": "none", - "edition": "Final", - "failoverState": "active", - "haCapacity": 0, - "hostname": "bigip1", - "key": "/Common/dtdi.key", - "keyReference": { - "link": "https://localhost/mgmt/tm/cm/key/~Common~dtdi.key?ver=12.1.2" - }, - "managementIp": "10.0.2.15", - "marketingName": "BIG-IP Virtual Edition", - "mirrorIp": "any6", - "mirrorSecondaryIp": "any6", - "multicastIp": "any6", - "multicastPort": 0, - "optionalModules": [ - "APM, Base, VE (50 CCU / 200 Access Sessions)", - "App Mode (TMSH Only, No Root/Bash)", - "Concurrent Users", - "Concurrent Users and Access Sessions, VE", - "IPI Subscription, 1Yr, VE", - "IPI Subscription, 1Yr, VE-10G", - "IPI Subscription, 3Yr, VE-10G", - "LTM to Better Bundle Upgrade, 10Gbps", - "PEM URL Filtering, 1Yr, HIGH PERF", - "PEM URL Filtering, 3Yr, HIGH PERF", - "Routing Bundle", - "SWG Subscription, 1Yr, VE", - "URL Filtering Subscription, 1Yr, VE" - ], - "platformId": "Z100", - "product": "BIG-IP", - "selfDevice": "true", - "timeLimitedModules": [ - "IPI Subscription, 3Yr, VE|E430735-0717882|20170502|20170511|SUBSCRIPTION", - "SWG Subscription, 3Yr, VE|W797718-6984294|20170502|20170511|SUBSCRIPTION", - "URL Filtering Subscription, 3Yr, VE|G132953-9613041|20170502|20170511|SUBSCRIPTION" - ], - "timeZone": "America/Los_Angeles", - "version": "12.1.2" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_group.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_group.json deleted file mode 100644 index 66602341..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_device_group.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "kind": "tm:cm:device-group:device-groupstate", - "name": "device_trust_group", - "partition": "Common", - "fullPath": "/Common/device_trust_group", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/cm/device-group/~Common~device_trust_group?ver=13.0.0", - "asmSync": "disabled", - "autoSync": "enabled", - "fullLoadOnSync": "false", - "incrementalConfigSyncSizeMax": 1024, - "networkFailover": "disabled", - "saveOnAutoSync": "false", - "type": "sync-only", - "devicesReference": { - "link": "https://localhost/mgmt/tm/cm/device-group/~Common~device_trust_group/devices?ver=13.0.0", - "isSubcollection": true - } -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_1.json deleted file mode 100644 index dbbb1907..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:cm:traffic-group:traffic-groupstate", - "name": "traffic-group-1", - "partition": "Common", - "fullPath": "/Common/traffic-group-1", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-1?ver=13.0.0", - "autoFailbackEnabled": "false", - "autoFailbackTime": 60, - "failoverMethod": "ha-order", - "haLoadFactor": 1, - "isFloating": "true", - "mac": "none", - "monitor": {}, - "unitId": 1 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_2.json deleted file mode 100644 index 3b93cdae..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_cm_traffic_group_2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "kind": "tm:cm:traffic-group:traffic-groupstate", - "name": "asd", - "partition": "Common", - "fullPath": "/Common/asd", - "generation": 176, - "selfLink": "https://localhost/mgmt/tm/cm/traffic-group/~Common~asd?ver=13.0.0", - "autoFailbackEnabled": "false", - "autoFailbackTime": 60, - "failoverMethod": "ha-order", - "haLoadFactor": 1, - "isFloating": "true", - "mac": "00:00:00:00:00:02", - "monitor": {}, - "unitId": 2 -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_self.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_self.json deleted file mode 100644 index 9bf4f234..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_self.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "kind": "tm:net:self:selfstate", - "name": "net1", - "partition": "Common", - "fullPath": "/Common/net1", - "generation": 7, - "selfLink": "https://localhost/mgmt/tm/net/self/~Common~net1?ver=13.0.0", - "address": "10.10.10.10%1/24", - "addressSource": "from-user", - "floating": "disabled", - "inheritedTrafficGroup": "false", - "trafficGroup": "/Common/traffic-group-local-only", - "trafficGroupReference": { - "link": "https://localhost/mgmt/tm/cm/traffic-group/~Common~traffic-group-local-only?ver=13.0.0" - }, - "unit": 0, - "vlan": "/Common/net1", - "vlanReference": { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~net1?ver=13.0.0" - }, - "allowService": [ - "tcp:80", - "udp:53", - "gre:0" - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_trunk_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_trunk_1.json deleted file mode 100644 index af312d49..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_net_trunk_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "kind": "tm:net:trunk:trunkstate", - "name": "foo", - "fullPath": "foo", - "generation": 79, - "selfLink": "https://localhost/mgmt/tm/net/trunk/foo?ver=13.1.0.4", - "bandwidth": 10000, - "cfgMbrCount": 1, - "distributionHash": "dst-mac", - "id": 0, - "lacp": "disabled", - "lacpMode": "active", - "lacpTimeout": "long", - "linkSelectPolicy": "maximum-bandwidth", - "macAddress": "08:00:27:ea:18:52", - "media": "10000", - "qinqEthertype": "0x8100", - "stp": "enabled", - "type": "normal", - "workingMbrCount": 1, - "interfaces": [ - "1.3" - ], - "interfacesReference": [ - { - "link": "https://localhost/mgmt/tm/net/interface/1.3?ver=13.1.0.4" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_1.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_1.json deleted file mode 100644 index 47d76282..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_1.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "kind": "tm:sys:syslog:syslogstate", - "selfLink": "https://localhost/mgmt/tm/sys/syslog?ver=13.0.0", - "authPrivFrom": "notice", - "authPrivTo": "emerg", - "clusteredHostSlot": "enabled", - "clusteredMessageSlot": "disabled", - "consoleLog": "enabled", - "cronFrom": "warning", - "cronTo": "emerg", - "daemonFrom": "notice", - "daemonTo": "emerg", - "isoDate": "disabled", - "kernFrom": "debug", - "kernTo": "emerg", - "local6From": "notice", - "local6To": "emerg", - "mailFrom": "notice", - "mailTo": "emerg", - "messagesFrom": "notice", - "messagesTo": "warning", - "userLogFrom": "notice", - "userLogTo": "emerg", - "remoteServers": [ - { - "name": "/Common/remotesyslog1", - "host": "10.10.10.10", - "localIp": "none", - "remotePort": 514 - }, - { - "name": "/Common/remotesyslog2", - "host": "20.20.20.20", - "localIp": "1.1.1.1", - "remotePort": 8000 - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_2.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_2.json deleted file mode 100644 index d1eb8929..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tm_sys_syslog_2.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "kind": "tm:sys:syslog:syslogstate", - "selfLink": "https://localhost/mgmt/tm/sys/syslog?ver=13.0.0", - "authPrivFrom": "notice", - "authPrivTo": "emerg", - "clusteredHostSlot": "enabled", - "clusteredMessageSlot": "disabled", - "consoleLog": "enabled", - "cronFrom": "warning", - "cronTo": "emerg", - "daemonFrom": "notice", - "daemonTo": "emerg", - "isoDate": "disabled", - "kernFrom": "debug", - "kernTo": "emerg", - "local6From": "notice", - "local6To": "emerg", - "mailFrom": "notice", - "mailTo": "emerg", - "messagesFrom": "notice", - "messagesTo": "warning", - "userLogFrom": "notice", - "userLogTo": "emerg", - "remoteServers": [ - { - "name": "/Common/remotesyslog1", - "host": "10.10.10.10", - "localIp": "none", - "remotePort": 514 - }, - { - "name": "/Common/remotesyslog2", - "host": "10.10.10.10", - "localIp": "1.1.1.1", - "remotePort": 8000 - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_tmm_log.json b/tests/unit/plugins/modules/network/f5/fixtures/load_tmm_log.json deleted file mode 100644 index 5d634183..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_tmm_log.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "kind": "tm:sys:daemon-log-settings:tmm:tmmstate", - "selfLink": "https://localhost/mgmt/tm/sys/daemon-log-settings/tmm?ver=12.1.3.6", - "arpLogLevel": "warning", - "httpCompressionLogLevel": "error", - "httpLogLevel": "error", - "ipLogLevel": "warning", - "iruleLogLevel": "informational", - "layer4LogLevel": "notice", - "netLogLevel": "warning", - "osLogLevel": "notice", - "pvaLogLevel": "informational", - "sslLogLevel": "warning" -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan.json b/tests/unit/plugins/modules/network/f5/fixtures/load_vlan.json deleted file mode 100644 index 85d7fbb2..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "kind": "tm:net:vlan:vlanstate", - "name": "somevlan", - "partition": "Common", - "fullPath": "/Common/somevlan", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan?ver=12.1.0", - "autoLasthop": "default", - "cmpHash": "default", - "dagRoundRobin": "disabled", - "dagTunnel": "outer", - "failsafe": "disabled", - "failsafeAction": "failover-restart-tm", - "failsafeTimeout": 90, - "ifIndex": 480, - "learning": "enable-forward", - "mtu": 1500, - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes", - "samplingRate": 0, - "samplingRateGlobal": "yes" - }, - "sourceChecking": "disabled", - "tag": 4094, - "interfacesReference": { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan/interfaces?ver=12.1.0", - "isSubcollection": true - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_interfaces.json b/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_interfaces.json deleted file mode 100644 index 9fa16f76..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_interfaces.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "kind": "tm:net:vlan:interfaces:interfacescollectionstate", - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~vlan1/interfaces?ver=13.0.0", - "items": [ - { - "kind": "tm:net:vlan:interfaces:interfacesstate", - "name": "1.2", - "fullPath": "1.2", - "generation": 105, - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~vlan1/interfaces/1.2?ver=13.0.0", - "tagMode": "none", - "tagged": true - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_tagged_ifcs.json b/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_tagged_ifcs.json deleted file mode 100644 index 96b3150f..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_tagged_ifcs.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "kind": "tm:net:vlan:interfaces:interfacesstate", - "name": "1.2", - "fullPath": "1.2", - "generation": 2, - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~internal/interfaces/1.2?ver=12.1.0", - "tagMode": "none", - "tagged": true - } - - ] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_untag_ifcs.json b/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_untag_ifcs.json deleted file mode 100644 index ebc530e7..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/load_vlan_untag_ifcs.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "kind": "tm:net:vlan:interfaces:interfacesstate", - "name": "1.1", - "fullPath": "1.1", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~internal/interfaces/1.1?ver=12.1.0", - "tagMode": "none", - "untagged": true - } - ] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/f5/fixtures/pool_members_subcollection.json b/tests/unit/plugins/modules/network/f5/fixtures/pool_members_subcollection.json deleted file mode 100644 index 1041f8f6..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/pool_members_subcollection.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "kind": "tm:ltm:pool:members:membersstate", - "name": "1.1.1.1:80", - "partition": "Common", - "fullPath": "/Common/1.1.1.1:80", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/ltm/pool/~Common~test_pool/members/~Common~1.1.1.1:80?ver=11.5.4", - "address": "1.1.1.1", - "connectionLimit": 0, - "dynamicRatio": 1, - "inheritProfile": "enabled", - "logging": "disabled", - "monitor": "default", - "priorityGroup": 0, - "rateLimit": "disabled", - "ratio": 1, - "session": "user-disabled", - "state": "up" - } - ] diff --git a/tests/unit/plugins/modules/network/f5/fixtures/update_iapp_service_parameters_f5_http.json b/tests/unit/plugins/modules/network/f5/fixtures/update_iapp_service_parameters_f5_http.json deleted file mode 100644 index cbb38936..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/update_iapp_service_parameters_f5_http.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "name": "http_example", - "partition": "Common", - "template": "/Common/f5.http", - "lists": [ - { - "name": "irules__irules", - "encrypted": "no", - "value": [ - "/Common/lgyft" - ] - }, - { - "name": "net__client_vlan", - "encrypted": "no", - "value": [ - "/Common/net2" - ] - } - ], - "tables": [ - { - "columnNames": [ - "name" - ], - "name": "pool__hosts", - "rows": [ - { - "row": [ - "demo.example.com" - ] - } - ] - }, - { - "columnNames": [ - "addr", - "connection_limit" - ], - "name": "pool__members", - "rows": [ - { - "row": [ - "20.1.1.1", - "0" - ] - }, - { - "row": [ - "10.1.1.2", - "0" - ] - } - ] - } - ], - "variables": [ - { - "name": "afm__policy", - "value": "/#do_not_use#" - }, - { - "name": "afm__dos_security_profile", - "value": "/#do_not_use#" - }, - { - "name": "afm__protocol_security_profile", - "value": "/#do_not_use#" - }, - { - "name": "asm__use_asm", - "value": "/#do_not_use#" - }, - { - "name": "client__http_compression", - "value": "/#do_not_use#" - }, - { - "name": "client__standard_caching_without_wa", - "value": "/#do_not_use#" - }, - { - "name": "client__tcp_wan_opt", - "value": "/#create_new#" - }, - { - "name": "monitor__monitor", - "value": "/#create_new#" - }, - { - "name": "monitor__frequency", - "value": "30" - }, - { - "name": "monitor__uri", - "value": "/my/path" - }, - { - "name": "monitor__response", - "value": "" - }, - { - "name": "net__client_mode", - "value": "wan" - }, - { - "name": "net__server_mode", - "value": "lan" - }, - { - "name": "net__vlan_mode", - "value": "all" - }, - { - "name": "pool__addr", - "value": "10.10.10.10" - }, - { - "name": "pool__http", - "value": "/#create_new#" - }, - { - "name": "pool__mask", - "value": "" - }, - { - "name": "pool__persist", - "value": "/#cookie#" - }, - { - "name": "pool__lb_method", - "value": "least-connections-member" - }, - { - "name": "pool__pool_to_use", - "value": "/#create_new#" - }, - { - "name": "pool__port_secure", - "value": "443" - }, - { - "name": "pool__redirect_port", - "value": "80" - }, - { - "name": "pool__redirect_to_https", - "value": "yes" - }, - { - "name": "pool__xff", - "value": "yes" - }, - { - "name": "server__oneconnect", - "value": "/#create_new#" - }, - { - "name": "server__tcp_lan_opt", - "value": "/#create_new#" - }, - { - "name": "ssl__cert", - "value": "/Common/default.crt" - }, - { - "name": "ssl__client_ssl_profile", - "value": "/#create_new#" - }, - { - "name": "ssl__key", - "value": "/Common/default.key" - }, - { - "name": "ssl__mode", - "value": "client_ssl" - }, - { - "name": "ssl__use_chain_cert", - "value": "/#do_not_use#" - }, - { - "name": "ssl_encryption_questions__advanced", - "value": "yes" - }, - { - "name": "stats__analytics", - "value": "/#do_not_use#" - }, - { - "name": "stats__request_logging", - "value": "/#do_not_use#" - } - ] -} diff --git a/tests/unit/plugins/modules/network/f5/fixtures/update_vlan_description.json b/tests/unit/plugins/modules/network/f5/fixtures/update_vlan_description.json deleted file mode 100644 index 99bf4833..00000000 --- a/tests/unit/plugins/modules/network/f5/fixtures/update_vlan_description.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "kind": "tm:net:vlan:vlanstate", - "name": "somevlan", - "partition": "Common", - "fullPath": "/Common/somevlan", - "description": "changed_this", - "generation": 1, - "selfLink": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan?ver=12.1.0", - "autoLasthop": "default", - "cmpHash": "default", - "dagRoundRobin": "disabled", - "dagTunnel": "outer", - "failsafe": "disabled", - "failsafeAction": "failover-restart-tm", - "failsafeTimeout": 90, - "ifIndex": 480, - "learning": "enable-forward", - "mtu": 1500, - "sflow": { - "pollInterval": 0, - "pollIntervalGlobal": "yes", - "samplingRate": 0, - "samplingRateGlobal": "yes" - }, - "sourceChecking": "disabled", - "tag": 4094, - "interfacesReference": { - "link": "https://localhost/mgmt/tm/net/vlan/~Common~somevlan/interfaces?ver=12.1.0", - "isSubcollection": true - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/__init__.py b/tests/unit/plugins/modules/network/onyx/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_bgp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_bgp_show.cfg deleted file mode 100644 index b9c5c952..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_bgp_show.cfg +++ /dev/null @@ -1,34 +0,0 @@ -## -## Running database "initial" -## Generated at 2009/01/14 12:53:06 +0000 -## Hostname: r-ufm-sw102 -## - -## -## Running-config temporary prefix mode setting -## -no cli default prefix-modes enable - -## -## BGP configuration -## - protocol bgp - router bgp 172 vrf default - router bgp 172 vrf default router-id 1.2.3.4 force - router bgp 172 vrf default bgp fast-external-fallover - router bgp 172 vrf default maximum-paths 31 - router bgp 172 vrf default bestpath as-path multipath-relax force - router bgp 172 vrf default neighbor evpn peer-group - router bgp 172 vrf default neighbor evpn send-community extended - router bgp 172 vrf default neighbor 10.2.3.4 remote-as 173 - router bgp 172 vrf default neighbor 10.2.3.5 remote-as 322 - router bgp 172 vrf default neighbor 10.2.3.5 peer-group evpn - router bgp 172 vrf default neighbor 10.2.3.5 ebgp-multihop 255 - router bgp 172 vrf default address-family l2vpn-evpn neighbor evpn next-hop-unchanged - router bgp 172 vrf default address-family l2vpn-evpn neighbor evpn activate - router bgp 172 vrf default network 172.16.1.0 /24 - router bgp 172 vrf default address-family l2vpn-evpn auto-create -## -## Persistent prefix mode setting -## -cli default prefix-modes enable diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_buffer_pool.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_buffer_pool.cfg deleted file mode 100644 index 7172e8dc..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_buffer_pool.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "roce": [ - { - "Type": "lossless", - "Switch Priorities": "3", - "Max Usage": "0", - "Usage": "0", - "Memory actual": "5.9M", - "Memory [%]": "50.00" - } - ], - "Exception list": { - "message": "N/A" - } -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_command_show_version.txt b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_command_show_version.txt deleted file mode 100644 index cca075b6..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_command_show_version.txt +++ /dev/null @@ -1,19 +0,0 @@ -Product name: MLNX-OS -Product release: 3.6.5000 -Build ID: #1-dev -Build date: 2017-11-10 18:14:32 -Target arch: x86_64 -Target hw: x86_64 -Built by: jenkins@cc45f26cd083 -Version summary: X86_64 3.6.5000 2017-11-10 18:14:32 x86_64 - -Product model: x86onie -Host ID: 248A073D505C -System serial num: \"MT1632X00205\" -System UUID: 0b19d6d0-5eca-11e6-8000-7cfe90fadc40 - -Uptime: 1d 16h 31m 43.856s -CPU load averages: 0.06 / 0.12 / 0.13 -Number of CPUs: 4 -System memory: 2597 MB used / 5213 MB free / 7810 MB total -Swap: 0 MB used / 0 MB free / 0 MB total diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_config.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_config.cfg deleted file mode 100644 index 38062a8c..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_config.cfg +++ /dev/null @@ -1,115 +0,0 @@ -## -## Running database "initial" -## Generated at 2017/11/28 17:52:08 +0000 -## Hostname: ufm-switch16 -## - -## -## Running-config temporary prefix mode setting -## -no cli default prefix-modes enable - -## -## License keys -## - license install 11223344 - -## -## MLAG protocol -## - protocol mlag - -## -## Interface Ethernet configuration -## - interface mlag-port-channel 2 - interface port-channel 1 - interface ethernet 1/7-1/8 channel-group 1 mode active - interface ethernet 1/32 mlag-channel-group 2 mode on - interface mlag-port-channel 2 switchport mode hybrid - interface mlag-port-channel 2 no shutdown - -## -## LAG configuration -## - lacp - -## -## VLAN configuration -## - vlan 101 - vlan 4094 - interface mlag-port-channel 2 switchport access vlan 101 - -## -## STP configuration -## -no spanning-tree - -## -## L3 configuration -## - ip routing vrf default - interface vlan 101 - interface vlan 4094 - interface vlan 101 ip address 10.0.0.254 255.255.255.0 - interface vlan 4094 ip address 10.10.10.1 255.255.255.0 - -## -## Other IP configuration -## -hostname ufm-switch16 - -## -## DCBX PFC configuration -## - dcb priority-flow-control enable force - interface ethernet 1/7-1/8 dcb priority-flow-control mode on force - interface port-channel 1 dcb priority-flow-control mode on force - -## -## LLDP configuration -## - lldp - -## -## MAGP configuration -## - protocol magp - interface vlan 101 magp 102 - interface vlan 101 magp 102 ip virtual-router address 10.0.0.252 - interface vlan 101 magp 102 ip virtual-router mac-address 00:00:5E:00:01:01 - -## -## MLAG configurations -## - mlag-vip neo-mlag-vip-4094 ip 192.168.1.1 /24 force -no mlag shutdown - mlag system-mac 00:00:5E:00:01:00 - interface port-channel 1 ipl 1 - interface vlan 4094 ipl 1 peer-address 10.10.10.2 - -## -## AAA remote server configuration -## -# ldap bind-password ******** -# radius-server key ******** -# tacacs-server key ******** - -## -## Network management configuration -## -# web proxy auth basic password ******** - telnet-server enable - -## -## X.509 certificates configuration -## -# -# Certificate name system-self-signed, ID 51f545df9722387056f674401f510ff56077800b -# (public-cert config omitted since private-key config is hidden) - -## -## Persistent prefix mode setting -## -cli default prefix-modes enable \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_src.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_src.cfg deleted file mode 100644 index 2fc2ada1..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_config_src.cfg +++ /dev/null @@ -1,3 +0,0 @@ -no cli default prefix-modes enable -interface mlag-port-channel 2 - diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_interfaces_ethernet.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_interfaces_ethernet.cfg deleted file mode 100644 index 03128f1e..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_interfaces_ethernet.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "Fec": "auto", - "Mac address": "7c:fe:90:e5:ca:3c", - "Actual speed": "100 Gbps", - "MTU": "1500 bytes(Maximum packet size 1522 bytes)", - "header": "Eth1/1", - "Admin state": "Enabled", - "Operational state": "Down" - }, - { - "Fec": "auto", - "Mac address": "7c:fe:90:e5:ca:3e", - "Actual speed": "100 Gbps", - "MTU": "1500 bytes(Maximum packet size 1522 bytes)", - "header": "Eth1/2", - "Admin state": "Enabled", - "Operational state": "Down" - } -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_module.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_module.cfg deleted file mode 100644 index a82fcf75..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_module.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "MGMT": [ - { - "Status": "ready" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_version.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_version.cfg deleted file mode 100644 index 9a486e8c..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_facts_show_version.cfg +++ /dev/null @@ -1,19 +0,0 @@ -{ - "Uptime": "2d 13h 40m 34.992s", - "Product model": "x86onie", - "Build date": "2017-11-10 18:14:32", - "Target arch": "x86_64", - "Target hw": "x86_64", - "Number of CPUs": "4", - "Build ID": "#1-dev", - "CPU load averages": "0.21 / 0.07 / 0.06", - "Host ID": "248A07B0141C", - "System serial num": "MT1708X07233", - "System UUID": "03d242b6-1a24-11e7-8000-248a07f55400", - "Swap": "0 MB used / 0 MB free / 0 MB total", - "Product name": "MLNX-OS", - "Built by": "jenkins@cc45f26cd083", - "System memory": "2597 MB used / 5213 MB free / 7810 MB total", - "Version summary": "X86_64 3.6.5000 2017-11-10 18:14:32 x86_64", - "Product release": "3.6.5000" -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_igmp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_igmp_show.cfg deleted file mode 100644 index 13b19d94..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_igmp_show.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "Report suppression interval": "5 seconds", - "IGMP snooping unregistered multicast": "flood", - "IGMP snooping operationally": "disabled", - "Mrouter timeout": "125 seconds", - "IGMP default version for new VLAN": "V3", - "header": "IGMP snooping global configuration", - "Last member query interval": "1 seconds", - "IGMP snooping globally": "disabled", - "Proxy-reporting globally": "disabled", - "Port purge timeout": "260 seconds" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_rates.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_rates.cfg deleted file mode 100644 index 11131cc5..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_rates.cfg +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Eth1/1": [ - { - "ingress rate": "9000 b/s", - "egress pkts/sec": "10", - "egress rate": "10000 b/s", - "ingress pkts/sec": "10" - } - ] -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_show.cfg deleted file mode 100644 index 982e58fd..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_show.cfg +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "Fec": "auto", - "Mac address": "7c:fe:90:f0:54:fc", - "60 seconds ingress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last clearing of \"show interface\" counters": "Never", - "Actual speed": "40 Gbps", - "MTU": "1500 bytes(Maximum packet size 1522 bytes)", - "header": "Eth1/1", - "Telemetry threshold": "Disabled\t TCs: N\\A", - "Telemetry threshold level": "N\\A", - "Flow-control": "receive off send off", - "Forwarding mode": "inherited cut-through", - "60 seconds egress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last change in operational status": "Never", - "Boot delay time": "0 sec", - "Description": "N\\A", - "Admin state": "Enabled", - "Telemetry sampling": "Disabled\t TCs: N\\A", - "Operational state": "Down", - "Width reduction mode": "Not supported", - "Tx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "hoq discard packets": "0", - "broadcast packets": "0" - }, - "MAC learning mode": "Enabled", - "Switchport mode": "access", - "Rx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "broadcast packets": "0" - } - }, - { - "Icmp redirect": "Enabled", - "Description": "N/A", - "Mac Address": "7C:FE:90:F0:54:C1", - "Autostate": "Enabled", - "Admin state": "Enabled", - "header": "Vlan 10", - "MTU": "1500 bytes", - "DHCP client": "Disabled", - "Operational state": "Up", - "VRF": "default", - "Arp timeout": "1500 seconds", - "Counters": "Disabled" - }, - { - "Autostate": "Enabled", - "Icmp redirect": "Enabled", - "Broadcast address": "10.2.2.255", - "Description": "N/A", - "Mac Address": "7C:FE:90:F0:54:C1", - "Internet Address": "10.2.2.3/24", - "Admin state": "Enabled", - "header": "Vlan 1002", - "MTU": "1500 bytes", - "DHCP client": "Disabled", - "Operational state": "Down", - "VRF": "default", - "Arp timeout": "1500 seconds", - "Counters": "Disabled" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_status.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_status.cfg deleted file mode 100644 index 7a3a974a..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_interfaces_status.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Eth1/1": [ - { - "Negotiation": "No-Negotiation", - "Operational state": "Down", - "Speed": "100 Gbps" - } - ], - "Vlan 1002": [ - { - "State": "Down", - "Description": "N/A" - } - ] -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l2_interface_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l2_interface_show.cfg deleted file mode 100644 index dc3704e4..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l2_interface_show.cfg +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Eth1/11": { - "Access vlan": "1", - "Allowed vlans": "", - "Mode": "access" - }, - "Eth1/10": { - "Access vlan": "1", - "Allowed vlans": "10", - "Mode": "hybrid" - } -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_interface_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_interface_show.cfg deleted file mode 100644 index 6298953b..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_interface_show.cfg +++ /dev/null @@ -1,89 +0,0 @@ -[ - { - "Broadcast address": "172.3.1.255", - "Fec": "auto", - "Tx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "hoq discard packets": "0", - "broadcast packets": "0" - }, - "Rx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "broadcast packets": "0" - }, - "header": "Eth1/5", - "Arp timeout": "1500 seconds", - "Actual speed": "40 Gbps", - "60 seconds egress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last change in operational status": "Never", - "Boot delay time": "0 sec", - "Description": "N\\A", - "DHCP client": "Disabled", - "VRF": "default", - "Mac address": "24:8A:07:F5:54:01", - "60 seconds ingress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last clearing of \"show interface\" counters": "Never", - "MTU": "1500 bytes(Maximum packet size 1522 bytes)", - "Telemetry threshold": "Disabled\t TCs: N\\A", - "Telemetry threshold level": "N\\A", - "Flow-control": "receive off send off", - "Forwarding mode": "inherited cut-through", - "Admin state": "Enabled", - "Telemetry sampling": "Disabled\t TCs: N\\A", - "IP Address": "172.3.12.4 /24", - "Operational state": "Down", - "Width reduction mode": "Not supported" - }, - { - "Fec": "auto", - "Mac address": "24:8a:07:f5:54:0c", - "60 seconds ingress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last clearing of \"show interface\" counters": "Never", - "Actual speed": "40 Gbps", - "MTU": "1500 bytes(Maximum packet size 1522 bytes)", - "header": "Eth1/6", - "Telemetry threshold": "Disabled\t TCs: N\\A", - "Telemetry threshold level": "N\\A", - "Flow-control": "receive off send off", - "Forwarding mode": "inherited cut-through", - "60 seconds egress rate": "0 bits/sec, 0 bytes/sec, 0 packets/sec", - "Last change in operational status": "Never", - "Boot delay time": "0 sec", - "Description": "N\\A", - "Admin state": "Enabled", - "Telemetry sampling": "Disabled\t TCs: N\\A", - "Operational state": "Down", - "Width reduction mode": "Not supported", - "Tx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "hoq discard packets": "0", - "broadcast packets": "0" - }, - "MAC learning mode": "Enabled", - "Switchport mode": "access", - "Rx": { - "error packets": "0", - "packets": "0", - "bytes": "0", - "multicast packets": "0", - "unicast packets": "0", - "discard packets": "0", - "broadcast packets": "0" - } - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_vlan_interface_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_vlan_interface_show.cfg deleted file mode 100644 index 66a5509e..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_l3_vlan_interface_show.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "Autostate": "Enabled", - "Icmp redirect": "Enabled", - "Broadcast address": "172.3.12.255", - "Description": "N/A", - "Mac Address": "7C:FE:90:E5:CA:01", - "Internet Address": "172.3.12.4/24", - "Admin state": "Enabled", - "header": "Vlan 1002", - "MTU": "1500 bytes", - "DHCP client": "Disabled", - "Operational state": "Down", - "VRF": "default", - "Arp timeout": "1500 seconds", - "Counters": "Disabled" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_interface_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_interface_show.cfg deleted file mode 100644 index d3a364b9..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_interface_show.cfg +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Eth1/1": [ - { - "Receive": "Enabled", - "Transmit": "Enabled", - "TLVs": "PD, SN, SD, SC, MA, PFC, AP, ETS-C, ETS-R" - } - ], - "Eth1/2": [ - { - "Receive": "Disabled", - "Transmit": "Disabled", - "TLVs": "PD, SN, SD, SC, MA, PFC, AP, ETS-C, ETS-R" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_show.cfg deleted file mode 100644 index 7bb1cb02..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_lldp_show.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "LLDP": "enabled" - }, - { - "Supported capabilities": "B,R", - "Chassis sub type": "Mac Address", - "header": "Local global configuration", - "System Name": "ufm-switch16", - "Supported capabilities enabled": "B", - "Chassis id": "7c:fe:90:e5:ca:00", - "System Description": "Mellanox MSN2700,MLNX-OS,SWv3.6.5000-04" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_config_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_config_show.cfg deleted file mode 100644 index 235205c2..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_config_show.cfg +++ /dev/null @@ -1,11 +0,0 @@ - -logging trap alert -logging 10.10.10.10 -logging 10.10.10.10 filter exclude ".*ERR.*" -logging 10.10.10.10 trap info -logging 10.10.10.12 -logging 10.10.10.12 port 80 -logging 10.10.10.12 trap override class sx-sdk priority emerg -logging files rotation criteria size-pct 10.000 -logging local info -logging receive diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_show.cfg deleted file mode 100644 index 09e21b10..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_logging_show.cfg +++ /dev/null @@ -1,35 +0,0 @@ -[ - { - "Log format": "standard", - "Log rotation size threshold": "10.000% of partition (986.46 megabytes)", - "Allow receiving of messages from remote hosts": "yes", - "Override for class debug-module": "notice", - "Local logging level": "info", - "Number of archived log files to keep": "10", - "Default remote logging level": "alert", - "Subsecond timestamp field": "disabled", - "Log rotation frequency": "weekly", - "debug": [ - "logging debug-files rotation criteria frequency daily", - "logging debug-files rotation criteria size 20", - "logging debug-files rotation max-num 20" - ] - }, - { - "Levels at which messages are logged": [ - { - "CLI commands": "notice", - "Audit messages": "notice" - } - ] - }, - { - "Remote syslog servers": [ - { - "Lines": [ - "No remote syslog servers configured" - ] - } - ] - } -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_magp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_magp_show.cfg deleted file mode 100644 index 7cc90b7a..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_magp_show.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "Interface vlan": "1243", - "Admin state": "Enabled", - "Virtual IP": "10.0.0.43", - "header": "MAGP 102", - "State": "Init", - "Virtual MAC": "01:02:03:04:05:06" - }, - { - "Interface vlan": "1200", - "Admin state": "Disabled", - "Virtual IP": "0.0.0.0", - "header": "MAGP 103", - "State": "Init", - "Virtual MAC": "00:00:00:00:00:00" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_ipl_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_ipl_show.cfg deleted file mode 100644 index 6d1f3df5..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_ipl_show.cfg +++ /dev/null @@ -1,29 +0,0 @@ -{ - "Reload-delay": "30 sec", - "Upgrade-timeout": "60 min", - "System-mac": "00:00:5E:00:01:4E [Mismatched]", - "Admin status": "Disabled", - "MLAG Ports Status Summary": { - "Active-partial": "0", - "Inactive": "0", - "Active-full": "0" - }, - "MLAG IPLs Summary": { - "1": [ - { - "Local IP address": "10.2.2.3", - "Peer IP address": "10.2.2.2", - "Operational State": "Down", - "Vlan Interface": "1002", - "Group Port-Channel": "Po1" - } - ] - }, - "Keepalive-interval": "1 sec", - "MLAG Ports Configuration Summary": { - "Disabled": "0", - "Configured": "0", - "Enabled": "0" - }, - "Operational status": "Down" -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_port_channel_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_port_channel_show.cfg deleted file mode 100644 index e883ecf3..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_port_channel_show.cfg +++ /dev/null @@ -1,18 +0,0 @@ -{ - "MLAG Port-Channel Flags": "D-Down, U-Up, P-Partial UP, S - suspended by MLAG", - "Port Flags": { - "I": "Individual", - "P": "Up in port-channel (members)", - "S": "Suspend in port-channel (members)", - "D": "Down" - }, - "MLAG Port-Channel Summary": { - "1 Mpo33(S)": [ - { - "Local Ports (D/P/S/I)": "Eth1/8(D)", - "Peer Ports (D/P/S/I)": "N/A", - "Type": "LACP" - } - ] - } -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_show.cfg deleted file mode 100644 index 1996a6b3..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_show.cfg +++ /dev/null @@ -1,18 +0,0 @@ -{ - "Reload-delay": "30 sec", - "Upgrade-timeout": "60 min", - "System-mac": "00:00:5E:00:01:4E", - "Admin status": "Disabled", - "MLAG Ports Status Summary": { - "Active-partial": "0", - "Inactive": "0", - "Active-full": "0" - }, - "Keepalive-interval": "1 sec", - "MLAG Ports Configuration Summary": { - "Disabled": "0", - "Configured": "0", - "Enabled": "0" - }, - "Operational status": "Down" -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_vip_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_vip_show.cfg deleted file mode 100644 index 19bee48f..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_mlag_vip_show.cfg +++ /dev/null @@ -1,19 +0,0 @@ -{ - "r-neo-sw12": [ - { - "IP Address": "10.209.26.55", - "VIP-State": "standby" - } - ], - "r-smg-sw14": [ - { - "IP Address": "10.209.27.172", - "VIP-State": "master" - } - ], - "MLAG-VIP": { - "MLAG VIP address": "10.209.25.107/24", - "MLAG group name": "neo-mlag-vip-500", - "Active nodes": "2" - } -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_servers_peers_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_servers_peers_show.cfg deleted file mode 100644 index 2f5d3c2f..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_servers_peers_show.cfg +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "NTP enabled": "yes", - "NTP Authentication enabled": "no" - }, - { - "NTP version": "4", - "Enabled": "yes", - "Key ID": "5", - "header": "NTP peer 1.1.1.1" - }, - { - "NTP version": "4", - "Enabled": "no", - "Trusted": "yes", - "Key ID": "99", - "header": "NTP server 2.2.2.2" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_show.cfg deleted file mode 100644 index b0b4a8db..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ntp_show.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[ -[ - { - "NTP is administratively": "enabled", - "NTP Authentication administratively": "disabled" - }, - { - "Lines": [ - "Clock is unsynchronized." - ] - }, - { - "Active servers and peers": [ - { - "Lines": [ - "No NTP associations present." - ] - } - ] - } -] , -[ - { - "header": "NTP Key 22", - "Encryption Type": "sha1", - "Trusted": "no" - } -] - -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_interfaces_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_interfaces_show.cfg deleted file mode 100644 index 75663058..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_interfaces_show.cfg +++ /dev/null @@ -1,5 +0,0 @@ - -OSPF Process ID 2 VRF default -Total number of interface: 1 -Interface Id Area Cost State Neighbors Status -Loopback1 0.0.0.0 1 Enabled 0 Up diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_show.cfg deleted file mode 100644 index 72e38568..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_ospf_show.cfg +++ /dev/null @@ -1 +0,0 @@ -Routing Process 2 with ID 10.2.3.4 default diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_disabled.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_disabled.cfg deleted file mode 100644 index 0d51d4d5..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_disabled.cfg +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Eth1/1": [ - { - "PFC admin": "Auto", - "PFC oper": "Disabled" - } - ], - "Eth1/1/2": [ - { - "PFC admin": "Auto", - "PFC oper": "Disabled" - } - ], - "Po1": [ - { - "PFC admin": "Auto", - "PFC oper": "Disabled" - } - ], - "Mpo2": [ - { - "PFC admin": "Auto", - "PFC oper": "Disabled" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_enabled.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_enabled.cfg deleted file mode 100644 index 471edc8c..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_pfc_interface_enabled.cfg +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Eth1/1": [ - { - "PFC admin": "on", - "PFC oper": "Enabled" - } - ], - "Eth1/1/2": [ - { - "PFC admin": "on", - "PFC oper": "Enabled" - } - ], - "Po1": [ - { - "PFC admin": "on", - "PFC oper": "Enabled" - } - ], - "Mpo2": [ - { - "PFC admin": "on", - "PFC oper": "Enabled" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_port_channel_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_port_channel_show.cfg deleted file mode 100644 index 805853f4..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_port_channel_show.cfg +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Flags": { - "I": "Individual", - "P": "Up in port-channel (members)", - "S": "Suspend in port-channel (members)", - "U": "Up", - "D": "Down" - }, - "1 Po22(D)": [ - { - "Type": "STATIC", - "Member Ports": "Eth1/7(D)" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_protocols_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_protocols_show.cfg deleted file mode 100644 index fd4549cd..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_protocols_show.cfg +++ /dev/null @@ -1,27 +0,0 @@ -{ - "pim": "disabled", - "dhcp-relay": "disabled", - "igmp-snooping": "disabled", - "lacp": "disabled", - "ptp": "disabled", - "lldp": "disabled", - "isolation-group": "disabled", - "bfd": "disabled", - "openflow": "disabled", - "telemetry": "disabled", - "vrrp": "disabled", - "spanning-tree": "rst", - "mlag": "disabled", - "magp": "disabled", - "nve": "disabled", - "Ethernet": "enabled", - "IP L3": "enabled", - "ets": "enabled", - "sflow": "disabled", - "dhcp-relay(v6)": "disabled", - "dot1x": "disabled", - "bgp": "disabled", - "priority-flow-control": "disabled", - "ospf": "disabled", - "bfd": "disabled" -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_aaa.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_aaa.cfg deleted file mode 100644 index 40abbf21..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_aaa.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "Default User": "admin", - "header": "AAA authorization", - "Fallback on server-err": "yes", - "Map Order": "remote-first" - }, - { - "header": "Authentication method(s)", - "message": "local" - }, - { - "header": "Accounting method(s)", - "message": "No accounting methods configured." - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_bfd.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_bfd.cfg deleted file mode 100644 index 2e578eb1..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_bfd.cfg +++ /dev/null @@ -1,14 +0,0 @@ -{ - "Lines": [ - " protocol bfd", - " ip bfd shutdown vrf default", - " ip bfd vrf 3 interval transmit-rate 55 force", - " ip bfd vrf default interval transmit-rate 55 force", - " ip bfd vrf 3 interval min-rx 50 force", - " ip bfd vrf default interval min-rx 50 force", - " ip bfd vrf 3 interval multiplier 7 force", - " ip bfd vrf default interval multiplier 7 force", - " ip route vrf 3 1.1.1.0/24 3.2.2.2 bfd", - " ip route vrf default 1.1.1.0/24 3.2.2.2 bfd" - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_dcb_ets_interface.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_dcb_ets_interface.cfg deleted file mode 100644 index b6bbc30f..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_dcb_ets_interface.cfg +++ /dev/null @@ -1,99 +0,0 @@ -[ - { - "Eth1/1": [ - { - "Multicast unaware mapping": "disabled", - "Interface Bandwidth Shape [Mbps]": "N/A" - }, - { - "Flags": [ - { - "S.Mode": "Scheduling Mode [Strict/WRR]", - "Bw.Sh": "Bandwidth Shaper", - "D": "-", - "W": "Weight", - "Bw.Gr": "Bandwidth Guaranteed" - } - ] - }, - { - "ETS per TC": [ - { - "1": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "17", - "BW Gr.(Mbps)": "0", - "W": "13" - } - ], - "0": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "17", - "BW Gr.(Mbps)": "0", - "W": "12" - } - ], - "3": [ - { - "S.Mode": "Strict", - "BW Sh.(Mbps)": "N/A", - "W(%)": "0", - "BW Gr.(Mbps)": "0", - "W": "0" - } - ], - "2": [ - { - "S.Mode": "Strict", - "BW Sh.(Mbps)": "N/A", - "W(%)": "0", - "BW Gr.(Mbps)": "0", - "W": "0" - } - ], - "5": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "17", - "BW Gr.(Mbps)": "0", - "W": "13" - } - ], - "4": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "16", - "BW Gr.(Mbps)": "0", - "W": "12" - } - ], - "7": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "17", - "BW Gr.(Mbps)": "0", - "W": "13" - } - ], - "6": [ - { - "S.Mode": "WRR", - "BW Sh.(Mbps)": "N/A", - "W(%)": "16", - "BW Gr.(Mbps)": "0", - "W": "12" - } - ] - } - ] - } - ] - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_igmp_interfaces.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_igmp_interfaces.cfg deleted file mode 100644 index 22641d8b..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_igmp_interfaces.cfg +++ /dev/null @@ -1,162 +0,0 @@ -{ - "Eth1/31": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/11": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/10": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/13": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/12": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/15": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/14": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/17": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/16": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/19": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/18": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/5": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/4": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/7": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/6": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/1": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/3": [ - { - "leave-mode": "Fast" - } - ], - "Eth1/2": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/9": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/8": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/32": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/24": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/25": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/26": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/27": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/20": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/21": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/22": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/23": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/30": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/28": [ - { - "leave-mode": "Normal" - } - ], - "Eth1/29": [ - { - "leave-mode": "Normal" - } - ] -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interface_congestion_control.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interface_congestion_control.cfg deleted file mode 100644 index e4c1207f..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interface_congestion_control.cfg +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "Interface ethernet": "1/1", - "ECN marked packets": "0" - }, - { - "header": "TC-0", - "Mode": "none" - }, - { - "header": "TC-1", - "Mode": "none" - }, - { - "Threshold mode": "relative", - "RED dropped packets": "0", - "header": "TC-2", - "Mode": "RED", - "Maximum threshold": "90%", - "Minimum threshold": "9%" - }, - { - "Threshold mode": "absolute", - "RED dropped packets": "0", - "header": "TC-3", - "Mode": "ECN", - "Maximum threshold": "1550 KB", - "Minimum threshold": "500 KB" - }, - { - "header": "TC-4", - "Mode": "none" - }, - { - "header": "TC-5", - "Mode": "none" - }, - { - "header": "TC-6", - "Mode": "none" - }, - { - "header": "TC-7", - "Mode": "none" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve.cfg deleted file mode 100644 index a907d168..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "Mlag tunnel IP": "192.10.10.1", - "Effective tunnel IP": "(not exist)", - "NVE member interfaces": "(not configured)", - "Admin state": "up", - "Source interface": "loopback 1 (ip 0.0.0.0)", - "header": "Interface NVE 1 status", - "Controller mode": "BGP", - "Global Neigh-Suppression": "Enable", - "Counters": { - "dropped NVE-encapsulated packets": "0", - "decapsulated (Rx) NVE packets": "0", - "encapsulated (Tx) NVE packets": "0", - "NVE-encapsulated packets with errors": "0" - } - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve_detail.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve_detail.cfg deleted file mode 100644 index e904bcc3..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_interfaces_nve_detail.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "10":[ - { - "Neigh Suppression":"Enable", - "VNI":"10010" - } - ], - "6":[ - { - "Neigh Suppression":"Enable", - "VNI":"10060" - } - ] - } -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping.cfg deleted file mode 100644 index 975b6723..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "mrouter static port list": "none", - "mrouter dynamic port list": "none", - "header": "Vlan 10 configuration parameters", - "message 1": "IGMP snooping is disabled", - "message 2": "IGMP version is V3", - "message 3": "Snooping switch is acting as Non-Querier" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_groups.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_groups.cfg deleted file mode 100644 index 3d84667b..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_groups.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "Snooping group information for VLAN 10 and group 224.5.5.1": [ - { - "Group flag": "St", - "Filter Mode": "EXCLUDE", - "V1/V2 Receiver Ports": "eth1/1, eth1/2", - "Exclude sources": "None" - }, - { - "V3 Receiver Ports": [ - { - "Exclude sources": [ - "None", - "None" - ], - "Include sources": [ - "1.1.1.1, 1.1.1.2", - "1.1.1.3" - ], - "Port Number": [ - "eth1/1", - "eth1/2" - ] - } - ] - } - ] - } -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_querier.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_querier.cfg deleted file mode 100644 index b64c260d..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ip_igmp_snooping_querier.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "Snooping querier information for VLAN 10": [ - { - "Lines": [ - "IGMP Querier Not Present" - ] - }, - { - "Response interval": "100", - "Elected querier IP address": "0.0.0.0", - "Group membership interval": "1", - "Robustness": "2", - "Configured querier IP address": "-", - "Query interval": "125", - "Version": "3" - } - ] - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ntp_configured.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ntp_configured.cfg deleted file mode 100644 index 4fa74b30..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ntp_configured.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "message 2": "No NTP servers configured.", - "message 1": "No NTP peers configured.", - "NTP enabled": "no", - "NTP Authentication enabled": "no" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_clock.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_clock.cfg deleted file mode 100644 index 93092b4e..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_clock.cfg +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Priority1": "128", - "Number of PTP ports": "0", - "Domain": "127", - "Priority2": "128", - "Local clock time": "04:50:24 Etc/UTC 2018/09/04" -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_interface.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_interface.cfg deleted file mode 100644 index 389612e0..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_ptp_interface.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "Transport protocol": "UDP IPv4", - "PTP interface state": "NONE", - "Forced Master": "no", - "Port Clock identity": "N/A", - "Announce interval(log mean)": "-2", - "PTP Port number": "0", - "header": "Interface name: Eth1/1", - "Delay Mechanism": "End to End", - "Sync interval(log mean)": "-3", - "Announce receipt time out": "3", - "Delay request interval(log mean)": "0" - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_hosts.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_hosts.cfg deleted file mode 100644 index 4a1312cc..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_hosts.cfg +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "Default notification port": "162", - "Default notification community": "public", - "Notifications enabled": "yes" - }, - { - "Notification sinks": [ - { - "1.1.1.1": [ - { - "Enabled": "yes", - "Port": "3", - "Notification type": "SNMP v3 inform", - "Remote engine ID": "" - }, - { - "Username": "sara", - "Authentication password": "(set)", - "Privacy password": "(set)", - "Privacy type": "3des", - "Authentication type": "md5" - } - ] - }, - { - "2.2.2.2": [ - { - "Community": "public (default)", - "Enabled": "yes", - "Port": "5", - "Notification type": "SNMP v2c trap" - } - ] - } - ] - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_users.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_users.cfg deleted file mode 100644 index 6c957ff0..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_show_snmp_users.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "User name sara": [ - { - "Privacy password": "(NOT SET; user disabled)", - "Enabled overall": "yes", - "Authentication password": "(NOT SET; user disabled)", - "Authentication type": "sha", - "Require privacy": "no", - "Privacy type": "aes-128" - }, - { - "SET access": [ - { - "Capability level": "admin", - "Enabled": "yes" - } - ] - } - ] - } -] diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_snmp_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_snmp_show.cfg deleted file mode 100644 index c3a16215..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_snmp_show.cfg +++ /dev/null @@ -1,52 +0,0 @@ -[ -[ - { - "SNMP port": "161", - "System contact": "sara", - "System location": "Jordan", - "SNMP enabled": "yes" - }, - { - "Read-only communities": [ - { - "Lines": [ - "community_1", - "public" - ] - } - ] - }, - { - "Read-write communities": [ - { - "Lines": [ - "community_2" - ] - } - ] - }, - { - "Interface listen enabled": "yes" - }, - { - "Listen Interfaces": [ - { - "Lines": [ - "No Listen Interfaces." - ] - } - ] - } -], -{ - "Lines": [ - " snmp-server community community_1 ro", - " snmp-server community community_2 rw", - " snmp-server contact sara", - " snmp-server location Jordan", - " snmp-server notify port 1", - " snmp-server notify community community_1" - ] -} - -] \ No newline at end of file diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_username_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_username_show.cfg deleted file mode 100644 index d5de67bf..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_username_show.cfg +++ /dev/null @@ -1,51 +0,0 @@ -{ - "xmladmin": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "Password set (SHA512)", - "FULL NAME": "XML Admin User" - } - ], - "monitor": [ - { - "CAPABILITY": "monitor", - "ACCOUNT STATUS": "Password set (SHA512)", - "FULL NAME": "System Monitor" - } - ], - "admin": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "No password required for login", - "FULL NAME": "System Administrator" - } - ], - "anass": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "Password set (SHA512)", - "FULL NAME": "" - } - ], - "root": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "No password required for login", - "FULL NAME": "Root User" - } - ], - "anassh": [ - { - "CAPABILITY": "admin", - "ACCOUNT STATUS": "Account disabled", - "FULL NAME": "" - } - ], - "xmluser": [ - { - "CAPABILITY": "monitor", - "ACCOUNT STATUS": "Password set (SHA512)", - "FULL NAME": "XML Monitor User" - } - ] -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_vlan_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_vlan_show.cfg deleted file mode 100644 index d1ae46bf..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_vlan_show.cfg +++ /dev/null @@ -1,14 +0,0 @@ -{ - "1": { - "Name": "default", - "Ports": "Eth1/1, Eth1/2, Eth1/3, Eth1/4, Eth1/5,\nEth1/6, Eth1/7, Eth1/8, Eth1/9, Eth1/10,\nEth1/11, Eth1/12, Eth1/13, Eth1/14, Eth1/15,\nEth1/16" - }, - "10": { - "Name": "test 10", - "Ports": "" - }, - "20": { - "Name": "test 20", - "Ports": "" - } -} diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_wjh_show.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/onyx_wjh_show.cfg deleted file mode 100644 index d50f4976..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/onyx_wjh_show.cfg +++ /dev/null @@ -1,3 +0,0 @@ - -no what-just-happened auto-export forwarding enable -no what-just-happened forwarding enable diff --git a/tests/unit/plugins/modules/network/onyx/fixtures/show_qos_interface_ethernet.cfg b/tests/unit/plugins/modules/network/onyx/fixtures/show_qos_interface_ethernet.cfg deleted file mode 100644 index cf2bba8f..00000000 --- a/tests/unit/plugins/modules/network/onyx/fixtures/show_qos_interface_ethernet.cfg +++ /dev/null @@ -1,134 +0,0 @@ -[ - { - "Eth1/1": [ - { - "PCP,DEI rewrite": "enabled", - "Default switch-priority": "0", - "IP PCP;DEI rewrite": "enable", - "Default DEI": "0", - "Default PCP": "0", - "Trust mode": "both", - "DSCP rewrite": "disabled" - }, - { - "PCP(DEI); DSCP to switch-priority mapping": [ - { - "2(0) 2(1)": [ - { - "switch-priority": "2", - "DSCP": "16 17 18 19 20 21 22 23" - } - ], - "3(0) 3(1)": [ - { - "switch-priority": "3", - "DSCP": "24 25 26 27 28 29 30 31" - } - ], - "5(0) 5(1)": [ - { - "switch-priority": "5", - "DSCP": "40 41 42 43 44 45 46 47" - } - ], - "0(0) 0(1)": [ - { - "switch-priority": "0", - "DSCP": "0 1 2 3 4 5 6 7" - } - ], - "7(0) 7(1)": [ - { - "switch-priority": "7", - "DSCP": "56 57 58 59 60 61 62 63" - } - ], - "4(0) 4(1)": [ - { - "switch-priority": "4", - "DSCP": "32 33 34 35 36 37 38 39" - } - ], - "6(0) 6(1)": [ - { - "switch-priority": "6", - "DSCP": "48 49 50 51 52 53 54 55" - } - ], - "1(0) 1(1)": [ - { - "switch-priority": "1", - "DSCP": "8 9 10 11 12 13 14 15" - } - ] - } - ] - }, - { - "PCP(DEI); DSCP rewrite mapping (switch-priority to PCP(DEI); DSCP; traffic-class)": [ - { - "Egress Interface": "Eth1/1" - }, - { - "1": [ - { - "PCP(DEI)": "1(0)", - "TC": "1", - "DSCP": "8" - } - ], - "0": [ - { - "PCP(DEI)": "0(0)", - "TC": "0", - "DSCP": "0" - } - ], - "3": [ - { - "PCP(DEI)": "3(0)", - "TC": "3", - "DSCP": "24" - } - ], - "2": [ - { - "PCP(DEI)": "2(0)", - "TC": "2", - "DSCP": "16" - } - ], - "5": [ - { - "PCP(DEI)": "5(0)", - "TC": "5", - "DSCP": "40" - } - ], - "4": [ - { - "PCP(DEI)": "4(0)", - "TC": "4", - "DSCP": "32" - } - ], - "7": [ - { - "PCP(DEI)": "7(0)", - "TC": "7", - "DSCP": "56" - } - ], - "6": [ - { - "PCP(DEI)": "6(0)", - "TC": "6", - "DSCP": "48" - } - ] - } - ] - } - ] - } -] diff --git a/tests/unit/plugins/modules/network/onyx/onyx_module.py b/tests/unit/plugins/modules/network/onyx/onyx_module.py deleted file mode 100644 index 1c98d48a..00000000 --- a/tests/unit/plugins/modules/network/onyx/onyx_module.py +++ /dev/null @@ -1,91 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import json -import os - -from ansible_collections.community.network.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase - -fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') -fixture_data = {} - - -def load_fixture(name): - path = os.path.join(fixture_path, name) - - if path in fixture_data: - return fixture_data[path] - - with open(path) as f: - data = f.read() - - try: - data = json.loads(data) - except Exception: - pass - - fixture_data[path] = data - return data - - -class TestOnyxModule(ModuleTestCase): - - def execute_module(self, failed=False, changed=False, commands=None, is_updates=False, sort=True, transport='cli'): - - self.load_fixtures(commands, transport=transport) - - if failed: - result = self.failed() - self.assertTrue(result['failed'], result) - else: - result = self.changed(changed) - self.assertEqual(result['changed'], changed, result) - - if commands is not None: - if is_updates: - commands_res = result.get('updates') - else: - commands_res = result.get('commands') - if sort: - self.assertEqual(sorted(commands), sorted(commands_res), commands_res) - else: - self.assertEqual(commands, commands_res, commands_res) - - return result - - def failed(self): - with self.assertRaises(AnsibleFailJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertTrue(result['failed'], result) - return result - - def changed(self, changed=False): - with self.assertRaises(AnsibleExitJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertEqual(result['changed'], changed, result) - return result - - def load_fixtures(self, commands=None, transport='cli'): - pass diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_aaa.py b/tests/unit/plugins/modules/network/onyx/test_onyx_aaa.py deleted file mode 100644 index 480354f2..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_aaa.py +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_aaa -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxAAAModule(TestOnyxModule): - - module = onyx_aaa - - def setUp(self): - self.enabled = False - super(TestOnyxAAAModule, self).setUp() - self.mock_get_config = patch.object( - onyx_aaa.OnyxAAAModule, "_show_aaa_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxAAAModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_aaa.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_aaa_accounting_no_change(self): - set_module_args(dict(tacacs_accounting_enabled=False)) - self.execute_module(changed=False) - - def test_aaa_accounting_with_change(self): - set_module_args(dict(tacacs_accounting_enabled=True)) - commands = ['aaa accounting changes default stop-only tacacs+'] - self.execute_module(changed=True, commands=commands) - - def test_aaa_auth_default_user_no_change(self): - set_module_args(dict(auth_default_user='admin')) - self.execute_module(changed=False) - - def test_aaa_auth_default_user_with_change(self): - set_module_args(dict(auth_default_user='monitor')) - commands = ['aaa authorization map default-user monitor'] - self.execute_module(changed=True, commands=commands) - - def test_aaa_auth_order_no_change(self): - set_module_args(dict(auth_order='remote-first')) - self.execute_module(changed=False) - - def test_aaa_auth_order_with_change(self): - set_module_args(dict(auth_order='local-only')) - commands = ['aaa authorization map order local-only'] - self.execute_module(changed=True, commands=commands) - - def test_aaa_fallback_no_change(self): - set_module_args(dict(auth_fallback_enabled=True)) - self.execute_module(changed=False) - - def test_aaa_fallback_with_change(self): - set_module_args(dict(auth_fallback_enabled=False)) - commands = ['no aaa authorization map fallback server-err'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_bfd.py b/tests/unit/plugins/modules/network/onyx/test_onyx_bfd.py deleted file mode 100644 index a22c85a0..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_bfd.py +++ /dev/null @@ -1,114 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_bfd -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxBFDModule(TestOnyxModule): - - module = onyx_bfd - - def setUp(self): - self.enabled = False - super(TestOnyxBFDModule, self).setUp() - self.mock_get_config = patch.object( - onyx_bfd.OnyxBFDModule, "_show_bfd_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxBFDModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_bfd.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_bfd_shutdown_no_change(self): - set_module_args(dict(shutdown=True)) - self.execute_module(changed=False) - - def test_bfd_shutdown_with_change(self): - set_module_args(dict(shutdown=False)) - commands = ['no ip bfd shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_vrf_bfd_shutdown_no_change(self): - set_module_args(dict(shutdown=False, - vrf='3')) - self.execute_module(changed=False) - - def test_vrf_bfd_shutdown_with_change(self): - set_module_args(dict(shutdown=True, - vrf='3')) - commands = ['ip bfd shutdown vrf 3'] - self.execute_module(changed=True, commands=commands) - - def test_bfd_interval_no_change(self): - set_module_args(dict(interval_min_rx=50, - interval_multiplier=7, - interval_transmit_rate=55)) - self.execute_module(changed=False) - - def test_bfd_interval_with_change(self): - set_module_args(dict(interval_min_rx=55, - interval_multiplier=7, - interval_transmit_rate=100)) - commands = ['ip bfd interval min-rx 55 multiplier 7 transmit-rate 100 force'] - self.execute_module(changed=True, commands=commands) - - def test_vrf_bfd_interval_no_change(self): - set_module_args(dict(interval_min_rx=50, - interval_multiplier=7, - interval_transmit_rate=55, - vrf='3')) - self.execute_module(changed=False) - - def test_vrf_bfd_interval_with_change(self): - set_module_args(dict(interval_min_rx=55, - interval_multiplier=7, - interval_transmit_rate=100, - vrf='3')) - commands = ['ip bfd vrf 3 interval min-rx 55 multiplier 7 transmit-rate 100 force'] - self.execute_module(changed=True, commands=commands) - - def test_bfd_iproute_no_change(self): - set_module_args(dict(iproute_network_prefix='1.1.1.0', - iproute_mask_length=24, - iproute_next_hop='3.2.2.2')) - self.execute_module(changed=False) - - def test_bfd_iproute_with_change(self): - set_module_args(dict(iproute_network_prefix='1.1.1.0', - iproute_mask_length=24, - iproute_next_hop='3.2.2.3')) - commands = ['ip route 1.1.1.0 /24 3.2.2.3 bfd'] - self.execute_module(changed=True, commands=commands) - - def test_vrf_bfd_iproute_no_change(self): - set_module_args(dict(iproute_network_prefix='1.1.1.0', - iproute_mask_length=24, - iproute_next_hop='3.2.2.2', - vrf='3')) - self.execute_module(changed=False) - - def test_vrf_bfd_iproute_with_change(self): - set_module_args(dict(iproute_network_prefix='1.1.1.0', - iproute_mask_length=24, - iproute_next_hop='3.2.2.3', - vrf='3')) - commands = ['ip route vrf 3 1.1.1.0 /24 3.2.2.3 bfd'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_bgp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_bgp.py deleted file mode 100644 index d135e869..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_bgp.py +++ /dev/null @@ -1,111 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_bgp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxBgpModule(TestOnyxModule): - - module = onyx_bgp - - def setUp(self): - super(TestOnyxBgpModule, self).setUp() - self.mock_get_config = patch.object( - onyx_bgp.OnyxBgpModule, "_get_bgp_summary") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxBgpModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_bgp_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_bgp_no_change(self): - neighbor = dict(remote_as=322, neighbor='10.2.3.5', multihop=255) - set_module_args(dict(as_number=172, router_id='1.2.3.4', - neighbors=[neighbor], - networks=['172.16.1.0/24'], - evpn=True, fast_external_fallover=True, - max_paths=31, ecmp_bestpath=True, - )) - self.execute_module(changed=False) - - def test_bgp_remove(self): - set_module_args(dict(as_number=172, state='absent')) - commands = ['no router bgp 172'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_with_vrf_changed(self): - set_module_args(dict(as_number=173, vrf='new_vrf')) - commands = ['no router bgp 172 vrf default', 'router bgp 173 vrf new_vrf', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_change(self): - neighbor = dict(remote_as=173, neighbor='10.2.3.4') - set_module_args(dict(as_number=174, router_id='1.2.3.4', - neighbors=[neighbor], - evpn=False, fast_external_fallover=False, - max_paths=32, ecmp_bestpath=False, - )) - commands = ['no router bgp 172 vrf default', 'router bgp 174 vrf default', 'exit', - 'router bgp 174 vrf default router-id 1.2.3.4 force', - 'router bgp 174 vrf default neighbor 10.2.3.4 remote-as 173', - 'no router bgp 174 vrf default neighbor evpn peer-group', - 'no router bgp 174 vrf default address-family l2vpn-evpn auto-create', - 'router bgp 174 vrf default no bgp fast-external-fallover', - 'router bgp 174 vrf default maximum-paths 32', - 'router bgp 174 vrf default no bestpath as-path multipath-relax force'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_add_neighbor(self): - neighbors = [dict(remote_as=173, neighbor='10.2.3.4'), - dict(remote_as=175, neighbor='10.2.3.5'), - dict(remote_as=175, neighbor='10.2.3.6', multihop=250)] - set_module_args(dict(as_number=172, router_id='1.2.3.4', - neighbors=neighbors, - networks=['172.16.1.0/24'], - evpn=True)) - commands = ['router bgp 172 vrf default neighbor 10.2.3.5 remote-as 175', - 'router bgp 172 vrf default neighbor 10.2.3.6 remote-as 175', - 'router bgp 172 vrf default neighbor 10.2.3.6 ebgp-multihop 250', - 'router bgp 172 vrf default neighbor 10.2.3.6 peer-group evpn', - 'router bgp 172 vrf default neighbor 10.2.3.4 peer-group evpn'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_del_neighbor(self): - set_module_args(dict(as_number=172, - networks=['172.16.1.0/24'], - purge=True)) - commands = ['router bgp 172 vrf default no neighbor 10.2.3.4 remote-as 173', - 'router bgp 172 vrf default no neighbor 10.2.3.5 remote-as 322'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_add_network(self): - neighbors = [dict(remote_as=173, neighbor='10.2.3.4')] - set_module_args(dict(as_number=172, router_id='1.2.3.4', - neighbors=neighbors, - networks=['172.16.1.0/24', '172.16.2.0/24'])) - commands = ['router bgp 172 vrf default network 172.16.2.0 /24'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_del_network(self): - neighbors = [dict(remote_as=173, neighbor='10.2.3.4')] - set_module_args(dict(as_number=172, neighbors=neighbors)) - commands = ['router bgp 172 no network 172.16.1.0 /24'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_buffer_pool.py b/tests/unit/plugins/modules/network/onyx/test_onyx_buffer_pool.py deleted file mode 100644 index 05b7cb00..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_buffer_pool.py +++ /dev/null @@ -1,78 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_buffer_pool -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxBufferPoolModule(TestOnyxModule): - - module = onyx_buffer_pool - buffer_pool_configured = False - - def setUp(self): - super(TestOnyxBufferPoolModule, self).setUp() - self.mock_get_buffer_pool_config = patch.object( - onyx_buffer_pool.OnyxBufferPoolModule, "_show_traffic_pool") - self.get_buffer_pool_config = self.mock_get_buffer_pool_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxBufferPoolModule, self).tearDown() - self.mock_get_buffer_pool_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - buffer_pool_config_file = 'onyx_buffer_pool.cfg' - self.get_buffer_pool_config.return_value = None - - if self.buffer_pool_configured is True: - buffer_pool_data = load_fixture(buffer_pool_config_file) - self.get_buffer_pool_config.return_value = buffer_pool_data - - self.load_config.return_value = None - - def test_buffer_pool_no_change(self): - self.buffer_pool_configured = True - set_module_args(dict(name="roce", pool_type="lossless", - memory_percent=50.0, switch_priority=3)) - self.execute_module(changed=False) - - def test_buffer_pool_with_change(self): - set_module_args(dict(name="roce", pool_type="lossless", - memory_percent=50.0, switch_priority=3)) - commands = ["traffic pool roce type lossless", - "traffic pool roce memory percent 50.0", - "traffic pool roce map switch-priority 3" - ] - self.execute_module(changed=True, commands=commands) - - def test_memory_percent_with_change(self): - self.buffer_pool_configured = True - set_module_args(dict(name="roce", pool_type="lossless", - memory_percent=60.0, switch_priority=3)) - commands = ["traffic pool roce memory percent 60.0"] - self.execute_module(changed=True, commands=commands) - - def test_switch_priority_with_change(self): - self.buffer_pool_configured = True - set_module_args(dict(name="roce", pool_type="lossless", - memory_percent=50.0, switch_priority=5)) - commands = ["traffic pool roce map switch-priority 5"] - self.execute_module(changed=True, commands=commands) - - def test_pool_type_with_change(self): - self.buffer_pool_configured = True - set_module_args(dict(name="roce", memory_percent=50.0, switch_priority=3)) - commands = ["traffic pool roce type lossy"] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_command.py b/tests/unit/plugins/modules/network/onyx/test_onyx_command.py deleted file mode 100644 index c85db3bd..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_command.py +++ /dev/null @@ -1,114 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import json - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_command -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxCommandModule(TestOnyxModule): - - module = onyx_command - - def setUp(self): - super(TestOnyxCommandModule, self).setUp() - self.mock_run_commands = patch( - 'ansible_collections.community.network.plugins.modules.network.onyx.onyx_command.run_commands') - self.run_commands = self.mock_run_commands.start() - - def tearDown(self): - super(TestOnyxCommandModule, self).tearDown() - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None, transport='cli'): - def load_from_file(*args, **kwargs): - module, commands = args - output = list() - - for item in commands: - try: - obj = json.loads(item['command']) - command = obj['command'] - except ValueError: - command = item['command'] - filename = str(command).replace(' ', '_') - filename = 'onyx_command_%s.txt' % filename - output.append(load_fixture(filename)) - return output - - self.run_commands.side_effect = load_from_file - - def test_onyx_command_simple(self): - set_module_args(dict(commands=['show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 1) - self.assertTrue(result['stdout'][0].startswith('Product name')) - - def test_onyx_command_multiple(self): - set_module_args(dict(commands=['show version', 'show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 2) - self.assertTrue(result['stdout'][0].startswith('Product name')) - - def test_onyx_command_wait_for(self): - wait_for = 'result[0] contains "MLNX"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module() - - def test_onyx_command_wait_for_fails(self): - wait_for = 'result[0] contains "test string"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 10) - - def test_onyx_command_retries(self): - wait_for = 'result[0] contains "test string"' - set_module_args( - dict(commands=['show version'], wait_for=wait_for, retries=2)) - self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 2) - - def test_onyx_command_match_any(self): - wait_for = ['result[0] contains "MLNX"', - 'result[0] contains "test string"'] - set_module_args(dict( - commands=['show version'], - wait_for=wait_for, - match='any')) - self.execute_module() - - def test_onyx_command_match_all(self): - wait_for = ['result[0] contains "MLNX"', - 'result[0] contains "Version summary"'] - set_module_args( - dict(commands=['show version'], wait_for=wait_for, match='all')) - self.execute_module() - - def test_onyx_command_match_all_failure(self): - wait_for = ['result[0] contains "MLNX"', - 'result[0] contains "test string"'] - commands = ['show version', 'show version'] - set_module_args( - dict(commands=commands, wait_for=wait_for, match='all')) - self.execute_module(failed=True) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_config.py b/tests/unit/plugins/modules/network/onyx/test_onyx_config.py deleted file mode 100644 index 558d9a92..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_config.py +++ /dev/null @@ -1,113 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_config -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxConfigModule(TestOnyxModule): - - module = onyx_config - - def setUp(self): - super(TestOnyxConfigModule, self).setUp() - - self.mock_get_config = patch('ansible_collections.community.network.plugins.modules.network.onyx.onyx_config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible_collections.community.network.plugins.modules.network.onyx.onyx_config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_run_commands = patch('ansible_collections.community.network.plugins.modules.network.onyx.onyx_config.run_commands') - self.run_commands = self.mock_run_commands.start() - - def tearDown(self): - super(TestOnyxConfigModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_config_config.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_onyx_config_unchanged(self): - src = load_fixture('onyx_config_config.cfg') - set_module_args(dict(src=src)) - self.execute_module() - - def test_onyx_config_src(self): - src = load_fixture('onyx_config_src.cfg') - set_module_args(dict(src=src)) - commands = [ - 'interface mlag-port-channel 2'] - self.execute_module(changed=True, commands=commands, is_updates=True) - - def test_onyx_config_backup(self): - set_module_args(dict(backup=True)) - result = self.execute_module() - self.assertIn('__backup__', result) - - def test_onyx_config_save(self): - set_module_args(dict(lines=['hostname foo'], save='yes')) - self.execute_module(changed=True) - self.assertEqual(self.run_commands.call_count, 0) - self.assertEqual(self.get_config.call_count, 1) - self.assertEqual(self.load_config.call_count, 1) - args = self.load_config.call_args[0][1] - self.assertIn('configuration write', args) - - def test_onyx_config_lines_wo_parents(self): - set_module_args(dict(lines=['hostname foo'])) - commands = ['hostname foo'] - self.execute_module(changed=True, commands=commands, is_updates=True) - - def test_onyx_config_before(self): - set_module_args(dict(lines=['hostname foo'], before=['test1', 'test2'])) - commands = ['test1', 'test2', 'hostname foo'] - self.execute_module(changed=True, commands=commands, sort=False, is_updates=True) - - def test_onyx_config_after(self): - set_module_args(dict(lines=['hostname foo'], after=['test1', 'test2'])) - commands = ['hostname foo', 'test1', 'test2'] - self.execute_module(changed=True, commands=commands, sort=False, is_updates=True) - - def test_onyx_config_before_after(self): - set_module_args(dict(lines=['hostname foo'], - before=['test1', 'test2'], - after=['test3', 'test4'])) - commands = ['test1', 'test2', 'hostname foo', 'test3', 'test4'] - self.execute_module(changed=True, commands=commands, sort=False, is_updates=True) - - def test_onyx_config_config(self): - config = 'hostname localhost' - set_module_args(dict(lines=['hostname router'], config=config)) - commands = ['hostname router'] - self.execute_module(changed=True, commands=commands, is_updates=True) - - def test_onyx_config_match_none(self): - lines = ['hostname router'] - set_module_args(dict(lines=lines, match='none')) - self.execute_module(changed=True, commands=lines, is_updates=True) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_facts.py b/tests/unit/plugins/modules/network/onyx/test_onyx_facts.py deleted file mode 100644 index 9f4ab191..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_facts.py +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_facts - - -class TestOnyxFacts(TestOnyxModule): - - module = onyx_facts - - def setUp(self): - super(TestOnyxFacts, self).setUp() - - self.mock_run_command = patch.object( - onyx_facts.FactsBase, "_show_cmd") - self.run_command = self.mock_run_command.start() - - def tearDown(self): - super(TestOnyxFacts, self).tearDown() - - self.mock_run_command.stop() - - def load_fixtures(self, commands=None, transport=None): - - def load_from_file(*args, **kwargs): - command = args[0] - filename = "onyx_facts_%s.cfg" % command - filename = filename.replace(' ', '_') - filename = filename.replace('/', '7') - output = load_fixture(filename) - return output - - self.run_command.side_effect = load_from_file - - def test_onyx_facts_version(self): - set_module_args(dict(gather_subset='version')) - result = self.execute_module() - facts = result.get('ansible_facts') - self.assertEqual(len(facts), 2) - version = facts['ansible_net_version'] - self.assertEqual(version['Product name'], 'MLNX-OS') - - def test_onyx_facts_modules(self): - set_module_args(dict(gather_subset='modules')) - result = self.execute_module() - facts = result.get('ansible_facts') - self.assertEqual(len(facts), 2) - modules = facts['ansible_net_modules'] - self.assertIn("MGMT", modules) - - def test_onyx_facts_interfaces(self): - set_module_args(dict(gather_subset='interfaces')) - result = self.execute_module() - facts = result.get('ansible_facts') - self.assertEqual(len(facts), 2) - interfaces = facts['ansible_net_interfaces'] - self.assertEqual(len(interfaces), 2) - - def test_onyx_facts_all(self): - set_module_args(dict(gather_subset='all')) - result = self.execute_module() - facts = result.get('ansible_facts') - self.assertEqual(len(facts), 4) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_igmp.py deleted file mode 100644 index c3bb5178..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp.py +++ /dev/null @@ -1,127 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_igmp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxIgmpModule(TestOnyxModule): - - module = onyx_igmp - enabled = False - - def setUp(self): - self.enabled = False - super(TestOnyxIgmpModule, self).setUp() - self.mock_get_config = patch.object( - onyx_igmp.OnyxIgmpModule, "_show_igmp") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxIgmpModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_igmp_show.cfg' - data = load_fixture(config_file) - if self.enabled: - data[0]['IGMP snooping globally'] = 'enabled' - self.get_config.return_value = data - self.load_config.return_value = None - - def test_igmp_no_change(self): - set_module_args(dict(state='disabled')) - self.execute_module(changed=False) - - def test_igmp_enable(self): - set_module_args(dict(state='enabled')) - commands = ['ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_last_member_query_interval(self): - set_module_args(dict(state='enabled', - last_member_query_interval=10)) - commands = ['ip igmp snooping', - 'ip igmp snooping last-member-query-interval 10'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_mrouter_timeout(self): - set_module_args(dict(state='enabled', - mrouter_timeout=100)) - commands = ['ip igmp snooping', - 'ip igmp snooping mrouter-timeout 100'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_port_purge_timeout(self): - set_module_args(dict(state='enabled', - port_purge_timeout=150)) - commands = ['ip igmp snooping', - 'ip igmp snooping port-purge-timeout 150'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_report_suppression_interval(self): - set_module_args(dict(state='enabled', - report_suppression_interval=10)) - commands = ['ip igmp snooping', - 'ip igmp snooping report-suppression-interval 10'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_proxy_reporting_disabled(self): - set_module_args(dict(state='enabled', - proxy_reporting='disabled')) - commands = ['ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_proxy_reporting_enabled(self): - set_module_args(dict(state='enabled', - proxy_reporting='enabled')) - commands = ['ip igmp snooping', - 'ip igmp snooping proxy reporting'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_unregistered_multicast_flood(self): - set_module_args(dict(state='enabled', - unregistered_multicast='flood')) - commands = ['ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_unregistered_multicast_forward(self): - set_module_args( - dict(state='enabled', - unregistered_multicast='forward-to-mrouter-ports')) - commands = [ - 'ip igmp snooping', - 'ip igmp snooping unregistered multicast forward-to-mrouter-ports' - ] - self.execute_module(changed=True, commands=commands) - - def test_igmp_version_v2(self): - set_module_args(dict(state='enabled', - default_version='V2')) - commands = ['ip igmp snooping', - 'ip igmp snooping version 2'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_version_v3(self): - set_module_args(dict(state='enabled', - default_version='V3')) - commands = ['ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_disable(self): - self.enabled = True - set_module_args(dict(state='disabled')) - commands = ['no ip igmp snooping'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_interface.py deleted file mode 100644 index c46fc9ca..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_interface.py +++ /dev/null @@ -1,69 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_igmp_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxIgmpInterfaceModule(TestOnyxModule): - - module = onyx_igmp_interface - - def setUp(self): - super(TestOnyxIgmpInterfaceModule, self).setUp() - - self.mock_get_config = patch.object(onyx_igmp_interface.OnyxIgmpInterfaceModule, "_show_igmp_interfaces") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxIgmpInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_igmp_interfaces.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_igmp_interface_enabled_no_change(self): - set_module_args(dict(state='enabled', name='Eth1/3')) - self.execute_module(changed=False) - - def test_igmp_interface_enabled_change(self): - set_module_args(dict(state='enabled', name='Eth1/1')) - commands = ['interface ethernet 1/1 ip igmp snooping fast-leave'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_interface_disabled_no_change(self): - set_module_args(dict(state='disabled', name='Eth1/1')) - self.execute_module(changed=False) - - def test_igmp_interface_disabled_change(self): - set_module_args(dict(state='disabled', name='Eth1/3')) - commands = ['interface ethernet 1/3 no ip igmp snooping fast-leave'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_vlan.py b/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_vlan.py deleted file mode 100644 index 3e363a6f..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_igmp_vlan.py +++ /dev/null @@ -1,190 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_igmp_vlan -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxIgmpVlan(TestOnyxModule): - - module = onyx_igmp_vlan - enabled = False - mrouter_state = False - querier_state = False - static_groups_enabled = False - - def setUp(self): - self.enabled = False - super(TestOnyxIgmpVlan, self).setUp() - self.mock_get_igmp_config = patch.object( - onyx_igmp_vlan.OnyxIgmpVlanModule, "_show_igmp_vlan") - self.get_igmp_config = self.mock_get_igmp_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_igmp_guerier_config = patch.object( - onyx_igmp_vlan.OnyxIgmpVlanModule, "_show_igmp_querier_config") - self.get_igmp_guerier_config = self.mock_get_igmp_guerier_config.start() - - self.mock_get_igmp_static_groups_config = patch.object( - onyx_igmp_vlan.OnyxIgmpVlanModule, "_show_igmp_snooping_groups_config") - self.get_igmp_static_groups_config = self.mock_get_igmp_static_groups_config.start() - - def tearDown(self): - super(TestOnyxIgmpVlan, self).tearDown() - self.mock_get_igmp_config.stop() - self.mock_load_config.stop() - self.mock_get_igmp_guerier_config.stop() - self.mock_get_igmp_static_groups_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - igmp_vlan_config_file = 'onyx_show_ip_igmp_snooping.cfg' - igmp_querier_config_file = 'onyx_show_ip_igmp_snooping_querier.cfg' - igmp_static_groups_file = 'onyx_show_ip_igmp_snooping_groups.cfg' - igmp_vlan_data = load_fixture(igmp_vlan_config_file) - igmp_querier_data = load_fixture(igmp_querier_config_file) - igmp_static_groups_data = None - if self.enabled: - igmp_vlan_data[0]['message 1'] = 'IGMP snooping is enabled' - - if self.querier_state: - igmp_vlan_data[0]['message 3'] = 'Snooping switch is acting as Querier' - - if self.mrouter_state: - igmp_vlan_data[0]['mrouter static port list'] = 'Eth1/1' - - if self.static_groups_enabled: - igmp_static_groups_data = load_fixture(igmp_static_groups_file) - - self.get_igmp_config.return_value = igmp_vlan_data - self.get_igmp_guerier_config = igmp_querier_data - self.get_igmp_static_groups_config = igmp_static_groups_data - self.load_config.return_value = None - - def test_igmp_disabled_no_change(self): - set_module_args(dict(state='disabled', vlan_id=10)) - self.execute_module(changed=False) - - def test_igmp_disabled_with_change(self): - self.enabled = True - set_module_args(dict(state='disabled', vlan_id=10)) - commands = ['vlan 10 no ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_enabled_no_change(self): - self.enabled = True - set_module_args(dict(state='enabled', vlan_id=10)) - self.execute_module(changed=False) - - def test_igmp_enabled_with_change(self): - set_module_args(dict(state='enabled', vlan_id=10)) - commands = ['vlan 10 ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_mrouter_disabled_no_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, mrouter=dict(state='disabled', name='Eth1/1'))) - self.execute_module(changed=False) - - def test_igmp_mrouter_disabled_with_change(self): - self.enabled = True - self.mrouter_state = True - set_module_args(dict(vlan_id=10, mrouter=dict(state='disabled', name='Eth1/1'))) - commands = ['vlan 10 no ip igmp snooping mrouter interface ethernet 1/1'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_mrouter_enabled_no_change(self): - self.enabled = True - self.mrouter_state = True - set_module_args(dict(vlan_id=10, mrouter=dict(state='enabled', name='Eth1/1'))) - self.execute_module(changed=False) - - def test_igmp_mrouter_enabled_with_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, mrouter=dict(state='enabled', name='Eth1/1'))) - commands = ['vlan 10 ip igmp snooping mrouter interface ethernet 1/1'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_mrouter_enabled_withinterface_change(self): - self.enabled = True - self.mrouter_state = True - set_module_args(dict(vlan_id=10, mrouter=dict(state='enabled', name='Eth1/2'))) - commands = ['vlan 10 ip igmp snooping mrouter interface ethernet 1/2'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_querier_disabled_no_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, querier=dict(state='disabled'))) - self.execute_module(changed=False) - - def test_igmp_querier_disabled_with_change(self): - self.enabled = True - self.querier_state = True - set_module_args(dict(vlan_id=10, querier=dict(state='disabled'))) - commands = ['vlan 10 no ip igmp snooping querier'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_querier_enabled_no_change(self): - self.enabled = True - self.querier_state = True - set_module_args(dict(vlan_id=10, querier=dict(state='enabled'))) - self.execute_module(changed=False) - - def test_igmp_querier_enabled_with_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, querier=dict(state='enabled'))) - commands = ['vlan 10 ip igmp snooping querier'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_querier_attr_no_change(self): - self.enabled = True - self.querier_state = True - set_module_args(dict(vlan_id=10, querier=dict(state='enabled', interval=125, address='-'))) - self.execute_module(changed=True) - - def test_igmp_querier_attr_with_change(self): - self.enabled = True - self.querier_state = True - set_module_args(dict(vlan_id=10, querier=dict(state='enabled', interval=127, address='10.10.10.1'))) - commands = ['vlan 10 ip igmp snooping querier query-interval 127', - 'vlan 10 ip igmp snooping querier address 10.10.10.1'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_version_no_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, version='V3')) - self.execute_module(changed=False) - - def test_igmp_version_with_change(self): - self.enabled = True - set_module_args(dict(vlan_id=10, version='V2')) - commands = ['vlan 10 ip igmp snooping version 2'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_static_groups_multicast_ip_address_not_configured(self): - self.enabled = True - set_module_args(dict(vlan_id=10, static_groups=[dict(multicast_ip_address='224.5.5.2', name='Eth1/1', - sources=["1.1.1.2", "1.1.1.3"])])) - commands = ['vlan 10 ip igmp snooping static-group 224.5.5.2 interface ethernet 1/1', - 'vlan 10 ip igmp snooping static-group 224.5.5.2 interface ethernet 1/1 source 1.1.1.2', - 'vlan 10 ip igmp snooping static-group 224.5.5.2 interface ethernet 1/1 source 1.1.1.3'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_static_groups_multicast_ip_address_configured_with_change(self): - self.enabled = True - self.static_groups_enabled = True - set_module_args(dict(vlan_id=10, static_groups=[dict(multicast_ip_address='224.5.5.1', name='Eth1/3', - sources=["1.1.1.1", "1.1.1.2"])])) - commands = ['vlan 10 ip igmp snooping static-group 224.5.5.1 interface ethernet 1/3', - 'vlan 10 ip igmp snooping static-group 224.5.5.1 interface ethernet 1/3 source 1.1.1.1', - 'vlan 10 ip igmp snooping static-group 224.5.5.1 interface ethernet 1/3 source 1.1.1.2'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_interface.py deleted file mode 100644 index 8493edaa..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_interface.py +++ /dev/null @@ -1,125 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxInterfaceModule(TestOnyxModule): - - module = onyx_interface - - def setUp(self): - super(TestOnyxInterfaceModule, self).setUp() - self.mock_get_config = patch.object( - onyx_interface.OnyxInterfaceModule, "_get_interfaces_config") - self.get_config = self.mock_get_config.start() - - self.mock_get_interfaces_status = patch.object( - onyx_interface.OnyxInterfaceModule, "_get_interfaces_status") - self.get_interfaces_status = self.mock_get_interfaces_status.start() - - self.mock_get_interfaces_rates = patch.object( - onyx_interface.OnyxInterfaceModule, "_get_interfaces_rates") - self.get_interfaces_rates = self.mock_get_interfaces_rates.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_version = patch.object( - onyx_interface.OnyxInterfaceModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_interfaces_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def test_mtu_no_change(self): - set_module_args(dict(name='Eth1/1', mtu=1500)) - self.execute_module(changed=False) - - def test_mtu_change(self): - set_module_args(dict(name='Eth1/1', mtu=1522)) - commands = ['interface ethernet 1/1', 'mtu 1522 force', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_speed_no_change(self): - set_module_args(dict(name='Eth1/1', speed='40G')) - self.execute_module(changed=False) - - def test_speed_change(self): - set_module_args(dict(name='Eth1/1', speed='100G')) - commands = ['interface ethernet 1/1', 'speed 100G force', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_mtu_speed_change(self): - set_module_args(dict(name='Eth1/1', speed='100G', mtu=1522)) - commands = ['interface ethernet 1/1', 'speed 100G force', - 'mtu 1522 force', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_admin_state_no_change(self): - set_module_args(dict(name='Eth1/1', enabled=True)) - self.execute_module(changed=False) - - def test_admin_state_change(self): - set_module_args(dict(name='Eth1/1', enabled=False)) - commands = ['interface ethernet 1/1', 'shutdown', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_add_loopback_if(self): - set_module_args(dict(name='Loopback 1', description='Loopback test')) - commands = ['interface loopback 1', 'description Loopback test', - 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_add_vlan_if(self): - set_module_args(dict(name='Vlan 101', description='Vlan test', - enabled=True)) - commands = ['interface vlan 101', 'description Vlan test', - 'no shutdown', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_remove_vlan_if(self): - set_module_args(dict(name='Vlan 1002', state='absent')) - commands = ['no interface vlan 1002'] - self.execute_module(changed=True, commands=commands) - - def test_oper_state_check(self): - set_module_args(dict(name='Eth1/1', enabled=True, state='down')) - config_file = 'onyx_interfaces_status.cfg' - self.get_interfaces_status.return_value = load_fixture(config_file) - self.execute_module(changed=False) - - def test_vlan_oper_state_check(self): - set_module_args(dict(name='Vlan 1002', state='down')) - config_file = 'onyx_interfaces_status.cfg' - self.get_interfaces_status.return_value = load_fixture(config_file) - self.execute_module(changed=False) - - def test_rx_rate_check(self): - set_module_args(dict(name='Eth1/1', enabled=True, rx_rate='ge(9000)')) - config_file = 'onyx_interfaces_rates.cfg' - self.get_interfaces_rates.return_value = load_fixture(config_file) - self.execute_module(changed=False) - - def test_tx_rate_check(self): - set_module_args(dict(name='Eth1/1', enabled=True, tx_rate='ge(10000)')) - config_file = 'onyx_interfaces_rates.cfg' - self.get_interfaces_rates.return_value = load_fixture(config_file) - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_l2_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_l2_interface.py deleted file mode 100644 index 0f5d57a2..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_l2_interface.py +++ /dev/null @@ -1,119 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_l2_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxInterfaceModule(TestOnyxModule): - - module = onyx_l2_interface - - def setUp(self): - super(TestOnyxInterfaceModule, self).setUp() - self.mock_get_config = patch.object( - onyx_l2_interface.OnyxL2InterfaceModule, "_get_switchport_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_version = patch.object( - onyx_l2_interface.OnyxL2InterfaceModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_l2_interface_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def test_access_vlan_no_change(self): - set_module_args(dict(name='Eth1/11', access_vlan=1)) - self.execute_module(changed=False) - - def test_trunk_vlans_no_change(self): - set_module_args(dict(name='Eth1/10', mode='hybrid', access_vlan=1, - trunk_allowed_vlans=[10])) - self.execute_module(changed=False) - - def test_access_vlan_change(self): - set_module_args(dict(name='Eth1/11', access_vlan=10)) - commands = ['interface ethernet 1/11', 'switchport access vlan 10', - 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_trunk_vlan_change(self): - set_module_args(dict(name='Eth1/10', mode='hybrid', access_vlan=1, - trunk_allowed_vlans=[11])) - commands = ['interface ethernet 1/10', - 'switchport hybrid allowed-vlan remove 10', - 'switchport hybrid allowed-vlan add 11', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_trunk_vlan_add(self): - set_module_args(dict(name='Eth1/10', mode='hybrid', access_vlan=1, - trunk_allowed_vlans=[10, 11])) - commands = ['interface ethernet 1/10', - 'switchport hybrid allowed-vlan add 11', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_switch_port_access(self): - set_module_args(dict(name='Eth1/12', mode='access', access_vlan=11)) - commands = ['interface ethernet 1/12', 'switchport mode access', - 'switchport access vlan 11', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_switch_port_trunk(self): - set_module_args(dict(name='Eth1/12', mode='trunk', - trunk_allowed_vlans=[11])) - commands = ['interface ethernet 1/12', 'switchport mode trunk', - 'switchport trunk allowed-vlan add 11', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_switch_port_hybrid(self): - set_module_args(dict(name='Eth1/12', mode='hybrid', access_vlan=10, - trunk_allowed_vlans=[11])) - commands = ['interface ethernet 1/12', 'switchport mode hybrid', - 'switchport access vlan 10', - 'switchport hybrid allowed-vlan add 11', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_aggregate(self): - aggregate = list() - aggregate.append(dict(name='Eth1/10')) - aggregate.append(dict(name='Eth1/12')) - - set_module_args(dict(aggregate=aggregate, access_vlan=10)) - commands = ['interface ethernet 1/10', 'switchport mode access', - 'switchport access vlan 10', 'exit', - 'interface ethernet 1/12', 'switchport mode access', - 'switchport access vlan 10', 'exit'] - self.execute_module(changed=True, commands=commands, sort=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_l3_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_l3_interface.py deleted file mode 100644 index a11da0cd..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_l3_interface.py +++ /dev/null @@ -1,113 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_l3_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxL3InterfaceModule(TestOnyxModule): - - module = onyx_l3_interface - - def setUp(self): - super(TestOnyxL3InterfaceModule, self).setUp() - self.mock_get_config = patch.object( - onyx_l3_interface.OnyxL3InterfaceModule, - "_get_interfaces_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_version = patch.object( - onyx_l3_interface.OnyxL3InterfaceModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxL3InterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def _execute_module(self, failed=False, changed=False, commands=None, sort=True): - if failed: - result = self.failed() - self.assertTrue(result['failed'], result) - else: - result = self.changed(changed) - self.assertEqual(result['changed'], changed, result) - - if commands is not None: - commands_res = result.get('commands') - if sort: - self.assertEqual(sorted(commands), sorted(commands_res), commands_res) - else: - self.assertEqual(commands, commands_res, commands_res) - - return result - - def load_fixture(self, config_file): - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def load_eth_ifc_fixture(self): - config_file = 'onyx_l3_interface_show.cfg' - self.load_fixture(config_file) - - def load_vlan_ifc_fixture(self): - config_file = 'onyx_l3_vlan_interface_show.cfg' - self.load_fixture(config_file) - - def test_vlan_ifc_no_change(self): - set_module_args(dict(name='Vlan 1002', state='present', - ipv4='172.3.12.4/24')) - self.load_vlan_ifc_fixture() - self._execute_module(changed=False) - - def test_vlan_ifc_remove(self): - set_module_args(dict(name='Vlan 1002', state='absent')) - commands = ['interface vlan 1002 no ip address'] - self.load_vlan_ifc_fixture() - self._execute_module(changed=True, commands=commands) - - def test_vlan_ifc_update(self): - set_module_args(dict(name='Vlan 1002', state='present', - ipv4='172.3.13.4/24')) - commands = ['interface vlan 1002 ip address 172.3.13.4/24'] - self.load_vlan_ifc_fixture() - self._execute_module(changed=True, commands=commands) - - def test_eth_ifc_no_change(self): - set_module_args(dict(name='Eth1/5', state='present', - ipv4='172.3.12.4/24')) - self.load_eth_ifc_fixture() - self._execute_module(changed=False) - - def test_eth_ifc_remove(self): - set_module_args(dict(name='Eth1/5', state='absent')) - commands = ['interface ethernet 1/5 no ip address'] - self.load_eth_ifc_fixture() - self._execute_module(changed=True, commands=commands) - - def test_eth_ifc_update(self): - set_module_args(dict(name='Eth1/5', state='present', - ipv4='172.3.13.4/24')) - commands = ['interface ethernet 1/5 ip address 172.3.13.4/24'] - self.load_eth_ifc_fixture() - self._execute_module(changed=True, commands=commands) - - def test_eth_ifc_add_ip(self): - set_module_args(dict(name='Eth1/6', state='present', - ipv4='172.3.14.4/24')) - commands = ['interface ethernet 1/6 no switchport force', - 'interface ethernet 1/6 ip address 172.3.14.4/24'] - self.load_eth_ifc_fixture() - self._execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_linkagg.py b/tests/unit/plugins/modules/network/onyx/test_onyx_linkagg.py deleted file mode 100644 index 0c1ec68e..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_linkagg.py +++ /dev/null @@ -1,116 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_linkagg -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxLinkaggModule(TestOnyxModule): - - module = onyx_linkagg - - def setUp(self): - super(TestOnyxLinkaggModule, self).setUp() - self.mock_get_config = patch.object( - onyx_linkagg.OnyxLinkAggModule, - "_get_port_channels") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - self.mock_get_version = patch.object( - onyx_linkagg.OnyxLinkAggModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxLinkaggModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_get_version.stop() - - def load_fixture(self, config_file): - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def load_port_channel_fixture(self): - config_file = 'onyx_port_channel_show.cfg' - self.load_fixture(config_file) - - def load_mlag_port_channel_fixture(self): - config_file = 'onyx_mlag_port_channel_show.cfg' - self.load_fixture(config_file) - - def test_port_channel_no_change(self): - set_module_args(dict(name='Po22', state='present', - members=['Eth1/7'])) - self.load_port_channel_fixture() - self.execute_module(changed=False) - - def test_port_channel_remove(self): - set_module_args(dict(name='Po22', state='absent')) - self.load_port_channel_fixture() - commands = ['no interface port-channel 22'] - self.execute_module(changed=True, commands=commands) - - def test_port_channel_add(self): - set_module_args(dict(name='Po23', state='present', - members=['Eth1/8'])) - self.load_port_channel_fixture() - commands = ['interface port-channel 23', 'exit', - 'interface ethernet 1/8 channel-group 23 mode on'] - self.execute_module(changed=True, commands=commands) - - def test_port_channel_add_member(self): - set_module_args(dict(name='Po22', state='present', - members=['Eth1/7', 'Eth1/8'])) - self.load_port_channel_fixture() - commands = ['interface ethernet 1/8 channel-group 22 mode on'] - self.execute_module(changed=True, commands=commands) - - def test_port_channel_remove_member(self): - set_module_args(dict(name='Po22', state='present')) - self.load_port_channel_fixture() - commands = ['interface ethernet 1/7 no channel-group'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_port_channel_no_change(self): - set_module_args(dict(name='Mpo33', state='present', - members=['Eth1/8'])) - self.load_mlag_port_channel_fixture() - self.execute_module(changed=False) - - def test_mlag_port_channel_remove(self): - set_module_args(dict(name='Mpo33', state='absent')) - self.load_mlag_port_channel_fixture() - commands = ['no interface mlag-port-channel 33'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_port_channel_add(self): - set_module_args(dict(name='Mpo34', state='present', - members=['Eth1/9'])) - self.load_mlag_port_channel_fixture() - commands = ['interface mlag-port-channel 34', 'exit', - 'interface ethernet 1/9 mlag-channel-group 34 mode on'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_port_channel_add_member(self): - set_module_args(dict(name='Mpo33', state='present', - members=['Eth1/8', 'Eth1/9'])) - self.load_mlag_port_channel_fixture() - commands = ['interface ethernet 1/9 mlag-channel-group 33 mode on'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_port_channel_remove_member(self): - set_module_args(dict(name='Mpo33', state='present')) - self.load_mlag_port_channel_fixture() - commands = ['interface ethernet 1/8 no mlag-channel-group'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_lldp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_lldp.py deleted file mode 100644 index f76a9e00..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_lldp.py +++ /dev/null @@ -1,68 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_lldp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxInterfaceModule(TestOnyxModule): - - module = onyx_lldp - - def setUp(self): - super(TestOnyxInterfaceModule, self).setUp() - self.mock_get_config = patch.object( - onyx_lldp.OnyxLldpModule, "_get_lldp_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if commands == ['lldp']: - self.get_config.return_value = None - else: - config_file = 'onyx_lldp_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_lldp_no_change(self): - set_module_args(dict()) - self.execute_module(changed=False) - - def test_lldp_disable(self): - set_module_args(dict(state='absent')) - commands = ['no lldp'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_enable(self): - set_module_args(dict(state='present')) - commands = ['lldp'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_lldp_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_lldp_interface.py deleted file mode 100644 index b5c0812a..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_lldp_interface.py +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_lldp_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxLldpInterfaceModule(TestOnyxModule): - - module = onyx_lldp_interface - - def setUp(self): - super(TestOnyxLldpInterfaceModule, self).setUp() - self.mock_get_config = patch.object( - onyx_lldp_interface.OnyxLldpInterfaceModule, - "_get_lldp_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxLldpInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_lldp_interface_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_lldp_no_change(self): - set_module_args(dict(name='Eth1/1', state='present')) - self.execute_module(changed=False) - - def test_no_lldp_no_change(self): - set_module_args(dict(name='Eth1/2', state='absent')) - self.execute_module(changed=False) - - def test_no_lldp_change(self): - set_module_args(dict(name='Eth1/2', state='present')) - commands = ['interface ethernet 1/2 lldp receive', - 'interface ethernet 1/2 lldp transmit'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_change(self): - set_module_args(dict(name='Eth1/1', state='absent')) - commands = ['interface ethernet 1/1 no lldp receive', - 'interface ethernet 1/1 no lldp transmit'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_aggregate(self): - aggregate = [dict(name='Eth1/1'), dict(name='Eth1/2')] - set_module_args(dict(aggregate=aggregate, state='present')) - commands = ['interface ethernet 1/2 lldp receive', - 'interface ethernet 1/2 lldp transmit'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_aggregate_purge(self): - aggregate = [dict(name='Eth1/3'), dict(name='Eth1/2')] - set_module_args(dict(aggregate=aggregate, state='present', purge=True)) - commands = ['interface ethernet 1/2 lldp receive', - 'interface ethernet 1/2 lldp transmit', - 'interface ethernet 1/3 lldp receive', - 'interface ethernet 1/3 lldp transmit', - 'interface ethernet 1/1 no lldp receive', - 'interface ethernet 1/1 no lldp transmit'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_magp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_magp.py deleted file mode 100644 index 6c06eb5d..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_magp.py +++ /dev/null @@ -1,110 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_magp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxMagpModule(TestOnyxModule): - - module = onyx_magp - - def setUp(self): - super(TestOnyxMagpModule, self).setUp() - self.mock_get_config = patch.object( - onyx_magp.OnyxMagpModule, - "_get_magp_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_version = patch.object(onyx_magp.OnyxMagpModule, - "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxMagpModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_get_version.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_magp_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def test_magp_absent_no_change(self): - set_module_args(dict(interface='Vlan 1002', magp_id=110, - state='absent')) - self.execute_module(changed=False) - - def test_magp_no_change(self): - set_module_args(dict(interface='Vlan 1200', magp_id=103, - state='disabled')) - self.execute_module(changed=False) - - def test_magp_present_no_change(self): - set_module_args(dict(interface='Vlan 1200', magp_id=103)) - self.execute_module(changed=False) - - def test_magp_enable(self): - set_module_args(dict(interface='Vlan 1200', magp_id=103, - state='enabled')) - commands = ['interface vlan 1200 magp 103 no shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_magp_disable(self): - set_module_args(dict(interface='Vlan 1243', magp_id=102, - state='disabled', router_ip='10.0.0.43', - router_mac='01:02:03:04:05:06')) - commands = ['interface vlan 1243 magp 102 shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_magp_change_address(self): - set_module_args(dict(interface='Vlan 1243', magp_id=102, - router_ip='10.0.0.44', - router_mac='01:02:03:04:05:07')) - commands = [ - 'interface vlan 1243 magp 102 ip virtual-router address 10.0.0.44', - 'interface vlan 1243 magp 102 ip virtual-router mac-address 01:02:03:04:05:07'] - self.execute_module(changed=True, commands=commands) - - def test_magp_remove_address(self): - set_module_args(dict(interface='Vlan 1243', magp_id=102)) - commands = [ - 'interface vlan 1243 magp 102 no ip virtual-router address', - 'interface vlan 1243 magp 102 no ip virtual-router mac-address'] - self.execute_module(changed=True, commands=commands) - - def test_magp_add(self): - set_module_args(dict(interface='Vlan 1244', magp_id=104, - router_ip='10.0.0.44', - router_mac='01:02:03:04:05:07')) - commands = [ - 'interface vlan 1244 magp 104', - 'exit', - 'interface vlan 1244 magp 104 ip virtual-router address 10.0.0.44', - 'interface vlan 1244 magp 104 ip virtual-router mac-address 01:02:03:04:05:07'] - self.execute_module(changed=True, commands=commands, sort=False) - - def test_magp_change_vlan(self): - set_module_args(dict(interface='Vlan 1244', magp_id=102, - router_ip='10.0.0.43', - router_mac='01:02:03:04:05:06')) - commands = [ - 'interface vlan 1243 no magp 102', - 'interface vlan 1244 magp 102', - 'exit', - 'interface vlan 1244 magp 102 ip virtual-router address 10.0.0.43', - 'interface vlan 1244 magp 102 ip virtual-router mac-address 01:02:03:04:05:06'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_ipl.py b/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_ipl.py deleted file mode 100644 index fbe01502..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_ipl.py +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_mlag_ipl -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxMlagIplModule(TestOnyxModule): - - module = onyx_mlag_ipl - - def setUp(self): - super(TestOnyxMlagIplModule, self).setUp() - self._mlag_enabled = True - self.mock_get_config = patch.object( - onyx_mlag_ipl.OnyxMlagIplModule, - "_show_mlag_data") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxMlagIplModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if self._mlag_enabled: - config_file = 'onyx_mlag_ipl_show.cfg' - self.get_config.return_value = load_fixture(config_file) - else: - self.get_config.return_value = None - self.load_config.return_value = None - - def test_no_ipl_no_change(self): - self._mlag_enabled = False - set_module_args(dict(name="Po1", state='absent')) - self.execute_module(changed=False) - - def test_ipl_no_change(self): - self._mlag_enabled = True - set_module_args(dict(name="Po1", state='present', - vlan_interface='Vlan 1002', - peer_address='10.2.2.2')) - self.execute_module(changed=False) - - def test_ipl_add(self): - self._mlag_enabled = False - set_module_args(dict(name="Po1", state='present', - vlan_interface='Vlan 1002', - peer_address='10.2.2.2')) - commands = ['interface port-channel 1 ipl 1', - 'interface vlan 1002 ipl 1 peer-address 10.2.2.2'] - self.execute_module(changed=True, commands=commands) - - def test_ipl_add_peer(self): - self._mlag_enabled = True - set_module_args(dict(name="Po1", state='present', - vlan_interface='Vlan 1002', - peer_address='10.2.2.4')) - commands = ['interface vlan 1002 ipl 1 peer-address 10.2.2.4'] - self.execute_module(changed=True, commands=commands) - - def test_ipl_remove(self): - self._mlag_enabled = True - set_module_args(dict(name="Po1", state='absent')) - commands = ['interface port-channel 1 no ipl 1'] - self.execute_module(changed=True, commands=commands) - - def test_ipl_change_vlan(self): - self._mlag_enabled = True - set_module_args(dict(name="Po1", state='present', - vlan_interface='Vlan 1003', - peer_address='10.2.2.4')) - commands = ['interface vlan 1002 no ipl 1', - 'interface vlan 1003 ipl 1 peer-address 10.2.2.4'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_vip.py b/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_vip.py deleted file mode 100644 index 8eb8aaff..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_mlag_vip.py +++ /dev/null @@ -1,84 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_mlag_vip -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxMlagVipModule(TestOnyxModule): - - module = onyx_mlag_vip - - def setUp(self): - super(TestOnyxMlagVipModule, self).setUp() - self._mlag_enabled = True - self.mock_show_mlag = patch.object( - onyx_mlag_vip.OnyxMLagVipModule, - "_show_mlag") - self.show_mlag = self.mock_show_mlag.start() - self.mock_show_mlag_vip = patch.object( - onyx_mlag_vip.OnyxMLagVipModule, - "_show_mlag_vip") - self.show_mlag_vip = self.mock_show_mlag_vip.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxMlagVipModule, self).tearDown() - self.mock_show_mlag.stop() - self.mock_show_mlag_vip.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if self._mlag_enabled: - config_file = 'onyx_mlag_vip_show.cfg' - self.show_mlag_vip.return_value = load_fixture(config_file) - config_file = 'onyx_mlag_show.cfg' - self.show_mlag.return_value = load_fixture(config_file) - else: - self.show_mlag_vip.return_value = None - self.show_mlag.return_value = None - self.load_config.return_value = None - - def test_mlag_no_change(self): - set_module_args(dict(ipaddress='10.209.25.107/24', - group_name='neo-mlag-vip-500', - mac_address='00:00:5E:00:01:4E')) - self.execute_module(changed=False) - - def test_mlag_change(self): - self._mlag_enabled = False - set_module_args(dict(ipaddress='10.209.25.107/24', - group_name='neo-mlag-vip-500', - mac_address='00:00:5E:00:01:4E', - delay=0)) - commands = ['mlag-vip neo-mlag-vip-500 ip 10.209.25.107 /24 force', - 'mlag system-mac 00:00:5e:00:01:4e', 'no mlag shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_send_group_name_only_change(self): - self._mlag_enabled = False - set_module_args(dict(group_name='neo-mlag-vip-500', - delay=0)) - commands = ['mlag-vip neo-mlag-vip-500', - 'no mlag shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_absent_no_change(self): - self._mlag_enabled = False - set_module_args(dict(state='absent')) - self.execute_module(changed=False) - - def test_mlag_absent_change(self): - set_module_args(dict(state='absent', delay=0)) - commands = ['no mlag-vip'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_ntp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_ntp.py deleted file mode 100644 index 34cb1566..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_ntp.py +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_ntp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxNTP(TestOnyxModule): - - module = onyx_ntp - enabled = False - - def setUp(self): - self.enabled = False - super(TestOnyxNTP, self).setUp() - self.mock_get_config = patch.object( - onyx_ntp.OnyxNTPModule, "_show_ntp_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxNTP, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_ntp_show.cfg' - data = load_fixture(config_file) - self.get_config.return_value = data - self.load_config.return_value = None - - def test_ntp_state_no_change(self): - set_module_args(dict(state='enabled')) - self.execute_module(changed=False) - - def test_ntp_state_with_change(self): - set_module_args(dict(state='disabled')) - commands = ['no ntp enable'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_authenticate_state_no_change(self): - set_module_args(dict(authenticate_state='disabled')) - self.execute_module(changed=False) - - def test_ntp_authenticate_state_with_change(self): - set_module_args(dict(authenticate_state='enabled')) - commands = ['ntp authenticate'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_authentication_key_no_change(self): - set_module_args(dict(ntp_authentication_keys=[dict(auth_key_id='22', - auth_key_encrypt_type='sha1', - auth_key_password='12345')])) - self.execute_module(changed=False) - - def test_ntp_authentication_key_with_change(self): - set_module_args(dict(ntp_authentication_keys=[dict(auth_key_id='22', - auth_key_encrypt_type='md5', - auth_key_password='12345')])) - commands = ['ntp authentication-key 22 md5 12345'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_trusted_keys_with_change(self): - set_module_args(dict(trusted_keys='22')) - commands = ['ntp trusted-key 22'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_ntp_servers_peers.py b/tests/unit/plugins/modules/network/onyx/test_onyx_ntp_servers_peers.py deleted file mode 100644 index c3537b3b..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_ntp_servers_peers.py +++ /dev/null @@ -1,134 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_ntp_servers_peers -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxNtpServersPeersModule(TestOnyxModule): - - module = onyx_ntp_servers_peers - enabled = False - - def setUp(self): - self.enabled = False - super(TestOnyxNtpServersPeersModule, self).setUp() - self.mock_get_config = patch.object( - onyx_ntp_servers_peers.OnyxNTPServersPeersModule, "_show_peers_servers_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxNtpServersPeersModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_ntp_servers_peers_show.cfg' - data = load_fixture(config_file) - self.get_config.return_value = data - self.load_config.return_value = None - - def test_ntp_peer_state_no_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - enabled='yes')])) - self.execute_module(changed=False) - - def test_ntp_peer_state_with_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - enabled='no')])) - commands = ['ntp peer 1.1.1.1 disable'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_peer_version_no_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - version='4')])) - self.execute_module(changed=False) - - def test_ntp_peer_version_with_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - version='3')])) - commands = ['ntp peer 1.1.1.1 version 3'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_peer_key_id_no_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - key_id='5')])) - self.execute_module(changed=False) - - def test_ntp_peer_key_id_with_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - key_id='6')])) - commands = ['ntp peer 1.1.1.1 keyID 6'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_peer_delete_with_change(self): - set_module_args(dict(peer=[dict(ip_or_name='1.1.1.1', - state='absent')])) - commands = ['no ntp peer 1.1.1.1'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_server_state_no_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - enabled='no')])) - self.execute_module(changed=False) - - def test_ntp_server_state_with_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - enabled='yes')])) - commands = ['no ntp server 2.2.2.2 disable'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_server_version_no_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - version='4')])) - self.execute_module(changed=False) - - def test_ntp_server_version_with_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - version='3')])) - commands = ['ntp server 2.2.2.2 version 3'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_server_keyID_no_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - key_id='99')])) - self.execute_module(changed=False) - - def test_ntp_server_keyID_with_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - key_id='8')])) - commands = ['ntp server 2.2.2.2 keyID 8'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_server_trusted_state_no_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - trusted_enable='yes')])) - self.execute_module(changed=False) - - def test_ntp_server_trusted_state_with_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - trusted_enable='no')])) - commands = ['no ntp server 2.2.2.2 trusted-enable'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_server_delete_with_change(self): - set_module_args(dict(server=[dict(ip_or_name='2.2.2.2', - state='absent')])) - commands = ['no ntp server 2.2.2.2'] - self.execute_module(changed=True, commands=commands) - - def test_ntpdate_with_change(self): - set_module_args(dict(ntpdate='192.22.1.66')) - commands = ['ntpdate 192.22.1.66'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_ospf.py b/tests/unit/plugins/modules/network/onyx/test_onyx_ospf.py deleted file mode 100644 index 3dec4074..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_ospf.py +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_ospf -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxOspfModule(TestOnyxModule): - - module = onyx_ospf - - def setUp(self): - super(TestOnyxOspfModule, self).setUp() - self._ospf_exists = True - self.mock_get_config = patch.object( - onyx_ospf.OnyxOspfModule, - "_get_ospf_config") - self.get_config = self.mock_get_config.start() - - self.mock_get_interfaces_config = patch.object( - onyx_ospf.OnyxOspfModule, - "_get_ospf_interfaces_config") - self.get_interfaces_config = self.mock_get_interfaces_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxOspfModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if self._ospf_exists: - config_file = 'onyx_ospf_show.cfg' - self.get_config.return_value = load_fixture(config_file) - config_file = 'onyx_ospf_interfaces_show.cfg' - self.get_interfaces_config.return_value = load_fixture(config_file) - else: - self.get_config.return_value = None - self.get_interfaces_config.return_value = None - self.load_config.return_value = None - - def test_ospf_absent_no_change(self): - set_module_args(dict(ospf=3, state='absent')) - self.execute_module(changed=False) - - def test_ospf_present_no_change(self): - interface = dict(name='Loopback 1', area='0.0.0.0') - set_module_args(dict(ospf=2, router_id='10.2.3.4', - interfaces=[interface])) - self.execute_module(changed=False) - - def test_ospf_present_remove(self): - set_module_args(dict(ospf=2, state='absent')) - commands = ['no router ospf 2'] - self.execute_module(changed=True, commands=commands) - - def test_ospf_change_router(self): - interface = dict(name='Loopback 1', area='0.0.0.0') - set_module_args(dict(ospf=2, router_id='10.2.3.5', - interfaces=[interface])) - commands = ['router ospf 2', 'router-id 10.2.3.5', 'exit'] - self.execute_module(changed=True, commands=commands, sort=False) - - def test_ospf_remove_router(self): - interface = dict(name='Loopback 1', area='0.0.0.0') - set_module_args(dict(ospf=2, interfaces=[interface])) - commands = ['router ospf 2', 'no router-id', 'exit'] - self.execute_module(changed=True, commands=commands, sort=False) - - def test_ospf_add_interface(self): - interfaces = [dict(name='Loopback 1', area='0.0.0.0'), - dict(name='Loopback 2', area='0.0.0.0')] - set_module_args(dict(ospf=2, router_id='10.2.3.4', - interfaces=interfaces)) - commands = ['interface loopback 2 ip ospf area 0.0.0.0'] - self.execute_module(changed=True, commands=commands) - - def test_ospf_remove_interface(self): - set_module_args(dict(ospf=2, router_id='10.2.3.4')) - commands = ['interface loopback 1 no ip ospf area'] - self.execute_module(changed=True, commands=commands) - - def test_ospf_add(self): - self._ospf_exists = False - interfaces = [dict(name='Loopback 1', area='0.0.0.0'), - dict(name='Vlan 210', area='0.0.0.0'), - dict(name='Eth1/1', area='0.0.0.0'), - dict(name='Po1', area='0.0.0.0')] - set_module_args(dict(ospf=2, router_id='10.2.3.4', - interfaces=interfaces)) - commands = ['router ospf 2', 'router-id 10.2.3.4', 'exit', - 'interface loopback 1 ip ospf area 0.0.0.0', - 'interface vlan 210 ip ospf area 0.0.0.0', - 'interface ethernet 1/1 ip ospf area 0.0.0.0', - 'interface port-channel 1 ip ospf area 0.0.0.0'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_pfc_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_pfc_interface.py deleted file mode 100644 index 68c2e054..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_pfc_interface.py +++ /dev/null @@ -1,114 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_pfc_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxPfcInterfaceModule(TestOnyxModule): - - module = onyx_pfc_interface - - def setUp(self): - super(TestOnyxPfcInterfaceModule, self).setUp() - self._pfc_enabled = True - self.mock_get_config = patch.object( - onyx_pfc_interface.OnyxPfcInterfaceModule, - "_get_pfc_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - self.mock_get_version = patch.object( - onyx_pfc_interface.OnyxPfcInterfaceModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxPfcInterfaceModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_get_version.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if self._pfc_enabled: - suffix = 'enabled' - else: - suffix = 'disabled' - config_file = 'onyx_pfc_interface_%s.cfg' % suffix - - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def _test_pfc_if(self, if_name, enabled, changed, commands): - state = 'enabled' if enabled else 'disabled' - set_module_args(dict(name=if_name, state=state)) - self.execute_module(changed=changed, commands=commands) - - def _test_pfc_no_change(self, enabled): - interfaces = ('Eth1/1', 'Eth1/1/2', 'Po1', 'Mpo2') - changed = False - commands = None - for ifc in interfaces: - self._test_pfc_if(ifc, enabled, changed, commands) - - def test_pfc_enabled_no_change(self): - self._pfc_enabled = True - enabled = True - self._test_pfc_no_change(enabled) - - def test_pfc_disabled_no_change(self): - self._pfc_enabled = False - enabled = False - self._test_pfc_no_change(enabled) - - def _test_pfc_change(self, enabled): - cmd_list = [ - ('Eth1/1', 'interface ethernet 1/1'), - ('Eth1/1/2', 'interface ethernet 1/1/2'), - ('Po1', 'interface port-channel 1'), - ('Mpo2', 'interface mlag-port-channel 2'), - ] - changed = True - suffix = ' dcb priority-flow-control mode on force' - if not enabled: - suffix = ' no dcb priority-flow-control mode force' - for (if_name, cmd) in cmd_list: - commands = [cmd + suffix] - self._test_pfc_if(if_name, enabled, changed, commands) - - def test_pfc_disabled_change(self): - self._pfc_enabled = False - enabled = True - self._test_pfc_change(enabled) - - def test_pfc_enabled_change(self): - self._pfc_enabled = True - enabled = False - self._test_pfc_change(enabled) - - def test_pfc_aggregate(self): - self._pfc_enabled = False - aggregate = [dict(name='Eth1/1'), dict(name='Eth1/1/2')] - set_module_args(dict(aggregate=aggregate, state='enabled')) - commands = [ - 'interface ethernet 1/1 dcb priority-flow-control mode on force', - 'interface ethernet 1/1/2 dcb priority-flow-control mode on force'] - self.execute_module(changed=True, commands=commands) - - def test_pfc_aggregate_purge(self): - self._pfc_enabled = True - aggregate = [dict(name='Po1'), dict(name='Mpo2')] - set_module_args(dict(aggregate=aggregate, state='enabled', purge=True)) - commands = [ - 'interface ethernet 1/1 no dcb priority-flow-control mode force', - 'interface ethernet 1/1/2 no dcb priority-flow-control mode force'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_protocol.py b/tests/unit/plugins/modules/network/onyx/test_onyx_protocol.py deleted file mode 100644 index 03d88160..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_protocol.py +++ /dev/null @@ -1,152 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_protocol -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxProtocolModule(TestOnyxModule): - - module = onyx_protocol - - def setUp(self): - super(TestOnyxProtocolModule, self).setUp() - self.mock_get_config = patch.object( - onyx_protocol.OnyxProtocolModule, - "_get_protocols") - self.get_config = self.mock_get_config.start() - - self.mock_get_ip_config = patch.object( - onyx_protocol.OnyxProtocolModule, - "_get_ip_routing") - self.get_ip_config = self.mock_get_ip_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxProtocolModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_protocols_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_ip_config.return_value = "IP routing: enabled" - - def test_mlag_enable(self): - set_module_args(dict(mlag='enabled')) - commands = ['protocol mlag'] - self.execute_module(changed=True, commands=commands) - - def test_mlag_disable(self): - set_module_args(dict(mlag='disabled')) - self.execute_module(changed=False) - - def test_magp_enable(self): - set_module_args(dict(magp='enabled')) - commands = ['protocol magp'] - self.execute_module(changed=True, commands=commands) - - def test_magp_disable(self): - set_module_args(dict(magp='disabled')) - self.execute_module(changed=False) - - def test_spanning_tree_enable(self): - set_module_args(dict(spanning_tree='enabled')) - self.execute_module(changed=False) - - def test_spanning_tree_disable(self): - set_module_args(dict(spanning_tree='disabled')) - commands = ['no spanning-tree'] - self.execute_module(changed=True, commands=commands) - - def test_dcb_pfc_enable(self): - set_module_args(dict(dcb_pfc='enabled')) - commands = ['dcb priority-flow-control enable force'] - self.execute_module(changed=True, commands=commands) - - def test_dcb_pfc_disable(self): - set_module_args(dict(dcb_pfc='disabled')) - self.execute_module(changed=False) - - def test_igmp_snooping_enable(self): - set_module_args(dict(igmp_snooping='enabled')) - commands = ['ip igmp snooping'] - self.execute_module(changed=True, commands=commands) - - def test_igmp_snooping_disable(self): - set_module_args(dict(igmp_snooping='disabled')) - self.execute_module(changed=False) - - def test_lacp_enable(self): - set_module_args(dict(lacp='enabled')) - commands = ['lacp'] - self.execute_module(changed=True, commands=commands) - - def test_lacp_disable(self): - set_module_args(dict(lacp='disabled')) - self.execute_module(changed=False) - - def test_ip_routing_enable(self): - set_module_args(dict(ip_routing='enabled')) - self.execute_module(changed=False) - - def test_ip_routing_disable(self): - set_module_args(dict(ip_routing='disabled')) - commands = ['no ip routing'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_enable(self): - set_module_args(dict(lldp='enabled')) - commands = ['lldp'] - self.execute_module(changed=True, commands=commands) - - def test_lldp_disable(self): - set_module_args(dict(lldp='disabled')) - self.execute_module(changed=False) - - def test_bgp_enable(self): - set_module_args(dict(bgp='enabled')) - commands = ['protocol bgp'] - self.execute_module(changed=True, commands=commands) - - def test_bgp_disable(self): - set_module_args(dict(bgp='disabled')) - self.execute_module(changed=False) - - def test_ospf_enable(self): - set_module_args(dict(ospf='enabled')) - commands = ['protocol ospf'] - self.execute_module(changed=True, commands=commands) - - def test_ospf_disable(self): - set_module_args(dict(ospf='disabled')) - self.execute_module(changed=False) - - def test_nve_enable(self): - set_module_args(dict(nve='enabled')) - commands = ['protocol nve'] - self.execute_module(changed=True, commands=commands) - - def test_nve_disabled(self): - set_module_args(dict(nve='disabled')) - self.execute_module(changed=False) - - def test_bfd_enable(self): - set_module_args(dict(bfd='enabled')) - commands = ['protocol bfd'] - self.execute_module(changed=True, commands=commands) - - def test_bfd_disabled(self): - set_module_args(dict(bfd='disabled')) - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_global.py b/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_global.py deleted file mode 100644 index 8a3e2fc1..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_global.py +++ /dev/null @@ -1,138 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_ptp_global -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxPtpModule(TestOnyxModule): - - module = onyx_ptp_global - - def setUp(self): - self._ptp_enabled = True - self._ntp_enabled = True - super(TestOnyxPtpModule, self).setUp() - - self.mock_get_ptp_config = patch.object(onyx_ptp_global.OnyxPtpGlobalModule, "_show_ptp_config") - self.get_ptp_config = self.mock_get_ptp_config.start() - self.mock_get_ntp_config = patch.object(onyx_ptp_global.OnyxPtpGlobalModule, "_show_ntp_config") - self.get_ntp_config = self.mock_get_ntp_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxPtpModule, self).tearDown() - self.mock_get_ptp_config.stop() - self.mock_get_ntp_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - if self._ptp_enabled: - config_file = 'onyx_show_ptp_clock.cfg' - self.get_ptp_config.return_value = load_fixture(config_file) - else: - self.get_ptp_config.return_value = None - - config_file = 'onyx_show_ntp_configured.cfg' - ret_val = load_fixture(config_file) - if self._ntp_enabled: - ret_val[0]['NTP enabled'] = 'yes' - self.get_ntp_config.return_value = ret_val - self.load_config.return_value = None - - def test_ptp_enabled_no_change(self): - set_module_args(dict(ptp_state='enabled')) - self.execute_module(changed=False) - - def test_ptp_enabled_with_change(self): - self._ptp_enabled = False - set_module_args(dict(ptp_state='enabled')) - commands = ['protocol ptp'] - self.execute_module(changed=True, commands=commands) - - def test_ptp_disabled_no_change(self): - self._ptp_enabled = False - set_module_args(dict(ptp_state='disabled')) - self.execute_module(changed=False) - - def test_ptp_disabled_with_change(self): - set_module_args(dict(ptp_state='disabled')) - commands = ['no protocol ptp'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_enabled_no_change(self): - self._ptp_enabled = False - set_module_args(dict(ntp_state='enabled', - ptp_state='disabled')) - self.execute_module(changed=False) - - def test_ntp_enabled_with_change(self): - self._ptp_enabled = False - self._ntp_enabled = False - set_module_args(dict(ntp_state='enabled', - ptp_state='disabled')) - commands = ['ntp enable'] - self.execute_module(changed=True, commands=commands) - - def test_ntp_disabled_no_change(self): - self._ntp_enabled = False - set_module_args(dict(ntp_state='disabled')) - self.execute_module(changed=False) - - def test_ntp_disabled_with_change(self): - set_module_args(dict(ntp_state='disabled')) - commands = ['no ntp enable'] - self.execute_module(changed=True, commands=commands) - - def test_set_domain_no_change(self): - self._ntp_enabled = False - set_module_args(dict(ntp_state='disabled', - domain=127)) - self.execute_module(changed=False) - - def test_set_domain_with_change(self): - set_module_args(dict(domain=100)) - commands = ['ptp domain 100'] - self.execute_module(changed=True, commands=commands) - - def test_set_primary_priority_no_change(self): - set_module_args(dict(primary_priority=128)) - self.execute_module(changed=False) - - def test_set_primary_priority_with_change(self): - set_module_args(dict(primary_priority=250)) - commands = ['ptp priority1 250'] - self.execute_module(changed=True, commands=commands) - - def test_set_secondary_priority_no_change(self): - set_module_args(dict(secondary_priority=128)) - self.execute_module(changed=False) - - def test_set_secondary_priority_with_change(self): - set_module_args(dict(secondary_priority=190)) - commands = ['ptp priority2 190'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_interface.py b/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_interface.py deleted file mode 100644 index fd24ad73..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_ptp_interface.py +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_ptp_interface -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxPtpInterface(TestOnyxModule): - - module = onyx_ptp_interface - enabled = False - interfaces = {'Eth1/1': ('ethernet', '1/1'), 'Vlan 1': ('vlan', '1')} - - def setUp(self): - self.enabled = False - super(TestOnyxPtpInterface, self).setUp() - self.mock_get_config = patch.object( - onyx_ptp_interface.OnyxPtpInterfaceModule, "_show_ptp_interface_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxPtpInterface, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_ptp_interface.cfg' - data = None - if self.enabled: - data = load_fixture(config_file) - - self.get_config.return_value = data - self.load_config.return_value = None - - def test_ptp_disabled_no_change(self): - for interface in self.interfaces: - set_module_args(dict(state='disabled', name=interface)) - self.execute_module(changed=False) - - def test_ptp_disabled_with_change(self): - self.enabled = True - for interface in self.interfaces: - set_module_args(dict(state='disabled', name=interface)) - interface_type, interface_id = self.interfaces.get(interface) - commands = ['no interface %s %s ptp enable' % (interface_type, interface_id)] - self.execute_module(changed=True, commands=commands) - - def test_ptp_enabled_no_change(self): - self.enabled = True - for interface in self.interfaces: - set_module_args(dict(state='enabled', name=interface)) - self.execute_module(changed=False) - - def test_ptp_enabled_with_change(self): - for interface in self.interfaces: - set_module_args(dict(state='disabled', name=interface)) - interface_type, interface_id = self.interfaces.get(interface) - set_module_args(dict(state='enabled', name=interface)) - commands = ['interface %s %s ptp enable' % (interface_type, interface_id)] - self.execute_module(changed=True, commands=commands) - - def test_ptp_attributs_no_change(self): - self.enabled = True - for interface in self.interfaces: - set_module_args(dict(state='enabled', name=interface, delay_request=0, - announce_interval=-2, announce_timeout=3, - sync_interval=-3)) - self.execute_module(changed=False) - - def test_ptp_attributs_with_change(self): - self.enabled = True - for interface in self.interfaces: - set_module_args(dict(state='enabled', name=interface, delay_request=2, - announce_interval=-1, announce_timeout=5, sync_interval=-1)) - interface_type, interface_id = self.interfaces.get(interface) - commands = ['interface %s %s ptp delay-req interval 2' % (interface_type, interface_id), - 'interface %s %s ptp announce interval -1' % (interface_type, interface_id), - 'interface %s %s ptp announce timeout 5' % (interface_type, interface_id), - 'interface %s %s ptp sync interval -1' % (interface_type, interface_id)] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_qos.py b/tests/unit/plugins/modules/network/onyx/test_onyx_qos.py deleted file mode 100644 index 1344f11b..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_qos.py +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_qos -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxQosModule(TestOnyxModule): - - module = onyx_qos - - def setUp(self): - super(TestOnyxQosModule, self).setUp() - self.mock_get_if_qos_config = patch.object( - onyx_qos.OnyxQosModule, "_show_interface_qos") - self.get_if_qos_config = self.mock_get_if_qos_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxQosModule, self).tearDown() - self.mock_get_if_qos_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - qos_interface_ethernet_config_file = 'show_qos_interface_ethernet.cfg' - qos_interface_ethernet_data = load_fixture(qos_interface_ethernet_config_file) - self.get_if_qos_config.return_value = qos_interface_ethernet_data - self.load_config.return_value = None - - def test_qos_interface_ethernet_no_change(self): - set_module_args(dict(interfaces=["Eth1/1"], trust="both", rewrite_pcp="enabled", - rewrite_dscp="disabled")) - self.execute_module(changed=False) - - def test_qos_interface_ethernet_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], trust="L2", rewrite_pcp="disabled", - rewrite_dscp="enabled")) - commands = ["interface ethernet 1/1 no qos rewrite pcp", - "interface ethernet 1/1 qos trust L2", - "interface ethernet 1/1 qos rewrite dscp" - ] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp.py b/tests/unit/plugins/modules/network/onyx/test_onyx_snmp.py deleted file mode 100644 index e9ba0956..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp.py +++ /dev/null @@ -1,150 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_snmp -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxSNMPModule(TestOnyxModule): - - module = onyx_snmp - enabled = False - - def setUp(self): - self.enabled = False - super(TestOnyxSNMPModule, self).setUp() - self.mock_get_config = patch.object( - onyx_snmp.OnyxSNMPModule, "_show_snmp_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxSNMPModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_snmp_show.cfg' - data = load_fixture(config_file) - self.get_config.return_value = data - self.load_config.return_value = None - - def test_snmp_state_no_change(self): - set_module_args(dict(state_enabled=True)) - self.execute_module(changed=False) - - def test_snmp_state_with_change(self): - set_module_args(dict(state_enabled=False)) - commands = ['no snmp-server enable'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_contact_no_change(self): - set_module_args(dict(contact_name='sara')) - self.execute_module(changed=False) - - def test_snmp_contact_with_change(self): - set_module_args(dict(contact_name='Omar')) - commands = ['snmp-server contact Omar'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_location_no_change(self): - set_module_args(dict(location='Jordan')) - self.execute_module(changed=False) - - def test_snmp_location_with_change(self): - set_module_args(dict(location='London')) - commands = ['snmp-server location London'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_communities_state_no_change(self): - set_module_args(dict(communities_enabled=True)) - self.execute_module(changed=False) - - def test_snmp_communities_state_with_change(self): - set_module_args(dict(communities_enabled=False)) - commands = ['no snmp-server enable communities'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_multi_communities_state_with_no_change(self): - set_module_args(dict(multi_communities_enabled=True)) - self.execute_module(changed=False) - - def test_snmp_multi_communities_state_with_change(self): - set_module_args(dict(multi_communities_enabled=False)) - commands = ['no snmp-server enable mult-communities'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_communities_no_change(self): - set_module_args(dict(snmp_communities=[dict(community_name='community_2', - community_type='read-write')])) - self.execute_module(changed=False) - - def test_snmp_communities_with_change(self): - set_module_args(dict(snmp_communities=[dict(community_name='community_2', - community_type='read-only')])) - commands = ['snmp-server community community_2 ro'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_communities_delete_with_change(self): - set_module_args(dict(snmp_communities=[dict(community_name='community_1', - state='absent')])) - commands = ['no snmp-server community community_1'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_notify_state_no_change(self): - set_module_args(dict(notify_enabled=True)) - self.execute_module(changed=False) - - def test_snmp_notify_state_with_change(self): - set_module_args(dict(notify_enabled=False)) - commands = ['no snmp-server enable notify'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_notify_port_no_change(self): - set_module_args(dict(notify_port='1')) - self.execute_module(changed=False) - - def test_snmp_notify_port_with_change(self): - set_module_args(dict(notify_port='2')) - commands = ['snmp-server notify port 2'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_notify_community_no_change(self): - set_module_args(dict(notify_community='community_1')) - self.execute_module(changed=False) - - def test_snmp_notify_community_with_change(self): - set_module_args(dict(notify_community='community_2')) - commands = ['snmp-server notify community community_2'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_notify_send_test_with_change(self): - set_module_args(dict(notify_send_test='yes')) - commands = ['snmp-server notify send-test'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_notify_event_with_change(self): - set_module_args(dict(notify_event='interface-up')) - commands = ['snmp-server notify event interface-up'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_permissions_with_change(self): - set_module_args(dict(snmp_permissions=[dict(state_enabled=True, - permission_type='RFC1213-MIB')])) - commands = ['snmp-server enable set-permission RFC1213-MIB'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_engine_id_reset_with_change(self): - set_module_args(dict(engine_id_reset='yes')) - commands = ['snmp-server engineID reset'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_hosts.py b/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_hosts.py deleted file mode 100644 index 0bf08634..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_hosts.py +++ /dev/null @@ -1,170 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_snmp_hosts -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxSNMPHostsModule(TestOnyxModule): - - module = onyx_snmp_hosts - - def setUp(self): - self.enabled = False - super(TestOnyxSNMPHostsModule, self).setUp() - self.mock_get_config = patch.object( - onyx_snmp_hosts.OnyxSNMPHostsModule, "_show_hosts_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxSNMPHostsModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_snmp_hosts.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_snmp_host_enabled_state_no_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - enabled=True)])) - self.execute_module(changed=False) - - def test_snmp_host_enabled_state_with_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - enabled=False)])) - commands = ['snmp-server host 1.1.1.1 disable'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_notification_type_no_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='2c', - port='5')])) - self.execute_module(changed=False) - - def test_snmp_host_notification_type_with_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='inform', - version='2c', - port='5')])) - commands = ['snmp-server host 2.2.2.2 informs port 5 version 2c'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_version_no_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='2c', - port='5')])) - self.execute_module(changed=False) - - def test_snmp_host_version_with_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='1', - port='5')])) - commands = ['snmp-server host 2.2.2.2 traps port 5 version 1'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_port_no_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='2c', - port='5')])) - self.execute_module(changed=False) - - def test_snmp_host_port_with_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='2c', - port='3')])) - commands = ['snmp-server host 2.2.2.2 traps port 3 version 2c'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_user_name_no_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='sara', - auth_type='md5', - auth_password='sara123saea1234678')])) - self.execute_module(changed=False) - - def test_snmp_host_user_name_with_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='masa', - auth_type='md5', - auth_password='sara123saea1234678')])) - commands = ['snmp-server host 1.1.1.1 informs port 3 version 3 user masa auth md5 sara123saea1234678'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_auth_type_no_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='sara', - auth_type='md5', - auth_password='sara123saea1234678')])) - self.execute_module(changed=False) - - def test_snmp_host_auth_type_with_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='sara', - auth_type='sha', - auth_password='sara123saea1234678')])) - commands = ['snmp-server host 1.1.1.1 informs port 3 version 3 user sara auth sha sara123saea1234678'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_privacy_type_no_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='sara', - auth_type='md5', - auth_password='sara123saea1234678', - privacy_type='3des', - privacy_password='pjqriuewjhksjmdoiws')])) - self.execute_module(changed=False) - - def test_snmp_host_privacy_type_with_change(self): - set_module_args(dict(hosts=[dict(name='1.1.1.1', - notification_type='inform', - version='3', - port='3', - user_name='sara', - auth_type='md5', - auth_password='sara123saea1234678', - privacy_type='aes-192', - privacy_password='pjqriuewjhksjmdoiws')])) - commands = ['snmp-server host 1.1.1.1 informs port 3 version 3 user sara auth md5 sara123saea1234678 priv aes-192 pjqriuewjhksjmdoiws'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_host_state_with_change(self): - set_module_args(dict(hosts=[dict(name='2.2.2.2', - notification_type='trap', - version='2c', - port='5', - state='absent')])) - commands = ['no snmp-server host 2.2.2.2'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_users.py b/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_users.py deleted file mode 100644 index 7382ddbf..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_snmp_users.py +++ /dev/null @@ -1,95 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_snmp_users -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxSNMPUsersModule(TestOnyxModule): - - module = onyx_snmp_users - - def setUp(self): - self.enabled = False - super(TestOnyxSNMPUsersModule, self).setUp() - self.mock_get_config = patch.object( - onyx_snmp_users.OnyxSNMPUsersModule, "_show_users") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxSNMPUsersModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_show_snmp_users.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_snmp_user_state_no_change(self): - set_module_args(dict(users=[dict(name='sara', - enabled='true')])) - self.execute_module(changed=False) - - def test_snmp_user_state_with_change(self): - set_module_args(dict(users=[dict(name='sara', - enabled='false')])) - commands = ['no snmp-server user sara v3 enable'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_user_set_access_state_no_change(self): - set_module_args(dict(users=[dict(name='sara', - set_access_enabled='true')])) - self.execute_module(changed=False) - - def test_snmp_user_set_access_state_with_change(self): - set_module_args(dict(users=[dict(name='sara', - set_access_enabled='false')])) - commands = ['no snmp-server user sara v3 enable sets'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_user_require_privacy_state_no_change(self): - set_module_args(dict(users=[dict(name='sara', - require_privacy='false')])) - self.execute_module(changed=False) - - def test_snmp_user_require_privacy_state_with_change(self): - set_module_args(dict(users=[dict(name='sara', - require_privacy='yes')])) - commands = ['snmp-server user sara v3 require-privacy'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_user_auth_type_no_change(self): - set_module_args(dict(users=[dict(name='sara', - auth_type='sha', - auth_password='12sara123456')])) - self.execute_module(changed=False) - - def test_snmp_user_auth_type_with_change(self): - set_module_args(dict(users=[dict(name='sara', - auth_type='md5', - auth_password='12sara123456')])) - commands = ['snmp-server user sara v3 auth md5 12sara123456'] - self.execute_module(changed=True, commands=commands) - - def test_snmp_user_capability_level_no_change(self): - set_module_args(dict(users=[dict(name='sara', - capability_level='admin')])) - self.execute_module(changed=False) - - def test_snmp_user_capability_level_with_change(self): - set_module_args(dict(users=[dict(name='sara', - capability_level='monitor')])) - commands = ['snmp-server user sara v3 capability monitor'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_files.py b/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_files.py deleted file mode 100644 index cb9a8509..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_files.py +++ /dev/null @@ -1,113 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_syslog_files -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxSyslogFilesModule(TestOnyxModule): - - module = onyx_syslog_files - - def setUp(self): - self.enabled = False - super(TestOnyxSyslogFilesModule, self).setUp() - self.mock_get_config = patch.object( - onyx_syslog_files.OnyxSyslogFilesModule, "show_logging") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxSyslogFilesModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_logging_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_syslog_files_force_rotate(self): - set_module_args(dict(rotation=dict(force=True))) - commands = ["logging files rotation force"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_files_max_num(self): - set_module_args(dict(rotation=dict(max_num=30))) - commands = ["logging files rotation max-num 30"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_files_freq(self): - set_module_args(dict(rotation=dict(frequency="daily"))) - commands = ["logging files rotation criteria frequency daily"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_files_size(self): - set_module_args(dict(rotation=dict(size=10.5))) - commands = ["logging files rotation criteria size 10.5"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_files_delete(self): - set_module_args(dict(delete_group="oldest")) - commands = ["logging files delete oldest"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_debug_files_force_rotate(self): - set_module_args(dict(rotation=dict(force=True), debug=True)) - commands = ["logging debug-files rotation force"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_debug_files_max_num(self): - set_module_args(dict(rotation=dict(max_num=30), debug=True)) - commands = ["logging debug-files rotation max-num 30"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_debug_files_freq(self): - set_module_args(dict(rotation=dict(frequency="weekly"), debug=True)) - commands = ["logging debug-files rotation criteria frequency weekly"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_debug_files_size(self): - set_module_args(dict(rotation=dict(size=10.5), debug=True)) - commands = ["logging debug-files rotation criteria size 10.5"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_debug_files_delete(self): - set_module_args(dict(delete_group="oldest", debug=True)) - commands = ["logging debug-files delete oldest"] - self.execute_module(changed=True, commands=commands) - - ''' nochange ''' - def test_syslog_files_max_num_no_change(self): - set_module_args(dict(rotation=dict(max_num=10))) - self.execute_module(changed=False) - - def test_syslog_files_freq_no_change(self): - set_module_args(dict(rotation=dict(frequency="weekly"))) - self.execute_module(changed=False) - - def test_syslog_files_size_no_change(self): - set_module_args(dict(rotation=dict(size_pct=10))) - self.execute_module(changed=False) - - def test_syslog_debug_files_max_num_no_change(self): - set_module_args(dict(rotation=dict(max_num=20), debug=True)) - self.execute_module(changed=False) - - def test_syslog_debug_files_freq_no_change(self): - set_module_args(dict(rotation=dict(frequency="daily"), debug=True)) - self.execute_module(changed=False) - - def test_syslog_debug_files_size_no_change(self): - set_module_args(dict(rotation=dict(size=20), debug=True)) - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_remote.py b/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_remote.py deleted file mode 100644 index 2075037c..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_syslog_remote.py +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_syslog_remote -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxSysLogRemoteModule(TestOnyxModule): - - module = onyx_syslog_remote - - def setUp(self): - self.enabled = False - super(TestOnyxSysLogRemoteModule, self).setUp() - self.mock_get_config = patch.object( - onyx_syslog_remote.OnyxSyslogRemoteModule, "show_logging") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxSysLogRemoteModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_logging_config_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_syslog_new_host(self): - set_module_args(dict(host="10.10.20.20")) - commands = ["logging 10.10.20.20"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_new_host_port(self): - set_module_args(dict(host="10.10.20.20", port=8080)) - commands = ['logging 10.10.20.20', 'logging 10.10.20.20 port 8080'] - self.execute_module(changed=True, commands=commands) - - def test_syslog_override(self): - set_module_args(dict(host="10.10.10.12", trap_override=[dict(override_class="sx-sdk", override_priority='emerg'), - dict(override_class="mgmt-back", override_priority='emerg')])) - commands = ["logging 10.10.10.12 trap override class mgmt-back priority emerg"] # no sx-sdk its already configured - self.execute_module(changed=True, commands=commands) - - def test_syslog_trap(self): - set_module_args(dict(host="10.10.10.10", trap="notice")) - commands = ["logging 10.10.10.10 trap notice"] - self.execute_module(changed=True, commands=commands) - - def test_syslog_include_filter(self): - set_module_args(dict(host="10.10.10.10", filter="include", filter_str=".*ERR.*")) - commands = ['logging 10.10.10.10 filter include .*ERR.*'] - self.execute_module(changed=True, commands=commands) - - def test_syslog_no_override(self): - set_module_args(dict(host="10.10.10.12", trap_override=[dict(override_class="sx-sdk", override_enabled=False), - dict(override_class="mgmt-front", override_enabled=False)])) - commands = ['no logging 10.10.10.12 trap override class sx-sdk'] # no mgmt-front because doesn't configured - self.execute_module(changed=True, commands=commands) - - def test_syslog_no_port(self): - set_module_args(dict(host="10.10.10.12", enabled=False)) - commands = ['no logging 10.10.10.12'] - self.execute_module(changed=True, commands=commands) - - def test_syslog_filter_no_change(self): - set_module_args(dict(host="10.10.10.10", filter="exclude", filter_str=".*ERR.*")) - self.execute_module(changed=False) - - def test_syslog_trap_no_change(self): - set_module_args(dict(host="10.10.10.10", trap="info")) - self.execute_module(changed=False) - - def test_syslog_add_port_no_change(self): - set_module_args(dict(host="10.10.10.12", port=80)) - self.execute_module(changed=False) - - def test_syslog_override_no_change(self): - set_module_args(dict(host="10.10.10.12", trap_override=[dict(override_priority="emerg", override_class="sx-sdk")])) - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_traffic_class.py b/tests/unit/plugins/modules/network/onyx/test_onyx_traffic_class.py deleted file mode 100644 index b1534cde..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_traffic_class.py +++ /dev/null @@ -1,108 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_traffic_class -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxTrafficClassModule(TestOnyxModule): - - module = onyx_traffic_class - arp_suppression = True - - def setUp(self): - super(TestOnyxTrafficClassModule, self).setUp() - self.mock_get_congestion_control_config = patch.object( - onyx_traffic_class.OnyxTrafficClassModule, "_show_interface_congestion_control") - self.get_congestion_control_config = self.mock_get_congestion_control_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_dcb_config = patch.object( - onyx_traffic_class.OnyxTrafficClassModule, "_show_interface_dcb_ets") - self.get_dcb_config = self.mock_get_dcb_config.start() - - def tearDown(self): - super(TestOnyxTrafficClassModule, self).tearDown() - self.mock_get_congestion_control_config.stop() - self.mock_load_config.stop() - self.mock_get_dcb_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - interfaces_congestion_control_config_file = 'onyx_show_interface_congestion_control.cfg' - interfaces_dcb_config_file = 'onyx_show_dcb_ets_interface.cfg' - interfaces_congestion_control_data = load_fixture(interfaces_congestion_control_config_file) - interfaces_dcb_config_data = load_fixture(interfaces_dcb_config_file) - self.get_congestion_control_config.return_value = interfaces_congestion_control_data - self.get_dcb_config.return_value = interfaces_dcb_config_data - self.load_config.return_value = None - - def test_configure_congestion_control_disabled_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=1, - congestion_control=dict(control="ecn", threshold_mode="absolute", - min_threshold=500, max_threshold=1500))) - commands = [ - "interface ethernet 1/1 traffic-class 1 congestion-control ecn minimum-absolute 500 maximum-absolute 1500" - ] - self.execute_module(changed=True, commands=commands) - - def test_configure_congestion_control_disabled_with_no_change(self): - set_module_args(dict(state="disabled", interfaces=["Eth1/1"], tc=0)) - - self.execute_module(changed=False) - - def test_configure_congestion_control_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=2, - congestion_control=dict(control="ecn", threshold_mode="relative", - min_threshold=9, max_threshold=88))) - commands = [ - "interface ethernet 1/1 traffic-class 2 congestion-control ecn minimum-relative 9 maximum-relative 88" - ] - self.execute_module(changed=True, commands=commands) - - def test_configure_congestion_control_absolute_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=3, - congestion_control=dict(control="ecn", threshold_mode="absolute", - min_threshold=500, max_threshold=1500))) - commands = [ - "interface ethernet 1/1 traffic-class 3 congestion-control ecn minimum-absolute 500 maximum-absolute 1500" - ] - self.execute_module(changed=True, commands=commands) - - def test_configure_congestion_control_with_no_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=3, - congestion_control=dict(control="ecn", threshold_mode="absolute", - min_threshold=500, max_threshold=1550))) - self.execute_module(changed=False) - - def test_configure_dcb_mode_with_no_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=3, dcb=dict(mode="strict"))) - self.execute_module(changed=False) - - def test_configure_dcb_strict_mode_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=1, dcb=dict(mode="strict"))) - commands = [ - "interface ethernet 1/1 traffic-class 1 dcb ets strict" - ] - self.execute_module(changed=True, commands=commands) - - def test_configure_dcb_wrr_mode_with_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=0, dcb=dict(mode="wrr", weight=10))) - commands = [ - "interface ethernet 1/1 traffic-class 0 dcb ets wrr 10" - ] - self.execute_module(changed=True, commands=commands) - - def test_configure_dcb_wrr_mode_with_no_change(self): - set_module_args(dict(interfaces=["Eth1/1"], tc=0, dcb=dict(mode="wrr", weight=12))) - - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_username.py b/tests/unit/plugins/modules/network/onyx/test_onyx_username.py deleted file mode 100644 index c1da8a12..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_username.py +++ /dev/null @@ -1,99 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_username -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxUsernameModule(TestOnyxModule): - - module = onyx_username - - def setUp(self): - self.enabled = False - super(TestOnyxUsernameModule, self).setUp() - self.mock_get_config = patch.object( - onyx_username.OnyxUsernameModule, "_get_username_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxUsernameModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_username_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_new_username(self): - set_module_args(dict(username='test')) - commands = ['username test'] - self.execute_module(changed=True, commands=commands) - - def test_change_full_username(self): - set_module_args(dict(username='anass', full_name="anasshami")) - commands = ['username anass full-name anasshami'] - self.execute_module(changed=True, commands=commands) - - def test_change_username_password(self): - set_module_args(dict(username='anass', password="12345")) - commands = ['username anass password 12345'] - self.execute_module(changed=True, commands=commands) - - def test_change_username_password_encrypted(self): - set_module_args(dict(username='anass', password="12345", encrypted_password=True)) - commands = ['username anass password 7 12345'] - self.execute_module(changed=True, commands=commands) - - def test_disable_username(self): - set_module_args(dict(username='anass', disabled="all")) - commands = ['username anass disable'] - self.execute_module(changed=True, commands=commands) - - def test_disable_username_login(self): - set_module_args(dict(username='anass', disabled="login")) - commands = ['username anass disable login'] - self.execute_module(changed=True, commands=commands) - - def test_disable_username_password(self): - set_module_args(dict(username='anass', disabled="password")) - commands = ['username anass disable password'] - self.execute_module(changed=True, commands=commands) - - def test_change_username_capability(self): - set_module_args(dict(username='anass', capability="monitor")) - commands = ['username anass capability monitor'] - self.execute_module(changed=True, commands=commands) - - def test_disconnect_username(self): - set_module_args(dict(username='anass', disconnected=True)) - commands = ['username anass disconnect'] - self.execute_module(changed=True, commands=commands) - - def test_no_change_username_capability(self): - set_module_args(dict(username='anass', capability="admin")) - self.execute_module(changed=False) - - def test_no_change_username_disabled(self): - set_module_args(dict(username='anassh', disabled="all")) - self.execute_module(changed=False) - - def test_no_change_username_nopass(self): - set_module_args(dict(username='admin', nopassword=True)) - self.execute_module(changed=False) - - def test_no_change_full_username(self): - set_module_args(dict(username='admin', full_name="System Administrator")) - self.execute_module(changed=False) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_vlan.py b/tests/unit/plugins/modules/network/onyx/test_onyx_vlan.py deleted file mode 100644 index 2bc5aff0..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_vlan.py +++ /dev/null @@ -1,106 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_vlan -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxVlanModule(TestOnyxModule): - - module = onyx_vlan - - def setUp(self): - super(TestOnyxVlanModule, self).setUp() - self.mock_get_config = patch.object( - onyx_vlan.OnyxVlanModule, "_get_vlan_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_version = patch.object( - onyx_vlan.OnyxVlanModule, "_get_os_version") - self.get_version = self.mock_get_version.start() - - def tearDown(self): - super(TestOnyxVlanModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_get_version.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_vlan_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - self.get_version.return_value = "3.6.5000" - - def test_vlan_no_change(self): - set_module_args(dict(vlan_id=20)) - self.execute_module(changed=False) - - def test_vlan_remove_name(self): - set_module_args(dict(vlan_id=10, name='')) - commands = ['vlan 10 no name'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_change_name(self): - set_module_args(dict(vlan_id=10, name='test-test')) - commands = ['vlan 10 name test-test'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_create(self): - set_module_args(dict(vlan_id=30)) - commands = ['vlan 30', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_create_with_name(self): - set_module_args(dict(vlan_id=30, name='test-test')) - commands = ['vlan 30', 'exit', 'vlan 30 name test-test'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_remove(self): - set_module_args(dict(vlan_id=20, state='absent')) - commands = ['no vlan 20'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_remove_not_exist(self): - set_module_args(dict(vlan_id=30, state='absent')) - self.execute_module(changed=False) - - def test_vlan_aggregate(self): - aggregate = list() - aggregate.append(dict(vlan_id=30)) - aggregate.append(dict(vlan_id=20)) - set_module_args(dict(aggregate=aggregate)) - commands = ['vlan 30', 'exit'] - self.execute_module(changed=True, commands=commands) - - def test_vlan_aggregate_purge(self): - aggregate = list() - aggregate.append(dict(vlan_id=30)) - aggregate.append(dict(vlan_id=20)) - set_module_args(dict(aggregate=aggregate, purge=True)) - commands = ['vlan 30', 'exit', 'no vlan 10', 'no vlan 1'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_vxlan.py b/tests/unit/plugins/modules/network/onyx/test_onyx_vxlan.py deleted file mode 100644 index 05ea3b6a..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_vxlan.py +++ /dev/null @@ -1,101 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_vxlan -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxVxlanModule(TestOnyxModule): - - module = onyx_vxlan - arp_suppression = True - - def setUp(self): - super(TestOnyxVxlanModule, self).setUp() - self.mock_get_vxlan_config = patch.object( - onyx_vxlan.OnyxVxlanModule, "_show_vxlan_config") - self.get_vxlan_config = self.mock_get_vxlan_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_nve_detail = patch.object( - onyx_vxlan.OnyxVxlanModule, "_show_nve_detail") - self.get_nve_detail = self.mock_get_nve_detail.start() - - def tearDown(self): - super(TestOnyxVxlanModule, self).tearDown() - self.mock_get_vxlan_config.stop() - self.mock_load_config.stop() - self.mock_get_nve_detail.stop() - - def load_fixtures(self, commands=None, transport='cli'): - interfaces_nve_config_file = 'onyx_show_interfaces_nve.cfg' - interfaces_nve_detail_config_file = 'onyx_show_interfaces_nve_detail.cfg' - self.get_nve_detail.return_value = None - interfaces_nve_detail_data = load_fixture(interfaces_nve_detail_config_file) - interfaces_nv_data = load_fixture(interfaces_nve_config_file) - self.get_nve_detail.return_value = interfaces_nve_detail_data - if self.arp_suppression is False: - interfaces_nve_detail_data[0]["10"][0]["Neigh Suppression"] = "Disable" - interfaces_nve_detail_data[0]["6"][0]["Neigh Suppression"] = "Disable" - self.get_nve_detail.return_value = interfaces_nve_detail_data - self.get_vxlan_config.return_value = interfaces_nv_data - - self.load_config.return_value = None - - def test_configure_vxlan_no_change(self): - set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', - vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], - arp_suppression=True)) - self.execute_module(changed=False) - - def test_configure_vxlan_with_change(self): - set_module_args(dict(nve_id=2, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', - vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], - arp_suppression=True)) - commands = [ - "no interface nve 1", "interface nve 2", "exit", - "interface nve 2 vxlan source interface loopback 1 ", - "interface nve 2 nve controller bgp", "interface nve 2 vxlan mlag-tunnel-ip 192.10.10.1", - "interface nve 2 nve neigh-suppression", "interface nve 2 nve vni 10010 vlan 10", - "interface vlan 10", "exit", "interface nve 2 nve vni 10060 vlan 6", "interface vlan 6", "exit" - ] - self.execute_module(changed=True, commands=commands) - - def test_loopback_id_with_change(self): - set_module_args(dict(nve_id=1, loopback_id=2, bgp=True, mlag_tunnel_ip='192.10.10.1', - vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], - arp_suppression=True)) - commands = ["interface nve 1 vxlan source interface loopback 2 "] - self.execute_module(changed=True, commands=commands) - - def test_mlag_tunnel_ip_with_change(self): - set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.10', - vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], - arp_suppression=True)) - commands = ["interface nve 1 vxlan mlag-tunnel-ip 192.10.10.10"] - self.execute_module(changed=True, commands=commands) - - def test_vni_vlan_list_with_change(self): - set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', - vni_vlan_list=[dict(vlan_id=11, vni_id=10011), dict(vlan_id=7, vni_id=10061)], - arp_suppression=False)) - commands = ["interface nve 1 nve vni 10011 vlan 11", "interface nve 1 nve vni 10061 vlan 7"] - self.execute_module(changed=True, commands=commands) - - def test_arp_suppression_with_change(self): - self.arp_suppression = False - set_module_args(dict(nve_id=1, loopback_id=1, bgp=True, mlag_tunnel_ip='192.10.10.1', - vni_vlan_list=[dict(vlan_id=10, vni_id=10010), dict(vlan_id=6, vni_id=10060)], - arp_suppression=True)) - commands = ["interface vlan 10", "exit", "interface vlan 6", "exit"] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/plugins/modules/network/onyx/test_onyx_wjh.py b/tests/unit/plugins/modules/network/onyx/test_onyx_wjh.py deleted file mode 100644 index 04661d32..00000000 --- a/tests/unit/plugins/modules/network/onyx/test_onyx_wjh.py +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible_collections.community.network.tests.unit.compat.mock import patch -from ansible_collections.community.network.plugins.modules.network.onyx import onyx_wjh -from ansible_collections.community.network.tests.unit.plugins.modules.utils import set_module_args -from .onyx_module import TestOnyxModule, load_fixture - - -class TestOnyxWJHModule(TestOnyxModule): - - module = onyx_wjh - - def setUp(self): - self.enabled = False - super(TestOnyxWJHModule, self).setUp() - self.mock_get_config = patch.object( - onyx_wjh.OnyxWJHModule, "_get_wjh_config") - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible_collections.community.network.plugins.module_utils.network.onyx.onyx.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestOnyxWJHModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None, transport='cli'): - config_file = 'onyx_wjh_show.cfg' - self.get_config.return_value = load_fixture(config_file) - self.load_config.return_value = None - - def test_wjh_no_change(self): - set_module_args(dict(group='forwarding', enabled=False)) - self.execute_module(changed=False) - - def test_wjh_enable(self): - set_module_args(dict(group='forwarding', enabled=True)) - commands = ['what-just-happened forwarding enable'] - self.execute_module(changed=True, commands=commands) - - def test_wjh_export_no_change(self): - set_module_args(dict(export_group='forwarding', auto_export=False)) - self.execute_module(changed=False) - - def test_wjh_export_enable(self): - set_module_args(dict(export_group='forwarding', auto_export=True)) - commands = ['what-just-happened auto-export forwarding enable'] - self.execute_module(changed=True, commands=commands) - - def test_wjh_export_disable(self): - set_module_args(dict(export_group='all', auto_export=False)) - commands = ['no what-just-happened auto-export all enable'] - self.execute_module(changed=True, commands=commands) - - def test_wjh_clear(self): - set_module_args(dict(clear_group='all')) - commands = ['clear what-just-happened pcap-files all'] - self.execute_module(changed=True, commands=commands) diff --git a/tests/unit/requirements.txt b/tests/unit/requirements.txt index b539d346..632daaaf 100644 --- a/tests/unit/requirements.txt +++ b/tests/unit/requirements.txt @@ -9,8 +9,3 @@ pyFMG # requirements for Nuage modules - CURRENTLY BROKEN! # vspk # bambou - -# requirements for F5 specific modules -f5-sdk ; python_version >= '2.7' -f5-icontrol-rest ; python_version >= '2.7' -deepdiff