}
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 $cidr = $subnet->{cidr};
my $url = $plugin_config->{url};
my $params = { ip => $ip,
subnetId => $internalid,
is_gateway => $is_gateway,
+ hostname => $hostname,
+ description => $description,
};
+ $params->{mac} = $mac if $mac;
eval {
PVE::Network::SDN::Ipams::Plugin::api_request("POST", "$url/addresses/", $headers, $params);
}
sub add_next_freeip {
- my ($class, $plugin_config, $subnetid, $subnet, $internalid, $hostname) = @_;
+ my ($class, $plugin_config, $subnetid, $subnet, $hostname, $mac, $description) = @_;
my $cidr = $subnet->{cidr};
my $mask = $subnet->{mask};
my $section = $plugin_config->{section};
my $headers = ['Content-Type' => 'application/json; charset=UTF-8', 'Token' => $token];
- $internalid = get_internalid($url, $cidr, $headers) if !$internalid;
+ my $internalid = get_internalid($url, $cidr, $headers);
+
+ my $params = { hostname => $hostname,
+ description => $description,
+ };
- my $params = {};
+ $params->{mac} = $mac if $mac;
my $ip = undef;
eval {