def deploy_chaincode(self, context, chaincode, containers, channelId=TEST_CHANNEL_ID, user="******"): for container in containers: assert container in context.composition.collectServiceNames( ), "Unknown component '{0}'".format(container) orderers = self.get_orderers(context) peers = self.get_peers(context) assert orderers != [], "There are no active orderers in this network" chaincode.update({ "orderers": orderers, "channelID": channelId, }) if not hasattr(context, "network") and not self.channel_block_present( context, containers, channelId): config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) self.install_chaincode(context, chaincode, peers, user) self.instantiate_chaincode(context, chaincode, containers, user)
def deploy_impl(context, path, args, name, language, peer, channel, timeout=300, username="******"): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channel, config_util.CHANNEL_PROFILE, context) chaincode = { "path": path, "language": language, "name": name, "channelID": channel, "args": args, } context.results = context.interface.deploy_chaincode(context, chaincode, [peer], channel, user=username) # Save chaincode name and path and args context.chaincode = chaincode chaincode_container = "{0}-{1}-{2}-0".format(context.projectName, peer, chaincode['name']) context.interface.wait_for_deploy_completion(context, chaincode_container, timeout)
def pre_deploy_chaincode(self, context, path, args, name, language, channelId=TEST_CHANNEL_ID, version=0, policy=None): config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) orderers = self.get_orderers(context) peers = self.get_peers(context) assert orderers != [], "There are no active orderers in this network" context.chaincode = { "path": path, "language": language, "name": name, "version": str(version), "args": args, "orderers": orderers, "channelID": channelId, } if policy: context.chaincode['policy'] = policy
def create_channel_impl(context, channelId, orderer): # Be sure there is a transaction block for this channel if not os.path.exists("./configs/{0}/{1}.tx".format( context.projectName, channelId)): config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) context.interface.create_channel(context, orderer, channelId)
def ordererBootstrap_impl(context, ordererType): context.ordererProfile = config_util.PROFILE_TYPES.get( ordererType, "SampleInsecureSolo") config_util.generateOrdererConfig(context, config_util.CHANNEL_PROFILE, context.ordererProfile, "orderer.block") config_util.generateChannelConfig(context.interface.SYS_CHANNEL_ID, config_util.CHANNEL_PROFILE, context)
def setup_channel_impl(context, channelId, orderer): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) peers = context.interface.get_peers(context) context.interface.create_channel(context, orderer, channelId) context.interface.fetch_channel(context, peers, orderer, channelId) context.interface.join_channel(context, peers, channelId)
def deploy_impl(context, path, args, name, containerName, channel): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channel, config_util.CHANNEL_PROFILE, context.composition.projectName) chaincode = { "path": path, "language": "GOLANG", "name": name, "channelID": channel, "args": args, } context.results = endorser_util.deploy_chaincode(context, chaincode, [containerName], channel) # Save chaincode name and path and args context.chaincode = chaincode
def deploy_impl(context, path, args, name, language, containerName, channel): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channel, config_util.CHANNEL_PROFILE, context) chaincode = { "path": path, "language": language, "name": name, "channelID": channel, "args": args, } context.results = context.interface.deploy_chaincode( context, chaincode, [containerName], channel) # Save chaincode name and path and args context.chaincode = chaincode
def setup_channel_impl(context, channelId, orderer, username="******"): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) peers = context.interface.get_peers(context) context.interface.create_channel(context, orderer, channelId, user=username) context.interface.fetch_channel(context, peers, orderer, channelId, user=username) context.interface.join_channel(context, peers, channelId, user=username) # If using any interface besides the CLI, we should add a few seconds delay to be sure # that the code executes successfully if not isinstance(context.interface, CLIInterface): time.sleep(3)
def create_channel_impl(context, channelId, orderer): # Be sure there is a transaction block for this channel config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context) context.interface.create_channel(context, orderer, channelId)
def step_impl(context, channelId): config_util.generateChannelConfig(channelId, config_util.CHANNEL_PROFILE, context)