11-18-2010 10:27 PM - edited 03-01-2019 09:45 AM
Hi,
I wanted to know the XML Api for listing all the FC ports with a given VSAN ?
Thanks and Regards
11-23-2010 01:35 PM
Here is variant of a quick script I posted earlier. It should make it easier for you to experiment with the XML. Pay attention to the getfcvsan function I added. There are 2 options that I listed for classes you might want to try. The one I left it on will just return the FC ports with associated VSANs. The commented message will also return the parent information which is more information on just the VSANs.
The key XML for the requests being:
-or-
Simple Perl script:
#!/usr/local/bin/perl
use strict;
use warnings;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request::Common;
use XML::Simple;
use POSIX;
$Data::Dumper::Purity = 1;
$Data::Dumper::Useqq = 1;
### Configurables
my $ucsm = "*.*.*.*";
my $user = "config";
my $pass = 'config';
my $proto = "http";
my $cookie;
my $xml = XML::Simple->new();
my $xml_blade = XML::Simple->new(ForceArray => ['computeBlade']);
## Setup User Agent
my $ContentType = "application/x-www-form-urlencode";
my $userAgent = LWP::UserAgent->new(agent => 'perl post');
$userAgent->timeout(5);
&connect;
print Dumper &getfcvsan;
&disconnect;
### Subroutines
sub connect {
my $message = q(
print "$proto://".$ucsm."/nuova\n";
my $response = $userAgent->request(POST $proto.'://'.$ucsm.'/nuova', Content_Type => $ContentType, Content => $message);
my $xml_ref = $xml->XMLin($response->content);
$cookie = $xml_ref->{outCookie};
}
sub getfcvsan {
#my $message = q(
my $message = q(
return &post_message({message=>$message});
}
sub post_message {
my $ref = shift;
my $response = $userAgent->request(POST $proto.'://'.$ucsm.'/nuova', Content_Type => $ContentType, Content => $ref->{'message'});
my $xml_ref = $xml_blade->XMLin($response->content, keyattr => []);
return $xml_ref->{outConfigs};
}
sub disconnect {
my $message = q(
my $response = $userAgent->request(POST $proto.'://'.$ucsm.'/nuova', Content_Type => $ContentType, Content => $message);
}
~
61,1 All
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide