Beispiel #1
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]

    result7 = HTTPRequest().GET(
        'https://cmdb.uyuntest.cn/crab/api/v1/cis/578f1f65cdd390000beb0991')
    PTS.addHttpCode(result7.getStatusCode(), statusCode)
    return statusCode
Beispiel #2
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]

    result7 = HTTPRequest().GET(
        'https://cmdb.uyuntest.cn/crab/api/v1/cis?classCode=Y_Router')
    PTS.addHttpCode(result7.getStatusCode(), statusCode)
    return statusCode
def modifyDefensively(targetIN,rdf,auth):
    attempts = 0
    log("modifying object defensively")
    while (attempts<5):
        result = HTTPRequest().PUT(targetIN,rdf,[auth])
        status = result.getStatusCode()
        if status >= 200 and status < 300:
            break
        else:
            log("failed attempt "+str(attempts))
            grinder.sleep(1000)
            attempts = attempts+1
            #todo sleep a while
    stats = grinder.getStatistics().getForCurrentTest()
    status = result.getStatusCode()
    if status >= 200 and status < 300:
        stats.setSuccess(True)
    else:
        log("failed to modifyDefensively, ended with status "+str(status))
        stats.setSuccess(False)
Beispiel #4
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]

    result7 = HTTPRequest().GET(
        'http://10.1.11.254/itsm/api/v2/ticket/getTicketList?filterType=all')
    a = result7.getStatusCode()
    data = result7.getText()
    status = data[11:14]
    if status != '200':
        a = 300
    PTS.addHttpCode(a, statusCode)
    return statusCode
Beispiel #5
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]

    headers = [
        NVPair('Content-Type', 'application/json'),
        NVPair('Accept', 'application/json'),
    ]
    number = PTS.random_num(4)
    ip = PTS.random_num(8)
    name = '路由器' + number
    data = '{"Y_name": "%s","classCode": "Y_Router","Y_ip": "%s"}' % (name, ip)
    result = HTTPRequest().POST('https://cmdb.uyuntest.cn/crab/api/v1/cis',
                                data, headers)
    PTS.addHttpCode(result.getStatusCode(), statusCode)

    content = result.getText()
    data2 = '["%s"]' % content
    result2 = HTTPRequest().POST(
        'https://cmdb.uyuntest.cn/crab/api/v1/cis/delete', data2, headers)
    PTS.addHttpCode(result2.getStatusCode(), statusCode)

    return statusCode
Beispiel #6
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]
    result7 = HTTPRequest().GET('http://10.1.11.254/itsm/api/v2/ticket/getTicketList?filterType=all')  
    code = result7.getStatusCode()
    data = result7.getText()
    json = JSONObject(data)
    grinder.logger.info(json.getString("errCode"))
    status = json.getString("errCode")
    if status == 'null':
        code = 300
    if status != 'null':
        code = int(status)
    PTS.addHttpCode(code, statusCode)
    return statusCode
Beispiel #7
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]
    headers = [NVPair('Content-Type', 'application/json'),NVPair('Accept', 'application/json'),NVPair('Origin', '10.1.11.254')]
    data = '{"message": {"toUserList": [5],"content": "同意"},"executor": {"957c8fa1cfda44b596ed3b4e29d6e27e": ["bdfe0b48fe7741b395dc599bdc80835e", "e10adc3949ba59abbe56e057f20f88dd"]},"form": {"title": "测试0010","urgentLevel": "5"}}'
    result7 = HTTPRequest().POST('http://10.1.11.254/itsm/api/v2/ticket/createTicket/5dbb00bb124c4d0e86f8cd0d15da0749', data, headers)
    code = result7.getStatusCode()
    data = result7.getText()
    json = JSONObject(data)
    grinder.logger.info(json.getString("errCode"))
    status = json.getString("errCode")
    if status == 'null':
        code = 300
    if status != 'null':
        code = int(status)
    PTS.addHttpCode(code, statusCode)
    return statusCode
def tenant():
    statusCode = [0L, 0L, 0L, 0L]
    headers = [
        NVPair('Content-Type', 'application/json'),
        NVPair('Accept', 'application/json'),
        NVPair('Origin', '10.1.11.254')
    ]
    data = '{"priority": ["5"],"source": ["alert"],"extParams": {}}'
    result7 = HTTPRequest().POST(
        'http://10.1.11.254/itsm/api/v2/ticket/getAllTicket', data, headers)
    code = result7.getStatusCode()
    data = result7.getText()
    # grinder.logger.info(data)
    json = JSONObject(data)
    grinder.logger.info(json.getString("errCode"))
    status = json.getString("errCode")
    if status == 'null':
        code = 300
    if status != 'null':
        code = int(status)
    PTS.addHttpCode(code, statusCode)
    return statusCode
Beispiel #9
0
def tenant():
    statusCode = [0L, 0L, 0L, 0L]
    headers = [
        NVPair('Content-Type', 'application/json'),
        NVPair('Accept', 'application/json'),
        NVPair('Origin', '10.1.11.254')
    ]
    data = '{"message":{"toUserList":[],"content":"同意"},"executor":{},"modelId":"a7ea82fdd36b4348b5e242af1531bfd3","form":{"title":"性能测试工单ffff","urgentLevel":"4","ticketDesc":"性能测试工单001","startTime":"2017-11-01T09:32:01.550Z","announcer":"性能测试工单001","inCategory":"0"},"ticketSource":"web"}'
    result7 = HTTPRequest().POST(
        'http://10.1.11.254/itsm/api/v2/ticket/createTicket/a7ea82fdd36b4348b5e242af1531bfd3',
        data, headers)
    code = result7.getStatusCode()
    data = result7.getText()
    json = JSONObject(data)
    grinder.logger.info(json.getString("errCode"))
    status = json.getString("errCode")
    if status == 'null':
        code = 300
    if status != 'null':
        code = int(status)
    PTS.addHttpCode(code, statusCode)
    return statusCode