Exemplo n.º 1
0
def getEndorserStubs(context, composeServices):
	stubs = []
	for composeService in composeServices:
		ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers)
		channel = bdd_grpc_util.getGRPCChannel(ipAddress)
		newEndorserStub = fabric_service_pb2.beta_create_Endorser_stub(channel)
		stubs.append(newEndorserStub)
	return stubs
Exemplo n.º 2
0
def getEndorserStubs(context, composeServices):
    stubs = []
    for composeService in composeServices:
        ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers)
        channel = bdd_grpc_util.getGRPCChannel(ipAddress)
        newEndorserStub = peer_pb2_grpc.EndorserStub(channel)
        stubs.append(newEndorserStub)
    return stubs
Exemplo n.º 3
0
def step_impl(context, enrollId, ccDeploymentSpecAlias, ccSpecAlias, devopsComposeService):
	userRegistration = bdd_test_util.getUserRegistration(context, enrollId)
	assert ccSpecAlias in userRegistration.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, enrollId)

	ipAddress = bdd_test_util.ipFromContainerNamePart(devopsComposeService, context.compose_containers)
	channel = bdd_grpc_util.getGRPCChannel(ipAddress)
	devopsStub = devops_pb2.beta_create_Devops_stub(channel)
	deploymentSpec = devopsStub.Build(userRegistration.tags[ccSpecAlias],20)
	userRegistration.tags[ccDeploymentSpecAlias] = deploymentSpec
Exemplo n.º 4
0
def step_impl(context, userName, ccDeploymentSpecAlias, ccSpecAlias, devopsComposeService):
    directory = bootstrap_util.getDirectory(context=context)
    user = directory.getUser(userName=userName)
    assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, userName)

    ipAddress = bdd_test_util.ipFromContainerNamePart(devopsComposeService, context.compose_containers)
    channel = bdd_grpc_util.getGRPCChannel(ipAddress)
    devopsStub = devops_pb2.beta_create_Devops_stub(channel)
    deploymentSpec = devopsStub.Build(user.tags[ccSpecAlias],20)
    user.tags[ccDeploymentSpecAlias] = deploymentSpec
Exemplo n.º 5
0
 def getABStubForComposeService(self, context, composeService):
     'Return a Stub for the supplied composeService, will cache'
     if composeService in self.atomicBroadcastStubsDict:
         return self.atomicBroadcastStubsDict[composeService]
     # Get the IP address of the server that the user registered on
     root_certificates = self.directory.getTrustedRootsForOrdererNetworkAsPEM()
     ipAddress, port = bdd_test_util.getPortHostMapping(context.compose_containers, composeService, 7050)
     # print("ipAddress in getABStubForComposeService == {0}:{1}".format(ipAddress, port))
     channel = bdd_grpc_util.getGRPCChannel(ipAddress=ipAddress, port=port, root_certificates=root_certificates, ssl_target_name_override=composeService)
     newABStub = ab_pb2_grpc.AtomicBroadcastStub(channel)
     self.atomicBroadcastStubsDict[composeService] = newABStub
     return newABStub
Exemplo n.º 6
0
 def getABStubForComposeService(self, context, composeService):
     'Return a Stub for the supplied composeService, will cache'
     if composeService in self.atomicBroadcastStubsDict:
         return self.atomicBroadcastStubsDict[composeService]
     # Get the IP address of the server that the user registered on
     root_certificates = self.directory.getTrustedRootsForOrdererNetworkAsPEM()
     ipAddress, port = bdd_test_util.getPortHostMapping(context.compose_containers, composeService, 7050)
     # print("ipAddress in getABStubForComposeService == {0}:{1}".format(ipAddress, port))
     channel = bdd_grpc_util.getGRPCChannel(ipAddress=ipAddress, port=port, root_certificates=root_certificates, ssl_target_name_override=composeService)
     newABStub = ab_pb2_grpc.AtomicBroadcastStub(channel)
     self.atomicBroadcastStubsDict[composeService] = newABStub
     return newABStub
