From 10fbc564a7279a9f7af41251c61e7c9eba28b9e1 Mon Sep 17 00:00:00 2001 From: liquorice-head <40302350+liquorice-head@users.noreply.github.com> Date: Sun, 18 Feb 2024 01:49:12 +0400 Subject: [PATCH] Change ip vrf for router OS v7 (#259) * Update api_info.py * Update api_modify.py * Update _api_data.py * Update _api_data.py * Update _api_data.py * Update api_info.py * Update api_modify.py * Update api_info.py * Update api_modify.py * Create 259-add-routeros7-support-for-ip-vrf.yml * Update changelogs/fragments/259-add-routeros7-support-for-ip-vrf.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- .../259-add-routeros7-support-for-ip-vrf.yml | 2 ++ plugins/module_utils/_api_data.py | 36 +++++++++++++------ plugins/modules/api_info.py | 1 + plugins/modules/api_modify.py | 1 + 4 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/259-add-routeros7-support-for-ip-vrf.yml diff --git a/changelogs/fragments/259-add-routeros7-support-for-ip-vrf.yml b/changelogs/fragments/259-add-routeros7-support-for-ip-vrf.yml new file mode 100644 index 0000000..f55a706 --- /dev/null +++ b/changelogs/fragments/259-add-routeros7-support-for-ip-vrf.yml @@ -0,0 +1,2 @@ +minor_changes: + - api_modify, api_info - add support for the ``ip vrf`` path in RouterOS 7 (https://github.com/ansible-collections/community.routeros/pull/259) diff --git a/plugins/module_utils/_api_data.py b/plugins/module_utils/_api_data.py index d2027d6..8353614 100644 --- a/plugins/module_utils/_api_data.py +++ b/plugins/module_utils/_api_data.py @@ -727,17 +727,33 @@ PATHS = { }, ), ), + ('ip', 'vrf'): APIData( + versioned=[ + ('7', '>=', VersionedAPIData( + fully_understood=True, + primary_keys=('name', ), + fields={ + 'comment': KeyInfo(can_disable=True, remove_value=''), + 'disabled': KeyInfo(default=False), + 'interfaces': KeyInfo(), + 'name': KeyInfo(), + }, + )), + ] + ), ('ip', 'route', 'vrf'): APIData( - unversioned=VersionedAPIData( - fully_understood=True, - primary_keys=('routing-mark', ), - fields={ - 'comment': KeyInfo(can_disable=True, remove_value=''), - 'disabled': KeyInfo(default=False), - 'interfaces': KeyInfo(), - 'routing-mark': KeyInfo(), - }, - ), + versioned=[ + ('7', '<', VersionedAPIData( + fully_understood=True, + primary_keys=('routing-mark', ), + fields={ + 'comment': KeyInfo(can_disable=True, remove_value=''), + 'disabled': KeyInfo(default=False), + 'interfaces': KeyInfo(), + 'routing-mark': KeyInfo(), + }, + )), + ], ), ('ip', 'dhcp-server'): APIData( unversioned=VersionedAPIData( diff --git a/plugins/modules/api_info.py b/plugins/modules/api_info.py index 6eea5e8..216b2ab 100644 --- a/plugins/modules/api_info.py +++ b/plugins/modules/api_info.py @@ -147,6 +147,7 @@ options: - ip traffic-flow target - ip upnp - ip upnp interfaces + - ip vrf - ipv6 address - ipv6 dhcp-client - ipv6 dhcp-server diff --git a/plugins/modules/api_modify.py b/plugins/modules/api_modify.py index a683c2a..d9104bf 100644 --- a/plugins/modules/api_modify.py +++ b/plugins/modules/api_modify.py @@ -156,6 +156,7 @@ options: - ip traffic-flow target - ip upnp - ip upnp interfaces + - ip vrf - ipv6 address - ipv6 dhcp-client - ipv6 dhcp-server