Skip to content

Commit

Permalink
Support for additional API paths (#125)
Browse files Browse the repository at this point in the history
* adding api path interface pppoe-client

Signed-off-by: Tomas Herfert <herfik>

* support for api path interface vlan

Signed-off-by: Tomas Herfert <herfik>

* support for api path interface bridge vlan

Signed-off-by: Tomas Herfert <herfik>

* PR ID update

Signed-off-by: Tomas Herfert <herfik>

* typo fix

Signed-off-by: Tomas Herfert <herfik>

* support for API path interface bridge and update of interface bridge port ingress-filtering to True

Signed-off-by: Tomas Herfert <herfik>

* Apply suggestion per code review

Signed-off-by: Tomas Herfert <herfik>

* Update changelogs/fragments/125-api.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Signed-off-by: Tomas Herfert <herfik>
Co-authored-by: Tomas Herfert <herfik>
Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
therfert and felixfontein authored Nov 12, 2022
1 parent 9567bbf commit ad9d7c3
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
6 changes: 6 additions & 0 deletions changelogs/fragments/125-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
minor_changes:
- api_modify, api_info - support API paths ``interface pppoe-client``, ``interface vlan``, ``interface bridge``, ``interface bridge vlan``
(https://github.com/ansible-collections/community.routeros/pull/125).
bugfixes:
- api_modify, api_info - the default of the field ``ingress-filtering`` in ``interface bridge port`` is now ``true``, which is the default in ROS
(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

0 comments on commit ad9d7c3

Please sign in to comment.