add new config_e2e.yaml

parent 4ef1f132
This diff is collapsed.
...@@ -2,12 +2,16 @@ package e2e ...@@ -2,12 +2,16 @@ package e2e
import ( import (
"fmt" "fmt"
"github.com/fabric-sdk-sample/fabric-sdk-go/internal/github.com/hyperledger/fabric/common/cauthdsl"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/client/channel" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/client/channel"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/client/ledger" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/client/ledger"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/client/resmgmt"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/common/errors/retry" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/common/errors/retry"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/common/providers/core" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/common/providers/core"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/core/config" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/core/config"
packager "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/fab/ccpackager/gopackager"
"github.com/fabric-sdk-sample/fabric-sdk-go/pkg/fabsdk" "github.com/fabric-sdk-sample/fabric-sdk-go/pkg/fabsdk"
"github.com/fabric-sdk-sample/fabric-sdk-go/test/integration"
) )
var ( var (
...@@ -70,6 +74,28 @@ func CcInvoke(ccId ,functionName string,ccArgs [][]byte) []byte { ...@@ -70,6 +74,28 @@ func CcInvoke(ccId ,functionName string,ccArgs [][]byte) []byte {
} }
func CcCreate(){
configOpt := getConfig()
sdk, err := fabsdk.New(configOpt)
if err != nil {
fmt.Println("Failed to create new SDK: ", err)
}
defer sdk.Close()
//prepare context
adminContext := sdk.Context(fabsdk.WithUser(orgAdmin), fabsdk.WithOrg(orgName))
// Org resource management client
orgResMgmt, err := resmgmt.New(adminContext)
if err != nil {
fmt.Println("Failed to create new resource management client: ", err)
}
// Create chaincode package for example cc
response:= createCc(orgResMgmt)
fmt.Println("createCc txId",response.TransactionID)
}
func QueryBlockByHeight(){ func QueryBlockByHeight(){
configOpt := getConfig() configOpt := getConfig()
sdk, err := fabsdk.New(configOpt) sdk, err := fabsdk.New(configOpt)
...@@ -117,3 +143,27 @@ func executeCc(client *channel.Client,ccId ,functionName string,ccArgs [][]byte) ...@@ -117,3 +143,27 @@ func executeCc(client *channel.Client,ccId ,functionName string,ccArgs [][]byte)
} }
func createCc( orgResMgmt *resmgmt.Client) resmgmt.InstantiateCCResponse {
ccPkg, err := packager.NewCCPackage("github.com/example_cc", integration.GetDeployPath())
if err != nil {
fmt.Printf("createCc happen err: %s", err)
}
// Install example cc to org peers
installCCReq := resmgmt.InstallCCRequest{Name: ccID, Path: "github.com/example_cc", Version: "0", Package: ccPkg}
_, err = orgResMgmt.InstallCC(installCCReq, resmgmt.WithRetry(retry.DefaultResMgmtOpts))
if err != nil {
fmt.Printf("createCc happen err: %s", err)
}
// Set up chaincode policy
ccPolicy := cauthdsl.SignedByAnyMember([]string{"Org1MSP"})
// Org resource manager will instantiate 'example_cc' on channel
resp, err := orgResMgmt.InstantiateCC(
channelID,
resmgmt.InstantiateCCRequest{Name: ccID, Path: "github.com/example_cc", Version: "0", Args: integration.ExampleCCInitArgs(), Policy: ccPolicy},
resmgmt.WithRetry(retry.DefaultResMgmtOpts),
)
if err!=nil{
fmt.Printf("createCc happen err: %s", err)
}
return resp
}
\ No newline at end of file
...@@ -22,46 +22,46 @@ client: ...@@ -22,46 +22,46 @@ client:
# Which organization does this application instance belong to? The value must be the name of an org # Which organization does this application instance belong to? The value must be the name of an org
# defined under "organizations" # defined under "organizations"
organization: org1 organization: org2
logging: logging:
level: info level: info
# Global configuration for peer, event service and orderer timeouts # Global configuration for peer, event service and orderer timeouts
# if this this section is omitted, then default values will be used (same values as below) # if this this section is omitted, then default values will be used (same values as below)
# peer: # peer:
# timeout: # timeout:
# connection: 10s # connection: 10s
# response: 180s # response: 180s
# discovery: # discovery:
# # Expiry period for discovery service greylist filter # # Expiry period for discovery service greylist filter
# # The channel client will greylist peers that are found to be offline # # The channel client will greylist peers that are found to be offline
# # to prevent re-selecting them in subsequent retries. # # to prevent re-selecting them in subsequent retries.
# # This interval will define how long a peer is greylisted # # This interval will define how long a peer is greylisted
# greylistExpiry: 10s # greylistExpiry: 10s
# eventService: # eventService:
# the below timeouts are commented out to use the default values that are found in # the below timeouts are commented out to use the default values that are found in
# "pkg/fab/endpointconfig.go" # "pkg/fab/endpointconfig.go"
# the client is free to override the default values by uncommenting and resetting # the client is free to override the default values by uncommenting and resetting
# the values as they see fit in their config file # the values as they see fit in their config file
# timeout: # timeout:
# registrationResponse: 15s # registrationResponse: 15s
# orderer: # orderer:
# timeout: # timeout:
# connection: 15s # connection: 15s
# response: 15s # response: 15s
# global: # global:
# timeout: # timeout:
# query: 180s # query: 180s
# execute: 180s # execute: 180s
# resmgmt: 180s # resmgmt: 180s
# cache: # cache:
# connectionIdle: 30s # connectionIdle: 30s
# eventServiceIdle: 2m # eventServiceIdle: 2m
# channelConfig: 30m # channelConfig: 30m
# channelMembership: 30s # channelMembership: 30s
# discovery: 10s # discovery: 10s
# selection: 10m # selection: 10m
# Root of the MSP directories with keys and certs. # Root of the MSP directories with keys and certs.
cryptoconfig: cryptoconfig:
...@@ -74,12 +74,12 @@ client: ...@@ -74,12 +74,12 @@ client:
# [Optional] BCCSP config for the client. Used by GO SDK. # [Optional] BCCSP config for the client. Used by GO SDK.
BCCSP: BCCSP:
security: security:
enabled: true enabled: true
default: default:
provider: "SW" provider: "SW"
hashAlgorithm: "SHA2" hashAlgorithm: "SHA2"
softVerify: true softVerify: true
level: 256 level: 256
tlsCerts: tlsCerts:
# [Optional]. Use system certificate pool when connecting to peers, orderers (for negotiating TLS) Default: false # [Optional]. Use system certificate pool when connecting to peers, orderers (for negotiating TLS) Default: false
...@@ -88,9 +88,9 @@ client: ...@@ -88,9 +88,9 @@ client:
# [Optional]. Client key and cert for TLS handshake with peers and orderers # [Optional]. Client key and cert for TLS handshake with peers and orderers
client: client:
key: key:
path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.key path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/client.key
cert: cert:
path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/client.crt path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/client.crt
# #
# [Optional]. But most apps would have this section so that channel objects can be constructed # [Optional]. But most apps would have this section so that channel objects can be constructed
...@@ -239,6 +239,25 @@ channels: ...@@ -239,6 +239,25 @@ channels:
# produce events but the app typically only needs to connect to one to listen to events. # produce events but the app typically only needs to connect to one to listen to events.
# Default: true # Default: true
eventSource: true eventSource: true
peer0.org2.example.com:
# [Optional]. will this peer be sent transaction proposals for endorsement? The peer must
# have the chaincode installed. The app can also use this property to decide which peers
# to send the chaincode install request. Default: true
endorsingPeer: true
# [Optional]. will this peer be sent query proposals? The peer must have the chaincode
# installed. The app can also use this property to decide which peers to send the
# chaincode install request. Default: true
chaincodeQuery: true
# [Optional]. will this peer be sent query proposals that do not require chaincodes, like
# queryBlock(), queryTransaction(), etc. Default: true
ledgerQuery: true
# [Optional]. will this peer be the target of the SDK's listener registration? All peers can
# produce events but the app typically only needs to connect to one to listen to events.
# Default: true
eventSource: true
# #
...@@ -282,11 +301,11 @@ organizations: ...@@ -282,11 +301,11 @@ organizations:
# Orderer Org name # Orderer Org name
ordererorg: ordererorg:
# Membership Service Provider ID for this organization # Membership Service Provider ID for this organization
mspID: OrdererMSP mspID: OrdererMSP
# Needed to load users crypto keys and certs for this org (absolute path or relative to global crypto path, DEV mode) # Needed to load users crypto keys and certs for this org (absolute path or relative to global crypto path, DEV mode)
cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp cryptoPath: ordererOrganizations/example.com/users/{username}@example.com/msp
# #
...@@ -418,22 +437,22 @@ certificateAuthorities: ...@@ -418,22 +437,22 @@ certificateAuthorities:
cert: cert:
path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/client.crt path: /opt/gopath/src/github.com/fabric-sdk-sample/fabric-sdk-go/${CRYPTOCONFIG_FIXTURES_PATH}/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/client.crt
# Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is # Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is
# needed to enroll and invoke new users. # needed to enroll and invoke new users.
registrar: registrar:
enrollId: admin enrollId: admin
enrollSecret: adminpw enrollSecret: adminpw
# [Optional] The optional name of the CA. # [Optional] The optional name of the CA.
caName: ca.org2.example.com caName: ca.org2.example.com
# EntityMatchers enable substitution of network hostnames with static configurations # EntityMatchers enable substitution of network hostnames with static configurations
# so that properties can be mapped. Regex can be used for this purpose # so that properties can be mapped. Regex can be used for this purpose
# UrlSubstitutionExp can be empty which means the same network hostname will be used # UrlSubstitutionExp can be empty which means the same network hostname will be used
# UrlSubstitutionExp can be given same as mapped peer url, so that mapped peer url can be used # UrlSubstitutionExp can be given same as mapped peer url, so that mapped peer url can be used
# UrlSubstitutionExp can have golang regex matchers like ${1}.local.example.${2}:${3} for pattern # UrlSubstitutionExp can have golang regex matchers like ${1}.local.example.${2}:${3} for pattern
# like peer0.org1.example.com:1234 which converts peer0.org1.example.com to peer0.org1.local.example.com:1234 # like peer0.org1.example.com:1234 which converts peer0.org1.example.com to peer0.org1.local.example.com:1234
# sslTargetOverrideUrlSubstitutionExp follow in the same lines as # sslTargetOverrideUrlSubstitutionExp follow in the same lines as
# SubstitutionExp for the fields gprcOptions.ssl-target-name-override respectively # SubstitutionExp for the fields gprcOptions.ssl-target-name-override respectively
# In any case mappedHost's config will be used, so mapped host cannot be empty, if entityMatchers are used # In any case mappedHost's config will be used, so mapped host cannot be empty, if entityMatchers are used
#entityMatchers: #entityMatchers:
#entityMatchers: #entityMatchers:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment