]> git.proxmox.com Git - pve-network.git/commitdiff
move transport plugins to Network/Transport/
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 2 Apr 2019 22:19:10 +0000 (00:19 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 3 Apr 2019 04:20:34 +0000 (06:20 +0200)
PVE/API2/Network/Transport.pm
PVE/Network/Makefile
PVE/Network/Plugin.pm [deleted file]
PVE/Network/Transport.pm
PVE/Network/Transport/Makefile [new file with mode: 0644]
PVE/Network/Transport/Plugin.pm [new file with mode: 0644]
PVE/Network/Transport/VlanPlugin.pm [new file with mode: 0644]
PVE/Network/Transport/VxlanMulticastPlugin.pm [new file with mode: 0644]
PVE/Network/VlanPlugin.pm [deleted file]
PVE/Network/Vnet/Makefile
PVE/Network/VxlanMulticastPlugin.pm [deleted file]

index bddae40422a45db1cbc675fd6d9833fdeb20bbca..0e1610ff33ab441c779145e14f322790f9b56ad5 100644 (file)
@@ -7,9 +7,9 @@ use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param);
 use PVE::Cluster qw(cfs_read_file cfs_write_file);
 use PVE::Network::Transport;
-use PVE::Network::Plugin;
-use PVE::Network::VlanPlugin;
-use PVE::Network::VxlanMulticastPlugin;
+use PVE::Network::Transport::Plugin;
+use PVE::Network::Transport::VlanPlugin;
+use PVE::Network::Transport::VxlanMulticastPlugin;
 use Storable qw(dclone);
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::RPCEnvironment;
@@ -18,7 +18,7 @@ use PVE::RESTHandler;
 
 use base qw(PVE::RESTHandler);
 
