• F5 VirtualServer 提供的方法


        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)
    
  • 相关阅读:
    题目一:使用Java实现二维数组中的查找
    算法的时间复杂度
    爬虫----爬虫存储库
    爬虫----爬虫解析库Beautifulsoup模块
    问卷调查
    爬虫----爬虫请求库selenium
    爬虫----爬虫请求库requests
    爬虫----爬虫基本原理
    python金融与量化分析------Matplotlib(绘图和可视化)
    Python与金融量化分析----金融与量化投资
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348464.html
Copyright © 2020-2023  润新知