]> git.proxmox.com Git - pve-network.git/blob - PVE/Network/SDN/Zones/FaucetPlugin.pm
remove vxlan|vlan allowed zone option
[pve-network.git] / PVE / Network / SDN / Zones / FaucetPlugin.pm
1 package PVE::Network::SDN::Zones::FaucetPlugin;
2
3 use strict;
4 use warnings;
5 use PVE::Network::SDN::Zones::VlanPlugin;
6
7 use base('PVE::Network::SDN::Zones::VlanPlugin');
8
9 sub type {
10 return 'faucet';
11 }
12
13 sub plugindata {
14 return {
15 role => 'transport',
16 };
17 }
18
19 sub properties {
20 return {
21 'dp-id' => {
22 type => 'integer',
23 description => 'Faucet dataplane id',
24 },
25 };
26 }
27
28 sub options {
29
30 return {
31 'dp-id' => { optional => 0 },
32 'uplink-id' => { optional => 0 },
33 'controller' => { optional => 0 },
34 };
35 }
36
37 # Plugin implementation
38 sub generate_sdn_config {
39 my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks, $config) = @_;
40
41 my $mtu = $vnet->{mtu};
42 my $uplink = $plugin_config->{'uplink-id'};
43 my $dpid = $plugin_config->{'dp-id'};
44 my $dphex = printf("%x",$dpid); #fixme :should be 16characters hex
45
46 my $iface = $uplinks->{$uplink}->{name};
47 $iface = "uplink${uplink}" if !$iface;
48
49 #tagged interface
50 my @iface_config = ();
51 push @iface_config, "ovs_type OVSPort";
52 push @iface_config, "ovs_bridge $zoneid";
53 push @iface_config, "ovs_mtu $mtu" if $mtu;
54 push(@{$config->{$iface}}, @iface_config) if !$config->{$iface};
55
56 #vnet bridge
57 @iface_config = ();
58 push @iface_config, "ovs_port $iface";
59 push @iface_config, "ovs_type OVSBridge";
60 push @iface_config, "ovs_mtu $mtu" if $mtu;
61
62 push @iface_config, "ovs_extra set bridge $zoneid other-config:datapath-id=$dphex";
63 push @iface_config, "ovs_extra set bridge $zoneid other-config:disable-in-band=true";
64 push @iface_config, "ovs_extra set bridge $zoneid fail_mode=secure";
65 push @iface_config, "ovs_extra set-controller $vnetid tcp:127.0.0.1:6653";
66
67 push(@{$config->{$zoneid}}, @iface_config) if !$config->{$zoneid};
68
69 return $config;
70 }
71
72
73 1;
74
75