def getNodeLogs(context):
    """ Get the Node logs."""
    headers = getTokenedHeaders(context)
    getNetwork(context)
    url = "{0}://{1}/api/com.ibm.zBlockchain/networks/{2}/nodes/{3}/logs".format(
        getSchema(context.tls), context.remote_ip, context.network_id, peer)
    response = httpGet(url, headers=headers)
    return response
Example #2
0
def step_impl(context, enrollId, enrollSecret, composeService):
    assert 'compose_containers' in context, "compose_containers not found in context"

    secretMsg = {
        "enrollId": enrollId,
        "enrollSecret" : enrollSecret
    }

    url = buildContainerAliasUrl(context, composeService, "/", port=SDK_NODE_APP_REST_PORT)
    context.response = httpGet(url)
def step_impl(context, enrollId, enrollSecret, composeService):
    assert 'compose_containers' in context, "compose_containers not found in context"

    secretMsg = {"enrollId": enrollId, "enrollSecret": enrollSecret}

    url = buildContainerAliasUrl(context,
                                 composeService,
                                 "/",
                                 port=SDK_NODE_APP_REST_PORT)
    context.response = httpGet(url)
def getNetwork(context):
    """ Get the Network ID."""
    if hasattr(context, 'network_id'):
        return context.network_id

    headers = getTokenedHeaders(context)
    url = "{0}://{1}/api/com.ibm.zBlockchain/networks".format(
        getSchema(context.tls), context.remote_ip)
    response = httpGet(url, headers=headers)
    context.network_id = response.json()[0]
    return response
Example #5
0
def httpGetUntilSuccessfulOrTimeout(url, timeoutTimestamp, isSuccessFunction):
    """ Keep attempting to HTTP GET the given URL until either the given
        timestamp is exceeded or the given callback function passes.
        isSuccessFunction should accept a requests.response and return a boolean
    """
    successful = False

    while timeNowIsWithinTimestamp(timeoutTimestamp) and not successful:
        response = bdd_request_util.httpGet(url, expectSuccess=False)
        successful = isSuccessFunction(response)
        time.sleep(1)

    return successful
Example #6
0
def httpGetUntilSuccessfulOrTimeout(url, timeoutTimestamp, isSuccessFunction):
    """ Keep attempting to HTTP GET the given URL until either the given
        timestamp is exceeded or the given callback function passes.
        isSuccessFunction should accept a requests.response and return a boolean
    """
    successful = False

    while timeNowIsWithinTimestamp(timeoutTimestamp) and not successful:
        response = bdd_request_util.httpGet(url, expectSuccess=False)
        successful = isSuccessFunction(response)
        time.sleep(1)

    return successful
def getChaincodeLogs(context, peer):
    """ Get the Chaincode logs."""
    headers = getTokenedHeaders(context)
    getNetwork(context)
    # /api/com.ibm.zBlockchain/networks/{network_id}/nodes/{node_id}/chaincodes/{chaincode_id}/logs
    #url = "{0}://{1}/api/com.ibm.zBlockchain/networks/{2}/nodes/{3}/chaincodes/{4}/logs".format(getSchema(context.tls), context.remote_ip, context.network_id, peer, context.chaincodeSpec['chaincodeID']['name'])
    if hasattr(context, 'chaincodeSpec'):
        url = "{0}://{1}/api/com.ibm.zBlockchain/networks/{2}/nodes/{3}/chaincodes/{4}/logs".format(
            getSchema(context.tls), context.remote_ip, context.network_id,
            peer,
            context.chaincodeSpec.get('chaincodeID', {}).get('name', ''))
        response = httpGet(url, headers=headers)
    else:
        response = "No chaincode has been deployed"
    return response