Exemplo n.º 7
0
def step_impl(context, enrollId, ccDeploymentSpecAlias, ccSpecAlias,
              devopsComposeService):
    userRegistration = bdd_test_util.getUserRegistration(context, enrollId)
    assert ccSpecAlias in userRegistration.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(
        ccSpecAlias, enrollId)

    ipAddress = bdd_test_util.ipFromContainerNamePart(
        devopsComposeService, context.compose_containers)
    channel = bdd_grpc_util.getGRPCChannel(ipAddress)
    devopsStub = devops_pb2.beta_create_Devops_stub(channel)
    deploymentSpec = devopsStub.Build(userRegistration.tags[ccSpecAlias], 20)
    userRegistration.tags[ccDeploymentSpecAlias] = deploymentSpec
Exemplo n.º 8
0
def step_impl(context, userName, ccDeploymentSpecAlias, ccSpecAlias,
              devopsComposeService):
    directory = bootstrap_util.getDirectory(context=context)
    user = directory.getUser(userName=userName)
    assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(
        ccSpecAlias, userName)

    ipAddress = bdd_test_util.ipFromContainerNamePart(
        devopsComposeService, context.compose_containers)
    channel = bdd_grpc_util.getGRPCChannel(ipAddress)
    devopsStub = devops_pb2.beta_create_Devops_stub(channel)
    deploymentSpec = devopsStub.Build(user.tags[ccSpecAlias], 20)
    user.tags[ccDeploymentSpecAlias] = deploymentSpec
Exemplo n.º 9
0
 def getABStubForComposeService(self, context, composeService, port=7050):
     'Return a Stub for the supplied composeService, will cache'
     if composeService in self.atomicBroadcastStubsDict:
         return self.atomicBroadcastStubsDict[composeService]
     # Get the IP address of the server that the user registered on
     root_certificates = self.directory.getTrustedRootsForOrdererNetworkAsPEM()
     peer_root_certificates = self.directory.getTrustedRootsForPeerNetworkAsPEM()
     ipAddress, port_to_use = bdd_test_util.getPortHostMapping(context.compose_containers, composeService, port)
     # print("ipAddress in getABStubForComposeService == {0}:{1}".format(ipAddress, port))
     channel = bdd_grpc_util.getGRPCChannel(ipAddress=ipAddress, port=port_to_use, root_certificates="".join([peer_root_certificates, root_certificates]), ssl_target_name_override=composeService)
     # Added logic to choose between ab.Deliver and events.Deliver for orderer vs peer respectively.
     newABStub = ab_pb2_grpc.AtomicBroadcastStub(channel) if bootstrap_util.OrdererGensisBlockCompositionCallback.DISCRIMINATOR in composeService else events_pb2_grpc.DeliverStub(channel)
     self.atomicBroadcastStubsDict[composeService] = newABStub
     return newABStub
Exemplo n.º 10
0
def getEndorserStubs(context, composeServices, directory, nodeAdminTuple):
    stubs = []
    user = directory.getUser(nodeAdminTuple.user)
    signingOrg = directory.getOrganization(nodeAdminTuple.organization)

    for composeService in composeServices:
        ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers)
        # natForPeerSigner = directory.findNodeAdminTuple(userName="******".format(composeService), contextName=composeService, orgName="peerOrg0")
        # signerCert = directory.getCertAsPEM(natForPeerSigner)
        root_certificates = directory.getTrustedRootsForPeerNetworkAsPEM()
        channel = bdd_grpc_util.getGRPCChannel(ipAddress=ipAddress, port=7051, root_certificates=root_certificates,
                                               ssl_target_name_override=composeService)
        newEndorserStub = peer_pb2_grpc.EndorserStub(channel)
        stubs.append(newEndorserStub)
    return stubs
Exemplo n.º 11
0
def getEndorserStubs(context, composeServices, directory, nodeAdminTuple):
    stubs = []
    user = directory.getUser(nodeAdminTuple.user)
    signingOrg = directory.getOrganization(nodeAdminTuple.organization)

    for composeService in composeServices:
        ipAddress, port = bdd_test_util.getPortHostMapping(context.compose_containers, composeService, 7051)
        # natForPeerSigner = directory.findNodeAdminTuple(userName="******".format(composeService), contextName=composeService, orgName="peerOrg0")
        # signerCert = directory.getCertAsPEM(natForPeerSigner)
        root_certificates = directory.getTrustedRootsForPeerNetworkAsPEM()
        channel = bdd_grpc_util.getGRPCChannel(ipAddress=ipAddress, port=port, root_certificates=root_certificates,
                                               ssl_target_name_override=composeService)
        newEndorserStub = peer_pb2_grpc.EndorserStub(channel)
        stubs.append(newEndorserStub)
    return stubs