]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN.pm
controller : evpn : only allow 1 evpn controller
[pve-network.git] / PVE / Network / SDN.pm
index 8078c3f88c622ef4c5e94763494928a437f08566..2e996e9e5304189bd788195cb9a608b79c6f6154 100644 (file)
@@ -6,66 +6,14 @@ use warnings;
 use Data::Dumper;
 use JSON;
 
+use PVE::Network::SDN::Zones;
+
 use PVE::Tools qw(extract_param dir_glob_regex run_command);
 use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
-use PVE::Network::SDN::Plugin;
-use PVE::Network::SDN::VnetPlugin;
-use PVE::Network::SDN::VlanPlugin;
-use PVE::Network::SDN::VxlanMulticastPlugin;
-
-PVE::Network::SDN::VnetPlugin->register();
-PVE::Network::SDN::VlanPlugin->register();
-PVE::Network::SDN::VxlanMulticastPlugin->register();
-PVE::Network::SDN::Plugin->init();
-
-
-sub sdn_config {
-    my ($cfg, $sdnid, $noerr) = @_;
 
-    die "no sdn ID specified\n" if !$sdnid;
+# improve me : move status code inside plugins ?
 
-    my $scfg = $cfg->{ids}->{$sdnid};
-    die "sdn '$sdnid' does not exists\n" if (!$noerr && !$scfg);
-
-    return $scfg;
-}
-
-sub config {
-    my $config = cfs_read_file("sdn.cfg.new");
-    $config = cfs_read_file("sdn.cfg") if !keys %{$config->{ids}};
-    return $config;
-}
-
-sub write_config {
-    my ($cfg) = @_;
-
-    cfs_write_file("sdn.cfg.new", $cfg);
-}
-
-sub lock_sdn_config {
-    my ($code, $errmsg) = @_;
-
-    cfs_lock_file("sdn.cfg.new", undef, $code);
-    if (my $err = $@) {
-        $errmsg ? die "$errmsg: $err" : die $err;
-    }
-}
-
-sub sdn_ids {
-    my ($cfg) = @_;
-
-    return keys %{$cfg->{ids}};
-}
-
-sub complete_sdn {
-    my ($cmdname, $pname, $cvalue) = @_;
-
-    my $cfg = PVE::Network::SDN::config();
-
-    return  $cmdname eq 'add' ? [] : [ PVE::Network::SDN::sdn_ids($cfg) ];
-}
-
-sub status {
+sub ifquery_check {
 
     my $cmd = ['ifquery', '-a', '-c', '-o','json'];
 
@@ -91,4 +39,11 @@ sub status {
     return $interfaces;
 }
 
+sub status {
+
+    my ($zone_status, $vnet_status) = PVE::Network::SDN::Zones::status();
+    return($zone_status, $vnet_status);
+}
+
 1;
+