Skip to content

Commit

Permalink
FAB-8523 Update fabric generated artifacts to v1.1
Browse files Browse the repository at this point in the history
PS:

14 issue with testing on Windows.

Change-Id: I67c728f92762c2edcca7e1b9890b5425b4296ab3
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Mar 1, 2018
1 parent dc2b94f commit 8f65202
Show file tree
Hide file tree
Showing 252 changed files with 1,819 additions and 1,018 deletions.
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,20 @@ In the directory src/test/fixture/sdkintegration/e2e-2Orgs/channel

The command used to generate end2end `crypto-config` artifacts:</br>

```build/bin/cryptogen generate --config crypto-config.yaml --output=crypto-config```
v1.0 ```build/bin/cryptogen generate --config crypto-config.yaml --output=crypto-config```

v1.1 ```cryptogen generate --config crypto-config.yaml --output=v1.1/crypto-config```

For ease of assigning ports and mapping of artifacts to physical files, all peers, orderers, and fabric-ca are run as Docker containers controlled via a docker-compose configuration file.

The files used by the end to end are:
* _src/test/fixture/sdkintegration/e2e-2Orgs/channel_ (everything needed to bootstrap the orderer and create the channels)
* _src/test/fixture/sdkintegration/e2e-2Orgs/crypto-config_ (as-is. Used by `configtxgen` and `docker-compose` to map the MSP directories)
* _src/test/fixture/sdkintegration/e2e-2Orgs/vX.0_ (everything needed to bootstrap the orderer and create the channels)
* _src/test/fixture/sdkintegration/e2e-2Orgs/vX.0crypto-config_ (as-is. Used by `configtxgen` and `docker-compose` to map the MSP directories)
* _src/test/fixture/sdkintegration/docker-compose.yaml_




The end to end test case artifacts are stored under the directory _src/test/fixture/sdkintegration/e2e-2Org/channel_ .

### TLS connection to Orderer and Peers
Expand Down Expand Up @@ -297,25 +301,31 @@ and one file in the _src/test/fixture/sdkintegration/e2e-2Orgs/channel_ director
section to be true. The `signed-by` references an identity in the identities section.

### Channel creation artifacts
Channel configuration files and orderer bootstrap files ( see directory _src/test/fixture/sdkintegration/e2e-2Orgs/channel_ ) are needed when creating a new channel.
This is created with the Hyperledger Fabric `configtxgen` tool.
Channel configuration files and orderer bootstrap files ( see directory _src/test/fixture/sdkintegration/e2e-2Orgs_ ) are needed when creating a new channel.
This is created with the Hyperledger Fabric `configtxgen` tool. This must be run after `cryptogen` and the directory you're
running in **must** have a generated `crypto-config` directory.

If `build/bin/configtxgen` tool is not present run `make configtxgen`

For End2endIT.java the commands are
For v1.0 integration test the commands are:

* build/bin/configtxgen -outputCreateChannelTx foo.tx -profile TwoOrgsChannel -channelID foo
* build/bin/configtxgen -outputCreateChannelTx bar.tx -profile TwoOrgsChannel -channelID bar
* build/bin/configtxgen -outputBlock orderer.block -profile TwoOrgsOrdererGenesis

with the configtxgen config file _src/test/fixture/sdkintegration/e2e-2Orgs/channel/configtx.yaml_
For v1.1 integration the commands use the v11 profiles in configtx.yaml.
You need to for now copy the configtx.yaml in `e2e-20orgs` to the v1.1 directory and run from there:
* configtxgen -outputBlock orderer.block -profile TwoOrgsOrdererGenesis_v11
* configtxgen -outputCreateChannelTx bar.tx -profile TwoOrgsChannel_v11 -channelID bar
* configtxgen -outputCreateChannelTx foo.tx -profile TwoOrgsChannel_v11 -channelID foo

This should produce in the `v1.1` directory: bar.tx,foo.tx, orderer.block

**Note:** The above describes how this was done. If you redo this there are private key files
which are produced with uniqe names which won't match what's expected in the integration tests.
One examle of this is the docker-compose.yaml (search for **_sk**)


If `build/bin/configtxgen` tool is not present run `make configtxgen`

Before running the end to end test case:
* you may need to modify `configtx.yaml` to change all hostname and port definitions to match
your server(s) hostname(s) and port(s).
* you **WILL** have to modify `configtx.yaml` to have the _MSPDir_ point to the correct path to the _crypto-config_ directories.
* `configtx.yaml` currently assumes that you are running in a Vagrant environment where the fabric, fabric-ca and fabric-sdk-java projects exist under the _/opt/gopath/src/github.com/hyperledger_ directory.

