04-20-2010 06:27 PM - edited 03-01-2019 09:38 AM
Hi all,
I need to create about 100 vlans on the UCS fabric interconnect cluster uplinking to nexus 7K, couldn't find a way get UCS to learn vlans using VTP or something like that. I prepared the command list to run with in CLI, which is still a lot of work, because for after each create vlan command, I need to add "exit" command to return to the previous mode, otherwise the next "create vlan" command won't work - different from Cat switches.
does UCS blade system support VTP? what is the easiest way to create that many vlans?
thanks
Solved! Go to Solution.
04-20-2010 09:16 PM
UCS does not support VTP as this point.
I suggedt you to make a small script in your notepad and paste this on the fabric interconnect CLI.
04-20-2010 09:36 PM
Just to add to what Lucien pointed out, you can copy & paste your CLI commands from a text editor such as notepad into the CLI.
Ex.
scope eth-uplink
create vlan accounting 2000
exit
create vlan hr 2001
exit
create vlan finance 2002
exit
create vlan techsupport 2003
exit
create vlan management 2004
exit
commit-buffer
Log into the CLI of your VIP and paste your VLAN config for a much faster import than the GUI.
VTP Transparent mode support is coming, but not available today.
Robert
04-20-2010 09:16 PM
UCS does not support VTP as this point.
I suggedt you to make a small script in your notepad and paste this on the fabric interconnect CLI.
04-20-2010 09:36 PM
Just to add to what Lucien pointed out, you can copy & paste your CLI commands from a text editor such as notepad into the CLI.
Ex.
scope eth-uplink
create vlan accounting 2000
exit
create vlan hr 2001
exit
create vlan finance 2002
exit
create vlan techsupport 2003
exit
create vlan management 2004
exit
commit-buffer
Log into the CLI of your VIP and paste your VLAN config for a much faster import than the GUI.
VTP Transparent mode support is coming, but not available today.
Robert
04-21-2010 07:58 PM
thanks guys, that is what I did, seems that there is no easier ways, hope VTP is coming soon :D. It took me a while to prepare the convert the "show vlan" output from uplink switches into script for UCS, as it's about 110 vlans.
04-25-2010 01:48 AM
You can (and probably should) use the XML API to create many VLANs in one go. Here's some sample code that will do this for you. All you need is Perl and a text file that contains vlan_name,vlan_number lines.
#!/usr/bin/perl
#
# UCS API Perl script to create contiguous range of N VLANs
#
# cpaggen at cisco dot com
#
# input file format is
# vlan_name,number
# eg:
# foo,666
# bar,667
# foobar,800
use strict;
use warnings;
use Getopt::Long;
use LWP::UserAgent;
use HTTP::Request::Common;
$|++;
GetOptions( "ip=s"=>\my $ip,
"user=s"=>\my $user,
"password=s"=>\my $password,
"f=s"=>\my $configfile,
"help!"=> \my $help) or die "Incorrect usage - type --help for guidelines\n";
if ((!defined($configfile) || !defined($ip) || !defined($password) || !defined($user)) || ($help) )
{
die ("createvlans -ip
}
my $browser = LWP::UserAgent->new(agent => 'perl post');
my $xmlcmd = "
my $url = 'http://'.$ip.'/nuova';
my $xml_header = "";
my $request = HTTP::Request->new(POST => $url);
$request->content_type("text/xml; charset=utf-8");
$request->content($xmlcmd);
my $response = $browser->request($request);
if ($response->content =~ m/errorDescr=\"([a-zA-Z0-9_\-\. ]+)\".*/)
{
die ("Login failure: ".$1."\n");
}
# cookie format: outCookie="1263997145/efd499ed-cd2e-4128-8de7-16598d80d8c9"
$response->content =~ m/outCookie=\"(\d{10}\/\w{8}\-\w{4}\-\w{4}\-\w{4}\-\w{12})\".*/;
my $ucscookie = $1;
print ("Login successful - obtained UCS cookie ".$ucscookie."\n");
open (my $in, $configfile);
while (<$in>)
{
chomp;
my @vlan=split(",",$_);
print ("Creating vlan ".$vlan[0]." (".$vlan[1].")\n");
my $xmlcmd = "
$request->content($xmlcmd);
$response = $browser->request($request);
if ($response->content =~ m/status=\"created\"/)
{
print (" ... success\n");
} else
{
print (" ... error\n");
}
}
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