Infoblox perl api错误1002-创建DNS区域时缺少参数或参数不正确

Infoblox perl api错误1002-创建DNS区域时缺少参数或参数不正确,perl,Perl,我正在设置一个perl脚本,用于与一些运行NIOS5.1的infoblox设备通信,下面的代码部分让我感到困惑。此零件用于创建反向区域记录 有人指出我可能做错了什么吗 #!/usr/bin/perl require Infoblox; use Getopt::Std; use Term::GetKey; use JSON; use Data::Dumper; use VCIM qw ( load_config getline unpack_netmask pack_netmask validat

我正在设置一个perl脚本,用于与一些运行NIOS5.1的infoblox设备通信,下面的代码部分让我感到困惑。此零件用于创建反向区域记录

有人指出我可能做错了什么吗

#!/usr/bin/perl
require Infoblox;
use Getopt::Std;
use Term::GetKey;
use JSON;
use Data::Dumper;
use VCIM qw ( load_config getline unpack_netmask pack_netmask validate_netmask validate_vlan        get_first_ip get_last_ip get_next_ip dprint
write_config i18n hash_merge dqtobin bintodq binmax binmin ip_is_used );

my $DEBUG=1;
my $overwrite=0;

my $match;

my %options;
getopts('yp:', \%options);

if (defined $options{'y'}) {
$overwrite = 1;
}

# read settings from settings.conf
my %config;
%config = %{load_config()};

# acquire infoblox handle
dprint("\nConnecting to $infobloxip as $infobloxuser" . ($infobloxpass eq 'default' ? " using     default password 'default'":"")."\n");
my $ibh = Infoblox::Session->new(
master => $infobloxip,
password => $infobloxpass,
username => $infobloxuser
);
my @searchres = $ibh->search(
"object" => "Infoblox::Grid::Member",
"name" => ".*"
);
unless (@searchres) {
if ( defined $config{'credentials'}{'infobloxPass'} ) {
dprint("Connection failed. (Status Code " . $ibh->status_code() . ": " . $ibh->status_detail() . ").\n");
dprint("Trying again. Will use config password instead.\n");
$infobloxpass = $config{'credentials'}{'infobloxPass'};
$ibh = Infoblox::Session->new(
  master => $infobloxip,
  password => $infobloxpass,
  username => $infobloxuser);
@searchres = $ibh->search(
  "object" => "Infoblox::Grid::Member",
  "name" => ".*"
);
unless (@searchres) {
  die ($ibh->status_code() . ':' . $ibh->status_detail());
}
} else {
die ($ibh->status_code() . ':' . $ibh->status_detail());
}
}

sub create_zones {
my $oct0 = shift;
my $oct1 = shift;
my $oct2 = shift;
my $netbits = shift;
$netbits = ($netbits>24?24:$netbits);
#one network for /8, /16, /24, or  2^x where x is each bit less than the classful boundary
$networks = ($netbits%8==0?1:(2**(8-($netbits%8))));
my $snb = ($netbits<24 && $netbits>16 ? \$oct2 : ($netbits > 8 ? \$oct1 : \$oct0));
for (my $i=0;$i<$networks;$i++) {
if ($i>0) {
${$snb}++;
}
dprint("Creating Reverse zone $oct2.$oct1.$oct0.in-addr.arpa... ");
my $newzone = Infoblox::DNS::Zone->new(
name  => $oct2.".".$oct1.".".$oct0."."."0"."/".($netbits%8==0?$netbits:$netbits + (8 - ($netbits%8))),
enable_rfc2317_exclusion => "true",
disable => "false",
primary => $dns_member
);
unless (my $response = $ibh->add($newzone)) {
  unless ($ibh->status_code() == 1005) {
    die ($ibh->status_code() . ":" . $ibh->status_detail());
  }
#/usr/bin/perl
需要Infoblox;
使用Getopt::Std;
使用Term::GetKey;
使用JSON;
使用数据::转储程序;
使用VCIM qw(加载配置getline解包网络掩码包网络掩码验证vlan获取第一个ip获取最后一个ip获取下一个ip数据点
写入配置i18n散列(使用合并dqtobin bintodq binmax binmin ip);
我的$DEBUG=1;
我的$overwrite=0;
我的$match;
我的%选择;
getopts('yp:',\%options);
if(定义的$options{'y'}){
$overwrite=1;
}
#从settings.conf读取设置
我的%config;
%config=%{load_config()};
#获取infoblox句柄
dprint(“\n以$infobloxuser的身份连接到$infobloxip”。($infobloxpasseq'default'?”使用默认密码'default':)。“\n”);
my$ibh=Infoblox::Session->new(
master=>infobloxip美元,
密码=>$infobloxpass,
用户名=>$infobloxuser
);
my@searchres=$ibh->search(
“对象”=>“Infoblox::Grid::Member”,
“名称”=>“*”
);
除非(@searchres){
if(定义为$config{'credentials'}{'infobloxPass'}){
dprint(“连接失败。(状态代码“$ibh->状态代码()”:“$ibh->状态详细信息()”)。\n”);
dprint(“重试。将改用配置密码。\n”);
$infobloxpass=$config{'credentials'}{'infobloxpass'};
$ibh=Infoblox::Session->new(
master=>infobloxip美元,
密码=>$infobloxpass,
用户名=>$infobloxuser);
@searchres=$ibh->search(
“对象”=>“Infoblox::Grid::Member”,
“名称”=>“*”
);
除非(@searchres){
模具($ibh->status_code()。:'。$ibh->status_detail());
}
}否则{
模具($ibh->status_code()。:'。$ibh->status_detail());
}
}
创建子分区{
我的$oct0=班次;
我的$oct1=班次;
我的$oct2=班次;
我的$netbits=shift;
$netbits=($netbits>24-24:$netbits);
#一个用于/8、/16、/24或2^x的网络,其中x的每一位都小于类边界
$networks=($netbits%8==0?1:(2**(8-($netbits%8)));
我的$snb=($netbits16?\$oct2:($netbits>8?\$oct1:\$oct0));
对于(我的$i=0;我的$i0){
${$snb}++;
}
dprint(“创建反向区域$oct2.$oct1.$oct0.in addr.arpa…”);
我的$newzone=Infoblox::DNS::Zone->new(
name=>$oct2..“$oct1..”$oct0.“.0.”/“($netbits%8==0?$netbits:$netbits+(8-($netbits%8))),
启用\u rfc2317 \u排除=>“true”,
disable=>“false”,
主要=>$dns\u成员
);
除非(my$response=$ibh->add($newzone)){
除非($ibh->状态代码()==1005){
模具($ibh->status_code()。”:“$ibh->status_detail());
}

完整的错误代码是
1002:请求中的一个或多个参数在infobloxSetup.pl第601行、第657行丢失或不正确。

结果表明它与perl无关,问题是在我使用的API版本中不支持enablerfc2317_exclusion=>“true”。

写得更好,“$oct2.$oct1.$oct0.0/”。不过,你可能应该在问题上投入比代码更多的东西。这就像把车开到车库说“修好”包括所有错误消息、您的预期输出、实际输出、一些测试数据等。谢谢。原来它与perl无关,问题是enable_rfc2317_exclusion=>“true”在我使用的API版本中不受支持,它是为较新的Infoblox版本编写的。