### GO Lang chaincode
Go lang chaincode dependencies must be contained in vendor folder.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
import org.hyperledger.fabric.sdk.helper.Utils;
import org.hyperledger.fabric.sdk.security.CryptoPrimitives;
import org.hyperledger.fabric.sdk.security.CryptoSuite;
import org.hyperledger.fabric_ca.sdk.HFCAAffiliation.HFCAAffiliationResp;
import org.hyperledger.fabric_ca.sdk.exception.AffiliationException;
import org.hyperledger.fabric_ca.sdk.exception.EnrollmentException;
import org.hyperledger.fabric_ca.sdk.exception.GenerateCRLException;
Expand Down Expand Up @@ -168,6 +167,8 @@ public class HFCAClient {
*/
public static final String HFCA_ATTRIBUTE_HFGENCRL = "hf.GenCRL";

private static final Config config = Config.getConfig(); // DO NOT REMOVE THIS IS NEEDED TO MAKE SURE WE FIRST LOAD CONFIG!!!

private static final Log logger = LogFactory.getLog(HFCAClient.class);

static final String FABRIC_CA_REQPROP = "caname";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class RegistrationRequest {
// The enrollment ID of the user
private String enrollmentID;
// Type of identity
private String type = "user";
private String type = HFCAClient.HFCA_TYPE_CLIENT;
// Optional secret
private String secret;
// Maximum number of enrollments with the secret
Expand Down
6 changes: 6 additions & 0 deletions src/test/cirun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ export ORG_HYPERLEDGER_FABRIC_SDK_CHANNEL_GENESISBLOCK_WAIT_TIME=180000
ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION:-}

if [ "$ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION" == "1.0.0" ]; then
# Limit the test run for V1.0
export ORG_HYPERLEDGER_FABRIC_SDKTEST_ITSUITE="-Dorg.hyperledger.fabric.sdktest.ITSuite=IntegrationSuiteV1.java"
#Options starting fabric-ca in docker-compose.yaml which are not supported on v1.0
export V11_IDENTITIES_ALLOWREMOVE=""
export V11_AFFILIATIONS_ALLOWREMOVE=""
#set which images we pull for docker-compose.yaml when starting Fabric.
export IMAGE_TAG_FABRIC=:x86_64-1.0.0
export IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0
# set which Fabric generated configuations is used.
export FAB_CONFIG_GEN_VERS="v1.0"
else
#everythign just defaults for latest (v1.1)
export ORG_HYPERLEDGER_FABRIC_SDKTEST_ITSUITE=""
#unset to use what's in docker's .env file.
unset IMAGE_TAG_FABRIC
Expand Down
2 changes: 2 additions & 0 deletions src/test/fixture/sdkintegration/.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=
#IMAGE_TAG_FABRIC_CA=:x86_64-1.1.0-alpha
IMAGE_TAG_FABRIC=
IMAGE_TAG_FABRIC_CA=
#FAB_CONFIG_GEN_VERS=v1.0
FAB_CONFIG_GEN_VERS=v1.1
V11_IDENTITIES_ALLOWREMOVE=--cfg.identities.allowremove
V11_AFFILIATIONS_ALLOWREMOVE=--cfg.affiliations.allowremove
18 changes: 9 additions & 9 deletions src/test/fixture/sdkintegration/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
command: sh -c 'fabric-ca-server start -n ca0 ${V11_IDENTITIES_ALLOWREMOVE} ${V11_AFFILIATIONS_ALLOWREMOVE} --registry.maxenrollments -1 --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/fcf776b02a05600408d0be9d9752afc59f64950b721cacb363b5b95a0fea6216_sk -b admin:adminpw ${ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS} --tls.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --tls.keyfile /etc/hyperledger/fabric-ca-server-config/fcf776b02a05600408d0be9d9752afc59f64950b721cacb363b5b95a0fea6216_sk -d'

volumes:
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
container_name: ca_peerOrg1

ca1:
Expand All @@ -26,7 +26,7 @@ services:
- "8054:7054"
command: sh -c 'fabric-ca-server start --registry.maxenrollments -1 --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/b59bba37975dafcc4a93984aa01d3d29b64894617db9e0c9a2d486b5273cbd27_sk -b admin:adminpw ${ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS} --tls.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --tls.keyfile /etc/hyperledger/fabric-ca-server-config/b59bba37975dafcc4a93984aa01d3d29b64894617db9e0c9a2d486b5273cbd27_sk -d'
volumes:
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
container_name: ca_peerOrg2


Expand All @@ -44,14 +44,14 @@ services:
- ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt]
# - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt, /etc/hyperledger/msp/peer0Org1/tls/ca.crt, /etc/hyperledger/msp/peer1Org1/tls/ca.crt, /etc/hyperledger/msp/peer0Org2/tls/ca.crt, /etc/hyperledger/msp/peer1Org2/tls/ca.crt]
- GRPC_TRACE=all=true,
- GRPC_VERBOSITY=debug
- ORDERER_GENERAL_AUTHENTICATION_TIMEWINDOW=3600s #Not for production -- remove.
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ./e2e-2Orgs/channel:/etc/hyperledger/configtx:ro
- ./e2e-2Orgs/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}:/etc/hyperledger/configtx:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer:ro
ports:
- 7050:7050

Expand All @@ -68,7 +68,7 @@ services:
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer:ro
ports:
- 7051:7051
- 7053:7053
Expand All @@ -88,7 +88,7 @@ services:
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/:/etc/hyperledger/msp/peer:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/:/etc/hyperledger/msp/peer:ro
ports:
- 7056:7051
- 7058:7053
Expand All @@ -109,7 +109,7 @@ services:
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer:ro
ports:
- 8051:7051
- 8053:7053
Expand All @@ -129,7 +129,7 @@ services:
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/:/etc/hyperledger/msp/peer:ro
- ./e2e-2Orgs/${FAB_CONFIG_GEN_VERS}/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/:/etc/hyperledger/msp/peer:ro
ports:
- 8056:7051
- 8058:7053
Expand Down
149 changes: 0 additions & 149 deletions src/test/fixture/sdkintegration/e2e-2Orgs/channel/configtx.yaml

This file was deleted.

Loading

0 comments on commit 8f65202

Please sign in to comment.