2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

modified depending on comments

This commit is contained in:
XuWei 2017-05-02 22:22:33 -04:00
parent db2ec5ddcc
commit f0a6d22c9e
4 changed files with 28 additions and 36 deletions

View File

@ -43,6 +43,13 @@ BMC specific:
\ **rspconfig**\ \ *noderange*\ \ **garp**\ =\ *time*\
OpenBMC specific:
=================
\ **rspconfig**\ \ *noderange*\ {\ **vlan | ip | netmask | gateway**\ }
MPA specific:
=============

View File

@ -132,9 +132,11 @@ my %usage = (
rspconfig <noderange> [snmpdest|alert|community] [-V|--verbose]
rspconfig <noderange> [snmpdest=<dest ip address>|alert=<on|off|en|dis|enable|disable>|community=<string>]
BMC specific:
rspconfig <noderange> [ip|netmask|gateway|backupgateway|garp]
rspconfig <noderange> [vlan|ip|netmask|gateway|backupgateway|garp]
rspconfig <noderange> [garp=<number of 1/2 second>]
rspconfig <noderange> [userid=<userid> username=<username> password=<password>]
OpenBMC specific:
rspconfig <noderange> [vlan|ip|netmask|gateway]
iDataplex specific:
rspconfig <noderange> [thermprofile]
rspconfig <noderange> [thermprofile=<two digit number from chassis>]

View File

@ -22,6 +22,10 @@ B<rspconfig> I<noderange> {B<vlan>|B<ip>|B<netmask>|B<gateway>|B<backupgateway>|
B<rspconfig> I<noderange> B<garp>=I<time>
=head2 OpenBMC specific:
B<rspconfig> I<noderange> {B<vlan>|B<ip>|B<netmask>|B<gateway>}
=head2 MPA specific:
B<rspconfig> I<noderange> {B<sshcfg>|B<snmpcfg>|B<pd1>|B<pd2>|B<network>|B<swnet>|B<ntp>|B<textid>|B<frame>}

View File

@ -355,30 +355,24 @@ sub parse_args {
my $extrargs = shift;
my $noderange = shift;
my $check = undef;
# disable function until fully tested
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
if (scalar(@ARGV) > 1 and $command ne "rsetboot" and $command ne "reventlog" and $command ne "rspconfig") {
if (!defined($extrargs) and $command =~ /rpower|rsetboot|rspconfig/) {
return ([ 1, "No option specified for $command" ]);
}
if (scalar(@ARGV) > 1 and ($command =~ /rpower|rinv|rsetboot/)) {
return ([ 1, "Only one option is supported at the same time" ]);
}
my $subcommand = $ARGV[0];
if ($command eq "rpower") {
#
# disable function until fully tested
#
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
if (!defined($extrargs)) {
return ([ 1, "No option specified for rpower" ]);
}
unless ($subcommand =~ /^on$|^off$|^reset$|^boot$|^status$|^stat$|^state$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
} elsif ($command eq "rinv") {
#
# disable function until fully tested
#
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
$subcommand = "all" if (!defined($ARGV[0]));
unless ($subcommand =~ /^cpu$|^dimm$|^model$|^serial$|^firm$|^mac$|^vpd$|^mprom$|^deviceid$|^guid$|^uuid$|^all$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
@ -386,41 +380,22 @@ sub parse_args {
} elsif ($command eq "getopenbmccons") {
#command for openbmc rcons
} elsif ($command eq "rsetboot") {
if (!defined($extrargs)) {
return ([ 1, "No option specified for $command" ]);
}
#
# disable function until fully tested
#
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
unless ($subcommand =~ /^net$|^hd$|^cd$|^def$|^default$|^stat$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
} elsif ($command eq "reventlog") {
#
# disable function until fully tested
#
$subcommand = "all" if (!defined($ARGV[0]));
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
unless ($subcommand =~ /^\d$|^\d+$|^all$|^clear$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
} elsif ($command eq "rspconfig") {
if (!defined($extrargs)) {
return ([ 1, "No option specified for $command" ]);
}
#
# disable function until fully tested
#
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
my $setorget;
foreach $subcommand (@ARGV) {
if ($subcommand =~ /^(\w+)=(.*)/) {
return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "get");
my $key = $1;
my $value = $2;
return ([ 1, "Unsupported command: $command $key" ]) unless ($key =~ /^ip$|^netmask$|^gateway$/);
return ([ 1, "Unsupported command: $command $key" ]) unless ($key =~ /^ip$|^netmask$|^gateway$|^vlan$/);
my $nodes_num = @$noderange;
return ([ 1, "Invalid parameter for option $key" ]) unless ($value);
@ -429,7 +404,7 @@ sub parse_args {
return ([ 1, "Can not configure more than 1 nodes' ip at the same time" ]) if ($nodes_num >= 2);
}
$setorget = "set";
} elsif ($subcommand =~ /^ip$|^netmask$|^gateway$/) {
} elsif ($subcommand =~ /^ip$|^netmask$|^gateway$|^vlan$/) {
return ([ 1, "Can not configure and display nodes' value at the same time" ]) if ($setorget and $setorget eq "set");
$setorget = "get";
} else {
@ -1059,6 +1034,10 @@ sub rspconfig_response {
$data = ""; # got data from response
push @output, "BMC Gateway: $data";
}
if ($grep_string =~ "vlan") {
$data = ""; # got data from response
push @output, "BMC VLAN ID enabled: $data";
}
xCAT::SvrUtils::sendmsg("$_", $callback, $node) foreach (@output);
}