VirtualServer => {
get_list => 0,
get_default_pool_name => 'virtual_servers',
get_destination => 'virtual_servers',
get_enabled_state => 'virtual_servers',
get_protocol => 'virtual_servers',
get_statistics => 'virtual_servers',
get_all_statistics => 0,
get_rule => 'virtual_servers',
get_snat_pool => 'virtual_servers',
get_snat_type => 'virtual_servers'
},
1.get_list:
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_list()
2.get_default_pool_name:
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_default_pool_name(virtual_servers=['BaoWenQingSuan_HuiGui_8085_vs'])
3.get_destination
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_destination(virtual_servers=['BaoWenQingSuan_HuiGui_8085_vs'])
4.get_enabled_state
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_enabled_state(virtual_servers=['BaoWenQingSuan_HuiGui_8085_vs'])
5.get_protocol
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_protocol(virtual_servers=['BaoWenQingSuan_HuiGui_8085_vs'])
6.get_statistics
import pycontrol.pycontrol as pc
import urllib3
import ssl
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
print p1.get_statistics(virtual_servers=['BaoWenQingSuan_HuiGui_8085_vs'])
7.get_all_statistics
import pycontrol.pycontrol as pc
import urllib3
import ssl
import time
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl._create_default_https_context = ssl._create_unverified_context
import requests
requests.packages.urllib3.disable_warnings()
print 'aaaaaaaaaaaaaaaa'
c = pc.BIGIP(
hostname='10.4.170.160',
username='xxxxx',
password='12345678',
fromurl=True,
wsdls=['LocalLB.VirtualServer'])
p1 = c.LocalLB.VirtualServer
a= dir(p1)
print type(a)
# for x in a:
# print x
b= p1.get_all_statistics()
print dir(b)
c= b.statistics
print type(c)
d= b.time_stamp
print type(d)
for x in c:
# print x
# print dir(x)
# print x.statistics,x.virtual_server
# print type(x.statistics)
for y in x.statistics:
# print x.virtual_server
# print type(x.virtual_server)
# print dir(x.virtual_server)
# print y.time_stamp
print str(x.virtual_server.address)+'=>'+str(x.virtual_server.name)+'=>'+str(x.virtual_server.port)+'=>'+ str(y.type) +'=>'+ str(y.value.high) +'=>'+str(y.value.low)