From be15f85106557b42fafb406c6e3feff7db633d9f Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <public@hansmi.ch>
Date: Mon, 21 Aug 2023 13:17:02 +0200
Subject: [PATCH] Finalize fields for "interface wireless security-profiles"

A few fields were missing for `interface wireless security-profiles`
(e.g. `disabled`). `default` on the other hand is a built-in property
which can't be modified.

Mark the `interface wireless security-profiles` path as fully understood
to enable its use in Ansible tasks.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
---
 .../203-wireless-security-profiles.yml        |  2 +
 plugins/module_utils/_api_data.py             | 46 +++++++++----------
 plugins/modules/api_info.py                   |  1 +
 plugins/modules/api_modify.py                 |  1 +
 4 files changed, 27 insertions(+), 23 deletions(-)
 create mode 100644 changelogs/fragments/203-wireless-security-profiles.yml

diff --git a/changelogs/fragments/203-wireless-security-profiles.yml b/changelogs/fragments/203-wireless-security-profiles.yml
new file mode 100644
index 00000000..5eee689b
--- /dev/null
+++ b/changelogs/fragments/203-wireless-security-profiles.yml
@@ -0,0 +1,2 @@
+minor_changes:
+  - api_info, api_modify - finalize fields for the ``interface wireless security-profiles`` path and enable it (https://github.com/ansible-collections/community.routeros/pull/203).
diff --git a/plugins/module_utils/_api_data.py b/plugins/module_utils/_api_data.py
index 7ace4fc1..2317b143 100644
--- a/plugins/module_utils/_api_data.py
+++ b/plugins/module_utils/_api_data.py
@@ -1356,42 +1356,42 @@ def join_path(path):
         },
     ),
     ('interface', 'wireless', 'security-profiles'): APIData(
-        unknown_mechanism=True,
-        # primary_keys=('default', ),
+        fully_understood=True,
+        primary_keys=('name', ),
         fields={
-            'default': KeyInfo(),
             'authentication-types': KeyInfo(),
-            'disable-pmkid': KeyInfo(),
+            'disable-pmkid': KeyInfo(default=False),
+            'disabled': KeyInfo(default=True),
             'eap-methods': KeyInfo(),
             'group-ciphers': KeyInfo(),
-            'group-key-update': KeyInfo(),
+            'group-key-update': KeyInfo(default='5m'),
             'interim-update': KeyInfo(),
-            'management-protection': KeyInfo(),
-            'management-protection-key': KeyInfo(),
-            'mode': KeyInfo(),
-            'mschapv2-password': KeyInfo(),
-            'mschapv2-username': KeyInfo(),
+            'management-protection': KeyInfo(default='disabled'),
+            'management-protection-key': KeyInfo(default=''),
+            'mode': KeyInfo(default='none'),
+            'mschapv2-password': KeyInfo(default=''),
+            'mschapv2-username': KeyInfo(default=''),
             'name': KeyInfo(),
             'radius-called-format': KeyInfo(),
-            'radius-eap-accounting': KeyInfo(),
-            'radius-mac-accounting': KeyInfo(),
-            'radius-mac-authentication': KeyInfo(),
-            'radius-mac-caching': KeyInfo(),
-            'radius-mac-format': KeyInfo(),
-            'radius-mac-mode': KeyInfo(),
-            'static-algo-0': KeyInfo(),
-            'static-algo-1': KeyInfo(),
-            'static-algo-2': KeyInfo(),
-            'static-algo-3': KeyInfo(),
+            'radius-eap-accounting': KeyInfo(default=False),
+            'radius-mac-accounting': KeyInfo(default=False),
+            'radius-mac-authentication': KeyInfo(default=False),
+            'radius-mac-caching': KeyInfo(default='disabled'),
+            'radius-mac-format': KeyInfo(default='XX:XX:XX:XX:XX:XX'),
+            'radius-mac-mode': KeyInfo(default='as-username'),
+            'static-algo-0': KeyInfo(default='none'),
+            'static-algo-1': KeyInfo(default='none'),
+            'static-algo-2': KeyInfo(default='none'),
+            'static-algo-3': KeyInfo(default='none'),
             'static-key-0': KeyInfo(),
             'static-key-1': KeyInfo(),
             'static-key-2': KeyInfo(),
             'static-key-3': KeyInfo(),
-            'static-sta-private-algo': KeyInfo(),
+            'static-sta-private-algo': KeyInfo(default='none'),
             'static-sta-private-key': KeyInfo(),
             'static-transmit-key': KeyInfo(),
-            'supplicant-identity': KeyInfo(),
-            'tls-certificate': KeyInfo(),
+            'supplicant-identity': KeyInfo(default='MikroTik'),
+            'tls-certificate': KeyInfo(default='none'),
             'tls-mode': KeyInfo(),
             'unicast-ciphers': KeyInfo(),
             'wpa-pre-shared-key': KeyInfo(),
diff --git a/plugins/modules/api_info.py b/plugins/modules/api_info.py
index 99471038..0aa27029 100644
--- a/plugins/modules/api_info.py
+++ b/plugins/modules/api_info.py
@@ -83,6 +83,7 @@
         - interface wireless
         - interface wireless align
         - interface wireless cap
+        - interface wireless security-profiles
         - interface wireless sniffer
         - interface wireless snooper
         - ip accounting
diff --git a/plugins/modules/api_modify.py b/plugins/modules/api_modify.py
index 2fc7c574..99655027 100644
--- a/plugins/modules/api_modify.py
+++ b/plugins/modules/api_modify.py
@@ -88,6 +88,7 @@
         - interface wireless
         - interface wireless align
         - interface wireless cap
+        - interface wireless security-profiles
         - interface wireless sniffer
         - interface wireless snooper
         - ip accounting