return $config;
}
+
+sub reload_controller {
+
+ my $sdn_cfg = PVE::Cluster::cfs_read_file('sdn.cfg');
+ return if !$sdn_cfg;
+
+ foreach my $id (keys %{$sdn_cfg->{ids}}) {
+ my $plugin_config = $sdn_cfg->{ids}->{$id};
+ my $plugin = PVE::Network::SDN::Plugin->lookup($plugin_config->{type});
+ my $pd = $plugin->plugindata();
+ my $role = $pd->{role};
+ if ($role eq 'controller') {
+ $plugin->reload_controller();
+ }
+ }
+}
+
sub write_etc_network_config {
my ($rawconfig) = @_;
$writefh->close();
}
+sub reload_controller {
+ my ($class) = @_;
+
+ my $conf_file = "/etc/faucet/faucet.yaml";
+ my $bin_path = "/usr/bin/faucet";
+
+ if (-e $conf_file && -e $bin_path) {
+ PVE::Tools::run_command(['systemctl', 'reload', 'faucet']);
+ }
+}
+
1;
$writefh->close();
}
+sub reload_controller {
+ my ($class) = @_;
+
+ my $conf_file = "/etc/frr/frr.conf";
+ my $bin_path = "/usr/bin/vtysh";
+
+ my $err = sub {
+ my $line = shift;
+ if ($line =~ /^line (\S+)/) {
+ print "$line \n";
+ }
+ };
+
+ if (-e $conf_file && -e $bin_path) {
+ PVE::Tools::run_command([$bin_path, '-m', '-f', $conf_file], outfunc => {}, errfunc => $err);
+ }
+}
+
1;
die "please implement inside plugin";
}
+sub controller_reload {
+ my ($class) = @_;
+
+ die "please implement inside plugin";
+}
+
sub on_delete_hook {
my ($class, $sndid, $scfg) = @_;