]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Ipams/NetboxPlugin.pm
ipams: add mac address
[pve-network.git] / PVE / Network / SDN / Ipams / NetboxPlugin.pm
index 298634d32657d86f2b8ee79ae7d64f0b1da78be5..3c9921865b5177c2331b452c7a303652f1709d2e 100644 (file)
@@ -77,13 +77,14 @@ sub del_subnet {
 }
 
 sub add_ip {
-    my ($class, $plugin_config, $subnetid, $subnet, $ip, $hostname, $description, $is_gateway) = @_;
+    my ($class, $plugin_config, $subnetid, $subnet, $ip, $hostname, $mac, $description, $is_gateway) = @_;
 
     my $mask = $subnet->{mask};
     my $url = $plugin_config->{url};
     my $token = $plugin_config->{token};
     my $section = $plugin_config->{section};
     my $headers = ['Content-Type' => 'application/json; charset=UTF-8', 'Authorization' => "token $token"];
+    $description .= " mac:$mac" if $mac && $description;
 
     my $params = { address => "$ip/$mask", dns_name => $hostname, description => $description };
 
@@ -97,7 +98,7 @@ sub add_ip {
 }
 
 sub add_next_freeip {
-    my ($class, $plugin_config, $subnetid, $subnet, $hostname, $description) = @_;
+    my ($class, $plugin_config, $subnetid, $subnet, $hostname, $mac, $description) = @_;
 
     my $cidr = $subnet->{cidr};
 
@@ -106,6 +107,7 @@ sub add_next_freeip {
     my $headers = ['Content-Type' => 'application/json; charset=UTF-8', 'Authorization' => "token $token"];
 
     my $internalid = get_prefix_id($url, $cidr, $headers);
+    $description .= " mac:$mac" if $mac && $description;
 
     my $params = { dns_name => $hostname, description => $description };