support for new API paths and few updates (#133)

* support for new API paths and few updates

Signed-off-by: Tomas Herfert <herfik>

* changelog fix

Signed-off-by: Tomas Herfert <herfik>

* tests update

Signed-off-by: Tomas Herfert <herfik>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
This commit is contained in:
Tomas Herfert 2022-11-17 20:14:07 +01:00 committed by GitHub
parent 23b3aa3beb
commit 5af14a8940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 247 additions and 16 deletions

View file

@ -0,0 +1,11 @@
minor_changes:
- api_modify, api_info - support API paths - ``interface bonding``, ``interface bridge mlag``, ``ipv6 firewall mangle``, ``ipv6 nd``, ``system scheduler``, ``system script``, ``system ups``
(https://github.com/ansible-collections/community.routeros/pull/133).
- api_modify, api_info - support fields ``jump-target``, ``reject-with`` in ``ip firewall filter`` API path, field ``comment`` in ``ip firwall address-list`` API path, field ``jump-target`` in ``ip firewall mangle`` API path, field ``comment`` in ``ipv6 firewall address-list`` API path, fields ``jump-target``, ``reject-with`` in ``ipv6 firewall filter`` API path
(https://github.com/ansible-collections/community.routeros/pull/133).
- api_modify, api_info - support fields ``address-list``, ``address-list-timeout``, ``connection-bytes``, ``connection-limit``, ``connection-mark``, ``connection-rate``, ``connection-type``, ``content``, ``disabled``, ``dscp``, ``dst-address-list``, ``dst-address-type``, ``dst-limit``, ``fragment``, ``hotspot``, ``icmp-options``, ``in-bridge-port``, ``in-bridge-port-list``, ``ingress-priority``, ``ipsec-policy``, ``ipv4-options``, ``jump-target``, ``layer7-protocol``, ``limit``, ``log``, ``log-prefix``, ``nth``, ``out-bridge-port``, ``out-bridge-port-list``, ``packet-mark``, ``packet-size``, ``per-connection-classifier``, ``port``, ``priority``, ``psd``, ``random``, ``realm``, ``routing-mark``, ``same-not-by-dst``, ``src-address``, ``src-address-list``, ``src-address-type``, ``src-mac-address``, ``src-port``, ``tcp-mss``, ``time``, ``tls-host``, ``ttl`` in ``ip firewall nat`` path
(https://github.com/ansible-collections/community.routeros/pull/133).
bugfixes:
- api_modify, api_info - removed wrong field ``dynamic`` from API path ``ipv6 firewall address-list``
(https://github.com/ansible-collections/community.routeros/pull/133).

View file

@ -80,6 +80,33 @@ def join_path(path):
# 3. All bold attributes go into the `primary_keys` list -- this is not always true! # 3. All bold attributes go into the `primary_keys` list -- this is not always true!
PATHS = { PATHS = {
('interface', 'bonding'): APIData(
fully_understood=True,
primary_keys=('name', ),
fields={
'arp': KeyInfo(default='enabled'),
'arp-interval': KeyInfo(default='100ms'),
'arp-ip-targets': KeyInfo(default=''),
'arp-timeout': KeyInfo(default='auto'),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False),
'down-delay': KeyInfo(default='0ms'),
'forced-mac-address': KeyInfo(can_disable=True),
'lacp-rate': KeyInfo(default='30secs'),
'lacp-user-key': KeyInfo(can_disable=True, remove_value=0),
'link-monitoring': KeyInfo(default='mii'),
'mii-interval': KeyInfo(default='100ms'),
'min-links': KeyInfo(default=0),
'mlag-id': KeyInfo(can_disable=True, remove_value=0),
'mode': KeyInfo(default='balance-rr'),
'mtu': KeyInfo(default=1500),
'name': KeyInfo(),
'primary': KeyInfo(default='none'),
'slaves': KeyInfo(required=True),
'transmit-hash-policy': KeyInfo(default='layer-2'),
'up-delay': KeyInfo(default='0ms'),
}
),
('interface', 'bridge'): APIData( ('interface', 'bridge'): APIData(
fully_understood=True, fully_understood=True,
primary_keys=('name', ), primary_keys=('name', ),
@ -852,6 +879,14 @@ PATHS = {
'unknown-unicast-flood': KeyInfo(default=True), 'unknown-unicast-flood': KeyInfo(default=True),
}, },
), ),
('interface', 'bridge', 'mlag'): APIData(
single_value=True,
fully_understood=True,
fields={
'bridge': KeyInfo(default='none'),
'peer-port': KeyInfo(default='none'),
}
),
('interface', 'bridge', 'port-controller'): APIData( ('interface', 'bridge', 'port-controller'): APIData(
single_value=True, single_value=True,
fully_understood=True, fully_understood=True,
@ -1247,6 +1282,7 @@ PATHS = {
primary_keys=('address', 'list', ), primary_keys=('address', 'list', ),
fields={ fields={
'address': KeyInfo(), 'address': KeyInfo(),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False), 'disabled': KeyInfo(default=False),
'list': KeyInfo(), 'list': KeyInfo(),
}, },
@ -1284,6 +1320,7 @@ PATHS = {
'ingress-priority': KeyInfo(can_disable=True), 'ingress-priority': KeyInfo(can_disable=True),
'ipsec-policy': KeyInfo(can_disable=True), 'ipsec-policy': KeyInfo(can_disable=True),
'ipv4-options': KeyInfo(can_disable=True), 'ipv4-options': KeyInfo(can_disable=True),
'jump-target': KeyInfo(),
'layer7-protocol': KeyInfo(can_disable=True), 'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True),
'log': KeyInfo(), 'log': KeyInfo(),
@ -1302,6 +1339,7 @@ PATHS = {
'protocol': KeyInfo(can_disable=True), 'protocol': KeyInfo(can_disable=True),
'psd': KeyInfo(can_disable=True), 'psd': KeyInfo(can_disable=True),
'random': KeyInfo(can_disable=True), 'random': KeyInfo(can_disable=True),
'reject-with': KeyInfo(),
'routing-mark': KeyInfo(can_disable=True), 'routing-mark': KeyInfo(can_disable=True),
'routing-table': KeyInfo(can_disable=True), 'routing-table': KeyInfo(can_disable=True),
'src-address': KeyInfo(can_disable=True), 'src-address': KeyInfo(can_disable=True),
@ -1348,6 +1386,7 @@ PATHS = {
'ingress-priority': KeyInfo(can_disable=True), 'ingress-priority': KeyInfo(can_disable=True),
'ipsec-policy': KeyInfo(can_disable=True), 'ipsec-policy': KeyInfo(can_disable=True),
'ipv4-options': KeyInfo(can_disable=True), 'ipv4-options': KeyInfo(can_disable=True),
'jump-target': KeyInfo(),
'layer7-protocol': KeyInfo(can_disable=True), 'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True),
'log': KeyInfo(), 'log': KeyInfo(),
@ -1397,17 +1436,65 @@ PATHS = {
stratify_keys=('chain', ), stratify_keys=('chain', ),
fields={ fields={
'action': KeyInfo(), 'action': KeyInfo(),
'address-list': KeyInfo(),
'address-list-timeout': KeyInfo(),
'chain': KeyInfo(), 'chain': KeyInfo(),
'comment': KeyInfo(can_disable=True, remove_value=''), 'comment': KeyInfo(can_disable=True, remove_value=''),
'connection-bytes': KeyInfo(can_disable=True),
'connection-limit': KeyInfo(can_disable=True),
'connection-mark': KeyInfo(can_disable=True),
'connection-rate': KeyInfo(can_disable=True),
'connection-type': KeyInfo(can_disable=True),
'content': KeyInfo(can_disable=True),
'disabled': KeyInfo(),
'dscp': KeyInfo(can_disable=True),
'dst-address': KeyInfo(can_disable=True), 'dst-address': KeyInfo(can_disable=True),
'dst-address-list': KeyInfo(can_disable=True),
'dst-address-type': KeyInfo(can_disable=True),
'dst-limit': KeyInfo(can_disable=True),
'dst-port': KeyInfo(can_disable=True), 'dst-port': KeyInfo(can_disable=True),
'fragment': KeyInfo(can_disable=True),
'hotspot': KeyInfo(can_disable=True),
'icmp-options': KeyInfo(can_disable=True),
'in-bridge-port': KeyInfo(can_disable=True),
'in-bridge-port-list': KeyInfo(can_disable=True),
'in-interface': KeyInfo(can_disable=True), 'in-interface': KeyInfo(can_disable=True),
'in-interface-list': KeyInfo(can_disable=True), 'in-interface-list': KeyInfo(can_disable=True),
'ingress-priority': KeyInfo(can_disable=True),
'ipsec-policy': KeyInfo(can_disable=True),
'ipv4-options': KeyInfo(can_disable=True),
'jump-target': KeyInfo(),
'layer7-protocol': KeyInfo(can_disable=True),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(),
'log-prefix': KeyInfo(),
'nth': KeyInfo(can_disable=True),
'out-bridge-port': KeyInfo(can_disable=True),
'out-bridge-port-list': KeyInfo(can_disable=True),
'out-interface': KeyInfo(can_disable=True), 'out-interface': KeyInfo(can_disable=True),
'out-interface-list': KeyInfo(can_disable=True), 'out-interface-list': KeyInfo(can_disable=True),
'packet-mark': KeyInfo(can_disable=True),
'packet-size': KeyInfo(can_disable=True),
'per-connection-classifier': KeyInfo(can_disable=True),
'port': KeyInfo(can_disable=True),
'priority': KeyInfo(can_disable=True),
'protocol': KeyInfo(can_disable=True), 'protocol': KeyInfo(can_disable=True),
'psd': KeyInfo(can_disable=True),
'random': KeyInfo(can_disable=True),
'realm': KeyInfo(can_disable=True),
'routing-mark': KeyInfo(can_disable=True),
'same-not-by-dst': KeyInfo(),
'src-address': KeyInfo(can_disable=True),
'src-address-list': KeyInfo(can_disable=True),
'src-address-type': KeyInfo(can_disable=True),
'src-mac-address': KeyInfo(can_disable=True),
'src-port': KeyInfo(can_disable=True),
'tcp-mss': KeyInfo(can_disable=True),
'time': KeyInfo(can_disable=True),
'tls-host': KeyInfo(can_disable=True),
'to-addresses': KeyInfo(can_disable=True), 'to-addresses': KeyInfo(can_disable=True),
'to-ports': KeyInfo(can_disable=True), 'to-ports': KeyInfo(can_disable=True),
'ttl': KeyInfo(can_disable=True),
}, },
), ),
('ip', 'hotspot', 'user'): APIData( ('ip', 'hotspot', 'user'): APIData(
@ -1633,8 +1720,8 @@ PATHS = {
primary_keys=('address', 'list', ), primary_keys=('address', 'list', ),
fields={ fields={
'address': KeyInfo(), 'address': KeyInfo(),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False), 'disabled': KeyInfo(default=False),
'dynamic': KeyInfo(default=False),
'list': KeyInfo(), 'list': KeyInfo(),
}, },
), ),
@ -1668,6 +1755,7 @@ PATHS = {
'in-interface-list': KeyInfo(can_disable=True), 'in-interface-list': KeyInfo(can_disable=True),
'ingress-priority': KeyInfo(can_disable=True), 'ingress-priority': KeyInfo(can_disable=True),
'ipsec-policy': KeyInfo(can_disable=True), 'ipsec-policy': KeyInfo(can_disable=True),
'jump-target': KeyInfo(),
'limit': KeyInfo(can_disable=True), 'limit': KeyInfo(can_disable=True),
'log': KeyInfo(), 'log': KeyInfo(),
'log-prefix': KeyInfo(), 'log-prefix': KeyInfo(),
@ -1683,6 +1771,7 @@ PATHS = {
'priority': KeyInfo(can_disable=True), 'priority': KeyInfo(can_disable=True),
'protocol': KeyInfo(can_disable=True), 'protocol': KeyInfo(can_disable=True),
'random': KeyInfo(can_disable=True), 'random': KeyInfo(can_disable=True),
'reject-with': KeyInfo(),
'src-address': KeyInfo(can_disable=True), 'src-address': KeyInfo(can_disable=True),
'src-address-list': KeyInfo(can_disable=True), 'src-address-list': KeyInfo(can_disable=True),
'src-address-type': KeyInfo(can_disable=True), 'src-address-type': KeyInfo(can_disable=True),
@ -1693,24 +1782,97 @@ PATHS = {
'time': KeyInfo(can_disable=True), 'time': KeyInfo(can_disable=True),
}, },
), ),
('ipv6', 'nd'): APIData( ('ipv6', 'firewall', 'mangle'): APIData(
unknown_mechanism=True, fully_understood=True,
# primary_keys=('default', ), stratify_keys=('chain', ),
fields={ fields={
'default': KeyInfo(), 'action': KeyInfo(),
'advertise-dns': KeyInfo(), 'address-list': KeyInfo(),
'advertise-mac-address': KeyInfo(), 'address-list-timeout': KeyInfo(),
'chain': KeyInfo(),
'comment': KeyInfo(can_disable=True, remove_value=''),
'connection-bytes': KeyInfo(can_disable=True),
'connection-limit': KeyInfo(can_disable=True),
'connection-mark': KeyInfo(can_disable=True),
'connection-rate': KeyInfo(can_disable=True),
'connection-state': KeyInfo(can_disable=True),
'connection-type': KeyInfo(can_disable=True),
'content': KeyInfo(can_disable=True),
'disabled': KeyInfo(), 'disabled': KeyInfo(),
'hop-limit': KeyInfo(), 'dscp': KeyInfo(can_disable=True),
'dst-address': KeyInfo(can_disable=True),
'dst-address-list': KeyInfo(can_disable=True),
'dst-address-type': KeyInfo(can_disable=True),
'dst-limit': KeyInfo(can_disable=True),
'dst-port': KeyInfo(can_disable=True),
'dst-prefix': KeyInfo(),
'headers': KeyInfo(can_disable=True),
'hop-limit': KeyInfo(can_disable=True),
'icmp-options': KeyInfo(can_disable=True),
'in-bridge-port': KeyInfo(can_disable=True),
'in-bridge-port-list': KeyInfo(can_disable=True),
'in-interface': KeyInfo(can_disable=True),
'in-interface-list': KeyInfo(can_disable=True),
'ingress-priority': KeyInfo(can_disable=True),
'ipsec-policy': KeyInfo(can_disable=True),
'jump-target': KeyInfo(),
'limit': KeyInfo(can_disable=True),
'log': KeyInfo(),
'log-prefix': KeyInfo(),
'new-connection-mark': KeyInfo(),
'new-dscp': KeyInfo(),
'new-hop-limit': KeyInfo(),
'new-mss': KeyInfo(),
'new-packet-mark': KeyInfo(),
'new-routing-mark': KeyInfo(),
'nth': KeyInfo(can_disable=True),
'out-bridge-port': KeyInfo(can_disable=True),
'out-bridge-port-list': KeyInfo(can_disable=True),
'out-interface': KeyInfo(can_disable=True),
'out-interface-list': KeyInfo(can_disable=True),
'packet-mark': KeyInfo(can_disable=True),
'packet-size': KeyInfo(can_disable=True),
'passthrough': KeyInfo(),
'per-connection-classifier': KeyInfo(can_disable=True),
'port': KeyInfo(can_disable=True),
'priority': KeyInfo(can_disable=True),
'protocol': KeyInfo(can_disable=True),
'random': KeyInfo(can_disable=True),
'routing-mark': KeyInfo(can_disable=True),
'sniff-id': KeyInfo(),
'sniff-target': KeyInfo(),
'sniff-target-port': KeyInfo(),
'src-address': KeyInfo(can_disable=True),
'src-address-list': KeyInfo(can_disable=True),
'src-address-type': KeyInfo(can_disable=True),
'src-mac-address': KeyInfo(can_disable=True),
'src-port': KeyInfo(can_disable=True),
'src-prefix': KeyInfo(),
'tcp-flags': KeyInfo(can_disable=True),
'tcp-mss': KeyInfo(can_disable=True),
'time': KeyInfo(can_disable=True),
'tls-host': KeyInfo(can_disable=True),
}
),
('ipv6', 'nd'): APIData(
fully_understood=True,
primary_keys=('interface', ),
fields={
'advertise-dns': KeyInfo(default=True),
'advertise-mac-address': KeyInfo(default=True),
'disabled': KeyInfo(default=False),
'dns': KeyInfo(default=''),
'hop-limit': KeyInfo(default='unspecified'),
'interface': KeyInfo(), 'interface': KeyInfo(),
'managed-address-configuration': KeyInfo(), 'managed-address-configuration': KeyInfo(default=False),
'mtu': KeyInfo(), 'mtu': KeyInfo(default='unspecified'),
'other-configuration': KeyInfo(), 'other-configuration': KeyInfo(default=False),
'ra-delay': KeyInfo(), 'ra-delay': KeyInfo(default='3s'),
'ra-interval': KeyInfo(), 'ra-interval': KeyInfo(default='3m20s-10m'),
'ra-lifetime': KeyInfo(), 'ra-lifetime': KeyInfo(default='30m'),
'reachable-time': KeyInfo(), 'ra-preference': KeyInfo(default='medium'),
'retransmit-interval': KeyInfo(), 'reachable-time': KeyInfo(default='unspecified'),
'retransmit-interval': KeyInfo(default='unspecified'),
}, },
), ),
('ipv6', 'nd', 'prefix', 'default'): APIData( ('ipv6', 'nd', 'prefix', 'default'): APIData(
@ -2003,6 +2165,20 @@ PATHS = {
'user': KeyInfo(default=''), 'user': KeyInfo(default=''),
}, },
), ),
('system', 'ups'): APIData(
fully_understood=True,
primary_keys=('name', ),
fields={
'alarm-setting': KeyInfo(default='immediate'),
'check-capabilities': KeyInfo(can_disable=True, remove_value=True),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=True),
'min-runtime': KeyInfo(default='never'),
'name': KeyInfo(),
'offline-time': KeyInfo(default='0s'),
'port': KeyInfo(required=True),
},
),
('system', 'watchdog'): APIData( ('system', 'watchdog'): APIData(
single_value=True, single_value=True,
fully_understood=True, fully_understood=True,
@ -2404,4 +2580,30 @@ PATHS = {
'cpu': KeyInfo(), 'cpu': KeyInfo(),
}, },
), ),
('system', 'scheduler'): APIData(
fully_understood=True,
primary_keys=('name', ),
fields={
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False),
'interval': KeyInfo(default='0s'),
'name': KeyInfo(),
'on-event': KeyInfo(default=''),
'policy': KeyInfo(default='ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon'),
'start-date': KeyInfo(),
'start-time': KeyInfo(),
},
),
('system', 'script'): APIData(
fully_understood=True,
primary_keys=('name',),
fields={
'comment': KeyInfo(can_disable=True, remove_value=''),
'dont-require-permissions': KeyInfo(default=False),
'name': KeyInfo(),
'owner': KeyInfo(),
'policy': KeyInfo(default='ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon'),
'source': KeyInfo(default=''),
},
),
} }

View file

@ -50,7 +50,9 @@ options:
- caps-man provisioning - caps-man provisioning
- caps-man security - caps-man security
- certificate settings - certificate settings
- interface bonding
- interface bridge - interface bridge
- interface bridge mlag
- interface bridge port - interface bridge port
- interface bridge port-controller - interface bridge port-controller
- interface bridge port-extender - interface bridge port-extender
@ -120,6 +122,8 @@ options:
- ipv6 dhcp-server option - ipv6 dhcp-server option
- ipv6 firewall address-list - ipv6 firewall address-list
- ipv6 firewall filter - ipv6 firewall filter
- ipv6 firewall mangle
- ipv6 nd
- ipv6 nd prefix default - ipv6 nd prefix default
- ipv6 route - ipv6 route
- ipv6 settings - ipv6 settings
@ -153,7 +157,10 @@ options:
- system ntp server - system ntp server
- system package update - system package update
- system routerboard settings - system routerboard settings
- system scheduler
- system script
- system upgrade mirror - system upgrade mirror
- system ups
- system watchdog - system watchdog
- tool bandwidth-server - tool bandwidth-server
- tool e-mail - tool e-mail

View file

@ -55,7 +55,9 @@ options:
- caps-man provisioning - caps-man provisioning
- caps-man security - caps-man security
- certificate settings - certificate settings
- interface bonding
- interface bridge - interface bridge
- interface bridge mlag
- interface bridge port - interface bridge port
- interface bridge port-controller - interface bridge port-controller
- interface bridge port-extender - interface bridge port-extender
@ -125,6 +127,8 @@ options:
- ipv6 dhcp-server option - ipv6 dhcp-server option
- ipv6 firewall address-list - ipv6 firewall address-list
- ipv6 firewall filter - ipv6 firewall filter
- ipv6 firewall mangle
- ipv6 nd
- ipv6 nd prefix default - ipv6 nd prefix default
- ipv6 route - ipv6 route
- ipv6 settings - ipv6 settings
@ -158,7 +162,10 @@ options:
- system ntp server - system ntp server
- system package update - system package update
- system routerboard settings - system routerboard settings
- system scheduler
- system script
- system upgrade mirror - system upgrade mirror
- system ups
- system watchdog - system watchdog
- tool bandwidth-server - tool bandwidth-server
- tool e-mail - tool e-mail

View file

@ -220,6 +220,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
'!ingress-priority': None, '!ingress-priority': None,
'!ipsec-policy': None, '!ipsec-policy': None,
'!ipv4-options': None, '!ipv4-options': None,
'!jump-target': None,
'!layer7-protocol': None, '!layer7-protocol': None,
'!limit': None, '!limit': None,
'!log': None, '!log': None,
@ -238,6 +239,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
'!protocol': None, '!protocol': None,
'!psd': None, '!psd': None,
'!random': None, '!random': None,
'!reject-with': None,
'!routing-mark': None, '!routing-mark': None,
'!routing-table': None, '!routing-table': None,
'!src-address': None, '!src-address': None,
@ -304,6 +306,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
'ingress-priority': None, 'ingress-priority': None,
'ipsec-policy': None, 'ipsec-policy': None,
'ipv4-options': None, 'ipv4-options': None,
'jump-target': None,
'layer7-protocol': None, 'layer7-protocol': None,
'limit': None, 'limit': None,
'log': None, 'log': None,
@ -322,6 +325,7 @@ class TestRouterosApiInfoModule(ModuleTestCase):
'protocol': None, 'protocol': None,
'psd': None, 'psd': None,
'random': None, 'random': None,
'reject-with': None,
'routing-mark': None, 'routing-mark': None,
'routing-table': None, 'routing-table': None,
'src-address': None, 'src-address': None,