From: Alexandre Derumier via pve-devel Date: Tue, 16 Apr 2024 16:24:50 +0000 (+0200) Subject: fix #5344: isis: add isis networkid parser X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=c2473c7d65bc86980d3d3585f340ec504f1eebde;p=matthieu%2Fpve-network.git fix #5344: isis: add isis networkid parser Signed-off-by: Alexandre Derumier Signed-off-by: Thomas Lamprecht --- 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', }, }; }