mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-21 19:22:05 +00:00
REST API node automated testcases
This commit is contained in:
parent
4c8c68efb3
commit
4f58fb8c0c
@ -229,9 +229,10 @@ For example, to run rscan command against the hardware control point of compute
|
||||
.. code-block:: perl
|
||||
|
||||
rscan __GETNODEATTR($$CN, hcp)__ -z
|
||||
3. B<GETTABLEVALUE(keyname, key, colname, table)> To get the value of column where keyname == key in specified table.
|
||||
|
||||
|
||||
3. \ **GETTABLEVALUE(keyname, key, colname, table)**\ To get the value of column where keyname == key in specified table.
|
||||
|
||||
|
||||
*****
|
||||
FILES
|
||||
|
@ -1,99 +1,82 @@
|
||||
start:node_post
|
||||
description: node_post
|
||||
cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
|
||||
start:create_node_rest
|
||||
description: create a node with REST API
|
||||
cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
start:node_post2
|
||||
description: node_post2
|
||||
cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
|
||||
check:rc==403
|
||||
cmdcheck:restapitest -o '{"errorcode":"1"}' -O ==
|
||||
start:create_node_rest2
|
||||
description: create a node with REST API failure
|
||||
cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
|
||||
check:rc==147
|
||||
check:output=~'errorcode' => '1'
|
||||
end
|
||||
|
||||
|
||||
start:node_put
|
||||
description: node_put
|
||||
cmd:restapitest -m PUT -r /nodes/node1 -d '{"mgt":"hmc","netboot":"xnba"}'
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
|
||||
|
||||
start:nodes_get
|
||||
description: nodes_get
|
||||
start:get_nodes_rest
|
||||
description: get all nodes with REST API
|
||||
cmd:restapitest -m GET -r /nodes
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '["node1"]' -O ==
|
||||
check:output=~'restnode'
|
||||
end
|
||||
|
||||
start:node_get
|
||||
description: node_get
|
||||
cmd:restapitest -m GET -r /nodes/node1
|
||||
start:get_node_rest
|
||||
description: get single node with REST API
|
||||
cmd:restapitest -m GET -r /nodes/restnode
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"node1":{"netboot":"xnba"}}' -O ==
|
||||
check:output=~'restnode'
|
||||
end
|
||||
|
||||
start:node_delete
|
||||
description: node_delete
|
||||
cmd:restapitest -m DELETE -r /nodes/node1
|
||||
start:node_delete_rest
|
||||
description: delete node with REST API
|
||||
cmd:restapitest -m DELETE -r /nodes/restnode
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
start:nodes_get2
|
||||
description: nodes_get2
|
||||
start:get_nodes_rest2
|
||||
description: get all nodes with REST API
|
||||
cmd:restapitest -m GET -r /nodes
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '["node1"]' -O !=
|
||||
check:output!~'restnode'
|
||||
end
|
||||
|
||||
start:node_get2
|
||||
description: node_get2
|
||||
cmd:restapitest -m GET -r /nodes/node1
|
||||
check:rc==403
|
||||
cmdcheck:restapitest -o '{"errorcode":"1"}' -O ==
|
||||
start:get_node_rest2
|
||||
description: get single node with REST API
|
||||
cmd:restapitest -m GET -r /nodes/restnode
|
||||
check:rc==147
|
||||
check:output=~'errorcode' => '1'
|
||||
end
|
||||
|
||||
start:node_post3_for_get_test
|
||||
description: node_post3_for_get_test
|
||||
cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
|
||||
start:create_node_token_rest
|
||||
description: create a node with REST API using authentication token
|
||||
cmd:restapitest -m POST -r /nodes/restnode -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}' -t
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
start:node_attr_get
|
||||
description: node_get2
|
||||
cmd:restapitest -m GET -r /nodes/node1/attrs/mgt,groups,netboot
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"node1":{"netboot":"yaboot"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_makehosts
|
||||
description: node_makehosts
|
||||
cmd:restapitest -m POST -r /nodes/node1/host
|
||||
start:node_makehosts_rest
|
||||
description: makehosts for node with REST API
|
||||
cmd:restapitest -m POST -r /nodes/restnode/host
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
start:node_makedns
|
||||
description: node_makehosts
|
||||
cmd:restapitest -m POST -r /nodes/node1/dns
|
||||
start:node_makedns_rest
|
||||
description: makehosts for node with REST API
|
||||
cmd:restapitest -m POST -r /nodes/restnode/dns
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
|
||||
start:node_delete_dns
|
||||
description: node_delete_dns
|
||||
cmd:restapitest -m DELETE -r /nodes/node1/dns
|
||||
start:node_delete_dns_rest
|
||||
description: delete dns for node with REST API
|
||||
cmd:restapitest -m DELETE -r /nodes/restnode/dns
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
start:node_put
|
||||
description: node_put
|
||||
cmd:restapitest -m PUT -r /nodes/node1 -d '{"mac":"00:1a:64:54:14:80"}'
|
||||
start:node_change_attr_rest
|
||||
description: change node attribute with REST API
|
||||
cmd:restapitest -m PUT -r /nodes/restnode -d '{"mac":"00:1a:64:54:14:80"}'
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
start:node_makedhcp
|
||||
description: node_makedhcp
|
||||
start:node_makedhcp_rest
|
||||
description: makedhcp for node with REST API
|
||||
cmd:restapitest -m POST -r /nodes/node1/dhcp
|
||||
check:rc==201
|
||||
end
|
||||
@ -104,139 +87,18 @@ cmd:restapitest -m DELETE -r /nodes/node1/dhcp
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
start:node_state
|
||||
description: node_state
|
||||
cmd:restapitest -m GET -r /nodes/node1/nodestat
|
||||
start:node_state_rest
|
||||
description: get node state with REST API
|
||||
cmd:restapitest -m GET -r /nodes/restnode/nodestat
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"node1":{"nodestat":"ANY"}}' -O ==
|
||||
check:output=~'restnode'
|
||||
check:output=~'nodestat'
|
||||
end
|
||||
|
||||
|
||||
#start:node_post4_for_scan_test
|
||||
#description: node_post4_for_scan_test
|
||||
#cmd:restapitest -m POST -r /nodes/e108m6hmc02 -d '{"groups":"all,hmc","mgt":"hmc","hwtype":"hmc","mtm":"7042CR4","serial":"1050FBB","nodetype":"ppc"}'
|
||||
#check:rc==201
|
||||
#end
|
||||
|
||||
start:node_scan
|
||||
description: node_scan
|
||||
cmd:restapitest -m GET -r /nodes/__GETNODEATTR($$CN,hcp)__
|
||||
start:node_state_token_rest
|
||||
description: get node state with REST API using authentication token
|
||||
cmd:restapitest -m GET -r /nodes/restnode/nodestat -t
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"__GETNODEATTR($$CN,hcp)__":"ANY"}' -O ==
|
||||
check:output=~'restnode'
|
||||
check:output=~'nodestat'
|
||||
end
|
||||
|
||||
|
||||
start:node_power_get
|
||||
description: node_power_get
|
||||
cmd:restapitest -m GET -r /nodes/$$CN/power
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"$$CN":{"power":"ANY"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_power_put
|
||||
description: node_power_reset
|
||||
cmd:restapitest -m PUT -r /nodes/$$CN/power -d '{"action":"reset"}'
|
||||
check:rc==200
|
||||
end
|
||||
|
||||
#start:node_energy_put
|
||||
#description: node_energy_put
|
||||
#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}'
|
||||
#check:rc==200
|
||||
#end
|
||||
|
||||
#start:node_energy_get
|
||||
#description: node_energy_get
|
||||
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy
|
||||
#check:rc==200
|
||||
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O ==
|
||||
#end
|
||||
|
||||
#start:node_energy_get_attr
|
||||
#description: node_energy_get_attr
|
||||
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus
|
||||
#check:rc==200
|
||||
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O ==
|
||||
#end
|
||||
|
||||
#start:node_get_attr
|
||||
#description: node_get_attr
|
||||
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community
|
||||
#check:rc==200
|
||||
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O ==
|
||||
#end
|
||||
|
||||
#start:node_put_attr
|
||||
#description: node_put_attr
|
||||
#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}''
|
||||
#check:rc==200
|
||||
#end
|
||||
|
||||
#start:node_put_nextboot
|
||||
#description: node_put_nextboot
|
||||
#cmd:restapitest -m PUT -r /nodes/$$CN/nextboot -d '{"order":"net"}'
|
||||
#check:rc==201
|
||||
#end
|
||||
|
||||
#start:node_get_nextboot
|
||||
#description: node_get_nextboot
|
||||
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot
|
||||
#check:rc==200
|
||||
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O ==
|
||||
#end
|
||||
|
||||
start:node_put_bootstate
|
||||
description: node_put_bootstate
|
||||
cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/bootstate -d '{"osimage":"rhels6.4-x86_64-install-compute"}'
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
start:node_get_bootstate
|
||||
description: node_get_bootstate
|
||||
cmd:restapitest -m GET -r /nodes/$$CN/bootstate
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"$$CN":{"bootstat":"ANY"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_get_vitals
|
||||
description: node_get_vitals
|
||||
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/vitals
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"Vc68m5sn01":{"SysBrd Fault":"0"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_get_vitals_attr
|
||||
description: node_get_vitals_attr
|
||||
cmd:restapitest -m GET -r /nodes/$$CN/vitals/all
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"$$CN":{"System Temperature":"ANY"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_get_inventory
|
||||
description: node_get_inventory
|
||||
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"Vc68m5sn01":{"Power Supply 2 Board FRU Number":"94Y8105"}}' -O ==
|
||||
end
|
||||
|
||||
start:node_get_inventory_attr
|
||||
description: node_get_inventory_attr
|
||||
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/inventory/model
|
||||
check:rc==200
|
||||
cmdcheck:restapitest -o '{"Vc68m5sn01":{"System Description":"System x3650 M4"}}' -O ==
|
||||
end
|
||||
|
||||
#start:node_get_eventlog
|
||||
#description: node_get_eventlog
|
||||
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog
|
||||
#check:rc==200
|
||||
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O ==
|
||||
#end
|
||||
|
||||
start:node_post_nodecopy
|
||||
description: node_post_nodecopy
|
||||
cmd:restapitest -m POST -r /nodes/$$CN/nodecopy -d '{"src":["/etc/hosts","/etc/resolv.conf"],"target":"/tmp"}'
|
||||
check:rc==201
|
||||
end
|
||||
|
||||
|
||||
|
@ -151,6 +151,7 @@ The xCAT-test testing framework provides some inline functions. The inline funct
|
||||
For example, to run rscan command against the hardware control point of compute node specified in the configuration file:
|
||||
|
||||
rscan __GETNODEATTR($$CN, hcp)__ -z
|
||||
|
||||
3. B<GETTABLEVALUE(keyname, key, colname, table)> To get the value of column where keyname == key in specified table.
|
||||
|
||||
=head1 FILES
|
||||
|
@ -4,14 +4,14 @@
|
||||
# Flags are used for test input:
|
||||
# -m method. Should be GET, POST, PUT, DELETE
|
||||
# -r resource
|
||||
# -t token
|
||||
# -t
|
||||
# -h host
|
||||
# -u user
|
||||
# -p passwd
|
||||
# -P port (BC)
|
||||
# -d data
|
||||
# -c cert
|
||||
# -n hostname
|
||||
# --debug
|
||||
# Flags are used for check output:
|
||||
# -o expected output
|
||||
# -O logical operator
|
||||
@ -36,6 +36,7 @@ use strict;
|
||||
my $help;
|
||||
my $method;
|
||||
my $token;
|
||||
my $usetoken;
|
||||
my $resource;
|
||||
my $host;
|
||||
my $user;
|
||||
@ -43,7 +44,6 @@ my $passwd;
|
||||
my $port;
|
||||
my $data;
|
||||
my $cert;
|
||||
my $hostname;
|
||||
my $output;
|
||||
my $loperator;
|
||||
my $debug;
|
||||
@ -54,7 +54,7 @@ my $outputfile = "/tmp/testrestapiresult";
|
||||
if (
|
||||
!GetOptions("h|?" => \$help,
|
||||
"m=s" => \$method,
|
||||
"t=s" => \$token,
|
||||
"t" => \$usetoken, # use generated token instead of the user/pw
|
||||
"r=s" => \$resource,
|
||||
"h=s" => \$host,
|
||||
"u=s" => \$user,
|
||||
@ -62,7 +62,6 @@ if (
|
||||
"P=s" => \$port,
|
||||
"d=s" => \$data,
|
||||
"c=s" => \$cert,
|
||||
"n=s" => \$hostname,
|
||||
"o=s" => \$output,
|
||||
"O=s" => \$loperator,
|
||||
"debug" => \$debug,
|
||||
@ -131,52 +130,46 @@ while (<CONF>) {
|
||||
}
|
||||
}
|
||||
|
||||
# get token
|
||||
my $defaultserver = $confhash{DefaultServer};
|
||||
my $defaultuser = $confhash{DefaultUser1};
|
||||
my $DefaultPasswd = $confhash{DefaultPasswd1};
|
||||
my $gettoken = `curl -X POST -k 'https://$defaultserver/xcatws/tokens?userName=$defaultuser&password=$DefaultPasswd' -H Content-Type:application/json --data '{"userName":"$defaultuser","password":"$DefaultPasswd"}' 2>/dev/null`;
|
||||
my $reshash = parse_json($gettoken);
|
||||
my $token1 = $$reshash{token}{id};
|
||||
|
||||
# get hostname
|
||||
unless ($hostname) {
|
||||
$hostname = `hostname`;
|
||||
chomp($hostname);
|
||||
}
|
||||
unless ($defaultserver) {
|
||||
# get hostname or default to local host if not specified
|
||||
unless ($host) {
|
||||
$host = "127.0.0.1";
|
||||
} else {
|
||||
$host = $defaultserver;
|
||||
}
|
||||
|
||||
# keey default test result for save
|
||||
my $res = run_restapi($method, $resource, $data, "", $port, "$host", "$defaultuser", "$DefaultPasswd");
|
||||
unless ($user) {
|
||||
$user = $confhash{DefaultUser1};
|
||||
}
|
||||
unless ($passwd) {
|
||||
$passwd = $confhash{DefaultPasswd1};
|
||||
}
|
||||
my $DefaultPasswd = $confhash{DefaultPasswd1};
|
||||
|
||||
if ($usetoken) {
|
||||
# get token
|
||||
my $gettoken = `curl -X POST -k 'https://$host/xcatws/tokens' -H Content-Type:application/json --data '{"userName":"$user","userPW":"$passwd"}' 2>/dev/null`;
|
||||
my $reshash = parse_json($gettoken);
|
||||
$token = $$reshash{token}{id};
|
||||
}
|
||||
|
||||
# debug and log info
|
||||
log_debug(3, "User $user. \n");
|
||||
log_debug(3, "Password $passwd. \n");
|
||||
log_debug(3, "Host $host. \n");
|
||||
log_debug(3, "Got token $token. \n");
|
||||
log_debug(3, "get path of ca $confhash{Cert} \n");
|
||||
|
||||
my $res = run_restapi($method, $resource, $data, "", $port, "$host", "$user", "$passwd", "$token");
|
||||
$defaulthash = parse_json($res);
|
||||
$defaulthttpresult = check_errcode();
|
||||
|
||||
# debug and log info
|
||||
log_debug(3, "get token $token1. \n");
|
||||
log_debug(3, "get first default user $confhash{DefaultUser1} \n");
|
||||
log_debug(3, "get first default user's passwd is $confhash{DefaultPasswd1} \n");
|
||||
log_debug(3, "get second default user $confhash{DefaultUser2} \n");
|
||||
log_debug(3, "get second default user's passwd is $confhash{DefaultPasswd2} \n");
|
||||
log_debug(3, "get path of ca $confhash{Cert} \n");
|
||||
log_debug(3, "get server $defaultserver from configuration file and it is $host\n");
|
||||
log_debug(3, "get hostname $hostname.\n");
|
||||
log_debug(3, "default result is $res. \n");
|
||||
log_debug(3, "default resulthash is: \n");
|
||||
log_debug(3, $defaulthash);
|
||||
log_debug(3, "default errcode is $defaulthttpresult \n");
|
||||
log_debug(3, "**************begin to run more restapi test, stop when post***************");
|
||||
|
||||
print Dumper $defaulthash;
|
||||
exit $defaulthttpresult;
|
||||
|
||||
####################################################
|
||||
# Begin to run test cases
|
||||
####################################################
|
||||
my @users = ($confhash{DefaultUser1}, $confhash{DefaultUser2}, $user);
|
||||
my @passwds = ($confhash{DefaultPasswd1}, $confhash{DefaultPasswd2}, $passwd);
|
||||
my @tokens = ("", $token1, $token);
|
||||
my @tokens = ("", $token, $token);
|
||||
my @certs = ("", $confhash{Cert}, $cert);
|
||||
my $i = 0;
|
||||
unless ($method eq "POST") { # Should not post sevral times
|
||||
@ -235,7 +228,7 @@ sub usage
|
||||
print " testrestapi [-?|-h]\n";
|
||||
print " testrestapi [-m method] [-r resource] [-t tocken]\n";
|
||||
print " [-h host] [-P port][-u user] [-p passwd]\n";
|
||||
print " [-d data] [-c cert] [-n hostname]\n";
|
||||
print " [-d data] [-c cert] \n";
|
||||
print " [-o expect_output] [-O logical_operator] \n";
|
||||
print " [--debug]\n";
|
||||
print "\n";
|
||||
@ -287,18 +280,14 @@ sub run_restapi
|
||||
if ($t) {
|
||||
$cmd .= " -H X-Auth-Token:$t ";
|
||||
}
|
||||
if ($t or $c) {
|
||||
$cmd .= " 'https://$hostname";
|
||||
} else {
|
||||
$cmd .= " 'https://$h";
|
||||
}
|
||||
$cmd .= " 'https://$h";
|
||||
if ($p) {
|
||||
$cmd .= ":$p";
|
||||
}
|
||||
$cmd .= "/xcatws";
|
||||
$cmd .= "$r?";
|
||||
unless ($t) {
|
||||
$cmd .= "userName=$u&password=$a'";
|
||||
$cmd .= "userName=$u&userPW=$a'";
|
||||
} else {
|
||||
$cmd .= "'";
|
||||
}
|
||||
@ -331,7 +320,7 @@ sub parse_json
|
||||
# {"networks":[{"mgtifname":"eth1","mask":"255.255.255.0"},{"mgtifname":"eth1","mask":"255.255.255.0"}]}
|
||||
if ($input =~ /^\[(.*)\]$/s) {
|
||||
my $content = $1;
|
||||
log_debug(2, "[:] content is $content \n");
|
||||
# log_debug(2, "[:] content is $content \n");
|
||||
parse_json($content);
|
||||
}
|
||||
|
||||
@ -344,7 +333,7 @@ sub parse_json
|
||||
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
log_debug(2, ":{}, content is $t \n");
|
||||
#log_debug(2, ":{}, content is $t \n");
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
@ -366,7 +355,7 @@ sub parse_json
|
||||
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
log_debug(2, "{},{}, content is $t \n");
|
||||
#log_debug(2, "{},{}, content is $t \n");
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
@ -386,7 +375,7 @@ sub parse_json
|
||||
# {"clustersite":{"domain":"cluster.com","master":"192.168.1.15"}}
|
||||
elsif ($input =~ /^\s*{(.*)}\s*$/s) {
|
||||
my $content = $1;
|
||||
log_debug(2, "{} content is $content \n");
|
||||
#log_debug(2, "{} content is $content \n");
|
||||
parse_json($content);
|
||||
}
|
||||
elsif ($input =~ /],\"\S+\":/) {
|
||||
@ -396,7 +385,7 @@ sub parse_json
|
||||
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
log_debug(2, "],:, content is $t \n");
|
||||
#log_debug(2, "],:, content is $t \n");
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
@ -420,7 +409,7 @@ sub parse_json
|
||||
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
log_debug(2, ", content is $t \n");
|
||||
#log_debug(2, ", content is $t \n");
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
@ -446,7 +435,7 @@ sub parse_json
|
||||
if ($value =~ /{/) {
|
||||
|
||||
# "clustersite":{"domain":"cluster.com","master":"192.168.1.15"}
|
||||
log_debug(2, "{ content is $value \n");
|
||||
#log_debug(2, "{ content is $value \n");
|
||||
$hash{$key} = parse_json($value, $key);
|
||||
return \%hash;
|
||||
} else {
|
||||
@ -464,7 +453,7 @@ sub parse_json
|
||||
else {
|
||||
if ($input =~ /^\[(.*)\]/s) {
|
||||
my $content = $1;
|
||||
log_debug(2, "[] content is $content \n");
|
||||
#log_debug(2, "[] content is $content \n");
|
||||
my @all = split /,/, $content;
|
||||
foreach my $n (@all) {
|
||||
$n =~ /\"(.*)\"/;
|
||||
|
Loading…
x
Reference in New Issue
Block a user