Thank you to everyone who gave me help and assistance on this one. There's several useful suggestions to workaround the fact that the API would need multiple passes.
The most useful being - SNMP does it.
However I've also managed to dig something out that I thought I'd share - there's an undocumented API (which I'm sure you will all be wise enough to use at your own risk!)
system-cli
Which allows you to execute commands via the API auth mechanism.
<!DOCTYPE netapp SYSTEM "/na_admin/netapp_filer.dtd">
<netapp version="1.7" xmlns="http://www.netapp.com/filer/admin">
<system-cli>
<args>
<arg>df</arg>
<arg>-k</arg>
</args>
</system-cli>
</netapp>
As an example (and apologies if this format mashes - it's perl, run it through perltidy again and it'll be fine). This _doesn't_ use the NetApp SDK, but rather the two CPAN modules 'LWP' and 'XML::Twig'. Both are readily available, and personally I find them altogether easier to work with. (YMMV of course).
The downside is - you get back a single 'cli-output' element that's plain text formatted, so has all the downsides of 'ssh $host df -k'.
(I don't know if that changes in CDOT, but one of my feature requests would be enabling XML/CSV output from all NetApp commands - I've used another vendor's stuff, and this sort of thing is a real boon)
#!/usr/bin/env perl
use strict;
use warnings;
use XML::Twig;
use LWP;
my $twig = XML::Twig->new( 'pretty_print' => 'indented' );
$twig->set_root(
XML::Twig::Elt->new(
'netapp',
{ version => 1.7,
vfiler => "somevfiler",
},
)
);
my $api_req = $twig->root->insert_new_elt('system-cli');
my $args = $api_req->insert_new_elt('args');
$args->insert_new_elt( 'last_child', 'arg', 'df' );
$args->insert_new_elt( 'last_child', 'arg', '-k' );
$twig->set_doctype('netapp SYSTEM "file:/etc/netapp_filer.dtd"');
$twig->set_xml_version("1.0");
$twig->set_encoding('utf-8');
$twig->print;
exit;
my $user_agent = LWP::UserAgent->new(
'ssl_opts' => {
'verify_hostname' => 0,
'SSL_version' => 'SSLv3',
}
);
my $request =
HTTP::Request->new( 'POST' =>
);
$request->authorization_basic( 'username_here', 'password_here' );
$request->content( $twig->sprint );
my $results = $user_agent->request($request);
if ( not $results->is_success ) {
print "Error: ", $results->status_line;
exit;
}
my $results_xml = XML::Twig->new( 'pretty_print' => 'indented_a' );
$results_xml->parse( $results->content );
$results_xml->print;