cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
531
Views
0
Helpful
1
Replies

UCS XML Api for listing FC ports with a given VSAN

girishbist
Level 1
Level 1

Hi,

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

Thanks and Regards

1 Reply 1

Paul Wiltsey
Cisco Employee
Cisco Employee

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card