summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGomathiselviS <gomathiselvi@gmail.com>2020-07-24 16:16:03 -0400
committerGitHub <noreply@github.com>2020-07-24 20:16:03 +0000
commitfbb82a0875dacc8200d3f663c3286104d0a1afbf (patch)
treeae507874333cff6aea4e71e4032959e1168eb036
parenta387c0878535f6af1d19800ff5bb2d60fa2f4e8a (diff)
downloadvyos.vyos-fbb82a0875dacc8200d3f663c3286104d0a1afbf.tar.gz
vyos.vyos-fbb82a0875dacc8200d3f663c3286104d0a1afbf.zip
[vyos] Fix sanity issues (#58)
[vyos] Fix sanity issues Reviewed-by: https://github.com/apps/ansible-zuul
-rw-r--r--plugins/doc_fragments/vyos.py3
-rw-r--r--plugins/module_utils/network/vyos/argspec/facts/facts.py6
-rw-r--r--plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py2
-rw-r--r--plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py1
-rw-r--r--plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py9
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py14
-rw-r--r--plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py2
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py2
-rw-r--r--plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py2
-rw-r--r--plugins/module_utils/network/vyos/facts/legacy/base.py2
-rw-r--r--plugins/module_utils/network/vyos/vyos.py7
-rw-r--r--plugins/modules/vyos_banner.py3
-rw-r--r--plugins/modules/vyos_command.py14
-rw-r--r--plugins/modules/vyos_config.py9
-rw-r--r--plugins/modules/vyos_facts.py4
-rw-r--r--plugins/modules/vyos_firewall_global.py2
-rw-r--r--plugins/modules/vyos_interface.py77
-rw-r--r--plugins/modules/vyos_interfaces.py2
-rw-r--r--plugins/modules/vyos_l3_interface.py27
-rw-r--r--plugins/modules/vyos_lag_interfaces.py3
-rw-r--r--plugins/modules/vyos_linkagg.py41
-rw-r--r--plugins/modules/vyos_lldp.py3
-rw-r--r--plugins/modules/vyos_lldp_global.py1
-rw-r--r--plugins/modules/vyos_lldp_interface.py16
-rw-r--r--plugins/modules/vyos_lldp_interfaces.py4
-rw-r--r--plugins/modules/vyos_logging.py38
-rw-r--r--plugins/modules/vyos_ospfv2.py3
-rw-r--r--plugins/modules/vyos_ping.py3
-rw-r--r--plugins/modules/vyos_static_route.py27
-rw-r--r--plugins/modules/vyos_system.py17
-rw-r--r--plugins/modules/vyos_user.py54
-rw-r--r--plugins/modules/vyos_vlan.py59
-rw-r--r--tests/sanity/ignore-2.10.txt1
-rw-r--r--tests/sanity/ignore-2.9.txt87
-rw-r--r--tests/unit/compat/mock.py2
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_static_route.py8
36 files changed, 433 insertions, 122 deletions
diff --git a/plugins/doc_fragments/vyos.py b/plugins/doc_fragments/vyos.py
index 952c81d..ca40673 100644
--- a/plugins/doc_fragments/vyos.py
+++ b/plugins/doc_fragments/vyos.py
@@ -26,12 +26,10 @@ class ModuleDocFragment(object):
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
@@ -52,7 +50,6 @@ class ModuleDocFragment(object):
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
diff --git a/plugins/module_utils/network/vyos/argspec/facts/facts.py b/plugins/module_utils/network/vyos/argspec/facts/facts.py
index 46fabaa..e52b6eb 100644
--- a/plugins/module_utils/network/vyos/argspec/facts/facts.py
+++ b/plugins/module_utils/network/vyos/argspec/facts/facts.py
@@ -17,6 +17,8 @@ class FactsArgs(object): # pylint: disable=R0903
pass
argument_spec = {
- "gather_subset": dict(default=["!config"], type="list"),
- "gather_network_resources": dict(type="list"),
+ "gather_subset": dict(
+ default=["!config"], type="list", elements="str"
+ ),
+ "gather_network_resources": dict(type="list", elements="str"),
}
diff --git a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
index 6cfdabf..cc124a9 100644
--- a/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
+++ b/plugins/module_utils/network/vyos/argspec/lag_interfaces/lag_interfaces.py
@@ -41,7 +41,7 @@ class Lag_interfacesArgs(object): # pylint: disable=R0903
"arp_monitor": {
"options": {
"interval": {"type": "int"},
- "target": {"type": "list"},
+ "target": {"type": "list", "elements": "str"},
},
"type": "dict",
},
diff --git a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
index 6205fd7..fa41127 100644
--- a/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
+++ b/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py
@@ -42,6 +42,7 @@ class Lldp_globalArgs(object): # pylint: disable=R0903
"legacy_protocols": {
"choices": ["cdp", "edp", "fdp", "sonmp"],
"type": "list",
+ "elements": "str",
},
"snmp": {"type": "str"},
},
diff --git a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
index b4cdadf..b113035 100644
--- a/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/argspec/ospfv2/ospfv2.py
@@ -210,8 +210,11 @@ class Ospfv2Args(object): # pylint: disable=R0903
},
"type": "dict",
},
- "passive_interface": {"type": "list"},
- "passive_interface_exclude": {"type": "list"},
+ "passive_interface": {"type": "list", "elements": "str"},
+ "passive_interface_exclude": {
+ "type": "list",
+ "elements": "str",
+ },
"redistribute": {
"elements": "dict",
"options": {
@@ -231,7 +234,7 @@ class Ospfv2Args(object): # pylint: disable=R0903
},
"type": "list",
},
- "route_map": {"type": "list"},
+ "route_map": {"type": "list", "elements": "str"},
"timers": {
"options": {
"refresh": {
diff --git a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
index afc9853..f035641 100644
--- a/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
+++ b/plugins/module_utils/network/vyos/config/firewall_global/firewall_global.py
@@ -154,16 +154,16 @@ class Firewall_global(ConfigBase):
commands.extend(self._state_replaced(w, h))
return commands
- def _state_replaced(self, want, have):
+ def _state_replaced(self, w, h):
""" The command generator when state is replaced
:rtype: A list
:returns: the commands necessary to migrate the current configuration
to the desired configuration
"""
commands = []
- if have:
- commands.extend(self._state_deleted(have, want))
- commands.extend(self._state_merged(want, have))
+ if h:
+ commands.extend(self._state_deleted(h, w))
+ commands.extend(self._state_merged(w, h))
return commands
def _state_merged(self, want, have):
@@ -275,7 +275,7 @@ class Firewall_global(ConfigBase):
)
)
continue
- elif (
+ if (
key in l_set
and not (h and self._in_target(h, key))
and not self._is_del(l_set, h)
@@ -411,7 +411,7 @@ class Firewall_global(ConfigBase):
):
commands.append(cmd + " " + want["name"])
continue
- elif not (
+ if not (
h and self._in_target(h, key)
) and not self._is_grp_del(h, want, key):
commands.append(
@@ -586,7 +586,7 @@ class Firewall_global(ConfigBase):
)
)
continue
- elif not (
+ if not (
h and self._in_target(h, key)
) and not self._is_del(l_set, h):
commands.append(
diff --git a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
index 5c37741..5e38cee 100644
--- a/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
+++ b/plugins/module_utils/network/vyos/config/firewall_rules/firewall_rules.py
@@ -376,7 +376,7 @@ class Firewall_rules(ConfigBase):
)
)
continue
- elif (
+ if (
key == "disabled"
and val
and h
diff --git a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
index fd25c17..c0a4c78 100644
--- a/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
+++ b/plugins/module_utils/network/vyos/config/ospfv2/ospfv2.py
@@ -766,7 +766,7 @@ class Ospfv2(ConfigBase):
):
commands.append(cmd)
continue
- elif key != "area_id" and not _in_target(
+ if key != "area_id" and not _in_target(
h_area, key
):
commands.append(cmd + val + " " + key)
diff --git a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
index acda380..09b9200 100644
--- a/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
+++ b/plugins/module_utils/network/vyos/config/ospfv3/ospfv3.py
@@ -406,7 +406,7 @@ class Ospfv3(ConfigBase):
):
commands.append(cmd)
continue
- elif key != "area_id" and not _in_target(
+ if key != "area_id" and not _in_target(
h_area, key
):
commands.append(cmd + val + " " + key)
diff --git a/plugins/module_utils/network/vyos/facts/legacy/base.py b/plugins/module_utils/network/vyos/facts/legacy/base.py
index f6b343e..a493421 100644
--- a/plugins/module_utils/network/vyos/facts/legacy/base.py
+++ b/plugins/module_utils/network/vyos/facts/legacy/base.py
@@ -126,7 +126,7 @@ class Neighbors(LegacyFactsBase):
for line in data.split("\n"):
if not line:
continue
- elif line[0] == " ":
+ if line[0] == " ":
values += "\n%s" % line
elif line.startswith("Interface"):
if values:
diff --git a/plugins/module_utils/network/vyos/vyos.py b/plugins/module_utils/network/vyos/vyos.py
index 7257b85..4ab36b9 100644
--- a/plugins/module_utils/network/vyos/vyos.py
+++ b/plugins/module_utils/network/vyos/vyos.py
@@ -50,8 +50,11 @@ vyos_provider_spec = {
}
vyos_argument_spec = {
"provider": dict(
- type="dict", options=vyos_provider_spec, removed_in_version=2.14
- ),
+ type="dict",
+ options=vyos_provider_spec,
+ removed_at_date="2022-06-01",
+ removed_from_collection="vyos.vyos",
+ )
}
diff --git a/plugins/modules/vyos_banner.py b/plugins/modules/vyos_banner.py
index 50cc6ee..8d1e5ff 100644
--- a/plugins/modules/vyos_banner.py
+++ b/plugins/modules/vyos_banner.py
@@ -42,15 +42,18 @@ options:
choices:
- pre-login
- post-login
+ type: str
text:
description:
- The banner text that should be present in the remote device running configuration.
This argument accepts a multiline string, with no empty lines. Requires I(state=present).
+ type: str
state:
description:
- Specifies whether or not the configuration is present in the current devices
active running configuration.
default: present
+ type: str
choices:
- present
- absent
diff --git a/plugins/modules/vyos_command.py b/plugins/modules/vyos_command.py
index 03f476c..cb1fd47 100644
--- a/plugins/modules/vyos_command.py
+++ b/plugins/modules/vyos_command.py
@@ -42,13 +42,20 @@ options:
output from the command execution is returned to the playbook. If the I(wait_for)
argument is provided, the module is not returned until the condition is satisfied
or the number of retries has been exceeded.
+ - If a command sent to the device requires answering a prompt, it is possible to pass
+ a dict containing command, answer and prompt. Common answers are 'y' or "\\r"
+ (carriage return, must be double quotes). Refer below examples.
required: true
+ type: list
+ elements: raw
wait_for:
description:
- Specifies what to evaluate from the output of the command and what conditionals
to apply. This argument will cause the task to wait for a particular conditional
to be true before moving forward. If the conditional is not true by the configured
I(retries), the task fails. See examples.
+ type: list
+ elements: str
aliases:
- waitfor
match:
@@ -58,6 +65,7 @@ options:
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
+ type: str
choices:
- any
- all
@@ -67,12 +75,14 @@ options:
failed. The command is run on the target device every retry and evaluated against
the I(wait_for) conditionals.
default: 10
+ type: int
interval:
description:
- Configures the interval in seconds to wait between I(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
+ type: int
notes:
- Tested against VyOS 1.1.8 (helium).
- Running C(show system boot-messages all) will cause the module to hang since VyOS
@@ -166,8 +176,8 @@ def parse_commands(module, warnings):
def main():
spec = dict(
- commands=dict(type="list", required=True),
- wait_for=dict(type="list", aliases=["waitfor"]),
+ commands=dict(type="list", required=True, elements="raw"),
+ wait_for=dict(type="list", aliases=["waitfor"], elements="str"),
match=dict(default="all", choices=["all", "any"]),
retries=dict(default=10, type="int"),
interval=dict(default=1, type="int"),
diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py
index a945d6a..893cd64 100644
--- a/plugins/modules/vyos_config.py
+++ b/plugins/modules/vyos_config.py
@@ -40,11 +40,14 @@ options:
description:
- The ordered set of configuration lines to be managed and compared with the existing
configuration on the remote device.
+ type: list
+ elements: str
src:
description:
- The C(src) argument specifies the path to the source config file to load. The
source config file can either be in bracket format or set format. The source
file can include Jinja2 template variables.
+ type: path
match:
description:
- The C(match) argument controls the method used to match against the current
@@ -52,6 +55,7 @@ options:
active config and the deltas are loaded. If the C(match) argument is set to
C(none) the active configuration is ignored and the configuration is always
loaded.
+ type: str
default: line
choices:
- line
@@ -71,11 +75,13 @@ options:
is committed. If the configuration is not changed or committed, this argument
is ignored.
default: configured by vyos_config
+ type: str
config:
description:
- The C(config) argument specifies the base configuration to use to compare against
the desired configuration. If this value is not specified, the module will
automatically retrieve the current active configuration from the remote device.
+ type: str
save:
description:
- The C(save) argument controls whether or not changes made to the active configuration
@@ -94,6 +100,7 @@ options:
- 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 <hostname>_config.<current-date>@<current-time>
+ type: str
dir_path:
description:
- This option provides the path ending with directory name in which the backup
@@ -310,7 +317,7 @@ def main():
backup_spec = dict(filename=dict(), dir_path=dict(type="path"))
argument_spec = dict(
src=dict(type="path"),
- lines=dict(type="list"),
+ lines=dict(type="list", elements="str"),
match=dict(default="line", choices=["line", "none"]),
comment=dict(default=DEFAULT_COMMENT),
config=dict(),
diff --git a/plugins/modules/vyos_facts.py b/plugins/modules/vyos_facts.py
index b878c23..01c43c2 100644
--- a/plugins/modules/vyos_facts.py
+++ b/plugins/modules/vyos_facts.py
@@ -38,6 +38,8 @@ options:
initial C(M(!)) to specify that a specific subset should not be collected.
required: false
default: '!config'
+ type: list
+ elements: str
gather_network_resources:
description:
- When supplied, this argument will restrict the facts collected to a given subset.
@@ -48,6 +50,8 @@ options:
'lldp_global', 'lldp_interfaces', 'static_routes', 'firewall_rules', 'firewall_global',
'firewall_interfaces', 'ospfv3', 'ospfv2'.
required: false
+ type: list
+ elements: str
"""
EXAMPLES = """
diff --git a/plugins/modules/vyos_firewall_global.py b/plugins/modules/vyos_firewall_global.py
index 0574aa8..6ff3071 100644
--- a/plugins/modules/vyos_firewall_global.py
+++ b/plugins/modules/vyos_firewall_global.py
@@ -109,7 +109,7 @@ options:
- (strict) Enable Strict Reverse Path Forwarding as defined in RFC3704.
type: str
choices:
- - stricu
+ - strict
- loose
- disable
group:
diff --git a/plugins/modules/vyos_interface.py b/plugins/modules/vyos_interface.py
index be844c5..839e559 100644
--- a/plugins/modules/vyos_interface.py
+++ b/plugins/modules/vyos_interface.py
@@ -41,24 +41,28 @@ options:
name:
description:
- Name of the Interface.
- required: true
+ type: str
description:
description:
- Description of Interface.
+ type: str
enabled:
description:
- Interface link status.
type: bool
+ default: True
speed:
description:
- Interface link speed.
+ type: str
mtu:
description:
- Maximum size of transmit packet.
+ type: int
duplex:
description:
- Interface link status.
- default: auto
+ type: str
choices:
- full
- half
@@ -69,24 +73,93 @@ options:
device. This wait is applicable for operational state argument which are I(state)
with values C(up)/C(down) and I(neighbors).
default: 10
+ type: int
neighbors:
description:
- Check the operational state of given interface C(name) for LLDP neighbor.
- The following suboptions are available.
+ type: list
+ elements: dict
suboptions:
host:
description:
- LLDP neighbor host for given interface C(name).
+ type: str
port:
description:
- LLDP neighbor port to which given interface C(name) is connected.
+ type: str
aggregate:
description: List of Interfaces definitions.
+ type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of the Interface.
+ required: true
+ type: str
+ description:
+ description:
+ - Description of Interface.
+ type: str
+ enabled:
+ description:
+ - Interface link status.
+ type: bool
+ speed:
+ description:
+ - Interface link speed.
+ type: str
+ mtu:
+ description:
+ - Maximum size of transmit packet.
+ type: int
+ duplex:
+ description:
+ - Interface link status.
+ type: str
+ choices:
+ - full
+ - half
+ - auto
+ 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) and I(neighbors).
+ type: int
+ neighbors:
+ description:
+ - Check the operational state of given interface C(name) for LLDP neighbor.
+ - The following suboptions are available.
+ type: list
+ elements: dict
+ suboptions:
+ host:
+ description:
+ - LLDP neighbor host for given interface C(name).
+ type: str
+ port:
+ description:
+ - LLDP neighbor port to which given interface C(name) is connected.
+ type: str
+ state:
+ description:
+ - State of the Interface configuration, C(up) means present and operationally
+ up and C(down) means present and operationally C(down)
+ type: str
+ choices:
+ - present
+ - absent
+ - up
+ - down
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
+ type: str
choices:
- present
- absent
diff --git a/plugins/modules/vyos_interfaces.py b/plugins/modules/vyos_interfaces.py
index 47f9777..87738c6 100644
--- a/plugins/modules/vyos_interfaces.py
+++ b/plugins/modules/vyos_interfaces.py
@@ -49,6 +49,7 @@ options:
config:
description: The provided interfaces configuration.
type: list
+ elements: dict
suboptions:
name:
description:
@@ -97,6 +98,7 @@ options:
- Virtual sub-interfaces related configuration.
- 802.1Q VLAN interfaces are represented as virtual sub-interfaces in VyOS.
type: list
+ elements: dict
suboptions:
vlan_id:
description:
diff --git a/plugins/modules/vyos_l3_interface.py b/plugins/modules/vyos_l3_interface.py
index 676d6ec..25f24a6 100644
--- a/plugins/modules/vyos_l3_interface.py
+++ b/plugins/modules/vyos_l3_interface.py
@@ -41,18 +41,45 @@ options:
name:
description:
- Name of the L3 interface.
+ type: str
ipv4:
description:
- IPv4 of the L3 interface.
+ type: str
ipv6:
description:
- IPv6 of the L3 interface.
+ type: str
aggregate:
description: List of L3 interfaces definitions
+ type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of the L3 interface.
+ type: str
+ required: True
+ ipv4:
+ description:
+ - IPv4 of the L3 interface.
+ type: str
+ ipv6:
+ description:
+ - IPv6 of the L3 interface.
+ type: str
+ state:
+ description:
+ - State of the L3 interface configuration.
+ type: str
+ choices:
+ - present
+ - absent
state:
description:
- State of the L3 interface configuration.
default: present
+ type: str
choices:
- present
- absent
diff --git a/plugins/modules/vyos_lag_interfaces.py b/plugins/modules/vyos_lag_interfaces.py
index c2868a8..0848085 100644
--- a/plugins/modules/vyos_lag_interfaces.py
+++ b/plugins/modules/vyos_lag_interfaces.py
@@ -45,6 +45,7 @@ options:
config:
description: A list of link aggregation group configurations.
type: list
+ elements: dict
suboptions:
name:
description:
@@ -67,6 +68,7 @@ options:
description:
- List of member interfaces for the LAG (bond).
type: list
+ elements: dict
suboptions:
member:
description:
@@ -97,6 +99,7 @@ options:
description:
- IP address to use for ARP monitoring.
type: list
+ elements: str
running_config:
description:
- This option is used only with state I(parsed).
diff --git a/plugins/modules/vyos_linkagg.py b/plugins/modules/vyos_linkagg.py
index 4e63e2f..766a584 100644
--- a/plugins/modules/vyos_linkagg.py
+++ b/plugins/modules/vyos_linkagg.py
@@ -42,11 +42,11 @@ options:
name:
description:
- Name of the link aggregation group.
- required: true
type: str
mode:
description:
- Mode of the link aggregation group.
+ default: "802.3ad"
choices:
- 802.3ad
- active-backup
@@ -55,15 +55,50 @@ options:
- transmit-load-balance
- adaptive-load-balance
- xor-hash
- - on
+ - "on"
type: str
members:
description:
- List of members of the link aggregation group.
type: list
+ elements: str
aggregate:
description: List of link aggregation definitions.
type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of the link aggregation group.
+ required: true
+ type: str
+ mode:
+ description:
+ - Mode of the link aggregation group.
+ choices:
+ - 802.3ad
+ - active-backup
+ - broadcast
+ - round-robin
+ - transmit-load-balance
+ - adaptive-load-balance
+ - xor-hash
+ - "on"
+ type: str
+ members:
+ description:
+ - List of members of the link aggregation group.
+ type: list
+ elements: str
+ state:
+ description:
+ - State of the link aggregation group.
+ choices:
+ - present
+ - absent
+ - up
+ - down
+ type: str
state:
description:
- State of the link aggregation group.
@@ -276,7 +311,7 @@ def main():
],
default="802.3ad",
),
- members=dict(type="list"),
+ members=dict(type="list", elements="str"),
state=dict(
default="present", choices=["present", "absent", "up", "down"]
),
diff --git a/plugins/modules/vyos_lldp.py b/plugins/modules/vyos_lldp.py
index 9b138c1..feaf841 100644
--- a/plugins/modules/vyos_lldp.py
+++ b/plugins/modules/vyos_lldp.py
@@ -43,6 +43,7 @@ options:
description:
- Name of the interfaces.
type: list
+ elements: str
state:
description:
- State of the link aggregation group.
@@ -100,7 +101,7 @@ def main():
""" main entry point for module execution
"""
argument_spec = dict(
- interfaces=dict(type="list"),
+ interfaces=dict(type="list", elements="str"),
state=dict(
default="present",
choices=["present", "absent", "enabled", "disabled"],
diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py
index 017133e..e3adfcf 100644
--- a/plugins/modules/vyos_lldp_global.py
+++ b/plugins/modules/vyos_lldp_global.py
@@ -63,6 +63,7 @@ options:
description:
- List of the supported legacy protocols.
type: list
+ elements: str
choices:
- cdp
- edp
diff --git a/plugins/modules/vyos_lldp_interface.py b/plugins/modules/vyos_lldp_interface.py
index 2fd1bc5..911add0 100644
--- a/plugins/modules/vyos_lldp_interface.py
+++ b/plugins/modules/vyos_lldp_interface.py
@@ -46,6 +46,22 @@ options:
aggregate:
description: List of interfaces LLDP should be configured on.
type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of the interface LLDP should be configured on.
+ required: True
+ type: str
+ state:
+ description:
+ - State of the LLDP configuration.
+ choices:
+ - present
+ - absent
+ - enabled
+ - disabled
+ type: str
state:
description:
- State of the LLDP configuration.
diff --git a/plugins/modules/vyos_lldp_interfaces.py b/plugins/modules/vyos_lldp_interfaces.py
index 4db7cb0..99ca61c 100644
--- a/plugins/modules/vyos_lldp_interfaces.py
+++ b/plugins/modules/vyos_lldp_interfaces.py
@@ -45,6 +45,7 @@ options:
config:
description: A list of lldp interfaces configurations.
type: list
+ elements: dict
suboptions:
name:
description:
@@ -69,15 +70,14 @@ options:
ca_info:
description: LLDP-MED address info
type: list
+ elements: dict
suboptions:
ca_type:
description: LLDP-MED Civic Address type.
type: int
- required: true
ca_value:
description: LLDP-MED Civic Address value.
type: str
- required: true
country_code:
description: Country Code
type: str
diff --git a/plugins/modules/vyos_logging.py b/plugins/modules/vyos_logging.py
index 7b5d214..fa2f4c1 100644
--- a/plugins/modules/vyos_logging.py
+++ b/plugins/modules/vyos_logging.py
@@ -37,6 +37,7 @@ options:
dest:
description:
- Destination of the logs.
+ type: str
choices:
- console
- file
@@ -47,17 +48,54 @@ options:
description:
- If value of C(dest) is I(file) it indicates file-name, for I(user) it indicates
username and for I(host) indicates the host name to be notified.
+ type: str
facility:
description:
- Set logging facility.
+ type: str
level:
description:
- Set logging severity levels.
+ type: str
aggregate:
description: List of logging definitions.
+ type: list
+ elements: dict
+ suboptions:
+ dest:
+ description:
+ - Destination of the logs.
+ type: str
+ choices:
+ - console
+ - file
+ - global
+ - host
+ - user
+ name:
+ description:
+ - If value of C(dest) is I(file) it indicates file-name, for I(user) it indicates
+ username and for I(host) indicates the host name to be notified.
+ type: str
+ facility:
+ description:
+ - Set logging facility.
+ type: str
+ level:
+ description:
+ - Set logging severity levels.
+ type: str
+ state:
+ description:
+ - State of the logging configuration.
+ type: str
+ choices:
+ - present
+ - absent
state:
description:
- State of the logging configuration.
+ type: str
default: present
choices:
- present
diff --git a/plugins/modules/vyos_ospfv2.py b/plugins/modules/vyos_ospfv2.py
index d6ef36d..280630f 100644
--- a/plugins/modules/vyos_ospfv2.py
+++ b/plugins/modules/vyos_ospfv2.py
@@ -280,9 +280,11 @@ options:
passive_interface:
description: Suppress routing updates on an interface.
type: list
+ elements: str
passive_interface_exclude:
description: Interface to exclude when using passive-interface default.
type: list
+ elements: str
redistribute:
description: Redistribute information from another routing protocol.
type: list
@@ -304,6 +306,7 @@ options:
route_map:
description: Filter routes installed in local route map.
type: list
+ elements: str
timers:
description: Adjust routing timers.
type: dict
diff --git a/plugins/modules/vyos_ping.py b/plugins/modules/vyos_ping.py
index 9131917..0582c1f 100644
--- a/plugins/modules/vyos_ping.py
+++ b/plugins/modules/vyos_ping.py
@@ -41,6 +41,7 @@ options:
description:
- The IP Address or hostname (resolvable by the device) of the remote node.
required: true
+ type: str
count:
description:
- Number of packets to send to check reachability.
@@ -49,6 +50,7 @@ options:
source:
description:
- The source interface or IP Address to use while sending the ping packet(s).
+ type: str
ttl:
description:
- The time-to-live value for the ICMP packet(s).
@@ -64,6 +66,7 @@ options:
state:
description:
- Determines if the expected result is success or fail.
+ type: str
choices:
- absent
- present
diff --git a/plugins/modules/vyos_static_route.py b/plugins/modules/vyos_static_route.py
index 67f9954..44d8f6b 100644
--- a/plugins/modules/vyos_static_route.py
+++ b/plugins/modules/vyos_static_route.py
@@ -60,6 +60,33 @@ options:
aggregate:
description: List of static route definitions
type: list
+ elements: dict
+ suboptions:
+ prefix:
+ description:
+ - Network prefix of the static route. C(mask) param should be ignored if C(prefix)
+ is provided with C(mask) value C(prefix/mask).
+ required: True
+ type: str
+ mask:
+ description:
+ - Network prefix mask of the static route.
+ type: str
+ next_hop:
+ description:
+ - Next hop IP of the static route.
+ type: str
+ admin_distance:
+ description:
+ - Admin distance of the static route.
+ type: int
+ state:
+ description:
+ - State of the static route configuration.
+ choices:
+ - present
+ - absent
+ type: str
state:
description:
- State of the static route configuration.
diff --git a/plugins/modules/vyos_system.py b/plugins/modules/vyos_system.py
index 220d1ff..93c0909 100644
--- a/plugins/modules/vyos_system.py
+++ b/plugins/modules/vyos_system.py
@@ -38,21 +38,28 @@ options:
host_name:
description:
- Configure the device hostname parameter. This option takes an ASCII string value.
+ type: str
domain_name:
description:
- The new domain name to apply to the device.
- name_servers:
+ type: str
+ name_server:
description:
- A list of name servers to use with the device. Mutually exclusive with I(domain_search)
+ type: list
+ elements: str
aliases:
- - name_server
+ - name_servers
domain_search:
description:
- A list of domain names to search. Mutually exclusive with I(name_server)
+ type: list
+ elements: str
state:
description:
- Whether to apply (C(present)) or remove (C(absent)) the settings.
default: present
+ type: str
choices:
- present
- absent
@@ -181,8 +188,10 @@ def main():
argument_spec = dict(
host_name=dict(type="str"),
domain_name=dict(type="str"),
- domain_search=dict(type="list"),
- name_server=dict(type="list", aliases=["name_servers"]),
+ domain_search=dict(type="list", elements="str"),
+ name_server=dict(
+ type="list", aliases=["name_servers"], elements="str"
+ ),
state=dict(
type="str", default="present", choices=["present", "absent"]
),
diff --git a/plugins/modules/vyos_user.py b/plugins/modules/vyos_user.py
index 58532eb..e20f146 100644
--- a/plugins/modules/vyos_user.py
+++ b/plugins/modules/vyos_user.py
@@ -45,20 +45,71 @@ options:
aliases:
- users
- collection
+ type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - The username to be configured on the VyOS device. This argument accepts a string
+ value and is mutually exclusive with the C(aggregate) argument. Please note
+ that this option is not same as C(provider username).
+ required: True
+ type: str
+ full_name:
+ description:
+ - The C(full_name) argument provides the full name of the user account to be created
+ on the remote device. This argument accepts any text string value.
+ type: str
+ configured_password:
+ description:
+ - The password to be configured on the VyOS device. The password needs to be provided
+ in clear and it will be encrypted on the device. Please note that this option
+ is not same as C(provider password).
+ type: str
+ update_password:
+ description:
+ - Since passwords are encrypted in the device running config, this argument will
+ instruct the module when to change the password. When set to C(always), the
+ password will always be updated in the device and when set to C(on_create) the
+ password will be updated only if the username is created.
+ type: str
+ choices:
+ - on_create
+ - always
+ level:
+ description:
+ - The C(level) argument configures the level of the user when logged into the
+ system. This argument accepts string values admin or operator.
+ type: str
+ aliases:
+ - role
+ state:
+ description:
+ - Configures the state of the username definition as it relates to the device
+ operational configuration. When set to I(present), the username(s) should be
+ configured in the device active configuration and when set to I(absent) the
+ username(s) should not be in the device active configuration
+ type: str
+ choices:
+ - present
+ - absent
name:
description:
- The username to be configured on the VyOS device. This argument accepts a string
value and is mutually exclusive with the C(aggregate) argument. Please note
that this option is not same as C(provider username).
+ type: str
full_name:
description:
- The C(full_name) argument provides the full name of the user account to be created
on the remote device. This argument accepts any text string value.
+ type: str
configured_password:
description:
- The password to be configured on the VyOS device. The password needs to be provided
in clear and it will be encrypted on the device. Please note that this option
is not same as C(provider password).
+ type: str
update_password:
description:
- Since passwords are encrypted in the device running config, this argument will
@@ -66,6 +117,7 @@ options:
password will always be updated in the device and when set to C(on_create) the
password will be updated only if the username is created.
default: always
+ type: str
choices:
- on_create
- always
@@ -73,6 +125,7 @@ options:
description:
- The C(level) argument configures the level of the user when logged into the
system. This argument accepts string values admin or operator.
+ type: str
aliases:
- role
purge:
@@ -88,6 +141,7 @@ options:
operational configuration. When set to I(present), the username(s) should be
configured in the device active configuration and when set to I(absent) the
username(s) should not be in the device active configuration
+ type: str
default: present
choices:
- present
diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py
index a271dd4..81f4de1 100644
--- a/plugins/modules/vyos_vlan.py
+++ b/plugins/modules/vyos_vlan.py
@@ -23,29 +23,76 @@ options:
name:
description:
- Name of the VLAN.
+ type: str
address:
description:
- Configure Virtual interface address.
+ type: str
vlan_id:
description:
- ID of the VLAN. Range 0-4094.
- required: true
+ type: int
interfaces:
description:
- List of interfaces that should be associated to the VLAN.
- required: true
+ type: list
+ elements: str
associated_interfaces:
description:
- This is a intent option and checks the operational state of the for given vlan
C(name) for associated interfaces. If the value in the C(associated_interfaces)
does not match with the operational state of vlan on device it will result in
failure.
+ type: list
+ elements: str
delay:
description:
- Delay the play should wait to check for declarative intent params values.
default: 10
+ type: int
aggregate:
description: List of VLANs definitions.
+ type: list
+ elements: dict
+ suboptions:
+ name:
+ description:
+ - Name of the VLAN.
+ type: str
+ address:
+ description:
+ - Configure Virtual interface address.
+ type: str
+ vlan_id:
+ description:
+ - ID of the VLAN. Range 0-4094.
+ type: int
+ required: true
+ interfaces:
+ description:
+ - List of interfaces that should be associated to the VLAN.
+ type: list
+ elements: str
+ required: true
+ associated_interfaces:
+ description:
+ - This is a intent option and checks the operational state of the for given vlan
+ C(name) for associated interfaces. If the value in the C(associated_interfaces)
+ does not match with the operational state of vlan on device it will result in
+ failure.
+ type: list
+ elements: str
+ delay:
+ description:
+ - Delay the play should wait to check for declarative intent params values.
+ type: int
+ state:
+ description:
+ - State of the VLAN configuration.
+ type: str
+ choices:
+ - present
+ - absent
purge:
description:
- Purge VLANs not defined in the I(aggregate) parameter.
@@ -55,6 +102,7 @@ options:
description:
- State of the VLAN configuration.
default: present
+ type: str
choices:
- present
- absent
@@ -305,14 +353,15 @@ def main():
vlan_id=dict(type="int"),
name=dict(),
address=dict(),
- interfaces=dict(type="list"),
- associated_interfaces=dict(type="list"),
+ interfaces=dict(type="list", elements="str"),
+ associated_interfaces=dict(type="list", elements="str"),
delay=dict(default=10, type="int"),
state=dict(default="present", choices=["present", "absent"]),
)
aggregate_spec = deepcopy(element_spec)
-
+ aggregate_spec["vlan_id"].update(required=True)
+ aggregate_spec["interfaces"].update(required=True)
# remove default in aggregate spec, to handle common arguments
remove_default_spec(aggregate_spec)
diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt
new file mode 100644
index 0000000..c835eef
--- /dev/null
+++ b/tests/sanity/ignore-2.10.txt
@@ -0,0 +1 @@
+plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt
index 527fc32..8f3fd9c 100644
--- a/tests/sanity/ignore-2.9.txt
+++ b/tests/sanity/ignore-2.9.txt
@@ -1,76 +1,13 @@
+plugins/modules/vyos_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
+plugins/modules/vyos_l3_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_l3_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
+plugins/modules/vyos_linkagg.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_linkagg.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
+plugins/modules/vyos_static_route.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_static_route.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
+plugins/modules/vyos_lldp.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_lldp.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
+plugins/modules/vyos_lldp_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA
+plugins/modules/vyos_lldp_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict
plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
-plugins/modules/vyos_banner.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_banner.py validate-modules:doc-missing-type
-plugins/modules/vyos_command.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_command.py validate-modules:doc-missing-type
-plugins/modules/vyos_command.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_config.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_config.py validate-modules:doc-missing-type
-plugins/modules/vyos_config.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_facts.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_facts.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_firewall_global.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_interface.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_interface.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_interface.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_interface.py validate-modules:doc-missing-type
-plugins/modules/vyos_interface.py validate-modules:invalid-documentation
-plugins/modules/vyos_interface.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_interface.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_interface.py validate-modules:undocumented-parameter
-plugins/modules/vyos_l3_interface.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_l3_interface.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_l3_interface.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_l3_interface.py validate-modules:doc-missing-type
-plugins/modules/vyos_l3_interface.py validate-modules:invalid-documentation
-plugins/modules/vyos_l3_interface.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_l3_interface.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_l3_interface.py validate-modules:undocumented-parameter
-plugins/modules/vyos_linkagg.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_linkagg.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_linkagg.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_linkagg.py validate-modules:doc-missing-type
-plugins/modules/vyos_linkagg.py validate-modules:invalid-documentation
-plugins/modules/vyos_linkagg.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_linkagg.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_linkagg.py validate-modules:undocumented-parameter
-plugins/modules/vyos_lldp_interface.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_lldp_interface.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_lldp_interface.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_lldp_interface.py validate-modules:doc-missing-type
-plugins/modules/vyos_lldp_interface.py validate-modules:invalid-documentation
-plugins/modules/vyos_lldp_interface.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_lldp_interface.py validate-modules:undocumented-parameter
-plugins/modules/vyos_lldp.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_lldp.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_lldp.py validate-modules:invalid-documentation
-plugins/modules/vyos_logging.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_logging.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_logging.py validate-modules:doc-missing-type
-plugins/modules/vyos_logging.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_logging.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_logging.py validate-modules:undocumented-parameter
-plugins/modules/vyos_ping.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_ping.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_static_route.py validate-modules:deprecation-mismatch
-plugins/modules/vyos_static_route.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_static_route.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_static_route.py validate-modules:doc-missing-type
-plugins/modules/vyos_static_route.py validate-modules:invalid-documentation
-plugins/modules/vyos_static_route.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_static_route.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_static_route.py validate-modules:undocumented-parameter
-plugins/modules/vyos_system.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_system.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_user.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_user.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_user.py validate-modules:doc-missing-type
-plugins/modules/vyos_user.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_user.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_user.py validate-modules:undocumented-parameter
-plugins/modules/vyos_vlan.py validate-modules:doc-choices-do-not-match-spec
-plugins/modules/vyos_vlan.py validate-modules:doc-default-does-not-match-spec
-plugins/modules/vyos_vlan.py validate-modules:doc-missing-type
-plugins/modules/vyos_vlan.py validate-modules:missing-suboption-docs
-plugins/modules/vyos_vlan.py validate-modules:parameter-type-not-in-doc
-plugins/modules/vyos_vlan.py validate-modules:undocumented-parameter
diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py
index b45d6b5..b7df24f 100644
--- a/tests/unit/compat/mock.py
+++ b/tests/unit/compat/mock.py
@@ -24,6 +24,7 @@ __metaclass__ = type
Compat module for Python3.x's unittest.mock module
"""
import sys
+import _io
# Python 2.7
@@ -100,7 +101,6 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
global file_spec
if file_spec is None:
- import _io
file_spec = list(
set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))
diff --git a/tests/unit/modules/network/vyos/test_vyos_static_route.py b/tests/unit/modules/network/vyos/test_vyos_static_route.py
index 8eef5fb..21f1139 100644
--- a/tests/unit/modules/network/vyos/test_vyos_static_route.py
+++ b/tests/unit/modules/network/vyos/test_vyos_static_route.py
@@ -21,7 +21,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.vyos.vyos.tests.unit.compat.mock import patch
-from ansible.modules.network.vyos import vyos_static_route
+from ansible_collections.vyos.vyos.plugins.modules import vyos_static_route
from ansible_collections.vyos.vyos.tests.unit.modules.utils import (
set_module_args,
)
@@ -36,13 +36,14 @@ class TestVyosStaticRouteModule(TestVyosModule):
super(TestVyosStaticRouteModule, self).setUp()
self.mock_get_config = patch(
- "ansible.modules.network.vyos.vyos_static_route.get_config"
+ "ansible_collections.vyos.vyos.plugins.modules.vyos_static_route.get_config"
)
self.get_config = self.mock_get_config.start()
self.mock_load_config = patch(
- "ansible.modules.network.vyos.vyos_static_route.load_config"
+ "ansible_collections.vyos.vyos.plugins.modules.vyos_static_route.load_config"
)
+
self.load_config = self.mock_load_config.start()
def tearDown(self):
@@ -52,6 +53,7 @@ class TestVyosStaticRouteModule(TestVyosModule):
self.mock_load_config.stop()
def load_fixtures(self, commands=None, transport="cli"):
+ self.get_config.return_value = ""
self.load_config.return_value = dict(diff=None, session="session")
def test_vyos_static_route_present(self):