コード例 #1
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, userName, createChannelSignedConfigEnvelope):
    directory = bootstrap_util.getDirectory(context)
    user = directory.getUser(userName)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)


    channelID = context.table.rows[0]["ChannelID"]
    chainCreationPolicyName = context.table.rows[0]["Chain Creation Policy Name"]
    templateName = context.table.rows[0]["Template"]
    # Loop through templates referenced orgs
    mspOrgNames = [org.name for org in user.tags[templateName]]
    signedMspConfigItems = bootstrap_util.getSignedMSPConfigItems(context=context, orgNames=mspOrgNames)

    # Add the anchors signed config Items
    anchorSignedConfigItemsName = context.table.rows[0]["Anchors"]
    signedAnchorsConfigItems = user.tags[anchorSignedConfigItemsName]

    # Intermediate step until template tool is ready
    consensus_type = ordererBootstrapAdmin.tags["ConsensusType"]
    channel_config_groups = bootstrap_util.createSignedConfigItems(directory=directory,
                                                                   consensus_type=consensus_type,
                                                                   configGroups=signedMspConfigItems + signedAnchorsConfigItems)

    # bootstrap_util.setMetaPolicy(channelId=channelID, channgel_config_groups=channgel_config_groups)

    #NOTE: Conidered passing signing key for appDeveloper, but decided that the peer org signatures they need to collect subsequently should be proper way
    config_update_envelope = bootstrap_util.createConfigUpdateEnvelope(channelConfigGroup=channel_config_groups, chainId=channelID, chainCreationPolicyName=chainCreationPolicyName)

    user.setTagValue(createChannelSignedConfigEnvelope, config_update_envelope)
コード例 #2
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, ordererSystemChainIdName, mspConfigItemsName):
    assert 'table' in context, "Expected table of policy names"
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    mspSignedConfigItems = bootstrap_util.getMspConfigItemsForPolicyNames(context, policyNames=[row['PolicyName'] for row in context.table.rows])
    ordererBootstrapAdmin.setTagValue(mspConfigItemsName, mspSignedConfigItems)
コード例 #3
0
ファイル: bootstrap_impl.py プロジェクト: blockc/fabric
def step_impl(context, certAlias, ordererGenesisBlockName, ordererSystemChainIdName, composeFile, consensusType, consortiumsModPolicy):
    directory = bootstrap_util.getDirectory(context=context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    # Now collect the named signed config items
    configGroups =[bootstrap_util.getDefaultConsortiumGroup(consortiumsModPolicy)]
    for row in context.table.rows:
        configGroupName = row['Consortium']
        configGroups += ordererBootstrapAdmin.tags[configGroupName]
    # Concatenate signedConfigItems

    service_names = compose.Composition(context, composeFilesYaml=composeFile, register_and_up=False).getServiceNames()

    # Construct block
    nodeAdminTuple = ordererBootstrapAdmin.tags[certAlias]
    bootstrapCert = directory.findCertForNodeAdminTuple(nodeAdminTuple=nodeAdminTuple)
    (genesisBlock, envelope, genesis_block_channel_config) = bootstrap_util.createGenesisBlock(context=context,
                                                                                               service_names=service_names,
                                                                                               chainId=ordererSystemChainIdGUUID,
                                                                                               consensusType=consensusType,
                                                                                               nodeAdminTuple=nodeAdminTuple,
                                                                                               signedConfigItems=configGroups)
    ordererBootstrapAdmin.setTagValue(ordererGenesisBlockName + "_genesis_channel_config", genesis_block_channel_config)
    ordererBootstrapAdmin.setTagValue(ordererGenesisBlockName, genesisBlock)
    ordererBootstrapAdmin.setTagValue("ConsensusType", consensusType)
    bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
    bootstrap_util.PeerCompositionCallback(context)
コード例 #4
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, certAlias):
    assert "table" in context, "Expected table of Organizations"
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    assert len(context.table.rows) == 1, "Only support single orderer orgnaization at moment"
    for row in context.table.rows:
        nodeAdminNamedTuple = directory.registerOrdererAdminTuple(ordererBootstrapAdmin.name, "ordererBootstrapAdmin", row['Organization'])
        ordererBootstrapAdmin.setTagValue(certAlias, nodeAdminNamedTuple)
