Cisco Support Community
Community Member

UCS XML Api for listing FC ports with a given VSAN


I wanted to know the XML Api for listing all the FC ports with a given VSAN ?

Thanks and Regards

Cisco Employee

Re: UCS XML Api for listing FC ports with a given VSAN

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:


Simple Perl script:


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');



print Dumper &getfcvsan;


### 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

CreatePlease to create content