summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2007-08-27 12:30:19 +0000
committerkraxel <kraxel>2007-08-27 12:30:19 +0000
commitb6f7b4eb2f31eac90752594347a23dd7117c2531 (patch)
tree310c59c5128705cde94a1a447d84f79e546fded1
parent5604c1ccf720c3ca2eba49693c95f58569bc788b (diff)
downloadamtterm-b6f7b4eb2f31eac90752594347a23dd7117c2531.tar.gz
amttool: doc update, code cleanups.
-rwxr-xr-xamttool62
-rw-r--r--amttool.man28
2 files changed, 63 insertions, 27 deletions
diff --git a/amttool b/amttool
index de0fc26..d1b0f48 100755
--- a/amttool
+++ b/amttool
@@ -8,7 +8,8 @@ my $amt_host = shift;
my $amt_port = "16992";
$main::amt_user = "admin";
$main::amt_pass = $ENV{'AMT_PASSWORD'};
-my $amt_debug = 1;
+my $amt_debug = 0;
+$amt_debug = $ENV{'AMT_DEBUG'} if defined($ENV{'AMT_DEBUG'});
my $amt_command = shift;
$amt_command = "info" if !defined($amt_command);
@@ -113,11 +114,15 @@ This utility can talk to Intel AMT managed machines.
usage: amttool <hostname> [ <command> ]
commands:
- info - print some machine info (default).
- reset - reset machine.
- powerup - turn on machine.
- powerdown - turn off machine.
- powercycle - powercycle machine.
+ info - print some machine info (default).
+ reset - reset machine.
+ powerup - turn on machine.
+ powerdown - turn off machine.
+ powercycle - powercycle machine.
+
+AMT 2.5+ only:
+ netinfo - print network config.
+ netconf <args> - configure network (check manpage).
Password is passed via AMT_PASSWORD environment variable.
@@ -174,15 +179,26 @@ sub print_hash_ipv4 {
}
}
-sub dump_request {
+sub do_soap {
my $soap = shift;
- my $method = shift;
+ my $name = shift;
+ my @args = @_;
+ my $method;
+
+ $method = SOAP::Data->name($name)
+ ->attr( { xmlns => $soap->ns } );
- print "-- \n";
- open XML, "| xmllint --format -";
- print XML $soap->serializer->envelope(method => $method, @_);
- close XML;
- print "-- \n";
+ if ($amt_debug) {
+ print "-- \n";
+ open XML, "| xmllint --format -";
+ print XML $soap->serializer->envelope(method => $method, @_);
+ close XML;
+ print "-- \n";
+ }
+
+ my $ret = $soap->call($method, @args);
+ print_result($ret);
+ return $ret;
}
sub check_amt_version {
@@ -252,6 +268,7 @@ sub print_network_info() {
sub remote_control($) {
my $command = shift;
+ my @args;
my $hostname = $nas->GetHostName()->paramsout;
my $domainname = $nas->GetDomainName()->paramsout;
@@ -259,10 +276,9 @@ sub remote_control($) {
my $reply = <>;
if ($reply =~ m/^(y|yes)$/i) {
printf "execute: %s\n", $command;
- my $arg1 = SOAP::Data->name('Command' => $rcc{$command});
- my $arg2 = SOAP::Data->name('IanaOemNumber' => 4542);
- my $ret = $rcs->RemoteControl($arg1, $arg2);
- print_result($ret);
+ push (@args, SOAP::Data->name('Command' => $rcc{$command}));
+ push (@args, SOAP::Data->name('IanaOemNumber' => 4542));
+ do_soap($rcs, "RemoteControl", @args);
} else {
printf "canceled\n";
}
@@ -298,7 +314,7 @@ sub configure_network {
my $method;
my @args;
- # build args ...
+ # build argument structs ...
die "no interface" if !defined($if);
die "no linkpolicy" if !defined($link);
if (defined($ip)) {
@@ -323,18 +339,12 @@ sub configure_network {
\SOAP::Data->value(@ipv4)))
if @ipv4;
- # perform call
- $method = SOAP::Data->name("SetInterfaceSettings")
- ->attr( { xmlns => $nas->ns } );
push (@args, SOAP::Data->name("InterfaceHandle" => $if));
push (@args, SOAP::Data->name("InterfaceDescriptor" =>
\SOAP::Data->value(@ifdesc)));
- dump_request($nas, $method, @args)
- if $amt_debug;
-
- my $ret = $nas->call($method, @args);
- print_result($ret);
+ # perform call
+ do_soap($nas, "SetInterfaceSettings", @args);
}
diff --git a/amttool.man b/amttool.man
index d6c4393..e687881 100644
--- a/amttool.man
+++ b/amttool.man
@@ -35,12 +35,38 @@ turn off machine.
.TP
.B powercycle
powercycle machine.
+.TP
+.B netinfo
+print network configuration (requires AMT 2.5+).
+.TP
+.B netconf if link [ ip mask gw [ dns1 [ dns2 ]]]
+configure network interface (requires AMT 2.5+).
+.B if
+is the interface handle,
+.B link
+the link policy. If in doubt just feed in what the netinfo command
+prints.
+.B ip
+is the IPv4 address,
+.B mask
+the netmask,
+.B gw
+the default gateway,
+.B dns1
+and
+.B dns2
+are the DNS Servers. If no IP configuration is specified the tool
+tries to configure the machine in shared mac address mode with dhcp,
+otherwise in separate mac address mode with static IP address.
+Default for dns1 is the gateway address, for dns2 it is 0.0.0.0.
.SH ENVIRONMENT
.TP
.B AMT_PASSWORD
AMT password.
+.TP
+.B AMT_DEBUG
+Enable debug output.
.SH SEE ALSO
amtterm(1), gamt(1), amt-howto(7)
.SH AUTHOR
(c) 2007 Gerd Hoffmann <kraxel@redhat.com>
-