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 channel = getGRPCChannel(*bdd_test_util.getPortHostMapping(context.compose_containers, composeService, 7050)) newABStub = ab_pb2.beta_create_AtomicBroadcast_stub(channel) self.atomicBroadcastStubsDict[composeService] = newABStub return newABStub
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
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
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