Skip to content

Commit e1d8779

Browse files
denyeartsatota2
authored andcommitted
Add connection profile to test-network-nano-bash
Add connection profile to test-network-nano-bash to enable legacy SDK apps. Signed-off-by: David Enyeart <enyeart@us.ibm.com>
1 parent 839f793 commit e1d8779

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
function one_line_pem {
4+
echo "`awk 'NF {sub(/\\n/, ""); printf "%s\\\\\\\n",$0;}' $1`"
5+
}
6+
7+
function json_ccp {
8+
local PP=$(one_line_pem $4)
9+
local CP=$(one_line_pem $5)
10+
sed -e "s/\${ORG}/$1/" \
11+
-e "s/\${P0PORT}/$2/" \
12+
-e "s/\${CAPORT}/$3/" \
13+
-e "s#\${PEERPEM}#$PP#" \
14+
-e "s#\${CAPEM}#$CP#" \
15+
./ca/ccp-template.json
16+
}
17+
18+
function yaml_ccp {
19+
local PP=$(one_line_pem $4)
20+
local CP=$(one_line_pem $5)
21+
sed -e "s/\${ORG}/$1/" \
22+
-e "s/\${P0PORT}/$2/" \
23+
-e "s/\${CAPORT}/$3/" \
24+
-e "s#\${PEERPEM}#$PP#" \
25+
-e "s#\${CAPEM}#$CP#" \
26+
./ca/ccp-template.yaml | sed -e $'s/\\\\n/\\\n /g'
27+
}
28+
29+
ORG=1
30+
P0PORT=7051
31+
CAPORT=5053
32+
PEERPEM=./crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem
33+
CAPEM=./crypto-config/peerOrganizations/org1.example.com/ca/msp/cacerts/ca.org1.example.com-cert.pem
34+
35+
echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ./crypto-config/peerOrganizations/org1.example.com/connection-org1.json
36+
echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ./crypto-config/peerOrganizations/org1.example.com/connection-org1.yaml
37+
38+
ORG=2
39+
P0PORT=7054
40+
CAPORT=5054
41+
PEERPEM=./crypto-config/peerOrganizations/org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem
42+
CAPEM=./crypto-config/peerOrganizations/org2.example.com/ca/msp/cacerts/ca.org2.example.com-cert.pem
43+
44+
echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ./crypto-config/peerOrganizations/org2.example.com/connection-org2.json
45+
echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ./crypto-config/peerOrganizations/org2.example.com/connection-org2.yaml
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "test-network-org${ORG}",
3+
"version": "1.0.0",
4+
"client": {
5+
"organization": "Org${ORG}",
6+
"connection": {
7+
"timeout": {
8+
"peer": {
9+
"endorser": "300"
10+
}
11+
}
12+
}
13+
},
14+
"organizations": {
15+
"Org${ORG}": {
16+
"mspid": "Org${ORG}MSP",
17+
"peers": [
18+
"peer0.org${ORG}.example.com"
19+
],
20+
"certificateAuthorities": [
21+
"ca.org${ORG}.example.com"
22+
]
23+
}
24+
},
25+
"peers": {
26+
"peer0.org${ORG}.example.com": {
27+
"url": "grpcs://127.0.0.1:${P0PORT}",
28+
"tlsCACerts": {
29+
"pem": "${PEERPEM}"
30+
},
31+
"grpcOptions": {
32+
"ssl-target-name-override": "localhost"
33+
}
34+
}
35+
},
36+
"certificateAuthorities": {
37+
"ca.org${ORG}.example.com": {
38+
"url": "https://127.0.0.1:${CAPORT}",
39+
"caName": "ca",
40+
"tlsCACerts": {
41+
"pem": ["${CAPEM}"]
42+
},
43+
"httpOptions": {
44+
"verify": false
45+
}
46+
}
47+
}
48+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: test-network-org${ORG}
3+
version: 1.0.0
4+
client:
5+
organization: Org${ORG}
6+
connection:
7+
timeout:
8+
peer:
9+
endorser: '300'
10+
organizations:
11+
Org${ORG}:
12+
mspid: Org${ORG}MSP
13+
peers:
14+
- peer0.org${ORG}.example.com
15+
certificateAuthorities:
16+
- ca.org${ORG}.example.com
17+
peers:
18+
peer0.org${ORG}.example.com:
19+
url: grpcs://127.0.0.1:${P0PORT}
20+
tlsCACerts:
21+
pem: |
22+
${PEERPEM}
23+
grpcOptions:
24+
ssl-target-name-override: localhost
25+
certificateAuthorities:
26+
ca.org${ORG}.example.com:
27+
url: https://127.0.0.1:${CAPORT}
28+
caName: ca
29+
tlsCACerts:
30+
pem:
31+
- |
32+
${CAPEM}
33+
httpOptions:
34+
verify: false

test-network-nano-bash/ca/createEnrollments.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,12 @@ createMSP "org1ca" "org1" "${org1_dir}"
116116

117117
# Create the MSP for Org2
118118
createMSP "org2ca" "org2" "${org2_dir}"
119+
120+
######################################################################################
121+
# Generate CCP files for Org1 and Org2
122+
######################################################################################
123+
124+
# Generate CCP files for Org1 and Org2"
125+
echo "Generating CCP files for Org1 and Org2"
126+
./ca/ccp-generate.sh
127+
echo "Generated CCP files for Org1 and Org2"

0 commit comments

Comments
 (0)