Software Development Kit (SDK) and API Discussions

cluster mode system-cli with SDK

oferkes
3,804 Views

Hi,

 

i'm trying to get system-cli from SDK to work in clsuter mode environment, but it doesnt seem to work for me (Perl code):

my $server = $_[0];
my $cmd = NaElement->new("system-cli");
my $cmd_args = NaElement->new("args");
$cmd_args->child_add(NaElement->new("arg", "df"));
$cmd->child_add($cmd_args);
my $out = $server->invoke_elem( $cmd );
if($out->results_status() eq "failed")
{
print($out->results_reason() ."\n");
exit(-2);
}
my $results = $out->child_get_string("cli-output");;
print Dumper(\$results);

However nothing is returned..

 

can anyone please advise? 

 

Thanks,

Ofer

1 REPLY 1

robinpeter
3,667 Views

Yeah.. its almost a month.. 

If you feel its fun to use perl.. im sure you will be able to figure out what you want from this....

I guess.. no one really use perl anymore.. 

 

A good debugging technique would be to use: print $cmd->sprintf(); to verify the element structure.

 

#!/usr/bin/perl
#
use strict;
use warnings;
use lib "/netapp-manageability-sdk-5.6/lib/perl/NetApp";
use NaServer;
use NaElement;

my $s = new NaServer('10.10.10.11', 1 , 31);
    $s->set_http_version('1.0');
    $s->set_server_type('FILER');
    $s->set_transport_type('HTTPS');
    $s->set_port(443);
    $s->set_style('LOGIN');
    $s->set_admin_user('username', 'password');

my $api = new NaElement('system-cli');
    my $xi = new NaElement('args');
    $xi->child_add_string("arg","version");
    $api->child_add($xi);

print $api->sprintf();

my $xo = $s->invoke_elem($api);
if ($xo->results_status() eq 'failed') {
    print 'Error:\n';
    print $xo->sprintf();
    exit 1;
}

print 'Received:\n';
print $xo->sprintf();

Hope this helps...

Public