Mellanox OS name change: MLNXOS changed to ONYX (#34753)
* Mellanox OS name change: MLNXOS changed to ONYX Signed-off-by: Samer Deeb <samerd@mellanox.com> * Fix alphabetical order of modules metadata Signed-off-by: Samer Deeb <samerd@mellanox.com>
This commit is contained in:
parent
57ff84251e
commit
f8884f12bc
73 changed files with 381 additions and 383 deletions
28
.github/BOTMETA.yml
vendored
28
.github/BOTMETA.yml
vendored
|
@ -481,13 +481,13 @@ files:
|
|||
$modules/network/junos/: Qalthos ganeshrn
|
||||
$modules/network/layer2/: $team_networking
|
||||
$modules/network/layer3/: $team_networking
|
||||
$modules/network/mlnxos/: $team_mlnxos
|
||||
$modules/network/netconf/netconf_config.py: ganeshrn lpenz userlerueda
|
||||
$modules/network/netscaler/: $team_netscaler
|
||||
$modules/network/netvisor/: $team_netvisor
|
||||
$modules/network/nuage/: pdellaert
|
||||
$modules/network/nxos/: $team_nxos
|
||||
$modules/network/nso/: $team_nso
|
||||
$modules/network/onyx/: $team_onyx
|
||||
$modules/network/openvswitch/:
|
||||
ignored: stygstra
|
||||
maintainers: $team_networking
|
||||
|
@ -989,9 +989,6 @@ files:
|
|||
$module_utils/network/ironware:
|
||||
maintainers: paulquack
|
||||
labels: networking
|
||||
$module_utils/network/mlnxos:
|
||||
maintainers: $team_mlnxos
|
||||
labels: networking
|
||||
$module_utils/k8s_common.py:
|
||||
maintainers: chouseknecht sdoran maxamillion fabianvf flaper87
|
||||
labels: clustering
|
||||
|
@ -1003,6 +1000,9 @@ files:
|
|||
$module_utils/network/nso:
|
||||
maintainers: $team_nso
|
||||
labels: networking
|
||||
$module_utils/network/onyx:
|
||||
maintainers: $team_onyx
|
||||
labels: networking
|
||||
$module_utils/openstack.py:
|
||||
maintainers: $team_openstack
|
||||
labels:
|
||||
|
@ -1069,9 +1069,6 @@ files:
|
|||
lib/ansible/plugins/action/junos:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
lib/ansible/plugins/action/mlnxos_config.py:
|
||||
maintainers: $team_mlnxos
|
||||
labels: networking
|
||||
lib/ansible/plugins/action/net:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
|
@ -1080,6 +1077,9 @@ files:
|
|||
labels:
|
||||
- networking
|
||||
- nxos
|
||||
lib/ansible/plugins/action/onyx_config.py:
|
||||
maintainers: $team_onyx
|
||||
labels: networking
|
||||
lib/ansible/plugins/action/sros:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
|
@ -1095,14 +1095,14 @@ files:
|
|||
lib/ansible/plugins/cliconf/ironware.py:
|
||||
maintainers: paulquack
|
||||
labels: networking
|
||||
lib/ansible/plugins/cliconf/mlnxos.py:
|
||||
maintainers: $team_mlnxos
|
||||
labels: networking
|
||||
lib/ansible/plugins/cliconf/nxos.py:
|
||||
maintainers: $team_nxos
|
||||
labels:
|
||||
- networking
|
||||
- nxos
|
||||
lib/ansible/plugins/cliconf/onyx.py:
|
||||
maintainers: $team_onyx
|
||||
labels: networking
|
||||
lib/ansible/plugins/connection/netconf.py:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
|
@ -1169,14 +1169,14 @@ files:
|
|||
lib/ansible/plugins/terminal/junos.py:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
lib/ansible/plugins/terminal/mlnxos.py:
|
||||
maintainers: $team_mlnxos
|
||||
labels: networking
|
||||
lib/ansible/plugins/terminal/nxos.py:
|
||||
maintainers: $team_networking
|
||||
labels:
|
||||
- networking
|
||||
- nxos
|
||||
lib/ansible/plugins/terminal/onyx.py:
|
||||
maintainers: $team_onyx
|
||||
labels: networking
|
||||
lib/ansible/plugins/terminal/sros.py:
|
||||
maintainers: $team_networking
|
||||
labels: networking
|
||||
|
@ -1222,13 +1222,13 @@ macros:
|
|||
team_azure: haroldwongms nitzmahone tstringer yuwzho xscript zikalino
|
||||
team_cumulus: isharacomix jrrivers privateip
|
||||
team_manageiq: gtanzillo abellotti zgalor yaacov cben
|
||||
team_mlnxos: samerd
|
||||
team_netapp: hulquest lmprice broncofan gouthampacha
|
||||
team_netscaler: chiradeep giorgos-nikolopoulos
|
||||
team_netvisor: Qalthos amitsi gundalow privateip
|
||||
team_networking: Qalthos ganeshrn gundalow privateip rcarrillocruz trishnaguha kedarX
|
||||
team_nso: cmoberg pekdon
|
||||
team_nxos: mikewiebe privateip rahushen rcarrillocruz trishnaguha kedarX
|
||||
team_onyx: samerd
|
||||
team_openstack: emonty j2sol juliakreger rcarrillocruz shrews thingee dagnello
|
||||
team_openswitch: Qalthos gundalow privateip
|
||||
team_rabbitmq: chrishoffman manuel-sousa hyperized
|
||||
|
|
|
@ -48,10 +48,10 @@ The following is a list of module_utils files and a general description. The mod
|
|||
- network/iosxr/iosxr.py - Definitions and helper functions for modules that manage Cisco IOS-XR networking devices.
|
||||
- network/ironware/ironware.py - Module support utilities for managing Brocade IronWare devices.
|
||||
- network/junos/junos.py - Definitions and helper functions for modules that manage Junos networking devices.
|
||||
- network/mlnxos/mlnxos.py - Definitions and helper functions for modules that manage Mellanox MLNX-OS networking devices.
|
||||
- network/netscaler/netscaler.py - Utilities specifically for the netscaler network modules.
|
||||
- network/nso/nso.py - Utilities for modules that work with Cisco NSO.
|
||||
- network/nxos/nxos.py - Contains definitions and helper functions specific to Cisco NXOS networking devices.
|
||||
- network/onyx/onyx.py - Definitions and helper functions for modules that manage Mellanox ONYX networking devices.
|
||||
- network/ordance/ordance.py - Module support utilities for managing Ordnance devices.
|
||||
- network/sros/sros.py - Helper functions for modules working with Open vSwitch bridges.
|
||||
- network/vyos/vyos.py - Definitions and functions for working with VyOS networking
|
||||
|
|
|
@ -1325,7 +1325,7 @@ MERGE_MULTIPLE_CLI_TAGS:
|
|||
version_added: "2.3"
|
||||
NETWORK_GROUP_MODULES:
|
||||
name: Network module families
|
||||
default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, mlnxos]
|
||||
default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx]
|
||||
description: 'TODO: write it'
|
||||
env: [{name: NETWORK_GROUP_MODULES}]
|
||||
ini:
|
||||
|
|
|
@ -145,7 +145,7 @@ def get_bgp_summary(module):
|
|||
return show_cmd(module, cmd, json_fmt=False, fail_on_error=False)
|
||||
|
||||
|
||||
class BaseMlnxosModule(object):
|
||||
class BaseOnyxModule(object):
|
||||
|
||||
def __init__(self):
|
||||
self._module = None
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_bgp
|
||||
module: onyx_bgp
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Configures BGP on Mellanox MLNX-OS network devices
|
||||
short_description: Configures BGP on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of BGP router and neighbors
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
as_number:
|
||||
description:
|
||||
|
@ -53,7 +53,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure bgp
|
||||
mlnxos_bgp:
|
||||
onyx_bgp:
|
||||
as_number: 320
|
||||
router_id: 10.3.3.3
|
||||
neighbors:
|
||||
|
@ -81,11 +81,11 @@ import re
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_bgp_summary
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.onyx.onyx import get_bgp_summary
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
|
||||
|
||||
class MlnxosBgpModule(BaseMlnxosModule):
|
||||
class OnyxBgpModule(BaseOnyxModule):
|
||||
LOCAL_AS_REGEX = re.compile(r'^\s+router bgp\s+(\d+).*')
|
||||
ROUTER_ID_REGEX = re.compile(
|
||||
r'^\s+router bgp\s+(\d+).*router-id\s+(\S+)\s+.*')
|
||||
|
@ -249,7 +249,7 @@ class MlnxosBgpModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosBgpModule.main()
|
||||
OnyxBgpModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,25 +12,25 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_command
|
||||
extends_documentation_fragment: mlnxos
|
||||
module: onyx_command
|
||||
extends_documentation_fragment: onyx
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Run commands on remote devices running Mellanox MLNX-OS
|
||||
short_description: Run commands on remote devices running Mellanox ONYX
|
||||
description:
|
||||
- Sends arbitrary commands to an Mellanox MLNX-OS network device and returns
|
||||
- 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(mlnxos_config) to configure Mellanox MLNX-OS devices.
|
||||
Please use M(onyx_config) to configure Mellanox ONYX devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
commands:
|
||||
description:
|
||||
- List of commands to send to the remote mlnxos device over the
|
||||
configured provider. The resulting output from the command
|
||||
- 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.
|
||||
|
@ -71,22 +71,22 @@ options:
|
|||
EXAMPLES = """
|
||||
tasks:
|
||||
- name: run show version on remote devices
|
||||
mlnxos_command:
|
||||
onyx_command:
|
||||
commands: show version
|
||||
|
||||
- name: run show version and check to see if output contains MLNXOS
|
||||
mlnxos_command:
|
||||
onyx_command:
|
||||
commands: show version
|
||||
wait_for: result[0] contains MLNXOS
|
||||
|
||||
- name: run multiple commands on remote nodes
|
||||
mlnxos_command:
|
||||
onyx_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces
|
||||
|
||||
- name: run multiple commands and evaluate the output
|
||||
mlnxos_command:
|
||||
onyx_command:
|
||||
commands:
|
||||
- show version
|
||||
- show interfaces
|
||||
|
@ -120,7 +120,7 @@ from ansible.module_utils.network.common.parsing import Conditional
|
|||
from ansible.module_utils.network.common.utils import ComplexList
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import run_commands
|
||||
from ansible.module_utils.network.onyx.onyx import run_commands
|
||||
|
||||
|
||||
def to_lines(stdout):
|
||||
|
@ -146,8 +146,8 @@ def parse_commands(module, warnings):
|
|||
commands.remove(item)
|
||||
elif item['command'].startswith('conf'):
|
||||
module.fail_json(
|
||||
msg='mlnxos_command does not support running config mode '
|
||||
'commands. Please use mlnxos_config instead'
|
||||
msg='onyx_command does not support running config mode '
|
||||
'commands. Please use onyx_config instead'
|
||||
)
|
||||
return commands
|
||||
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_config
|
||||
extends_documentation_fragment: mlnxos
|
||||
module: onyx_config
|
||||
extends_documentation_fragment: onyx
|
||||
version_added: "2.5"
|
||||
author: "Alex Tabachnik (@atabachnik), Samer Deeb (@samerd)"
|
||||
short_description: Manage Mellanox MLNX-OS configuration sections
|
||||
short_description: Manage Mellanox ONYX configuration sections
|
||||
description:
|
||||
- Mellanox MLNX-OS configurations uses a simple block indent file syntax
|
||||
- Mellanox ONYX configurations uses a simple block indent file syntax
|
||||
for segmenting configuration into sections. This module provides
|
||||
an implementation for working with MLNX-OS configuration sections in
|
||||
an implementation for working with ONYX configuration sections in
|
||||
a deterministic way.
|
||||
options:
|
||||
lines:
|
||||
|
@ -105,7 +105,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
---
|
||||
- mlnxos_config:
|
||||
- onyx_config:
|
||||
lines:
|
||||
- snmp-server community
|
||||
- snmp-server host 10.2.2.2 traps version 2c
|
||||
|
@ -121,15 +121,15 @@ backup_path:
|
|||
description: The full path to the backup file
|
||||
returned: when backup is yes
|
||||
type: string
|
||||
sample: /playbooks/ansible/backup/mlnxos_config.2016-07-16@22:28:34
|
||||
sample: /playbooks/ansible/backup/onyx_config.2016-07-16@22:28:34
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.common.config import NetworkConfig, dumps
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_config
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import load_config
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import run_commands
|
||||
from ansible.module_utils.network.onyx.onyx import get_config
|
||||
from ansible.module_utils.network.onyx.onyx import load_config
|
||||
from ansible.module_utils.network.onyx.onyx import run_commands
|
||||
|
||||
|
||||
def get_candidate(module):
|
|
@ -12,18 +12,18 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_facts
|
||||
module: onyx_facts
|
||||
version_added: "2.5"
|
||||
author: "Waleed Mousa (@waleedym), Samer Deeb (@samerd)"
|
||||
short_description: Collect facts from Mellanox MLNX-OS network devices
|
||||
short_description: Collect facts from Mellanox ONYX network devices
|
||||
description:
|
||||
- Collects a base set of device facts from a MLNX-OS Mellanox network devices
|
||||
- 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_<fact>). 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 MLNX-OS 3.6
|
||||
- Tested against ONYX 3.6
|
||||
options:
|
||||
gather_subset:
|
||||
description:
|
||||
|
@ -40,16 +40,16 @@ options:
|
|||
EXAMPLES = """
|
||||
---
|
||||
- name: Collect all facts from the device
|
||||
mlnxos_facts:
|
||||
onyx_facts:
|
||||
gather_subset: all
|
||||
|
||||
- name: Collect only the interfaces facts
|
||||
mlnxos_facts:
|
||||
onyx_facts:
|
||||
gather_subset:
|
||||
- interfaces
|
||||
|
||||
- name: Do not collect version facts
|
||||
mlnxos_facts:
|
||||
onyx_facts:
|
||||
gather_subset:
|
||||
- "!version"
|
||||
"""
|
||||
|
@ -82,11 +82,11 @@ ansible_net_interfaces:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosFactsModule(BaseMlnxosModule):
|
||||
class OnyxFactsModule(BaseOnyxModule):
|
||||
|
||||
def get_runable_subset(self, gather_subset):
|
||||
runable_subsets = set()
|
||||
|
@ -231,7 +231,7 @@ VALID_SUBSETS = frozenset(FACT_SUBSETS.keys())
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosFactsModule.main()
|
||||
OnyxFactsModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_interface
|
||||
module: onyx_interface
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage Interfaces on Mellanox MLNX-OS network devices
|
||||
short_description: Manage Interfaces on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of Interfaces
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
notes:
|
||||
options:
|
||||
name:
|
||||
|
@ -74,29 +74,29 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure interface
|
||||
mlnxos_interface:
|
||||
onyx_interface:
|
||||
name: Eth1/2
|
||||
description: test-interface
|
||||
speed: 100 GB
|
||||
mtu: 512
|
||||
|
||||
- name: make interface up
|
||||
mlnxos_interface:
|
||||
onyx_interface:
|
||||
name: Eth1/2
|
||||
enabled: True
|
||||
|
||||
- name: make interface down
|
||||
mlnxos_interface:
|
||||
onyx_interface:
|
||||
name: Eth1/2
|
||||
enabled: False
|
||||
|
||||
- name: Check intent arguments
|
||||
mlnxos_interface:
|
||||
onyx_interface:
|
||||
name: Eth1/2
|
||||
state: up
|
||||
|
||||
- name: Config + intent
|
||||
mlnxos_interface:
|
||||
onyx_interface:
|
||||
name: Eth1/2
|
||||
enabled: False
|
||||
state: down
|
||||
|
@ -123,11 +123,11 @@ from ansible.module_utils.six import iteritems
|
|||
from ansible.module_utils.network.common.utils import conditional
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_interfaces_config
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import get_interfaces_config
|
||||
|
||||
|
||||
class MlnxosInterfaceModule(BaseMlnxosModule):
|
||||
class OnyxInterfaceModule(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+)$")
|
||||
|
@ -475,7 +475,7 @@ class MlnxosInterfaceModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosInterfaceModule.main()
|
||||
OnyxInterfaceModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_l2_interface
|
||||
module: onyx_l2_interface
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage Layer-2 interface on Mellanox MLNX-OS network devices
|
||||
short_description: Manage Layer-2 interface on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of Layer-2 interface
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -46,13 +46,13 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure Layer-2 interface
|
||||
mlnxos_l2_interface:
|
||||
onyx_l2_interface:
|
||||
name: Eth1/1
|
||||
mode: access
|
||||
access_vlan: 30
|
||||
|
||||
- name: remove Layer-2 interface configuration
|
||||
mlnxos_l2_interface:
|
||||
onyx_l2_interface:
|
||||
name: Eth1/1
|
||||
state: absent
|
||||
"""
|
||||
|
@ -74,11 +74,11 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_interfaces_config
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import get_interfaces_config
|
||||
|
||||
|
||||
class MlnxosL2InterfaceModule(BaseMlnxosModule):
|
||||
class OnyxL2InterfaceModule(BaseOnyxModule):
|
||||
IFNAME_REGEX = re.compile(r"^.*(Eth\d+\/\d+|Mpo\d+|Po\d+)")
|
||||
|
||||
@classmethod
|
||||
|
@ -277,7 +277,7 @@ class MlnxosL2InterfaceModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosL2InterfaceModule.main()
|
||||
OnyxL2InterfaceModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_l3_interface
|
||||
module: onyx_l3_interface
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage L3 interfaces on Mellanox MLNX-OS network devices
|
||||
short_description: Manage L3 interfaces on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of L3 interfaces
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -45,23 +45,23 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Set Eth1/1 IPv4 address
|
||||
mlnxos_l3_interface:
|
||||
onyx_l3_interface:
|
||||
name: Eth1/1
|
||||
ipv4: 192.168.0.1/24
|
||||
|
||||
- name: Remove Eth1/1 IPv4 address
|
||||
mlnxos_l3_interface:
|
||||
onyx_l3_interface:
|
||||
name: Eth1/1
|
||||
state: absent
|
||||
|
||||
- name: Set IP addresses on aggregate
|
||||
mlnxos_l3_interface:
|
||||
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
|
||||
mlnxos_l3_interface:
|
||||
onyx_l3_interface:
|
||||
aggregate:
|
||||
- { name: Eth1/1, ipv4: 192.168.2.10/24 }
|
||||
- { name: Eth1/2, ipv4: 192.168.3.10/24 }
|
||||
|
@ -83,11 +83,11 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_interfaces_config
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import get_interfaces_config
|
||||
|
||||
|
||||
class MlnxosL3InterfaceModule(BaseMlnxosModule):
|
||||
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+)$")
|
||||
|
@ -285,7 +285,7 @@ class MlnxosL3InterfaceModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosL3InterfaceModule.main()
|
||||
OnyxL3InterfaceModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_linkagg
|
||||
module: onyx_linkagg
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage link aggregation groups on Mellanox MLNX-OS network devices
|
||||
short_description: Manage link aggregation groups on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of link aggregation groups
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -53,25 +53,25 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure link aggregation group
|
||||
mlnxos_linkagg:
|
||||
onyx_linkagg:
|
||||
name: Po1
|
||||
members:
|
||||
- Eth1/1
|
||||
- Eth1/2
|
||||
|
||||
- name: remove configuration
|
||||
mlnxos_linkagg:
|
||||
onyx_linkagg:
|
||||
name: Po1
|
||||
state: absent
|
||||
|
||||
- name: Create aggregate of linkagg definitions
|
||||
mlnxos_linkagg:
|
||||
onyx_linkagg:
|
||||
aggregate:
|
||||
- { name: Po1, members: [Eth1/1] }
|
||||
- { name: Po2, members: [Eth1/2] }
|
||||
|
||||
- name: Remove aggregate of linkagg definitions
|
||||
mlnxos_linkagg:
|
||||
onyx_linkagg:
|
||||
aggregate:
|
||||
- name: Po1
|
||||
- name: Po2
|
||||
|
@ -97,11 +97,11 @@ from ansible.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.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import get_interfaces_config
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import get_interfaces_config
|
||||
|
||||
|
||||
class MlnxosLinkAggModule(BaseMlnxosModule):
|
||||
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+)(.*)$")
|
||||
|
@ -334,7 +334,7 @@ class MlnxosLinkAggModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosLinkAggModule.main()
|
||||
OnyxLinkAggModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_lldp
|
||||
module: onyx_lldp
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage LLDP configuration on Mellanox MLNX-OS network devices
|
||||
short_description: Manage LLDP configuration on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of LLDP service configuration
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
options:
|
||||
state:
|
||||
description:
|
||||
|
@ -29,11 +29,11 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Enable LLDP protocol
|
||||
mlnxos_lldp:
|
||||
onyx_lldp:
|
||||
state: present
|
||||
|
||||
- name: Disable LLDP protocol
|
||||
mlnxos_lldp:
|
||||
onyx_lldp:
|
||||
state: lldp
|
||||
"""
|
||||
|
||||
|
@ -48,11 +48,11 @@ commands:
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosLldpModule(BaseMlnxosModule):
|
||||
class OnyxLldpModule(BaseOnyxModule):
|
||||
LLDP_ENTRY = 'LLDP'
|
||||
SHOW_LLDP_CMD = 'show lldp local'
|
||||
|
||||
|
@ -110,7 +110,7 @@ class MlnxosLldpModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosLldpModule.main()
|
||||
OnyxLldpModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_lldp_interface
|
||||
module: onyx_lldp_interface
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage LLDP interfaces configuration on Mellanox MLNX-OS network devices
|
||||
short_description: Manage LLDP interfaces configuration on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of LLDP interfaces
|
||||
configuration on Mellanox MLNX-OS network devices.
|
||||
configuration on Mellanox ONYX network devices.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -39,34 +39,34 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: Configure LLDP on specific interfaces
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
name: Eth1/1
|
||||
state: present
|
||||
|
||||
- name: Disable LLDP on specific interfaces
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
name: Eth1/1
|
||||
state: disabled
|
||||
|
||||
- name: Enable LLDP on specific interfaces
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
name: Eth1/1
|
||||
state: enabled
|
||||
|
||||
- name: Delete LLDP on specific interfaces
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
name: Eth1/1
|
||||
state: absent
|
||||
|
||||
- name: Create aggregate of LLDP interface configurations
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
aggregate:
|
||||
- { name: Eth1/1 }
|
||||
- { name: Eth1/2 }
|
||||
state: present
|
||||
|
||||
- name: Delete aggregate of LLDP interface configurations
|
||||
mlnxos_lldp_interface:
|
||||
onyx_lldp_interface:
|
||||
aggregate:
|
||||
- { name: Eth1/1 }
|
||||
- { name: Eth1/2 }
|
||||
|
@ -89,11 +89,11 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosLldpInterfaceModule(BaseMlnxosModule):
|
||||
class OnyxLldpInterfaceModule(BaseOnyxModule):
|
||||
IF_NAME_REGEX = re.compile(r"^(Eth\d+\/\d+|Eth\d+\/\d+\d+)$")
|
||||
_purge = False
|
||||
|
||||
|
@ -222,7 +222,7 @@ class MlnxosLldpInterfaceModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosLldpInterfaceModule.main()
|
||||
OnyxLldpInterfaceModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_magp
|
||||
module: onyx_magp
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage MAGP protocol on Mellanox MLNX-OS network devices
|
||||
short_description: Manage MAGP protocol on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of MAGP protocol on vlan
|
||||
interface of Mellanox MLNX-OS network devices.
|
||||
interface of Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
magp_id:
|
||||
description:
|
||||
|
@ -45,7 +45,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: run add vlan interface with magp
|
||||
mlnxos_magp:
|
||||
onyx_magp:
|
||||
magp_id: 103
|
||||
router_ip: 192.168.8.2
|
||||
router_mac: AA:1B:2C:3D:4E:5F
|
||||
|
@ -66,11 +66,11 @@ import re
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosMagpModule(BaseMlnxosModule):
|
||||
class OnyxMagpModule(BaseOnyxModule):
|
||||
IF_VLAN_REGEX = re.compile(r"^Vlan (\d+)$")
|
||||
|
||||
@classmethod
|
||||
|
@ -220,7 +220,7 @@ class MlnxosMagpModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosMagpModule.main()
|
||||
OnyxMagpModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_mlag_ipl
|
||||
module: onyx_mlag_ipl
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage IPL (inter-peer link) on Mellanox MLNX-OS network devices
|
||||
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 MLNX-OS network devices.
|
||||
management on Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -41,14 +41,14 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: run configure ipl
|
||||
mlnxos_mlag_ipl:
|
||||
onyx_mlag_ipl:
|
||||
name: Po1
|
||||
vlan_interface: Vlan 322
|
||||
state: present
|
||||
peer_address: 192.168.7.1
|
||||
|
||||
- name: run remove ipl
|
||||
mlnxos_mlag_ipl:
|
||||
onyx_mlag_ipl:
|
||||
name: Po1
|
||||
state: absent
|
||||
"""
|
||||
|
@ -66,11 +66,11 @@ import re
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosMlagIplModule(BaseMlnxosModule):
|
||||
class OnyxMlagIplModule(BaseOnyxModule):
|
||||
VLAN_IF_REGEX = re.compile(r'^Vlan \d+')
|
||||
|
||||
@classmethod
|
||||
|
@ -203,7 +203,7 @@ class MlnxosMlagIplModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosMlagIplModule.main()
|
||||
OnyxMlagIplModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_mlag_vip
|
||||
module: onyx_mlag_vip
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Configures MLAG VIP on Mellanox MLNX-OS network devices
|
||||
short_description: Configures MLAG VIP on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of MLAG virtual IPs
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
ipaddress:
|
||||
description:
|
||||
|
@ -44,7 +44,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure mlag-vip
|
||||
mlnxos_mlag_vip:
|
||||
onyx_mlag_vip:
|
||||
ipaddress: 50.3.3.1/24
|
||||
group_name: ansible-test-group
|
||||
mac_address: 00:11:12:23:34:45
|
||||
|
@ -64,11 +64,11 @@ import time
|
|||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosMLagVipModule(BaseMlnxosModule):
|
||||
class OnyxMLagVipModule(BaseOnyxModule):
|
||||
|
||||
def init_module(self):
|
||||
""" initialize module
|
||||
|
@ -172,7 +172,7 @@ class MlnxosMLagVipModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosMLagVipModule.main()
|
||||
OnyxMLagVipModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_ospf
|
||||
module: onyx_ospf
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage OSPF protocol on Mellanox MLNX-OS network devices
|
||||
short_description: Manage OSPF protocol on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management and configuration of OSPF
|
||||
protocol on Mellanox MLNX-OS network devices.
|
||||
protocol on Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
ospf:
|
||||
description:
|
||||
|
@ -50,7 +50,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: add ospf router to interface
|
||||
mlnxos_ospf:
|
||||
onyx_ospf:
|
||||
ospf: 2
|
||||
router_id: 192.168.8.2
|
||||
interfaces:
|
||||
|
@ -74,11 +74,11 @@ import re
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosOspfModule(BaseMlnxosModule):
|
||||
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+).*')
|
||||
|
@ -231,7 +231,7 @@ class MlnxosOspfModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosOspfModule.main()
|
||||
OnyxOspfModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_pfc_interface
|
||||
module: onyx_pfc_interface
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Manage priority flow control on MLNX-OS network devices
|
||||
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 MLNX-OS network devices.
|
||||
on interfaces of Mellanox ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -41,7 +41,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure PFC
|
||||
mlnxos_pfc_interface:
|
||||
onyx_pfc_interface:
|
||||
name: Eth1/1
|
||||
state: enabled
|
||||
"""
|
||||
|
@ -61,11 +61,11 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosPfcInterfaceModule(BaseMlnxosModule):
|
||||
class OnyxPfcInterfaceModule(BaseOnyxModule):
|
||||
PFC_IF_REGEX = re.compile(
|
||||
r"^(Eth\d+\/\d+)|(Eth\d+\/\d+\/\d+)|(Po\d+)|(Mpo\d+)$")
|
||||
|
||||
|
@ -198,7 +198,7 @@ class MlnxosPfcInterfaceModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosPfcInterfaceModule.main()
|
||||
OnyxPfcInterfaceModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,15 +12,15 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_protocol
|
||||
module: onyx_protocol
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd)"
|
||||
short_description: Enables/Disables protocols on Mellanox MLNX-OS network devices
|
||||
short_description: Enables/Disables protocols on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides a mechanism for enabling and disabling protocols
|
||||
Mellanox on MLNX-OS network devices.
|
||||
Mellanox on ONYX network devices.
|
||||
notes:
|
||||
- Tested on MLNX-OS 3.6.4000
|
||||
- Tested on ONYX 3.6.4000
|
||||
options:
|
||||
mlag:
|
||||
description: MLAG protocol
|
||||
|
@ -59,7 +59,7 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: enable protocols for MLAG
|
||||
mlnxos_protocol:
|
||||
onyx_protocol:
|
||||
lacp: enabled
|
||||
spanning_tree: disabled
|
||||
ip_routing: enabled
|
||||
|
@ -80,11 +80,11 @@ commands:
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosProtocolModule(BaseMlnxosModule):
|
||||
class OnyxProtocolModule(BaseOnyxModule):
|
||||
|
||||
PROTOCOL_MAPPING = dict(
|
||||
mlag=dict(name="mlag", enable="protocol mlag",
|
||||
|
@ -178,7 +178,7 @@ class MlnxosProtocolModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosProtocolModule.main()
|
||||
OnyxProtocolModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: mlnxos_vlan
|
||||
module: onyx_vlan
|
||||
version_added: "2.5"
|
||||
author: "Samer Deeb (@samerd) Alex Tabachnik (@atabachnik)"
|
||||
short_description: Manage VLANs on Mellanox MLNX-OS network devices
|
||||
short_description: Manage VLANs on Mellanox ONYX network devices
|
||||
description:
|
||||
- This module provides declarative management of VLANs
|
||||
on Mellanox MLNX-OS network devices.
|
||||
on Mellanox ONYX network devices.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
@ -41,12 +41,12 @@ options:
|
|||
|
||||
EXAMPLES = """
|
||||
- name: configure VLAN ID and name
|
||||
mlnxos_vlan:
|
||||
onyx_vlan:
|
||||
vlan_id: 20
|
||||
name: test-vlan
|
||||
|
||||
- name: remove configuration
|
||||
mlnxos_vlan:
|
||||
onyx_vlan:
|
||||
state: absent
|
||||
"""
|
||||
|
||||
|
@ -67,11 +67,11 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.network.common.utils import remove_default_spec
|
||||
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import BaseMlnxosModule
|
||||
from ansible.module_utils.network.mlnxos.mlnxos import show_cmd
|
||||
from ansible.module_utils.network.onyx.onyx import BaseOnyxModule
|
||||
from ansible.module_utils.network.onyx.onyx import show_cmd
|
||||
|
||||
|
||||
class MlnxosVlanModule(BaseMlnxosModule):
|
||||
class OnyxVlanModule(BaseOnyxModule):
|
||||
_purge = False
|
||||
|
||||
@classmethod
|
||||
|
@ -194,7 +194,7 @@ class MlnxosVlanModule(BaseMlnxosModule):
|
|||
def main():
|
||||
""" main entry point for module execution
|
||||
"""
|
||||
MlnxosVlanModule.main()
|
||||
OnyxVlanModule.main()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
|
@ -46,7 +46,7 @@ def load_fixture(name):
|
|||
return data
|
||||
|
||||
|
||||
class TestMlnxosModule(ModuleTestCase):
|
||||
class TestOnyxModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, is_updates=False, sort=True, transport='cli'):
|
||||
|
|
@ -7,32 +7,32 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_bgp
|
||||
from ansible.modules.network.onyx import onyx_bgp
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosBgpModule(TestMlnxosModule):
|
||||
class TestOnyxBgpModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_bgp
|
||||
module = onyx_bgp
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosBgpModule, self).setUp()
|
||||
super(TestOnyxBgpModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_bgp.MlnxosBgpModule, "_get_bgp_summary")
|
||||
onyx_bgp.OnyxBgpModule, "_get_bgp_summary")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosBgpModule, self).tearDown()
|
||||
super(TestOnyxBgpModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_bgp_show.cfg'
|
||||
config_file = 'onyx_bgp_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
|
@ -22,23 +22,23 @@ __metaclass__ = type
|
|||
import json
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_command
|
||||
from ansible.modules.network.onyx import onyx_command
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosCommandModule(TestMlnxosModule):
|
||||
class TestOnyxCommandModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_command
|
||||
module = onyx_command
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosCommandModule, self).setUp()
|
||||
super(TestOnyxCommandModule, self).setUp()
|
||||
self.mock_run_commands = patch(
|
||||
'ansible.modules.network.mlnxos.mlnxos_command.run_commands')
|
||||
'ansible.modules.network.onyx.onyx_command.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosCommandModule, self).tearDown()
|
||||
super(TestOnyxCommandModule, self).tearDown()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
|
@ -53,43 +53,43 @@ class TestMlnxosCommandModule(TestMlnxosModule):
|
|||
except ValueError:
|
||||
command = item['command']
|
||||
filename = str(command).replace(' ', '_')
|
||||
filename = 'mlnxos_command_%s.txt' % filename
|
||||
filename = 'onyx_command_%s.txt' % filename
|
||||
output.append(load_fixture(filename))
|
||||
return output
|
||||
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_mlnxos_command_simple(self):
|
||||
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_mlnxos_command_multiple(self):
|
||||
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_mlnxos_command_wait_for(self):
|
||||
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_mlnxos_command_wait_for_fails(self):
|
||||
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_mlnxos_command_retries(self):
|
||||
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_mlnxos_command_match_any(self):
|
||||
def test_onyx_command_match_any(self):
|
||||
wait_for = ['result[0] contains "MLNX"',
|
||||
'result[0] contains "test string"']
|
||||
set_module_args(dict(
|
||||
|
@ -98,14 +98,14 @@ class TestMlnxosCommandModule(TestMlnxosModule):
|
|||
match='any'))
|
||||
self.execute_module()
|
||||
|
||||
def test_mlnxos_command_match_all(self):
|
||||
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_mlnxos_command_match_all_failure(self):
|
||||
def test_onyx_command_match_all_failure(self):
|
||||
wait_for = ['result[0] contains "MLNX"',
|
||||
'result[0] contains "test string"']
|
||||
commands = ['show version', 'show version']
|
|
@ -21,56 +21,56 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_config
|
||||
from ansible.modules.network.onyx import onyx_config
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosConfigModule(TestMlnxosModule):
|
||||
class TestOnyxConfigModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_config
|
||||
module = onyx_config
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosConfigModule, self).setUp()
|
||||
super(TestOnyxConfigModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible.modules.network.mlnxos.mlnxos_config.get_config')
|
||||
self.mock_get_config = patch('ansible.modules.network.onyx.onyx_config.get_config')
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch('ansible.modules.network.mlnxos.mlnxos_config.load_config')
|
||||
self.mock_load_config = patch('ansible.modules.network.onyx.onyx_config.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
self.mock_run_commands = patch('ansible.modules.network.mlnxos.mlnxos_config.run_commands')
|
||||
self.mock_run_commands = patch('ansible.modules.network.onyx.onyx_config.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosConfigModule, self).tearDown()
|
||||
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 = 'mlnxos_config_config.cfg'
|
||||
config_file = 'onyx_config_config.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
||||
def test_mlnxos_config_unchanged(self):
|
||||
src = load_fixture('mlnxos_config_config.cfg')
|
||||
def test_onyx_config_unchanged(self):
|
||||
src = load_fixture('onyx_config_config.cfg')
|
||||
set_module_args(dict(src=src))
|
||||
self.execute_module()
|
||||
|
||||
def test_mlnxos_config_src(self):
|
||||
src = load_fixture('mlnxos_config_src.cfg')
|
||||
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_mlnxos_config_backup(self):
|
||||
def test_onyx_config_backup(self):
|
||||
set_module_args(dict(backup=True))
|
||||
result = self.execute_module()
|
||||
self.assertIn('__backup__', result)
|
||||
|
||||
def test_mlnxos_config_save(self):
|
||||
def test_onyx_config_save(self):
|
||||
set_module_args(dict(save='yes'))
|
||||
self.execute_module(changed=True)
|
||||
self.assertEqual(self.run_commands.call_count, 1)
|
||||
|
@ -79,35 +79,35 @@ class TestMlnxosConfigModule(TestMlnxosModule):
|
|||
args = self.run_commands.call_args[0][1]
|
||||
self.assertIn('configuration write', args)
|
||||
|
||||
def test_mlnxos_config_lines_wo_parents(self):
|
||||
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_mlnxos_config_before(self):
|
||||
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_mlnxos_config_after(self):
|
||||
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_mlnxos_config_before_after(self):
|
||||
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_mlnxos_config_config(self):
|
||||
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_mlnxos_config_match_none(self):
|
||||
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)
|
|
@ -8,23 +8,23 @@ __metaclass__ = type
|
|||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from ansible.modules.network.mlnxos import mlnxos_facts
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
from ansible.modules.network.onyx import onyx_facts
|
||||
|
||||
|
||||
class TestMlnxosFacts(TestMlnxosModule):
|
||||
class TestOnyxFacts(TestOnyxModule):
|
||||
|
||||
module = mlnxos_facts
|
||||
module = onyx_facts
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosFacts, self).setUp()
|
||||
super(TestOnyxFacts, self).setUp()
|
||||
|
||||
self.mock_run_command = patch.object(
|
||||
mlnxos_facts.FactsBase, "_show_cmd")
|
||||
onyx_facts.FactsBase, "_show_cmd")
|
||||
self.run_command = self.mock_run_command.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosFacts, self).tearDown()
|
||||
super(TestOnyxFacts, self).tearDown()
|
||||
|
||||
self.mock_run_command.stop()
|
||||
|
||||
|
@ -32,7 +32,7 @@ class TestMlnxosFacts(TestMlnxosModule):
|
|||
|
||||
def load_from_file(*args, **kwargs):
|
||||
command = args[0]
|
||||
filename = "mlnxos_facts_%s.cfg" % command
|
||||
filename = "onyx_facts_%s.cfg" % command
|
||||
filename = filename.replace(' ', '_')
|
||||
filename = filename.replace('/', '7')
|
||||
output = load_fixture(filename)
|
||||
|
@ -40,7 +40,7 @@ class TestMlnxosFacts(TestMlnxosModule):
|
|||
|
||||
self.run_command.side_effect = load_from_file
|
||||
|
||||
def test_mlnxos_facts_version(self):
|
||||
def test_onyx_facts_version(self):
|
||||
set_module_args(dict(gather_subset='version'))
|
||||
result = self.execute_module()
|
||||
facts = result.get('ansible_facts')
|
||||
|
@ -48,7 +48,7 @@ class TestMlnxosFacts(TestMlnxosModule):
|
|||
version = facts['ansible_net_version']
|
||||
self.assertEqual(version['Product name'], 'MLNX-OS')
|
||||
|
||||
def test_mlnxos_facts_modules(self):
|
||||
def test_onyx_facts_modules(self):
|
||||
set_module_args(dict(gather_subset='modules'))
|
||||
result = self.execute_module()
|
||||
facts = result.get('ansible_facts')
|
||||
|
@ -56,7 +56,7 @@ class TestMlnxosFacts(TestMlnxosModule):
|
|||
modules = facts['ansible_net_modules']
|
||||
self.assertIn("MGMT", modules)
|
||||
|
||||
def test_mlnxos_facts_interfaces(self):
|
||||
def test_onyx_facts_interfaces(self):
|
||||
set_module_args(dict(gather_subset='interfaces'))
|
||||
result = self.execute_module()
|
||||
facts = result.get('ansible_facts')
|
||||
|
@ -64,7 +64,7 @@ class TestMlnxosFacts(TestMlnxosModule):
|
|||
interfaces = facts['ansible_net_interfaces']
|
||||
self.assertEqual(len(interfaces), 2)
|
||||
|
||||
def test_mlnxos_facts_all(self):
|
||||
def test_onyx_facts_all(self):
|
||||
set_module_args(dict(gather_subset='all'))
|
||||
result = self.execute_module()
|
||||
facts = result.get('ansible_facts')
|
|
@ -7,40 +7,40 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_interface
|
||||
from ansible.modules.network.onyx import onyx_interface
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosInterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxInterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_interface
|
||||
module = onyx_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosInterfaceModule, self).setUp()
|
||||
super(TestOnyxInterfaceModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_interface.MlnxosInterfaceModule, "_get_interfaces_config")
|
||||
onyx_interface.OnyxInterfaceModule, "_get_interfaces_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_get_interfaces_status = patch.object(
|
||||
mlnxos_interface.MlnxosInterfaceModule, "_get_interfaces_status")
|
||||
onyx_interface.OnyxInterfaceModule, "_get_interfaces_status")
|
||||
self.get_interfaces_status = self.mock_get_interfaces_status.start()
|
||||
|
||||
self.mock_get_interfaces_rates = patch.object(
|
||||
mlnxos_interface.MlnxosInterfaceModule, "_get_interfaces_rates")
|
||||
onyx_interface.OnyxInterfaceModule, "_get_interfaces_rates")
|
||||
self.get_interfaces_rates = self.mock_get_interfaces_rates.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosInterfaceModule, self).tearDown()
|
||||
super(TestOnyxInterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_interfaces_show.cfg'
|
||||
config_file = 'onyx_interfaces_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
||||
|
@ -97,24 +97,24 @@ class TestMlnxosInterfaceModule(TestMlnxosModule):
|
|||
|
||||
def test_oper_state_check(self):
|
||||
set_module_args(dict(name='Eth1/1', enabled=True, state='down'))
|
||||
config_file = 'mlnxos_interfaces_status.cfg'
|
||||
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 = 'mlnxos_interfaces_status.cfg'
|
||||
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 = 'mlnxos_interfaces_rates.cfg'
|
||||
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 = 'mlnxos_interfaces_rates.cfg'
|
||||
config_file = 'onyx_interfaces_rates.cfg'
|
||||
self.get_interfaces_rates.return_value = load_fixture(config_file)
|
||||
self.execute_module(changed=False)
|
|
@ -21,32 +21,32 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_l2_interface
|
||||
from ansible.modules.network.onyx import onyx_l2_interface
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosInterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxInterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_l2_interface
|
||||
module = onyx_l2_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosInterfaceModule, self).setUp()
|
||||
super(TestOnyxInterfaceModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_l2_interface.MlnxosL2InterfaceModule, "_get_switchport_config")
|
||||
onyx_l2_interface.OnyxL2InterfaceModule, "_get_switchport_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosInterfaceModule, self).tearDown()
|
||||
super(TestOnyxInterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_l2_interface_show.cfg'
|
||||
config_file = 'onyx_l2_interface_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
|
@ -7,28 +7,28 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_l3_interface
|
||||
from ansible.modules.network.onyx import onyx_l3_interface
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosL3InterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxL3InterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_l3_interface
|
||||
module = onyx_l3_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosL3InterfaceModule, self).setUp()
|
||||
super(TestOnyxL3InterfaceModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_l3_interface.MlnxosL3InterfaceModule,
|
||||
onyx_l3_interface.OnyxL3InterfaceModule,
|
||||
"_get_interfaces_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosL3InterfaceModule, self).tearDown()
|
||||
super(TestOnyxL3InterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
|
@ -54,11 +54,11 @@ class TestMlnxosL3InterfaceModule(TestMlnxosModule):
|
|||
self.load_config.return_value = None
|
||||
|
||||
def load_eth_ifc_fixture(self):
|
||||
config_file = 'mlnxos_l3_interface_show.cfg'
|
||||
config_file = 'onyx_l3_interface_show.cfg'
|
||||
self.load_fixture(config_file)
|
||||
|
||||
def load_vlan_ifc_fixture(self):
|
||||
config_file = 'mlnxos_l3_vlan_interface_show.cfg'
|
||||
config_file = 'onyx_l3_vlan_interface_show.cfg'
|
||||
self.load_fixture(config_file)
|
||||
|
||||
def test_vlan_ifc_no_change(self):
|
|
@ -7,28 +7,28 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_linkagg
|
||||
from ansible.modules.network.onyx import onyx_linkagg
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosLinkaggModule(TestMlnxosModule):
|
||||
class TestOnyxLinkaggModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_linkagg
|
||||
module = onyx_linkagg
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosLinkaggModule, self).setUp()
|
||||
super(TestOnyxLinkaggModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_linkagg.MlnxosLinkAggModule,
|
||||
onyx_linkagg.OnyxLinkAggModule,
|
||||
"_get_port_channels")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosLinkaggModule, self).tearDown()
|
||||
super(TestOnyxLinkaggModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
|
@ -37,11 +37,11 @@ class TestMlnxosLinkaggModule(TestMlnxosModule):
|
|||
self.load_config.return_value = None
|
||||
|
||||
def load_port_channel_fixture(self):
|
||||
config_file = 'mlnxos_port_channel_show.cfg'
|
||||
config_file = 'onyx_port_channel_show.cfg'
|
||||
self.load_fixture(config_file)
|
||||
|
||||
def load_mlag_port_channel_fixture(self):
|
||||
config_file = 'mlnxos_mlag_port_channel_show.cfg'
|
||||
config_file = 'onyx_mlag_port_channel_show.cfg'
|
||||
self.load_fixture(config_file)
|
||||
|
||||
def test_port_channel_no_change(self):
|
|
@ -23,28 +23,27 @@ __metaclass__ = type
|
|||
import json
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_lldp
|
||||
from ansible.module_utils.network.mlnxos import mlnxos as mlnxos_utils
|
||||
from ansible.modules.network.onyx import onyx_lldp
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosInterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxInterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_lldp
|
||||
module = onyx_lldp
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosInterfaceModule, self).setUp()
|
||||
super(TestOnyxInterfaceModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_lldp.MlnxosLldpModule, "_get_lldp_config")
|
||||
onyx_lldp.OnyxLldpModule, "_get_lldp_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosInterfaceModule, self).tearDown()
|
||||
super(TestOnyxInterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
|
@ -52,7 +51,7 @@ class TestMlnxosInterfaceModule(TestMlnxosModule):
|
|||
if commands == ['lldp']:
|
||||
self.get_config.return_value = None
|
||||
else:
|
||||
config_file = 'mlnxos_lldp_show.cfg'
|
||||
config_file = 'onyx_lldp_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
|
@ -7,33 +7,33 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_lldp_interface
|
||||
from ansible.modules.network.onyx import onyx_lldp_interface
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosLldpInterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxLldpInterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_lldp_interface
|
||||
module = onyx_lldp_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosLldpInterfaceModule, self).setUp()
|
||||
super(TestOnyxLldpInterfaceModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_lldp_interface.MlnxosLldpInterfaceModule,
|
||||
onyx_lldp_interface.OnyxLldpInterfaceModule,
|
||||
"_get_lldp_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosLldpInterfaceModule, self).tearDown()
|
||||
super(TestOnyxLldpInterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_lldp_interface_show.cfg'
|
||||
config_file = 'onyx_lldp_interface_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
|
@ -7,33 +7,33 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_magp
|
||||
from ansible.modules.network.onyx import onyx_magp
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosMagpModule(TestMlnxosModule):
|
||||
class TestOnyxMagpModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_magp
|
||||
module = onyx_magp
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosMagpModule, self).setUp()
|
||||
super(TestOnyxMagpModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_magp.MlnxosMagpModule,
|
||||
onyx_magp.OnyxMagpModule,
|
||||
"_get_magp_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosMagpModule, self).tearDown()
|
||||
super(TestOnyxMagpModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_magp_show.cfg'
|
||||
config_file = 'onyx_magp_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
|
@ -7,35 +7,35 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_mlag_ipl
|
||||
from ansible.modules.network.onyx import onyx_mlag_ipl
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosMlagIplModule(TestMlnxosModule):
|
||||
class TestOnyxMlagIplModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_mlag_ipl
|
||||
module = onyx_mlag_ipl
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosMlagIplModule, self).setUp()
|
||||
super(TestOnyxMlagIplModule, self).setUp()
|
||||
self._mlag_enabled = True
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_mlag_ipl.MlnxosMlagIplModule,
|
||||
onyx_mlag_ipl.OnyxMlagIplModule,
|
||||
"_show_mlag_data")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosMlagIplModule, self).tearDown()
|
||||
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 = 'mlnxos_mlag_ipl_show.cfg'
|
||||
config_file = 'onyx_mlag_ipl_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
else:
|
||||
self.get_config.return_value = None
|
|
@ -7,42 +7,42 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_mlag_vip
|
||||
from ansible.modules.network.onyx import onyx_mlag_vip
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosMlagVipModule(TestMlnxosModule):
|
||||
class TestOnyxMlagVipModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_mlag_vip
|
||||
module = onyx_mlag_vip
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosMlagVipModule, self).setUp()
|
||||
super(TestOnyxMlagVipModule, self).setUp()
|
||||
self._mlag_enabled = True
|
||||
self.mock_show_mlag = patch.object(
|
||||
mlnxos_mlag_vip.MlnxosMLagVipModule,
|
||||
onyx_mlag_vip.OnyxMLagVipModule,
|
||||
"_show_mlag")
|
||||
self.show_mlag = self.mock_show_mlag.start()
|
||||
self.mock_show_mlag_vip = patch.object(
|
||||
mlnxos_mlag_vip.MlnxosMLagVipModule,
|
||||
onyx_mlag_vip.OnyxMLagVipModule,
|
||||
"_show_mlag_vip")
|
||||
self.show_mlag_vip = self.mock_show_mlag_vip.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosMlagVipModule, self).tearDown()
|
||||
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 = 'mlnxos_mlag_vip_show.cfg'
|
||||
config_file = 'onyx_mlag_vip_show.cfg'
|
||||
self.show_mlag_vip.return_value = load_fixture(config_file)
|
||||
config_file = 'mlnxos_mlag_show.cfg'
|
||||
config_file = 'onyx_mlag_show.cfg'
|
||||
self.show_mlag.return_value = load_fixture(config_file)
|
||||
else:
|
||||
self.show_mlag_vip.return_value = None
|
|
@ -7,42 +7,42 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_ospf
|
||||
from ansible.modules.network.onyx import onyx_ospf
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosOspfModule(TestMlnxosModule):
|
||||
class TestOnyxOspfModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_ospf
|
||||
module = onyx_ospf
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosOspfModule, self).setUp()
|
||||
super(TestOnyxOspfModule, self).setUp()
|
||||
self._ospf_exists = True
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_ospf.MlnxosOspfModule,
|
||||
onyx_ospf.OnyxOspfModule,
|
||||
"_get_ospf_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_get_interfaces_config = patch.object(
|
||||
mlnxos_ospf.MlnxosOspfModule,
|
||||
onyx_ospf.OnyxOspfModule,
|
||||
"_get_ospf_interfaces_config")
|
||||
self.get_interfaces_config = self.mock_get_interfaces_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosOspfModule, self).tearDown()
|
||||
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 = 'mlnxos_ospf_show.cfg'
|
||||
config_file = 'onyx_ospf_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
config_file = 'mlnxos_ospf_interfaces_show.cfg'
|
||||
config_file = 'onyx_ospf_interfaces_show.cfg'
|
||||
self.get_interfaces_config.return_value = load_fixture(config_file)
|
||||
else:
|
||||
self.get_config.return_value = None
|
|
@ -7,29 +7,29 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_pfc_interface
|
||||
from ansible.modules.network.onyx import onyx_pfc_interface
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosPfcInterfaceModule(TestMlnxosModule):
|
||||
class TestOnyxPfcInterfaceModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_pfc_interface
|
||||
module = onyx_pfc_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosPfcInterfaceModule, self).setUp()
|
||||
super(TestOnyxPfcInterfaceModule, self).setUp()
|
||||
self._pfc_enabled = True
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_pfc_interface.MlnxosPfcInterfaceModule,
|
||||
onyx_pfc_interface.OnyxPfcInterfaceModule,
|
||||
"_get_pfc_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosPfcInterfaceModule, self).tearDown()
|
||||
super(TestOnyxPfcInterfaceModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
|
@ -38,7 +38,7 @@ class TestMlnxosPfcInterfaceModule(TestMlnxosModule):
|
|||
suffix = 'enabled'
|
||||
else:
|
||||
suffix = 'disabled'
|
||||
config_file = 'mlnxos_pfc_interface_%s.cfg' % suffix
|
||||
config_file = 'onyx_pfc_interface_%s.cfg' % suffix
|
||||
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
|
@ -7,38 +7,38 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_protocol
|
||||
from ansible.modules.network.onyx import onyx_protocol
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosProtocolModule(TestMlnxosModule):
|
||||
class TestOnyxProtocolModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_protocol
|
||||
module = onyx_protocol
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosProtocolModule, self).setUp()
|
||||
super(TestOnyxProtocolModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_protocol.MlnxosProtocolModule,
|
||||
onyx_protocol.OnyxProtocolModule,
|
||||
"_get_protocols")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_get_ip_config = patch.object(
|
||||
mlnxos_protocol.MlnxosProtocolModule,
|
||||
onyx_protocol.OnyxProtocolModule,
|
||||
"_get_ip_routing")
|
||||
self.get_ip_config = self.mock_get_ip_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosProtocolModule, self).tearDown()
|
||||
super(TestOnyxProtocolModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_protocols_show.cfg'
|
||||
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"
|
|
@ -23,33 +23,32 @@ __metaclass__ = type
|
|||
import json
|
||||
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.mlnxos import mlnxos_vlan
|
||||
from ansible.module_utils.network.mlnxos import mlnxos as mlnxos_utils
|
||||
from ansible.modules.network.onyx import onyx_vlan
|
||||
from units.modules.utils import set_module_args
|
||||
from .mlnxos_module import TestMlnxosModule, load_fixture
|
||||
from .onyx_module import TestOnyxModule, load_fixture
|
||||
|
||||
|
||||
class TestMlnxosVlanModule(TestMlnxosModule):
|
||||
class TestOnyxVlanModule(TestOnyxModule):
|
||||
|
||||
module = mlnxos_vlan
|
||||
module = onyx_vlan
|
||||
|
||||
def setUp(self):
|
||||
super(TestMlnxosVlanModule, self).setUp()
|
||||
super(TestOnyxVlanModule, self).setUp()
|
||||
self.mock_get_config = patch.object(
|
||||
mlnxos_vlan.MlnxosVlanModule, "_get_vlan_config")
|
||||
onyx_vlan.OnyxVlanModule, "_get_vlan_config")
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch(
|
||||
'ansible.module_utils.network.mlnxos.mlnxos.load_config')
|
||||
'ansible.module_utils.network.onyx.onyx.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestMlnxosVlanModule, self).tearDown()
|
||||
super(TestOnyxVlanModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
config_file = 'mlnxos_vlan_show.cfg'
|
||||
config_file = 'onyx_vlan_show.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
Loading…
Reference in a new issue