-my $transport_type_enum = PVE::Network::Plugin->lookup_types();
+my $transport_type_enum = PVE::Network::Transport::Plugin->lookup_types();
 
 my $api_transport_config = sub {
     my ($cfg, $transportid) = @_;
@@ -36,7 +36,7 @@ __PACKAGE__->register_method ({
     method => 'GET',
     description => "Transport index.",
     permissions => { 
-       description => "Only list entries where you have 'NetworkTransport.Audit' or 'NetworkTransport.Allocate' permissions on '/networktransports/<transport>'",
+       description => "Only list entries where you have 'NetworkTransport.Audit' or 'NetworkTransport.Allocate' permissions on '/cluster/network/transport/<transport>'",
        user => 'all',
     },
     parameters => {
@@ -71,7 +71,7 @@ __PACKAGE__->register_method ({
        my $res = [];
        foreach my $transportid (@sids) {
 #          my $privs = [ 'NetworkTransport.Audit', 'NetworkTransport.Allocate' ];
-#          next if !$rpcenv->check_any($authuser, "/network/transports/$transportid", $privs, 1);
+#          next if !$rpcenv->check_any($authuser, "/cluster/network/transport/$transportid", $privs, 1);
 
            my $scfg = &$api_transport_config($cfg, $transportid);
            next if $param->{type} && $param->{type} ne $scfg->{type};
@@ -87,7 +87,7 @@ __PACKAGE__->register_method ({
     method => 'GET',
     description => "Read transport configuration.",
 #    permissions => { 
-#      check => ['perm', '/network/transports/{transport}', ['NetworkTransport.Allocate']],
+#      check => ['perm', '/cluster/network/transport/{transport}', ['NetworkTransport.Allocate']],
 #   },
 
     parameters => {
@@ -112,9 +112,9 @@ __PACKAGE__->register_method ({
     method => 'POST',
     description => "Create a new network transport.",
 #    permissions => { 
-#      check => ['perm', '/network/transports', ['NetworkTransport.Allocate']],
+#      check => ['perm', '/cluster/network/transport', ['NetworkTransport.Allocate']],
 #    },
-    parameters => PVE::Network::Plugin->createSchema(),
+    parameters => PVE::Network::Transport::Plugin->createSchema(),
     returns => { type => 'null' },
     code => sub {
        my ($param) = @_;
@@ -122,7 +122,7 @@ __PACKAGE__->register_method ({
        my $type = extract_param($param, 'type');
        my $transportid = extract_param($param, 'transport');
 
-       my $plugin = PVE::Network::Plugin->lookup($type);
+       my $plugin = PVE::Network::Transport::Plugin->lookup($type);
        my $opts = $plugin->check_config($transportid, $param, 1, 1);
 
         PVE::Network::Transport::lock_transport_config(
@@ -153,9 +153,9 @@ __PACKAGE__->register_method ({
     method => 'PUT',
     description => "Update network transport configuration.",
 #    permissions => { 
-#      check => ['perm', '/network/transports', ['NetworkTransport.Allocate']],
+#      check => ['perm', '/cluster/network/transport', ['NetworkTransport.Allocate']],
 #    },
-    parameters => PVE::Network::Plugin->updateSchema(),
+    parameters => PVE::Network::Transport::Plugin->updateSchema(),
     returns => { type => 'null' },
     code => sub {
        my ($param) = @_;
@@ -172,7 +172,7 @@ __PACKAGE__->register_method ({
 
            my $scfg = PVE::Network::Transport::transport_config($cfg, $transportid);
 
-           my $plugin = PVE::Network::Plugin->lookup($scfg->{type});
+           my $plugin = PVE::Network::Transport::Plugin->lookup($scfg->{type});
            my $opts = $plugin->check_config($transportid, $param, 0, 1);
 
            foreach my $k (%$opts) {
@@ -191,11 +191,11 @@ __PACKAGE__->register_method ({
 __PACKAGE__->register_method ({
     name => 'delete',
     protected => 1,
-    path => '{transport}', # /network/transports/{transport}
+    path => '{transport}', # /cluster/network/transport/{transport}
     method => 'DELETE',
     description => "Delete network transport configuration.",
 #    permissions => { 
-#      check => ['perm', '/network/transports', ['NetworkTransport.Allocate']],
+#      check => ['perm', '/cluster/network/transport', ['NetworkTransport.Allocate']],
 #    },
     parameters => {
        additionalProperties => 0,
@@ -218,7 +218,7 @@ __PACKAGE__->register_method ({
 
                my $scfg = PVE::Network::Transport::transport_config($cfg, $transportid);
 
-#              my $plugin = PVE::Network::Plugin->lookup($scfg->{type});
+#              my $plugin = PVE::Network::Transport::Plugin->lookup($scfg->{type});
 #              $plugin->on_delete_hook($transportid, $scfg);
 
                delete $cfg->{ids}->{$transportid};
index dd74a2a357bcf2af0fd085695c13778e4fbff31f..66eeec89844472a0468e9e6b46495d3d4109c3ee 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=Plugin.pm VlanPlugin.pm Vnet.pm VxlanMulticastPlugin.pm
+SOURCES=Vnet.pm Transport.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
@@ -6,5 +6,5 @@ PERL5DIR=${DESTDIR}/usr/share/perl5
 .PHONY: install
 install:
        for i in ${SOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/PVE/Network/$$i; done
-        make -C Vnet install
-
+       make -C Vnet install
+       make -C Transport install
diff --git a/PVE/Network/Plugin.pm b/PVE/Network/Plugin.pm
deleted file mode 100644 (file)
index 36cd2ed..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package PVE::Network::Plugin;
-
-use strict;
-use warnings;
-
-use PVE::Tools;
-use PVE::JSONSchema;
-use PVE::Cluster;
-
-use Data::Dumper;
-use PVE::JSONSchema qw(get_standard_option);
-use base qw(PVE::SectionConfig);
-
-PVE::Cluster::cfs_register_file('network/transports.cfg',
-                                sub { __PACKAGE__->parse_config(@_); },
-                                sub { __PACKAGE__->write_config(@_); });
-
-my $defaultData = {
-
-    propertyList => {
-       type => { 
-           description => "Plugin type.",
-           type => 'string', format => 'pve-configid',
-           type => 'string',
-       },
-        transport => get_standard_option('pve-transport-id',
-            { completion => \&PVE::Network::Transport::complete_transport }),
-    },
-};
-
-sub private {
-    return $defaultData;
-}
-
-sub parse_section_header {
-    my ($class, $line) = @_;
-
-    if ($line =~ m/^(\S+):\s*(\S+)\s*$/) {
-        my ($type, $transportid) = (lc($1), $2);
-       my $errmsg = undef; # set if you want to skip whole section
-       eval { PVE::JSONSchema::pve_verify_configid($type); };
-       $errmsg = $@ if $@;
-       my $config = {}; # to return additional attributes
-       return ($type, $transportid, $errmsg, $config);
-    }
-    return undef;
-}
-
-sub generate_network_config {
-    my ($class, $plugin_config, $node, $data, $ctime) = @_;
-
-    die "please implement inside plugin";
-}
-
-#helpers
-sub parse_tag_number_or_range {
-    my ($str, $max, $tag) = @_;
-
-    my @elements = split(/,/, $str);
-    my $count = 0;
-    my $allowed = undef;
-
-    die "extraneous commas in list\n" if $str ne join(',', @elements);
-    foreach my $item (@elements) {
-       if ($item =~ m/^([0-9]+)-([0-9]+)$/) {
-           $count += 2;
-           my ($port1, $port2) = ($1, $2);
-           die "invalid port '$port1'\n" if $port1 > $max;
-           die "invalid port '$port2'\n" if $port2 > $max;
-           die "backwards range '$port1:$port2' not allowed, did you mean '$port2:$port1'?\n" if $port1 > $port2;
-
-           if ($tag && $tag >= $port1 && $tag <= $port2){
-               $allowed = 1;
-               last;
-           }
-
-       } elsif ($item =~ m/^([0-9]+)$/) {
-           $count += 1;
-           my $port = $1;
-           die "invalid port '$port'\n" if $port > $max;
-
-           if ($tag && $tag == $port){
-               $allowed = 1;
-               last;
-           }
-       }
-    }
-    die "tag $tag is not allowed" if $tag && !$allowed;
-
-    return (scalar(@elements) > 1);
-}
-
-1;
index 1b8a2cac0f0a94a13e460f8e71a285bdd71d0e9c..72cb0b5bcd4178c9fa7f02faaa0a341ed1404300 100644 (file)
@@ -4,13 +4,13 @@ use strict;
 use warnings;
 use Data::Dumper;
 use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
-use PVE::Network::Plugin;
-use PVE::Network::VlanPlugin;
-use PVE::Network::VxlanMulticastPlugin;
+use PVE::Network::Transport::Plugin;
+use PVE::Network::Transport::VlanPlugin;
+use PVE::Network::Transport::VxlanMulticastPlugin;
 
-PVE::Network::VlanPlugin->register();
-PVE::Network::VxlanMulticastPlugin->register();
-PVE::Network::Plugin->init();
+PVE::Network::Transport::VlanPlugin->register();
+PVE::Network::Transport::VxlanMulticastPlugin->register();
+PVE::Network::Transport::Plugin->init();
 
 
 sub transport_config {
diff --git a/PVE/Network/Transport/Makefile b/PVE/Network/Transport/Makefile
new file mode 100644 (file)
index 0000000..938e87b
--- /dev/null
@@ -0,0 +1,9 @@
+SOURCES=Plugin.pm VlanPlugin.pm  VxlanMulticastPlugin.pm
+
+
+PERL5DIR=${DESTDIR}/usr/share/perl5
+
+.PHONY: install
+install:
+       for i in ${SOURCES}; do install -D -m 0644 $$i ${PERL5DIR}/PVE/Network/Transport/$$i; done
+
diff --git a/PVE/Network/Transport/Plugin.pm b/PVE/Network/Transport/Plugin.pm
new file mode 100644 (file)
index 0000000..dcebbcf
--- /dev/null
@@ -0,0 +1,93 @@
+package PVE::Network::Transport::Plugin;
+
+use strict;
+use warnings;
+
+use PVE::Tools;
+use PVE::JSONSchema;
+use PVE::Cluster;
+
+use Data::Dumper;
+use PVE::JSONSchema qw(get_standard_option);
+use base qw(PVE::SectionConfig);
+
+PVE::Cluster::cfs_register_file('network/transports.cfg',
+                                sub { __PACKAGE__->parse_config(@_); },
+                                sub { __PACKAGE__->write_config(@_); });
+
+my $defaultData = {
+
+    propertyList => {
+       type => { 
+           description => "Plugin type.",
+           type => 'string', format => 'pve-configid',
+           type => 'string',
+       },
+        transport => get_standard_option('pve-transport-id',
+            { completion => \&PVE::Network::Transport::complete_transport }),
+    },
+};
+
+sub private {
+    return $defaultData;
+}
+
+sub parse_section_header {
+    my ($class, $line) = @_;
+
+    if ($line =~ m/^(\S+):\s*(\S+)\s*$/) {
+        my ($type, $transportid) = (lc($1), $2);
+       my $errmsg = undef; # set if you want to skip whole section
+       eval { PVE::JSONSchema::pve_verify_configid($type); };
+       $errmsg = $@ if $@;
+       my $config = {}; # to return additional attributes
+       return ($type, $transportid, $errmsg, $config);
+    }
+    return undef;
+}
+
+sub generate_network_config {
+    my ($class, $plugin_config, $node, $data, $ctime) = @_;
+
+    die "please implement inside plugin";
+}
+
+#helpers
+sub parse_tag_number_or_range {
+    my ($str, $max, $tag) = @_;
+
+    my @elements = split(/,/, $str);
+    my $count = 0;
+    my $allowed = undef;
+
+    die "extraneous commas in list\n" if $str ne join(',', @elements);
+    foreach my $item (@elements) {
+       if ($item =~ m/^([0-9]+)-([0-9]+)$/) {
+           $count += 2;
+           my ($port1, $port2) = ($1, $2);
+           die "invalid port '$port1'\n" if $port1 > $max;
+           die "invalid port '$port2'\n" if $port2 > $max;
+           die "backwards range '$port1:$port2' not allowed, did you mean '$port2:$port1'?\n" if $port1 > $port2;
+
+           if ($tag && $tag >= $port1 && $tag <= $port2){
+               $allowed = 1;
+               last;
+           }
+
+       } elsif ($item =~ m/^([0-9]+)$/) {
+           $count += 1;
+           my $port = $1;
+           die "invalid port '$port'\n" if $port > $max;
+
+           if ($tag && $tag == $port){
+               $allowed = 1;
+               last;
+           }
+       }
+    }
+    die "tag $tag is not allowed" if $tag && !$allowed;
+
+    return (scalar(@elements) > 1);
+}
+
+1;
diff --git a/PVE/Network/Transport/VlanPlugin.pm b/PVE/Network/Transport/VlanPlugin.pm
new file mode 100644 (file)
index 0000000..8ee8bdc
--- /dev/null
@@ -0,0 +1,101 @@
+package PVE::Network::Transport::VlanPlugin;
+
+use strict;
+use warnings;
+use PVE::Network::Transport::Plugin;
+
+use base('PVE::Network::Transport::Plugin');
+
+sub type {
+    return 'vlan';
+}
+
+PVE::JSONSchema::register_format('pve-network-vlanrange', \&pve_verify_network_vlanrange);
+sub pve_verify_network_vlanrange {
+   my ($vlanstr) = @_;
+
+   PVE::Network::Transport::Plugin::parse_tag_number_or_range($vlanstr, '4096');
+
+   return $vlanstr;
+}
+
+sub properties {
+    return {
+       'uplink-id' => {
+           type => 'integer',
+           minimum => 1, maximum => 4096,
+           description => 'Uplink interface',
+       },
+       'vlan-allowed' => {
+           type => 'string', format => 'pve-network-vlanrange',
+           description => "Allowed vlan range",
+       },
+       'vlan-aware' => {
+            type => 'boolean',
+           description => "enable 802.1q stacked vlan",
+       },
+       'vlan-protocol' => {
+           type => 'string',
+            enum => ['802.1q', '802.1ad'],
+           default => '802.1q',
+           optional => 1,
+           description => "vlan protocol",
+       }
+    };
+}
+
+sub options {
+
+    return {
+       'uplink-id' => { optional => 1 },
+        'vlan-allowed' => { optional => 1 },
+       'vlan-protocol' => { optional => 1 },
+       'vlan-aware' => { optional => 1 },
+
+    };
+}
+
+# Plugin implementation
+sub generate_network_config {
+    my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
+
+    my $tag = $vnet->{tag};
+    my $mtu = $vnet->{mtu};
+    my $vlanaware = $plugin_config->{'vlan-aware'};
+    my $vlanprotocol = $plugin_config->{'vlan-protocol'};
+    my $uplink = $plugin_config->{'uplink-id'};
+    my $vlanallowed = $plugin_config->{'vlan-allowed'};
+
+    die "missing vlan tag" if !$tag;
+    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
+
+    eval {
+       PVE::Network::Transport::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag) if $vlanallowed;
+    };
+    if($@) {
+       die "vlan $tag is not allowed in transport $zoneid";
+    }
+
+    my $iface = $uplinks->{$uplink};
+    $iface .= ".$tag";
+
+    my $config = "\n";
+    $config .= "auto $iface\n";
+    $config .= "iface $iface inet manual\n";
+    $config .= "        vlan-protocol $vlanprotocol\n" if $vlanprotocol;
+    $config .= "        mtu $mtu\n" if $mtu;
+    $config .= "\n";
+    $config .= "auto $vnetid\n";
+    $config .= "iface $vnetid inet manual\n";
+    $config .= "        bridge_ports $iface\n";
+    $config .= "        bridge_stp off\n";
+    $config .= "        bridge_fd 0\n";
+    $config .= "        bridge-vlan-aware yes \n" if $vlanaware;
+    $config .= "        mtu $mtu\n" if $mtu;
+
+    return $config;
+}
+
+1;
+
+
diff --git a/PVE/Network/Transport/VxlanMulticastPlugin.pm b/PVE/Network/Transport/VxlanMulticastPlugin.pm
new file mode 100644 (file)
index 0000000..c6fa29d
--- /dev/null
@@ -0,0 +1,85 @@
+package PVE::Network::Transport::VxlanMulticastPlugin;
+
+use strict;
+use warnings;
+use PVE::Network::Transport::Plugin;
+
+use base('PVE::Network::Transport::Plugin');
+
+PVE::JSONSchema::register_format('pve-network-vxlanrange', \&pve_verify_network_vxlanrange);
+sub pve_verify_network_vxlanrange {
+   my ($vxlanstr) = @_;
+
+   PVE::Network::Transport::Plugin::parse_tag_number_or_range($vxlanstr, '16777216');
+
+   return $vxlanstr;
+}
+
+sub type {
+    return 'vxlanmulticast';
+}
+
+sub properties {
+    return {
+        'vxlan-allowed' => {
+            type => 'string', format => 'pve-network-vxlanrange',
+            description => "Allowed vlan range",
+        },
+        'multicast-address' => {
+            description => "Multicast address.",
+            type => 'string',  #fixme: format 
+        },
+
+    };
+}
+
+sub options {
+
+    return {
+       'uplink-id' => { optional => 1 },
+        'multicast-address' => { fixed => 1 },
+        'vxlan-allowed' => { optional => 1 },
+    };
+}
+
+# Plugin implementation
+sub generate_network_config {
+    my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
+
+    my $tag = $vnet->{tag};
+    my $mtu = $vnet->{mtu};
+    my $multicastaddress = $plugin_config->{'multicast-address'};
+    my $uplink = $plugin_config->{'uplink-id'};
+    my $vxlanallowed = $plugin_config->{'vxlan-allowed'};
+
+    die "missing vxlan tag" if !$tag;
+    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
+    my $iface = $uplinks->{$uplink};
+
+    eval {
+       PVE::Network::Transport::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag) if $vxlanallowed;
+    };
+    if($@) {
+       die "vlan $tag is not allowed in transport $zoneid";
+    }
+
+    my $config = "\n";
+    $config .= "auto vxlan$vnetid\n";
+    $config .= "iface vxlan$vnetid inet manual\n";
+    $config .= "       vxlan-id $tag\n" if $tag;
+    $config .= "       vxlan-svcnodeip $multicastaddress\n" if $multicastaddress;
+    $config .= "       vxlan-physdev $iface\n" if $iface;
+    $config .= "\n";
+    $config .= "auto $vnetid\n";
+    $config .= "iface $vnetid inet manual\n";
+    $config .= "        bridge_ports vxlan$vnetid\n";
+    $config .= "        bridge_stp off\n";
+    $config .= "        bridge_fd 0\n";
+    $config .= "        mtu $mtu\n" if $mtu;
+
+    return $config;
+}
+
+1;
+
+
diff --git a/PVE/Network/VlanPlugin.pm b/PVE/Network/VlanPlugin.pm
deleted file mode 100644 (file)
index 7d64549..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-package PVE::Network::VlanPlugin;
-
-use strict;
-use warnings;
-use PVE::Network::Plugin;
-
-use base('PVE::Network::Plugin');
-
-sub type {
-    return 'vlan';
-}
-
-PVE::JSONSchema::register_format('pve-network-vlanrange', \&pve_verify_network_vlanrange);
-sub pve_verify_network_vlanrange {
-   my ($vlanstr) = @_;
-
-   PVE::Network::Plugin::parse_tag_number_or_range($vlanstr, '4096');
-
-   return $vlanstr;
-}
-
-sub properties {
-    return {
-       'uplink-id' => {
-           type => 'integer',
-           minimum => 1, maximum => 4096,
-           description => 'Uplink interface',
-       },
-       'vlan-allowed' => {
-           type => 'string', format => 'pve-network-vlanrange',
-           description => "Allowed vlan range",
-       },
-       'vlan-aware' => {
-            type => 'boolean',
-           description => "enable 802.1q stacked vlan",
-       },
-       'vlan-protocol' => {
-           type => 'string',
-            enum => ['802.1q', '802.1ad'],
-           default => '802.1q',
-           optional => 1,
-           description => "vlan protocol",
-       }
-    };
-}
-
-sub options {
-
-    return {
-       'uplink-id' => { optional => 1 },
-        'vlan-allowed' => { optional => 1 },
-       'vlan-protocol' => { optional => 1 },
-       'vlan-aware' => { optional => 1 },
-
-    };
-}
-
-# Plugin implementation
-sub generate_network_config {
-    my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
-
-    my $tag = $vnet->{tag};
-    my $mtu = $vnet->{mtu};
-    my $vlanaware = $plugin_config->{'vlan-aware'};
-    my $vlanprotocol = $plugin_config->{'vlan-protocol'};
-    my $uplink = $plugin_config->{'uplink-id'};
-    my $vlanallowed = $plugin_config->{'vlan-allowed'};
-
-    die "missing vlan tag" if !$tag;
-    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
-
-    eval {
-       PVE::Network::Plugin::parse_tag_number_or_range($vlanallowed, '4096', $tag) if $vlanallowed;
-    };
-    if($@) {
-       die "vlan $tag is not allowed in transport $zoneid";
-    }
-
-    my $iface = $uplinks->{$uplink};
-    $iface .= ".$tag";
-
-    my $config = "\n";
-    $config .= "auto $iface\n";
-    $config .= "iface $iface inet manual\n";
-    $config .= "        vlan-protocol $vlanprotocol\n" if $vlanprotocol;
-    $config .= "        mtu $mtu\n" if $mtu;
-    $config .= "\n";
-    $config .= "auto $vnetid\n";
-    $config .= "iface $vnetid inet manual\n";
-    $config .= "        bridge_ports $iface\n";
-    $config .= "        bridge_stp off\n";
-    $config .= "        bridge_fd 0\n";
-    $config .= "        bridge-vlan-aware yes \n" if $vlanaware;
-    $config .= "        mtu $mtu\n" if $mtu;
-
-    return $config;
-}
-
-1;
-
-
index bac1a8cf5fce0b77932d8aa799744719777b681a..8d4a8181063f62171e7f8736f771b250a2fdd260 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES=Plugin.pm VlanPlugin.pm
+SOURCES=Plugin.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
diff --git a/PVE/Network/VxlanMulticastPlugin.pm b/PVE/Network/VxlanMulticastPlugin.pm
deleted file mode 100644 (file)
index 3aa6e35..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-package PVE::Network::VxlanMulticastPlugin;
-
-use strict;
-use warnings;
-use PVE::Network::Plugin;
-
-use base('PVE::Network::Plugin');
-
-PVE::JSONSchema::register_format('pve-network-vxlanrange', \&pve_verify_network_vxlanrange);
-sub pve_verify_network_vxlanrange {
-   my ($vxlanstr) = @_;
-
-   PVE::Network::Plugin::parse_tag_number_or_range($vxlanstr, '16777216');
-
-   return $vxlanstr;
-}
-
-sub type {
-    return 'vxlanmulticast';
-}
-
-sub properties {
-    return {
-        'vxlan-allowed' => {
-            type => 'string', format => 'pve-network-vxlanrange',
-            description => "Allowed vlan range",
-        },
-        'multicast-address' => {
-            description => "Multicast address.",
-            type => 'string',  #fixme: format 
-        },
-
-    };
-}
-
-sub options {
-
-    return {
-       'uplink-id' => { optional => 1 },
-        'multicast-address' => { fixed => 1 },
-        'vxlan-allowed' => { optional => 1 },
-    };
-}
-
-# Plugin implementation
-sub generate_network_config {
-    my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $uplinks) = @_;
-
-    my $tag = $vnet->{tag};
-    my $mtu = $vnet->{mtu};
-    my $multicastaddress = $plugin_config->{'multicast-address'};
-    my $uplink = $plugin_config->{'uplink-id'};
-    my $vxlanallowed = $plugin_config->{'vxlan-allowed'};
-
-    die "missing vxlan tag" if !$tag;
-    die "uplink $uplink is not defined" if !$uplinks->{$uplink};
-    my $iface = $uplinks->{$uplink};
-
-    eval {
-       PVE::Network::Plugin::parse_tag_number_or_range($vxlanallowed, '16777216', $tag) if $vxlanallowed;
-    };
-    if($@) {
-       die "vlan $tag is not allowed in transport $zoneid";
-    }
-
-    my $config = "\n";
-    $config .= "auto vxlan$vnetid\n";
-    $config .= "iface vxlan$vnetid inet manual\n";
-    $config .= "       vxlan-id $tag\n" if $tag;
-    $config .= "       vxlan-svcnodeip $multicastaddress\n" if $multicastaddress;
-    $config .= "       vxlan-physdev $iface\n" if $iface;
-    $config .= "\n";
-    $config .= "auto $vnetid\n";
-    $config .= "iface $vnetid inet manual\n";
-    $config .= "        bridge_ports vxlan$vnetid\n";
-    $config .= "        bridge_stp off\n";
-    $config .= "        bridge_fd 0\n";
-    $config .= "        mtu $mtu\n" if $mtu;
-
-    return $config;
-}
-
-1;
-
-