[PATCH pve-network] fix #5344: isis: add isis networkid parser

Alexandre Derumier alexandre.derumier at groupe-cyllene.com
Tue Apr 16 18:24:50 CEST 2024


Signed-off-by: Alexandre Derumier <alexandre.derumier at 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




More information about the pve-devel mailing list