コード例 #5
0
def step_impl(context, orderer_snapshot_alias):
    contextHelper = ContextHelper.GetHelper(context=context)
    bootstrap_helper = contextHelper.get_bootstrap_helper()
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    assert "composition" in context, "No composition found in context"
    composition = context.composition
    bootstrap_helper.snapshot_orderer_system(context=context, composition=composition,
                                             snapshot_name=orderer_snapshot_alias)
コード例 #6
0
ファイル: bootstrap_impl.py プロジェクト: shader/fabric
def step_impl(context, ordererSystemChainId, networkConfigPolicy, consensusType, chainCreatorPolicyNames):
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    # Retrieve the chainCreators config items required for now (tuple).
    chainCreatorsSignedConfigItems = ordererBootstrapAdmin.tags[chainCreatorPolicyNames]
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainId]

    (genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=list(chainCreatorsSignedConfigItems))
    bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
    bootstrap_util.PeerCompositionCallback(context)
コード例 #7
0
ファイル: bootstrap_impl.py プロジェクト: shader/fabric
def step_impl(context, chainCreatePolicyName, ordererSystemChainId):
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGuuid = ordererBootstrapAdmin.tags[ordererSystemChainId]

    # Collect the orgs from the table
    orgNames = [row['Organization'] for row in context.table.rows]

    (chainCreationPolicyNamesSignedConfigItem, chainCreatorsOrgsPolicySignedConfigItem) = \
        bootstrap_util.createChainCreatorsPolicy(context=context, chainCreatePolicyName=chainCreatePolicyName, chaindId=ordererSystemChainIdGuuid, orgNames=orgNames)

    ordererBootstrapAdmin.tags[chainCreatePolicyName] = (chainCreationPolicyNamesSignedConfigItem, chainCreatorsOrgsPolicySignedConfigItem)
コード例 #8
0
ファイル: bootstrap_impl.py プロジェクト: lehors/fabric
def step_impl(context, consortiumName):
    directory = bootstrap_util.getDirectory(context)


    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)

    # Collect the orgs from the table
    orgNames = [row['Organization'] for row in context.table.rows]
    bootstrap_util.addOrdererBootstrapAdminOrgReferences(context, consortiumName, orgNames)

    consortium = bootstrap_util.createConsortium(context=context, consortium_name=consortiumName, org_names=orgNames)
    ordererBootstrapAdmin.setTagValue(consortiumName, [consortium])
コード例 #9
0
ファイル: bootstrap_impl.py プロジェクト: conseweb/fabric
def step_impl(context, ordererSystemChainIdName, networkConfigPolicy, consensusType):
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    # Now collect the named signed config items
    signedConfigItems =[]
    for row in context.table.rows:
        signedConfigItemName = row['SignedConfigItemsName']
        signedConfigItems += ordererBootstrapAdmin.tags[signedConfigItemName]

    # Concatenate signedConfigItems

    # Construct block
    (genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=signedConfigItems)
    bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
    bootstrap_util.PeerCompositionCallback(context)
コード例 #10
0
def step_impl(context, ordererSystemChainIdName, networkConfigPolicy, consensusType):
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    # Now collect the named signed config items
    signedConfigItems =[]
    for row in context.table.rows:
        signedConfigItemName = row['SignedConfigItemsName']
        signedConfigItems += ordererBootstrapAdmin.tags[signedConfigItemName]

    # Concatenate signedConfigItems

    # Construct block
    (genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=signedConfigItems)
    bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
    bootstrap_util.PeerCompositionCallback(context)
コード例 #11
0
ファイル: bootstrap_impl.py プロジェクト: shader/fabric
def step_impl(context, userName, createChannelSignedConfigEnvelope):
    directory = bootstrap_util.getDirectory(context)
    user = directory.getUser(userName)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)

    muralisRequiredSignedConfigItems = []

    channelID = context.table.rows[0]["ChannelID"]
    chainCreationPolicyName = context.table.rows[0]["Chain Creation Policy Name"]

    # Intermediate step until template tool is ready
    signedConfigItems = bootstrap_util.createSignedConfigItems(context, channelID, "solo", signedConfigItems=muralisRequiredSignedConfigItems)

    #NOTE: Conidered passing signing key for appDeveloper, but decided that the peer org signatures they need to collect subsequently should be proper way
    signedConfigEnvelope = bootstrap_util.signInitialChainConfig(signedConfigItems=signedConfigItems, chainId=channelID, chainCreationPolicyName=chainCreationPolicyName)

    user.tags[createChannelSignedConfigEnvelope] =  ChannelCreationInfo(channelID, chainCreationPolicyName, signedConfigEnvelope)
