Forum Discussion
fxt_31120
Jul 04, 2012Nimbostratus
How to find a Virtual server by ip+port
Hi everybody,
I'm looking for a Icontrol cmdlet or a tips for search if my @ip+port is already used by a Virtual server.
Right now I use a combo of 2 functions but it's not efficient at all (8 to 10 min):
$exist_address=$false
$list_virtual_server=$ic.LocalLBVirtualServer.get_list()
for ($i=0 ; $i -lt $list_virtual_server.length; $i++)
{
$virtual_server_spec=$ic.LocalLBVirtualServer.get_destination($list_virtual_server[$i])
$virtual_server_address=$virtual_server_spec[0].address
$virtual_server_port=$virtual_server_spec[0].port
if (($virtual_server_address -eq $ServerAddress) -and ($virtual_server_port -eq $ServerPort))
{
$exist_address=$true
return $exist_address
}
}
return $exist_address
I know it's possible to be more efficient because the web interface provide this in 3-4 seconds in "Local Traffic" > "Network Map" > "Search"
Any help ? :)
Ps: Sorry for my english
- Michael_YatesNimbostratusHi FXT,
- mhite_60883CirrocumulusSomething like this (python):
def f5_virtual_server_exists(b, ip, port): log.debug("Entering f5_virtual_server_exists()...") log.debug("ip = %s" % ip) log.debug("port = %s" % port) vs_list = b.LocalLB.VirtualServer.get_list() for vs in vs_list: vs_dest = b.LocalLB.VirtualServer.get_destination([vs])[0] if (str(vs_dest.address) == ip) and (str(vs_dest.port) == port): log.debug("Returning True...") log.debug("Exiting f5_virtual_server_exists()...") return(True) log.debug("Returning False...") log.debug("Exiting f5_virtual_server_exists()...") return(False)
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects