-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-15127] Update high throughput sample
Update high throughput sample scripts for chaincode lifecycle Change-Id: I8e7f9d98bb62d75a779e2767b0e165a36a700d43 Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
- Loading branch information
NIKHIL E GUPTA
committed
May 28, 2019
1 parent
fdf88df
commit 41dca99
Showing
9 changed files
with
144 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Copyright IBM Corp All Rights Reserved | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
|
||
echo "========== Query chaincode package ID ==========" | ||
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | ||
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 | ||
export CORE_PEER_LOCALMSPID="Org1MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | ||
peer lifecycle chaincode queryinstalled >&log.txt | ||
export PACKAGE_ID=`sed -n '/Package/{s/^Package ID: //; s/, Label:.*$//; p;}' log.txt` | ||
|
||
echo "========== Approve definition for Org1 ==========" | ||
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | ||
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 | ||
export CORE_PEER_LOCALMSPID="Org1MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | ||
peer lifecycle chaincode install ${CC_NAME}.tar.gz | ||
|
||
peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --package-id ${PACKAGE_ID} --sequence $1 | ||
|
||
echo "========== Approve definition for Org2 ==========" | ||
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp | ||
export CORE_PEER_ADDRESS=peer0.org2.example.com:9051 | ||
export CORE_PEER_LOCALMSPID="Org2MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt | ||
peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --package-id ${PACKAGE_ID} --sequence $1 | ||
|
||
. query-status.sh | ||
|
||
queryStatus $1 0 1 "\"Org1MSP\": true" "\"Org2MSP\": true" | ||
queryStatus $1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": true" | ||
|
||
|
||
echo "========== Commit the definition the $CHANNEL_NAME ==========" | ||
peer lifecycle chaincode commit -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --sequence $1 --waitForEvent --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt | ||
|
||
|
||
echo "========== Invoke the Init function ==========" | ||
peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME --isInit -c '{"Args":["Init"]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# Copyright IBM Corp All Rights Reserved | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
setGlobals() { | ||
PEER=$1 | ||
ORG=$2 | ||
if [ $ORG -eq 1 ]; then | ||
CORE_PEER_LOCALMSPID="Org1MSP" | ||
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | ||
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | ||
if [ $PEER -eq 0 ]; then | ||
CORE_PEER_ADDRESS=peer0.org1.example.com:7051 | ||
else | ||
CORE_PEER_ADDRESS=peer1.org1.example.com:8051 | ||
fi | ||
elif [ $ORG -eq 2 ]; then | ||
CORE_PEER_LOCALMSPID="Org2MSP" | ||
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt | ||
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp | ||
if [ $PEER -eq 0 ]; then | ||
CORE_PEER_ADDRESS=peer0.org2.example.com:9051 | ||
else | ||
CORE_PEER_ADDRESS=peer1.org2.example.com:10051 | ||
fi | ||
|
||
else | ||
echo "================== ERROR !!! ORG Unknown ==================" | ||
fi | ||
|
||
if [ "$VERBOSE" == "true" ]; then | ||
env | grep CORE | ||
fi | ||
} | ||
|
||
queryStatus() { | ||
VERSION=$1 | ||
PEER=$2 | ||
ORG=$3 | ||
shift 3 | ||
setGlobals $PEER $ORG | ||
echo "===================== Querying approval status on peer${PEER}.org${ORG} ===================== " | ||
local rc=1 | ||
local starttime=$(date +%s) | ||
|
||
# continue to poll | ||
# we either get a successful response, or reach TIMEOUT | ||
while | ||
test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0 | ||
do | ||
sleep $DELAY | ||
echo "Attempting to Query approval status on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs" | ||
set -x | ||
peer lifecycle chaincode queryapprovalstatus --channelID $CHANNEL_NAME --name $CC_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --version ${VERSION} --init-required --sequence ${VERSION} >&log.txt | ||
res=$? | ||
set +x | ||
test $res -eq 0 || continue | ||
let rc=0 | ||
for var in "$@" | ||
do | ||
grep "$var" log.txt &>/dev/null || let rc=1 | ||
done | ||
done | ||
echo | ||
cat log.txt | ||
if test $rc -eq 0; then | ||
echo "===================== Query approval status successful on peer${PEER}.org${ORG} ===================== " | ||
else | ||
echo "!!!!!!!!!!!!!!! Query approval status result on peer${PEER}.org${ORG} is INVALID !!!!!!!!!!!!!!!!" | ||
echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" | ||
echo | ||
exit 1 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
|
||
export CHANNEL_NAME=mychannel | ||
export CC_NAME=bigdatacc | ||
export TIMEOUT=10 | ||
export DELAY=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.