コード例 #12
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, certAlias, ordererGenesisBlockName, ordererSystemChainIdName, networkConfigPolicy, consensusType):
    directory = bootstrap_util.getDirectory(context=context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    # Now collect the named signed config items
    configGroups =[]
    for row in context.table.rows:
        configGroupName = row['ConfigGroup Names']
        configGroups += ordererBootstrapAdmin.tags[configGroupName]
    # Concatenate signedConfigItems

    # Construct block
    nodeAdminTuple = ordererBootstrapAdmin.tags[certAlias]
    bootstrapCert = directory.findCertForNodeAdminTuple(nodeAdminTuple=nodeAdminTuple)
    (genesisBlock, envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType,
                                                                 nodeAdminTuple=nodeAdminTuple,
                                                                 signedConfigItems=configGroups)
    ordererBootstrapAdmin.setTagValue(ordererGenesisBlockName, genesisBlock)
    ordererBootstrapAdmin.setTagValue("ConsensusType", consensusType)
    bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
    bootstrap_util.PeerCompositionCallback(context)
コード例 #13
0
ファイル: bootstrap_impl.py プロジェクト: conseweb/fabric
def step_impl(context, userName, createChannelSignedConfigEnvelope):
    directory = bootstrap_util.getDirectory(context)
    user = directory.getUser(userName)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)


    channelID = context.table.rows[0]["ChannelID"]
    chainCreationPolicyName = context.table.rows[0]["Chain Creation Policy Name"]
    templateName = context.table.rows[0]["Template"]
    # Loop through templates referenced orgs
    mspOrgNames = [org.name for org in user.tags[templateName]]
    signedMspConfigItems = bootstrap_util.getSignedMSPConfigItems(context=context, chainId=channelID, orgNames=mspOrgNames)

    # Add the anchors signed config Items
    anchorSignedConfigItemsName = context.table.rows[0]["Anchors"]
    signedAnchorsConfigItems = user.tags[anchorSignedConfigItemsName]

    # Intermediate step until template tool is ready
    signedConfigItems = bootstrap_util.createSignedConfigItems(context, channelID, "solo", signedConfigItems=signedMspConfigItems + signedAnchorsConfigItems)

    #NOTE: Conidered passing signing key for appDeveloper, but decided that the peer org signatures they need to collect subsequently should be proper way
    signedConfigEnvelope = bootstrap_util.signInitialChainConfig(signedConfigItems=signedConfigItems, chainId=channelID, chainCreationPolicyName=chainCreationPolicyName)

    user.tags[createChannelSignedConfigEnvelope] =  ChannelCreationInfo(channelID, chainCreationPolicyName, signedConfigEnvelope)
コード例 #14
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context):
    directory = bootstrap_util.getDirectory(context)
    assert len(directory.ordererAdminTuples) > 0, "No orderer admin tuples defined!!!"
    # Simply create the user
    bootstrap_util.getOrdererBootstrapAdmin(context, shouldCreate=True)
コード例 #15
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, chainCreationPolicyNames, ordererSystemChainIdName):
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
    policyNames = [row['PolicyName'] for row in context.table.rows]
    chainCreationPolicyNamesConfigItem = bootstrap_util.createChainCreationPolicyNames(context, chainCreationPolicyNames=policyNames, chaindId=ordererSystemChainIdGUUID)
    ordererBootstrapAdmin.setTagValue(chainCreationPolicyNames, [chainCreationPolicyNamesConfigItem])
コード例 #16
0
ファイル: bootstrap_impl.py プロジェクト: shader/fabric
def step_impl(context, ordererSystemChainId):
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererBootstrapAdmin.tags[ordererSystemChainId] = bootstrap_util.GetUUID()
コード例 #17
0
ファイル: bootstrap_impl.py プロジェクト: 2016Nishi/fabric
def step_impl(context, ordererSystemChainId):
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    ordererBootstrapAdmin.setTagValue(ordererSystemChainId, bootstrap_util.GetUUID())
コード例 #18
0
ファイル: bootstrap_impl.py プロジェクト: blockc/fabric
def step_impl(context, ordererSystemChainId):
    directory = bootstrap_util.getDirectory(context)
    ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
    chaind_id = bootstrap_util.GetUniqueChannelName()
    ordererBootstrapAdmin.setTagValue(ordererSystemChainId, chaind_id)