}
sub add_ip {
- my ($class, $plugin_config, $subnetid, $subnet, $ip, $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" };
+ my $params = { address => "$ip/$mask", dns_name => $hostname, description => $description };
eval {
PVE::Network::SDN::Ipams::Plugin::api_request("POST", "$url/ipam/ip-addresses/", $headers, $params);
}
sub add_next_freeip {
- my ($class, $plugin_config, $subnetid, $subnet) = @_;
+ my ($class, $plugin_config, $subnetid, $subnet, $hostname, $mac, $description) = @_;
my $cidr = $subnet->{cidr};
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 = {};
+ my $params = { dns_name => $hostname, description => $description };
my $ip = undef;
eval {