]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Controllers/Plugin.pm
evpn: remove uplink-id
[pve-network.git] / PVE / Network / SDN / Controllers / Plugin.pm
index df385f1ae183af3b9ed44bfba54200f0421c5b22..04eddca95e30df41702287eb5d41f83578cbe305 100644 (file)
@@ -27,10 +27,11 @@ PVE::JSONSchema::register_format('pve-sdn-controller-id', \&parse_sdn_controller
 sub parse_sdn_controller_id {
     my ($id, $noerr) = @_;
 
-    if ($id !~ m/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i) {
+    if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) {
         return undef if $noerr;
-        die "SDN controller object ID '$id' contains illegal characters\n";
+        die "controller ID '$id' contains illegal characters\n";
     }
+    die "controller ID '$id' can't be more length than 10 characters\n" if length($id) > 10;
     return $id;
 }
 
@@ -72,13 +73,13 @@ sub generate_sdn_config {
 }
 
 sub generate_controller_config {
-    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
+    my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_;
 
     die "please implement inside plugin";
 }
 
 sub generate_controller_vnet_config {
-    my ($class, $plugin_config, $controller, $transportid, $vnetid, $config) = @_;
+    my ($class, $plugin_config, $controller, $zoneid, $vnetid, $config) = @_;
 
 }
 
@@ -95,39 +96,15 @@ sub controller_reload {
 }
 
 sub on_delete_hook {
-    my ($class, $sndid, $scfg) = @_;
+    my ($class, $controllerid, $zone_cfg) = @_;
 
     # do nothing by default
 }
 
 sub on_update_hook {
-    my ($class, $sdnid, $scfg) = @_;
+    my ($class, $controllerid, $controller_cfg) = @_;
 
     # do nothing by default
 }
 
-#helpers
-
-#to be move to Network.pm helper
-sub get_first_local_ipv4_from_interface {
-    my ($interface) = @_;
-
-    my $cmd = ['/sbin/ip', 'address', 'show', 'dev', $interface];
-
-    my $IP = "";
-
-    my $code = sub {
-       my $line = shift;
-
-       if ($line =~ m!^\s*inet\s+($PVE::Tools::IPRE)(?:/\d+|\s+peer\s+)!) {
-           $IP = $1;
-           return;
-       }
-    };
-
-    PVE::Tools::run_command($cmd, outfunc => $code);
-
-    return $IP;
-}
-
 1;