Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for additional API paths #125

Merged
merged 9 commits into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/125-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- api_modify, api_info - support API paths ``interface pppoe-client``, ``interface vlan``, ``interface bridge``, ``interface bridge vlan``
and also setting ``interface bridge port ingress-filtering`` field default to True whih is the default in ROS
therfert marked this conversation as resolved.
Show resolved Hide resolved
(https://github.com/ansible-collections/community.routeros/pull/125).
67 changes: 63 additions & 4 deletions plugins/module_utils/_api_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,29 @@ def join_path(path):

PATHS = {
('interface', 'bridge'): APIData(
# fully_understood=True,
fully_understood=True,
primary_keys=('name', ),
fields={
'admin-mac': KeyInfo(),
'admin-mac': KeyInfo(default=''),
'ageing-time': KeyInfo(default='5m'),
'arp': KeyInfo(default='enabled'),
'arp-timeout': KeyInfo(default='auto'),
'auto-mac': KeyInfo(default=False),
'auto-mac': KeyInfo(default=True),
'comment': KeyInfo(can_disable=True, remove_value=''),
'dhcp-snooping': KeyInfo(default=False),
'disabled': KeyInfo(default=False),
'ether-type': KeyInfo(default='0x8100'),
'fast-forward': KeyInfo(default=True),
'frame-types': KeyInfo(default='admit-all'),
'forward-delay': KeyInfo(default='15s'),
'igmp-snooping': KeyInfo(default=False),
'ingress-filtering': KeyInfo(default=True),
'max-message-age': KeyInfo(default='20s'),
'mtu': KeyInfo(default='auto'),
'name': KeyInfo(),
'priority': KeyInfo(default='0x8000'),
'protocol-mode': KeyInfo(default='rstp'),
'pvid': KeyInfo(default=1),
'transmit-hold-count': KeyInfo(default=6),
'vlan-filtering': KeyInfo(default=False),
},
Expand Down Expand Up @@ -173,6 +177,49 @@ def join_path(path):
'use-peer-dns': KeyInfo(),
},
),
('interface', 'pppoe-client'): APIData(
fully_understood=True,
primary_keys=('name', ),
fields={
'ac-name': KeyInfo(default=''),
'add-default-route': KeyInfo(default=False),
'allow': KeyInfo(default='pap,chap,mschap1,mschap2'),
'comment': KeyInfo(can_disable=True, remove_value=''),
'default-route-distance': KeyInfo(default=1),
'dial-on-demand': KeyInfo(default=False),
'disabled': KeyInfo(default=True),
'host-uniq': KeyInfo(can_disable=True),
'interface': KeyInfo(required=True),
'keepalive-timeout': KeyInfo(default=10),
'max-mru': KeyInfo(default='auto'),
'max-mtu': KeyInfo(default='auto'),
'mrru': KeyInfo(default='disabled'),
'name': KeyInfo(),
'password': KeyInfo(default=''),
'profile': KeyInfo(default='default'),
'service-name': KeyInfo(default=''),
'use-peer-dns': KeyInfo(default=False),
'user': KeyInfo(default=''),
},
),
('interface', 'vlan'): APIData(
fully_understood=True,
primary_keys=('name', ),
fields={
'arp': KeyInfo(default='enabled'),
'arp-timeout': KeyInfo(default='auto'),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False),
'interface': KeyInfo(required=True),
'loop-protect': KeyInfo(default='default'),
'loop-protect-disable-time': KeyInfo(default='5m'),
'loop-protect-send-interval': KeyInfo(default='5s'),
'mtu': KeyInfo(default=1500),
'name': KeyInfo(),
'use-service-tag': KeyInfo(default=False),
'vlan-id': KeyInfo(required=True),
},
),
('interface', 'wireless', 'security-profiles'): APIData(
unknown_mechanism=True,
# primary_keys=('default', ),
Expand Down Expand Up @@ -486,7 +533,7 @@ def join_path(path):
'frame-types': KeyInfo(default='admit-all'),
'horizon': KeyInfo(default='none'),
'hw': KeyInfo(default=True),
'ingress-filtering': KeyInfo(default=False),
'ingress-filtering': KeyInfo(default=True),
'interface': KeyInfo(),
'internal-path-cost': KeyInfo(default=10),
'learn': KeyInfo(default='auto'),
Expand Down Expand Up @@ -531,6 +578,18 @@ def join_path(path):
'use-ip-firewall-for-vlan': KeyInfo(default=False),
},
),
('interface', 'bridge', 'vlan'): APIData(
fully_understood=True,
primary_keys=('bridge', 'vlan-ids', ),
fields={
'bridge': KeyInfo(),
'comment': KeyInfo(can_disable=True, remove_value=''),
'disabled': KeyInfo(default=False),
'tagged': KeyInfo(default=''),
'untagged': KeyInfo(default=''),
'vlan-ids': KeyInfo(),
},
),
('ip', 'firewall', 'connection', 'tracking'): APIData(
single_value=True,
fully_understood=True,
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/api_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
# BEGIN PATH LIST
- caps-man aaa
- certificate settings
- interface bridge
- interface bridge port
- interface bridge port-controller
- interface bridge port-extender
- interface bridge settings
- interface bridge vlan
- interface detect-internet
- interface ethernet
- interface ethernet switch
Expand All @@ -56,8 +58,10 @@
- interface list
- interface list member
- interface ovpn-server server
- interface pppoe-client
- interface pptp-server server
- interface sstp-server server
- interface vlan
- interface wireless align
- interface wireless cap
- interface wireless sniffer
Expand Down
4 changes: 4 additions & 0 deletions plugins/modules/api_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
# BEGIN PATH LIST
- caps-man aaa
- certificate settings
- interface bridge
- interface bridge port
- interface bridge port-controller
- interface bridge port-extender
- interface bridge settings
- interface bridge vlan
- interface detect-internet
- interface ethernet
- interface ethernet switch
Expand All @@ -61,8 +63,10 @@
- interface list
- interface list member
- interface ovpn-server server
- interface pppoe-client
- interface pptp-server server
- interface sstp-server server
- interface vlan
- interface wireless align
- interface wireless cap
- interface wireless sniffer
Expand Down