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'];
return $interfaces;
}
+sub status {
+
+ my ($zone_status, $vnet_status) = PVE::Network::SDN::Zones::status();
+ return($zone_status, $vnet_status);
+}
+
1;
+