当前位置: 首页>>代码示例>>Python>>正文


Python UtilLibrary.get方法代码示例

本文整理汇总了Python中UtilLibrary.get方法的典型用法代码示例。如果您正苦于以下问题:Python UtilLibrary.get方法的具体用法?Python UtilLibrary.get怎么用?Python UtilLibrary.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UtilLibrary的用法示例。


在下文中一共展示了UtilLibrary.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getPersons

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getPersons(hostname, port, ignore):
    """Uses the GET on people:people resource to get all persons in the store using RESTCONF

    <note>
        This also returns the dummy entry created for routed RPC
        with personId being user0
    </note>
    """
    resp = UtilLibrary.get(SettingsLibrary.getPersonsUrl(hostname, port), "admin", "admin")
    resp.encoding = 'utf-8'
    print(resp.text)
    return resp
开发者ID:ljakab,项目名称:integration-test,代码行数:14,代码来源:CrudLibrary.py

示例2: getClusterRoles

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getClusterRoles(shardName, numOfShards=3, numOfTries=3, sleepBetweenRetriesInSecs=1, port=8181, *ips):
    """Given a shardname (e.g. shard-inventory-config), number of shards and bunch of ips

    determines what role each ip has in an Akka (Raft based) cluster
    result would look like
    {'10.194.126.118':'Leader', '10.194.126.118':'Follower', '10.194.126.117': None}
    """
    dict = {}
    for ip in ips:
        i = 1
        dict[ip] = None

        while i <= numOfShards:
            shardMemberName = "member-" + str(i) + "-" + shardName
            j = 1

            while j <= numOfTries:
                print("Try number " + str(j))
                try:
                    print("finding if" + ip + "is leader for shardName =" + shardMemberName)
                    url = SettingsLibrary.getJolokiaURL(ip, str(port), str(i), shardName)
                    resp = UtilLibrary.get(url)
                    print(resp)
                    if resp.status_code != 200:
                        sleep(sleepBetweenRetriesInSecs)
                        continue
                    print(resp.text)
                    data = json.loads(resp.text)
                    if 'value' in data:
                        dataValue = data['value']
                        print("datavalue RaftState is", dataValue['RaftState'])
                        if dataValue['RaftState'] == 'Follower':
                            dict[ip] = 'Follower'
                            break
                        elif dataValue['RaftState'] == 'Leader':
                            dict[ip] = 'Leader'
                except:
                    e = sys.exc_info()[0]
                    print("Try" + str(j) + ":An error occurred when finding leader on" + ip +
                          " for shardName:" + shardMemberName)
                    print(e)
                    sleep(sleepBetweenRetriesInSecs)
                    continue
                finally:
                    j = j + 1

            if dict[ip] is not None:
                break
            i = i + 1

    return dict
开发者ID:cyclefusion,项目名称:integration,代码行数:53,代码来源:ClusterStateLibrary.py

示例3: getClusterRoles

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getClusterRoles(shardName,numOfShards=3,numOfTries=3,sleepBetweenRetriesInSecs=1,port=8181,*ips):
    dict={}
    for ip in ips:
      i=1
      dict[ip]=None
      bFollower = 0
      while i <= numOfShards:
        shardMemberName = "member-"+str(i)+"-"+shardName;
        j=1

        while j <= numOfTries:
            print "Try number "+str(j)
            try:
                print "finding if"+ ip +"is leader for shardName ="+shardMemberName
                url = SettingsLibrary.getJolokiaURL(ip,str(port),str(i),shardName)
                resp = UtilLibrary.get(url)
                print resp
                if(resp.status_code != 200):
                    continue
                data = json.loads(resp.text)
                if('value' in data):
                    dataValue = data['value']
                    if(dataValue['RaftState']=='Follower'):
                        dict[ip]='Follower'
                        break;
                    elif(dataValue['RaftState']=='Leader'):
                        dict[ip]='Leader'
            except:
                e = sys.exc_info()[0]
                print "Try"+str(j)+":An error occurred when finding leader on"+ip+" for shardName:" +shardMemberName
                print e
                sleep(sleepBetweenRetriesInSecs)
                continue
            finally:
                j=j+1

        if(dict[ip]!=None):
            break;
        i=i+1

    return dict
开发者ID:Cygnus-Labs,项目名称:opendaylight-integration,代码行数:43,代码来源:ClusterStateLibrary.py

示例4: getCarPersonMappings

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getCarPersonMappings(hostname,port,ignore):
    resp = UtilLibrary.get(SettingsLibrary.getCarPersonUrl(hostname,port),"admin","admin")
    resp.encoding = 'utf-8'
    print (resp)

    return resp
开发者ID:Cygnus-Labs,项目名称:opendaylight-integration,代码行数:8,代码来源:CrudLibrary.py

示例5: getPersons

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getPersons(hostname,port,ignore):
    resp = UtilLibrary.get(SettingsLibrary.getPersonsUrl(hostname,port),"admin","admin")
    resp.encoding = 'utf-8'
    print (resp.text)
    return resp
开发者ID:Cygnus-Labs,项目名称:opendaylight-integration,代码行数:7,代码来源:CrudLibrary.py

示例6: getCars

# 需要导入模块: import UtilLibrary [as 别名]
# 或者: from UtilLibrary import get [as 别名]
def getCars(hostname, port, ignore):
    """Uses the GET on car:cars resource to get all cars in the store using RESTCONF"""
    resp = UtilLibrary.get(SettingsLibrary.getCarsUrl(hostname, port), "admin", "admin")
    resp.encoding = 'utf-8'
    print(resp.text)
    return resp
开发者ID:ljakab,项目名称:integration-test,代码行数:8,代码来源:CrudLibrary.py


注:本文中的UtilLibrary.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。