Created
May 2, 2013 09:13
-
-
Save TvL2386/5501113 to your computer and use it in GitHub Desktop.
Testing icontrol-0.3.9 VirtualServer creation and destroy.
The F5 has firmware version: BIG-IP 11.3.0 Build 2968.0 Hotfix HF1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'icontrol' | |
require 'awesome_print' | |
require 'yaml' | |
IControl.config = { user: 'admin', password: 'secret', base_url: 'https://192.168.0.60' } | |
ap IControl::LocalLB::VirtualServer.find(:all) | |
puts | |
manifest = { | |
:definition => { | |
:address => '10.10.10.10', | |
:name => 'testing_server', | |
:port => '80', | |
:protocol => IControl::Common::ProtocolType::PROTOCOL_TCP | |
}, | |
:wildmask => '255.255.255.255', | |
:resource => { | |
:type => IControl::LocalLB::VirtualServer::VirtualServerType::RESOURCE_TYPE_POOL, | |
:default_pool_name => '' | |
}, | |
:profiles => [] | |
} | |
IControl::LocalLB::VirtualServer.create manifest | |
name = '/Common/' + manifest[:definition][:name] | |
virtual_server = IControl::LocalLB::VirtualServer.find name | |
ap virtual_server | |
puts | |
ap IControl::LocalLB::VirtualServer.find(:all) | |
puts | |
virtual_server.destroy | |
################################ | |
# output: | |
# | |
# [ | |
# [0] #<IControl::LocalLB::VirtualServer:0x00000002d3dc48 @attributes={:id=>"/Common/test-udp-server"}>, | |
# [1] #<IControl::LocalLB::VirtualServer:0x00000002d3dae0 @attributes={:id=>"/Common/test-tcp-vserver"}> | |
# ] | |
# | |
# #<IControl::LocalLB::VirtualServer:0x00000002872c40 @attributes={:id=>"/Common/testing_server"}> | |
# | |
# [ | |
# [0] #<IControl::LocalLB::VirtualServer:0x0000000258d160 @attributes={:id=>"/Common/test-udp-server"}>, | |
# [1] #<IControl::LocalLB::VirtualServer:0x0000000258d098 @attributes={:id=>"/Common/test-tcp-vserver"}>, | |
# [2] #<IControl::LocalLB::VirtualServer:0x0000000258cf80 @attributes={:id=>"/Common/testing_server"}> | |
# ] | |
# | |
# /usr/local/rvm/gems/ruby-1.9.3-p392/gems/icontrol-0.3.9/lib/icontrol/base.rb:251:in `method_missing': undefined method # `destroy' for IControl::LocalLB::VirtualServer:Class (NoMethodError) | |
# from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/icontrol-0.3.9/lib/icontrol/base.rb:303:in `method_missing' | |
# from bla.rb:35:in `<main>' | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
virtual_server.delete_virtual_server should do. http://magec.es/icontrol/IControl/LocalLB/VirtualServer.html#delete_virtual_server-instance_method