1 package PVE
::Network
::SDN
::FrrPlugin
;
5 use PVE
::Network
::SDN
::Plugin
;
8 use base
('PVE::Network::SDN::Plugin');
18 description
=> "autonomous system number",
21 description
=> "peers address list.",
22 type
=> 'string', #fixme: format
30 'uplink-id' => { optional
=> 0 },
31 'asn' => { optional
=> 0 },
32 'peers' => { optional
=> 0 },
36 # Plugin implementation
37 sub generate_frr_config
{
38 my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
40 my $asn = $plugin_config->{'asn'};
41 my @peers = split(',', $plugin_config->{'peers'}) if $plugin_config->{'peers'};
43 my $uplink = $plugin_config->{'uplink-id'};
45 die "missing peers" if !$plugin_config->{'peers'};
47 my $iface = "uplink$uplink";
50 if($uplinks->{$uplink}->{name
}) {
51 $iface = $uplinks->{$uplink}->{name
};
52 $ifaceip = get_first_local_ipv4_from_interface
($iface);
56 $config .= "router bgp $asn\n";
57 $config .= "bgp router-id $ifaceip\n";
58 $config .= "no bgp default ipv4-unicast\n";
59 $config .= "coalesce-time 1000\n";
61 foreach my $address (@peers) {
62 next if $address eq $ifaceip;
63 $config .= "neighbor $address remote-as $asn\n";
66 $config .= "address-family l2vpn evpn\n";
67 foreach my $address (@peers) {
68 next if $address eq $ifaceip;
69 $config .= " neighbor $address activate\n";
71 $config .= " advertise-all-vni\n";
72 $config .= "exit-address-family\n";
74 $config .= "line vty\n";
82 my ($class, $transportid, $sdn_cfg) = @_;
87 my ($class, $transportid, $sdn_cfg) = @_;