--- Begin Message ---
Signed-off-by: Alexandre Derumier <alexandre.derum...@groupe-cyllene.com>
---
 src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm 
b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
index afea82e..97c6876 100644
--- a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
@@ -17,6 +17,16 @@ sub type {
     return 'isis';
 }
 
+PVE::JSONSchema::register_format('pve-sdn-isis-net', 
\&pve_verify_sdn_isis_net);
+sub pve_verify_sdn_isis_net {
+    my ($net) = @_;
+
+    if ($net !~ m/^[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}$/) {
+       die "value does not look like a valid isis net\n";
+    }
+    return $net;
+}
+
 sub properties {
     return {
        'isis-domain' => {
@@ -29,7 +39,7 @@ sub properties {
        },
        'isis-net' => {
            description => "ISIS network entity title.",
-           type => 'string'
+           type => 'string', format => 'pve-sdn-isis-net',
        },
     };
 }
-- 
2.39.2



--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to