Forum Discussion

Andy_Litzinger's avatar
Dec 19, 2012

Unable to set virtual mirror connection state to DISABLED

Hello,

 

I've got a simple ruby iControl script that can successfully enable connection mirroring on a virutal server, but trying to set the state to DISABLED fails. In fact trying to set the mirror state to STATE_DISABLED on a virtual server that already has the mirror state disabled will actually ENABLE the mirror connection state!

 

i'm pretty sure i'm using the 11.0.0.1 gem, but i have both the 11.0.0.1 gem and the 10.2.0.2 gem installed and i'm not sure how to specify/tell which is being used. I'm using Ruby v1.9.2

 

Here is my sample code- the mirror state value is hardcoded inside the script. in case the wiki messes up the formating, you can find the script here: https://gist.github.com/4339179

 

 

 

require "rubygems"

 

require "f5-icontrol"

 

require "getoptlong"

 

require "rdoc/usage"

 

 

options = GetoptLong.new(

 

[ "--bigip-address", "-b", GetoptLong::REQUIRED_ARGUMENT ],

 

[ "--bigip-user", "-u", GetoptLong::REQUIRED_ARGUMENT ],

 

[ "--bigip-pass", "-p", GetoptLong::REQUIRED_ARGUMENT ],

 

[ "--vs-name", "-n", GetoptLong::REQUIRED_ARGUMENT ],

 

[ "--help", "-h", GetoptLong::NO_ARGUMENT ]

 

)

 

 

bigip_address = ''

 

bigip_user = ''

 

bigip_pass = ''

 

vs_name = ''

 

 

options.each do |option, arg|

 

case option

 

when "--bigip-address"

 

bigip_address = arg

 

when "--bigip-user"

 

bigip_user = arg

 

when "--bigip-pass"

 

bigip_pass = arg

 

when "--vs-name"

 

vs_name = arg

 

end

 

end

 

 

RDoc::usage if bigip_address.empty? or bigip_user.empty? or bigip_pass.empty? or vs_name.empty?

 

 

Initiate SOAP RPC connection to BIG-IP

 

bigip = F5::IControl.new(bigip_address, bigip_user, bigip_pass, ["LocalLB.VirtualServer", "LocalLB.Pool"]).get_interfaces

 

puts 'Connected to BIG-IP at "' + bigip_address + '" with username "' + bigip_user + '" and password "' + bigip_pass + '"...'

 

 

 

bigip["LocalLB.VirtualServer"].set_connection_mirror_state([vs_name],["STATE_DISABLED"])

 

 

No RepliesBe the first to reply