Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
Im trying to use the Manageability SDK to make a simple call to OCUM 7.1 to get the names of clusters, but I can't seem to figure out how. When I put num-records in the get_string method, it says I have 2 which accurately reflects the number of clusters. How do I pull something simple like the name?
s = NaServer(filer, 7, 1)
s.set_server_type("OCUM")
s.set_admin_user(user, password)
s.set_transport_type("HTTPS")
output = s.invoke("cluster-iter")
if(output.results_errno() != 0):
r = output.results_reason()
print("Failed: \n" + str(r))
else :
r = output.child_get_string("records")
print (r)
Solved! See The Solution
Answered my own question while playing with it some more. Had to go further down the tree with children_get() and child_get() methods.
def getClusters(self):
returnValue = []
iterator = self.interface.invoke("cluster-iter")
if(iterator.results_errno() != 0):
message = iterator.results_reason()
print("Failed: \n" + str(message))
else :
clusters = iterator.child_get("records").children_get()
for i in clusters:
returnValue.append(i.child_get_string("cluster-name"))
return returnValue
Answered my own question while playing with it some more. Had to go further down the tree with children_get() and child_get() methods.
def getClusters(self):
returnValue = []
iterator = self.interface.invoke("cluster-iter")
if(iterator.results_errno() != 0):
message = iterator.results_reason()
print("Failed: \n" + str(message))
else :
clusters = iterator.child_get("records").children_get()
for i in clusters:
returnValue.append(i.child_get_string("cluster-name"))
return returnValue
I have a similar problem, except using the Perl SDK rather than PS and invoking the DLL directly. Whenver I try to connect to OCUM 7.2 OVA using the code below, I get a the very helpful generic error shown. If I use PowerShell and the DataManagement.dll, works fine. But I'd really rather use Perl for this particular application so I'm trying to figure out what's up here. I'm not having much luck so any insight would be greatly appreciated.
#!/usr/bin/perl
use strict;
use NaServer;
use Data::Dumper;
#use WFAUtil;
BEGIN {$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;}
my $TRUE = 1;
my $FALSE = 0;
my $IS_DATASOURCE = $TRUE;
my $ocum_handle;
my $ocum_host = '10.0.0.118';
my $ocum_user = 'admin';
my $ocum_pw = '********';
$ocum_handle = new NaServer($ocum_host,1,0);
$ocum_handle->set_server_type('OCUM');
$ocum_handle->set_transport_type('HTTPS');
$ocum_handle->set_port(443);
$ocum_handle->set_style('LOGIN');
$ocum_handle->set_admin_user($ocum_user, $ocum_pw);
my $result;
eval {
$result = $ocum_handle->system_about();
};
print $@ if $@;
Server returned HTTP Error: (13001)
While I don't know the answer to your specific question, I can show you another way of getting that information using Perl.
For this solution to work, make sure that:
1. You install the DBD package (DBI package for managing MySQL)
2. You create a database user on the OCUM server with "Report Schema" role
Hopefully this code works for you as well.
I had considered that but was really trying to stay away from going directly to the database. I may reconsider that method but I had hoped to use the normal Perl SDK functions which are so much nicer, but it looks like at this point I can't do that no matter which option I pick.