]> git.proxmox.com Git - pve-network.git/commitdiff
rename frrevpn controller plugin to evpn plugin
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 26 Nov 2019 09:00:24 +0000 (10:00 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 26 Nov 2019 11:33:40 +0000 (12:33 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Network/SDN/Controllers.pm
PVE/Network/SDN/Controllers.pm
PVE/Network/SDN/Controllers/EvpnPlugin.pm [new file with mode: 0644]
PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm [deleted file]
PVE/Network/SDN/Controllers/Makefile
PVE/Network/SDN/Zones/EvpnPlugin.pm
PVE/Network/SDN/Zones/VlanPlugin.pm
PVE/Network/SDN/Zones/VxlanPlugin.pm
test/documentation.txt

index 7b8356d8d08cba12c0eab08c6208b377568b78a1..a740dbdd12ac366aa0ebf1ed6155adf68aae4cf1 100644 (file)
@@ -9,7 +9,7 @@ use PVE::Cluster qw(cfs_read_file cfs_write_file);
 use PVE::Network::SDN::Zones;
 use PVE::Network::SDN::Controllers;
 use PVE::Network::SDN::Controllers::Plugin;
-use PVE::Network::SDN::Controllers::FrrEvpnPlugin;
+use PVE::Network::SDN::Controllers::EvpnPlugin;
 use PVE::Network::SDN::Controllers::FaucetPlugin;
 
 use Storable qw(dclone);
index 2ee349d37236abbd72325feca220f3a058315448..827c715c2c539520806da1fb5086ed618748ca66 100644 (file)
@@ -12,10 +12,10 @@ use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
 use PVE::Network::SDN::Vnets;
 use PVE::Network::SDN::Zones;
 
-use PVE::Network::SDN::Controllers::FrrEvpnPlugin;
+use PVE::Network::SDN::Controllers::EvpnPlugin;
 use PVE::Network::SDN::Controllers::FaucetPlugin;
 use PVE::Network::SDN::Controllers::Plugin;
-PVE::Network::SDN::Controllers::FrrEvpnPlugin->register();
+PVE::Network::SDN::Controllers::EvpnPlugin->register();
 PVE::Network::SDN::Controllers::FaucetPlugin->register();
 PVE::Network::SDN::Controllers::Plugin->init();
 
diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
new file mode 100644 (file)
index 0000000..97dc825
--- /dev/null
@@ -0,0 +1,312 @@
+package PVE::Network::SDN::Controllers::EvpnPlugin;
+
+use strict;
+use warnings;
+use PVE::Network::SDN::Controllers::Plugin;
+use PVE::Tools;
+use PVE::INotify;
+use PVE::JSONSchema qw(get_standard_option);
+
+use base('PVE::Network::SDN::Controllers::Plugin');
+
+sub type {
+    return 'evpn';
+}
+
+sub properties {
+    return {
+       'uplink-id' => {
+           type => 'integer',
+           minimum => 1, maximum => 4096,
+           description => 'Uplink interface',
+       },
+        'asn' => {
+            type => 'integer',
+            description => "autonomous system number",
+        },
+        'peers' => {
+            description => "peers address list.",
+            type => 'string', format => 'ip-list'
+        },
+       'gateway-nodes' => get_standard_option('pve-node-list'),
+        'gateway-external-peers' => {
+            description => "upstream bgp peers address list.",
+            type => 'string', format => 'ip-list'
+        },
+    };
+}
+
+sub options {
+
+    return {
+       'uplink-id' => { optional => 0 },
+        'asn' => { optional => 0 },
+        'peers' => { optional => 0 },
+       'gateway-nodes' => { optional => 1 },
+       'gateway-external-peers' => { optional => 1 },
+    };
+}
+
+# Plugin implementation
+sub generate_controller_config {
+    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
+
+    my @peers = split(',', $plugin_config->{'peers'}) if $plugin_config->{'peers'};
+
+    my $asn = $plugin_config->{asn};
+    my $uplink = $plugin_config->{'uplink-id'};
+    my $gatewaynodes = $plugin_config->{'gateway-nodes'};
+    my @gatewaypeers = split(',', $plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'};
+
+    return if !$asn;
+
+    my $iface = "uplink$uplink";
+    my $ifaceip = "";
+
+    if($uplinks->{$uplink}->{name}) {
+       $iface = $uplinks->{$uplink}->{name};
+        $ifaceip = PVE::Network::SDN::Controllers::Plugin::get_first_local_ipv4_from_interface($iface);
+    }
+
+    my $is_gateway = undef;
+    my $local_node = PVE::INotify::nodename();
+
+    foreach my $gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
+        $is_gateway = 1 if $gatewaynode eq $local_node;
+    }
+
+    my @router_config = ();
+
+    push @router_config, "bgp router-id $ifaceip";
+    push @router_config, "no bgp default ipv4-unicast";
+    push @router_config, "coalesce-time 1000";
+
+    foreach my $address (@peers) {
+       next if $address eq $ifaceip;
+       push @router_config, "neighbor $address remote-as $asn";
+    }
+
+    if ($is_gateway) {
+       foreach my $address (@gatewaypeers) {
+           push @router_config, "neighbor $address remote-as external";
+       }
+    }
+    push(@{$config->{frr}->{router}->{"bgp $asn"}->{""}}, @router_config);
+
+    @router_config = ();
+    foreach my $address (@peers) {
+       next if $address eq $ifaceip;
+       push @router_config, "neighbor $address activate";
+    }
+    push @router_config, "advertise-all-vni";
+    push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"l2vpn evpn"}}, @router_config);
+
+    if ($is_gateway) {
+
+        @router_config = ();
+        #import /32 routes of evpn network from vrf1 to default vrf (for packet return)
+        #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
+        #https://github.com/FRRouting/frr/issues/4905
+       foreach my $address (@gatewaypeers) {
+           push @router_config, "neighbor $address activate";
+       }
+        push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
+        push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
+
+    }
+
+    return $config;
+}
+
+sub generate_controller_transport_config {
+    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
+
+    my $vrf = $plugin_config->{'vrf'};
+    my $vrfvxlan = $plugin_config->{'vrf-vxlan'};
+    my $asn = $router->{asn};
+    my $gatewaynodes = $router->{'gateway-nodes'};
+
+    return if !$vrf || !$vrfvxlan || !$asn;
+
+    #vrf
+    my @router_config = ();
+    push @router_config, "vni $vrfvxlan";
+    push(@{$config->{frr}->{vrf}->{"$vrf"}}, @router_config);
+
+    @router_config = ();
+
+    my $is_gateway = undef;
+    my $local_node = PVE::INotify::nodename();
+
+    foreach my $gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
+       $is_gateway = 1 if $gatewaynode eq $local_node;
+    }
+
+    if ($is_gateway) {
+
+       @router_config = ();
+       #import /32 routes of evpn network from vrf1 to default vrf (for packet return)
+       #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
+       #https://github.com/FRRouting/frr/issues/4905
+       push @router_config, "import vrf $vrf";
+       push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
+       push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
+
+       @router_config = ();
+       #redistribute connected to be able to route to local vms on the gateway
+       push @router_config, "redistribute connected";
+       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
+       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
+
+       @router_config = ();
+       #add default originate to announce 0.0.0.0/0 type5 route in evpn
+       push @router_config, "default-originate ipv4";
+       push @router_config, "default-originate ipv6";
+       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, @router_config);
+    }
+
+    return $config;
+}
+
+sub on_delete_hook {
+    my ($class, $routerid, $sdn_cfg) = @_;
+
+    # verify that transport is associated to this router
+    foreach my $id (keys %{$sdn_cfg->{ids}}) {
+        my $sdn = $sdn_cfg->{ids}->{$id};
+        die "router $routerid is used by $id"
+            if (defined($sdn->{router}) && $sdn->{router} eq $routerid);
+    }
+}
+
+sub on_update_hook {
+    my ($class, $routerid, $sdn_cfg) = @_;
+
+    # verify that asn is not already used by another router
+    my $asn = $sdn_cfg->{ids}->{$routerid}->{asn};
+    foreach my $id (keys %{$sdn_cfg->{ids}}) {
+       next if $id eq $routerid;
+        my $sdn = $sdn_cfg->{ids}->{$id};
+        die "asn $asn is already used by $id"
+            if (defined($sdn->{asn}) && $sdn->{asn} eq $asn);
+    }
+}
+
+sub sort_frr_config {
+    my $order = {};
+    $order->{''} = 0;
+    $order->{'vrf'} = 1;
+    $order->{'ipv4 unicast'} = 1;
+    $order->{'ipv6 unicast'} = 2;
+    $order->{'l2vpn evpn'} = 3;
+
+    my $a_val = 100;
+    my $b_val = 100;
+
+    $a_val = $order->{$a} if defined($order->{$a});
+    $b_val = $order->{$b} if defined($order->{$b});
+
+    if($a =~ /bgp (\d+)$/) {
+       $a_val = 2;
+    }
+
+    if($b =~ /bgp (\d+)$/) {
+       $b_val = 2;
+    }
+
+    return $a_val <=> $b_val;
+}
+
+sub generate_frr_recurse{
+   my ($final_config, $content, $parentkey, $level) = @_;
+
+   my $keylist = {};
+   $keylist->{vrf} = 1;
+   $keylist->{'address-family'} = 1;
+   $keylist->{router} = 1;
+
+   my $exitkeylist = {};
+   $exitkeylist->{vrf} = 1;
+   $exitkeylist->{'address-family'} = 1;
+
+   #fix me, make this generic
+   my $paddinglevel = undef;
+   if($level == 1 || $level == 2) {
+     $paddinglevel = $level - 1;
+   } elsif ($level == 3 || $level ==  4) {
+     $paddinglevel = $level - 2;
+   }
+
+   my $padding = "";
+   $padding = ' ' x ($paddinglevel) if $paddinglevel;
+
+   if (ref $content eq ref {}) {
+       foreach my $key (sort sort_frr_config keys %$content) {
+           if ($parentkey && defined($keylist->{$parentkey})) {
+                   push @{$final_config}, $padding."!";
+                   push @{$final_config}, $padding."$parentkey $key";
+           } else {
+                   push @{$final_config}, $padding."$key" if $key ne '' && !defined($keylist->{$key});
+           }
+
+           my $option = $content->{$key};
+           generate_frr_recurse($final_config, $option, $key, $level+1);
+
+           push @{$final_config}, $padding."exit-$parentkey" if $parentkey && defined($exitkeylist->{$parentkey});
+       }
+    }
+
+    if (ref $content eq 'ARRAY') {
+       foreach my $value (@$content) {
+           push @{$final_config}, $padding."$value";
+       }
+    }
+}
+
+sub write_controller_config {
+    my ($class, $plugin_config, $config) = @_;
+
+    my $final_config = [];
+    push @{$final_config}, "log syslog informational";
+    push @{$final_config}, "!";
+
+    generate_frr_recurse($final_config, $config->{frr}, undef, 0);
+
+    push @{$final_config}, "!";
+    push @{$final_config}, "line vty";
+    push @{$final_config}, "!";
+
+    my $rawconfig = join("\n", @{$final_config});
+
+
+    return if !$rawconfig;
+    return if !-d "/etc/frr";
+
+    my $frr_config_file = "/etc/frr/frr.conf";
+
+    my $writefh = IO::File->new($frr_config_file,">");
+    print $writefh $rawconfig;
+    $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;
+
+
diff --git a/PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm b/PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm
deleted file mode 100644 (file)
index 052c77e..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-package PVE::Network::SDN::Controllers::FrrEvpnPlugin;
-
-use strict;
-use warnings;
-use PVE::Network::SDN::Controllers::Plugin;
-use PVE::Tools;
-use PVE::INotify;
-use PVE::JSONSchema qw(get_standard_option);
-
-use base('PVE::Network::SDN::Controllers::Plugin');
-
-sub type {
-    return 'frrevpn';
-}
-
-sub properties {
-    return {
-       'uplink-id' => {
-           type => 'integer',
-           minimum => 1, maximum => 4096,
-           description => 'Uplink interface',
-       },
-        'asn' => {
-            type => 'integer',
-            description => "autonomous system number",
-        },
-        'peers' => {
-            description => "peers address list.",
-            type => 'string', format => 'ip-list'
-        },
-       'gateway-nodes' => get_standard_option('pve-node-list'),
-        'gateway-external-peers' => {
-            description => "upstream bgp peers address list.",
-            type => 'string', format => 'ip-list'
-        },
-    };
-}
-
-sub options {
-
-    return {
-       'uplink-id' => { optional => 0 },
-        'asn' => { optional => 0 },
-        'peers' => { optional => 0 },
-       'gateway-nodes' => { optional => 1 },
-       'gateway-external-peers' => { optional => 1 },
-    };
-}
-
-# Plugin implementation
-sub generate_controller_config {
-    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
-
-    my @peers = split(',', $plugin_config->{'peers'}) if $plugin_config->{'peers'};
-
-    my $asn = $plugin_config->{asn};
-    my $uplink = $plugin_config->{'uplink-id'};
-    my $gatewaynodes = $plugin_config->{'gateway-nodes'};
-    my @gatewaypeers = split(',', $plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'};
-
-    return if !$asn;
-
-    my $iface = "uplink$uplink";
-    my $ifaceip = "";
-
-    if($uplinks->{$uplink}->{name}) {
-       $iface = $uplinks->{$uplink}->{name};
-        $ifaceip = PVE::Network::SDN::Controllers::Plugin::get_first_local_ipv4_from_interface($iface);
-    }
-
-    my $is_gateway = undef;
-    my $local_node = PVE::INotify::nodename();
-
-    foreach my $gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
-        $is_gateway = 1 if $gatewaynode eq $local_node;
-    }
-
-    my @router_config = ();
-
-    push @router_config, "bgp router-id $ifaceip";
-    push @router_config, "no bgp default ipv4-unicast";
-    push @router_config, "coalesce-time 1000";
-
-    foreach my $address (@peers) {
-       next if $address eq $ifaceip;
-       push @router_config, "neighbor $address remote-as $asn";
-    }
-
-    if ($is_gateway) {
-       foreach my $address (@gatewaypeers) {
-           push @router_config, "neighbor $address remote-as external";
-       }
-    }
-    push(@{$config->{frr}->{router}->{"bgp $asn"}->{""}}, @router_config);
-
-    @router_config = ();
-    foreach my $address (@peers) {
-       next if $address eq $ifaceip;
-       push @router_config, "neighbor $address activate";
-    }
-    push @router_config, "advertise-all-vni";
-    push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"l2vpn evpn"}}, @router_config);
-
-    if ($is_gateway) {
-
-        @router_config = ();
-        #import /32 routes of evpn network from vrf1 to default vrf (for packet return)
-        #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
-        #https://github.com/FRRouting/frr/issues/4905
-       foreach my $address (@gatewaypeers) {
-           push @router_config, "neighbor $address activate";
-       }
-        push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
-        push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
-
-    }
-
-    return $config;
-}
-
-sub generate_controller_transport_config {
-    my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
-
-    my $vrf = $plugin_config->{'vrf'};
-    my $vrfvxlan = $plugin_config->{'vrf-vxlan'};
-    my $asn = $router->{asn};
-    my $gatewaynodes = $router->{'gateway-nodes'};
-
-    return if !$vrf || !$vrfvxlan || !$asn;
-
-    #vrf
-    my @router_config = ();
-    push @router_config, "vni $vrfvxlan";
-    push(@{$config->{frr}->{vrf}->{"$vrf"}}, @router_config);
-
-    @router_config = ();
-
-    my $is_gateway = undef;
-    my $local_node = PVE::INotify::nodename();
-
-    foreach my $gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
-       $is_gateway = 1 if $gatewaynode eq $local_node;
-    }
-
-    if ($is_gateway) {
-
-       @router_config = ();
-       #import /32 routes of evpn network from vrf1 to default vrf (for packet return)
-       #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
-       #https://github.com/FRRouting/frr/issues/4905
-       push @router_config, "import vrf $vrf";
-       push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
-       push(@{$config->{frr}->{router}->{"bgp $asn"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
-
-       @router_config = ();
-       #redistribute connected to be able to route to local vms on the gateway
-       push @router_config, "redistribute connected";
-       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"ipv4 unicast"}}, @router_config);
-       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"ipv6 unicast"}}, @router_config);
-
-       @router_config = ();
-       #add default originate to announce 0.0.0.0/0 type5 route in evpn
-       push @router_config, "default-originate ipv4";
-       push @router_config, "default-originate ipv6";
-       push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, @router_config);
-    }
-
-    return $config;
-}
-
-sub on_delete_hook {
-    my ($class, $routerid, $sdn_cfg) = @_;
-
-    # verify that transport is associated to this router
-    foreach my $id (keys %{$sdn_cfg->{ids}}) {
-        my $sdn = $sdn_cfg->{ids}->{$id};
-        die "router $routerid is used by $id"
-            if (defined($sdn->{router}) && $sdn->{router} eq $routerid);
-    }
-}
-
-sub on_update_hook {
-    my ($class, $routerid, $sdn_cfg) = @_;
-
-    # verify that asn is not already used by another router
-    my $asn = $sdn_cfg->{ids}->{$routerid}->{asn};
-    foreach my $id (keys %{$sdn_cfg->{ids}}) {
-       next if $id eq $routerid;
-        my $sdn = $sdn_cfg->{ids}->{$id};
-        die "asn $asn is already used by $id"
-            if (defined($sdn->{asn}) && $sdn->{asn} eq $asn);
-    }
-}
-
-sub sort_frr_config {
-    my $order = {};
-    $order->{''} = 0;
-    $order->{'vrf'} = 1;
-    $order->{'ipv4 unicast'} = 1;
-    $order->{'ipv6 unicast'} = 2;
-    $order->{'l2vpn evpn'} = 3;
-
-    my $a_val = 100;
-    my $b_val = 100;
-
-    $a_val = $order->{$a} if defined($order->{$a});
-    $b_val = $order->{$b} if defined($order->{$b});
-
-    if($a =~ /bgp (\d+)$/) {
-       $a_val = 2;
-    }
-
-    if($b =~ /bgp (\d+)$/) {
-       $b_val = 2;
-    }
-
-    return $a_val <=> $b_val;
-}
-
-sub generate_frr_recurse{
-   my ($final_config, $content, $parentkey, $level) = @_;
-
-   my $keylist = {};
-   $keylist->{vrf} = 1;
-   $keylist->{'address-family'} = 1;
-   $keylist->{router} = 1;
-
-   my $exitkeylist = {};
-   $exitkeylist->{vrf} = 1;
-   $exitkeylist->{'address-family'} = 1;
-
-   #fix me, make this generic
-   my $paddinglevel = undef;
-   if($level == 1 || $level == 2) {
-     $paddinglevel = $level - 1;
-   } elsif ($level == 3 || $level ==  4) {
-     $paddinglevel = $level - 2;
-   }
-
-   my $padding = "";
-   $padding = ' ' x ($paddinglevel) if $paddinglevel;
-
-   if (ref $content eq ref {}) {
-       foreach my $key (sort sort_frr_config keys %$content) {
-           if ($parentkey && defined($keylist->{$parentkey})) {
-                   push @{$final_config}, $padding."!";
-                   push @{$final_config}, $padding."$parentkey $key";
-           } else {
-                   push @{$final_config}, $padding."$key" if $key ne '' && !defined($keylist->{$key});
-           }
-
-           my $option = $content->{$key};
-           generate_frr_recurse($final_config, $option, $key, $level+1);
-
-           push @{$final_config}, $padding."exit-$parentkey" if $parentkey && defined($exitkeylist->{$parentkey});
-       }
-    }
-
-    if (ref $content eq 'ARRAY') {
-       foreach my $value (@$content) {
-           push @{$final_config}, $padding."$value";
-       }
-    }
-}
-
-sub write_controller_config {
-    my ($class, $plugin_config, $config) = @_;
-
-    my $final_config = [];
-    push @{$final_config}, "log syslog informational";
-    push @{$final_config}, "!";
-
-    generate_frr_recurse($final_config, $config->{frr}, undef, 0);
-
-    push @{$final_config}, "!";
-    push @{$final_config}, "line vty";
-    push @{$final_config}, "!";
-
-    my $rawconfig = join("\n", @{$final_config});
-
-
-    return if !$rawconfig;
-    return if !-d "/etc/frr";
-
-    my $frr_config_file = "/etc/frr/frr.conf";
-
-    my $writefh = IO::File->new($frr_config_file,">");
-    print $writefh $rawconfig;
-    $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;
-
-
index 73c3b7b240e21c397b4610bcc33efd25df940d70..33241252aabaf2645cd7d95fba311e59409b7b42 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=Plugin.pm FaucetPlugin.pm FrrEvpnPlugin.pm
+SOURCES=Plugin.pm FaucetPlugin.pm EvpnPlugin.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
index f9998472cdb3ac8e01f6b6cd4ddbf8fa8cf91efa..012274f42b934abd93d453ea62d0620d1b165148 100644 (file)
@@ -136,15 +136,15 @@ sub on_update_hook {
     my ($class, $transportid, $sdn_cfg) = @_;
 
     # verify that router exist
-    if (defined($sdn_cfg->{ids}->{$transportid}->{router})) {
-       my $router = $sdn_cfg->{ids}->{$transportid}->{router};
-       if (!defined($sdn_cfg->{ids}->{$router})) {
-           die "router $router don't exist";
+    if (defined($sdn_cfg->{ids}->{$transportid}->{controller})) {
+       my $controller = $sdn_cfg->{ids}->{$transportid}->{controller};
+       if (!defined($sdn_cfg->{ids}->{$controller})) {
+           die "controller $controller don't exist";
        } else {
-           die "$router is not a router type" if $sdn_cfg->{ids}->{$router}->{type} ne 'frr';
+           die "$controller is not a evpn controller type" if $sdn_cfg->{ids}->{$controller}->{type} ne 'evpn';
        }
 
-       #vrf && vrf-vxlan need to be defined with router
+       #vrf && vrf-vxlan need to be defined with controller
        my $vrf = $sdn_cfg->{ids}->{$transportid}->{vrf};
        if (!defined($vrf)) {
            die "missing vrf option";
index 39f103e374c2e86276b626ec5bb61f0943ccb227..2dd65e922f7f72c37fe69e83fff0f13a6ef21020 100644 (file)
@@ -80,11 +80,6 @@ sub on_delete_hook {
     }
 }
 
-sub on_update_hook {
-    my ($class, $transportid, $sdn_cfg) = @_;
-
-}
-
 1;
 
 
index e3624ea6a8d576d26b238eed702bb80535341133..8a39921b983b1083994d5388ba68c366e4c7787b 100644 (file)
@@ -134,45 +134,6 @@ sub on_delete_hook {
     }
 }
 
-sub on_update_hook {
-    my ($class, $transportid, $sdn_cfg) = @_;
-
-    # verify that router exist
-    if (defined($sdn_cfg->{ids}->{$transportid}->{router})) {
-       my $router = $sdn_cfg->{ids}->{$transportid}->{router};
-       if (!defined($sdn_cfg->{ids}->{$router})) {
-           die "router $router don't exist";
-       } else {
-           die "$router is not a router type" if $sdn_cfg->{ids}->{$router}->{type} ne 'frr';
-       }
-
-       #vrf && vrf-vxlan need to be defined with router
-       my $vrf = $sdn_cfg->{ids}->{$transportid}->{vrf};
-       if (!defined($vrf)) {
-           die "missing vrf option";
-       } else {
-           # verify that vrf is not already declared in another transport
-           foreach my $id (keys %{$sdn_cfg->{ids}}) {
-               next if $id eq $transportid;
-               die "vrf $vrf is already declared in $id"
-                       if (defined($sdn_cfg->{ids}->{$id}->{vrf}) && $sdn_cfg->{ids}->{$id}->{vrf} eq $vrf);
-           }
-       }
-
-       my $vrfvxlan = $sdn_cfg->{ids}->{$transportid}->{'vrf-vxlan'};
-       if (!defined($vrfvxlan)) {
-           die "missing vrf-vxlan option";
-       } else {
-           # verify that vrf-vxlan is not already declared in another transport
-           foreach my $id (keys %{$sdn_cfg->{ids}}) {
-               next if $id eq $transportid;
-               die "vrf-vxlan $vrfvxlan is already declared in $id"
-                       if (defined($sdn_cfg->{ids}->{$id}->{'vrf-vxlan'}) && $sdn_cfg->{ids}->{$id}->{'vrf-vxlan'} eq $vrfvxlan);
-           }
-       }
-    }
-}
-
 1;
 
 
index 8b78d466a5ab61b33e39b97fd1e5e2ab9e354f9c..6b2dfb2e47e1f5c7514727a6737ae16d7c936fbb 100644 (file)
@@ -12,7 +12,7 @@ pvesh create /cluster/sdn/zones/ --zone vxlanmulticastzone --type vxlan --uplink
 pvesh create /cluster/sdn/zones/ --zone vxlanunicastzone --type vxlan --uplink-id 1 --unicast-address 192.168.0.1,192.168.0.2,192.168.0.3
 
 #create an controller
-pvesh create /cluster/sdn/controllers/ --controller frrrouter1 --type frrevpn --uplink-id 1 --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234 --gateway-nodes pxnode1,pxnode2 --gateway-external-peers 192.168.0.253,192.168.0.254
+pvesh create /cluster/sdn/controllers/ --controller frrrouter1 --type evpn --uplink-id 1 --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234 --gateway-nodes pxnode1,pxnode2 --gateway-external-peers 192.168.0.253,192.168.0.254
 
 #create a layer2 vxlan bgpevpn transportzone
 pvesh create /cluster/sdn/zones/ --zone layer2evpnzone --type evpn --uplink-id 1 --controller frrrouter1