github.com/yacovm/fabric@v2.0.0-alpha.0.20191128145320-c5d4087dc723+incompatible/integration/nwo/standard_networks.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package nwo
     8  
     9  func BasicSolo() *Config {
    10  	return &Config{
    11  		Organizations: []*Organization{{
    12  			Name:          "OrdererOrg",
    13  			MSPID:         "OrdererMSP",
    14  			Domain:        "example.com",
    15  			EnableNodeOUs: false,
    16  			Users:         0,
    17  			CA:            &CA{Hostname: "ca"},
    18  		}, {
    19  			Name:          "Org1",
    20  			MSPID:         "Org1MSP",
    21  			Domain:        "org1.example.com",
    22  			EnableNodeOUs: true,
    23  			Users:         2,
    24  			CA:            &CA{Hostname: "ca"},
    25  		}, {
    26  			Name:          "Org2",
    27  			MSPID:         "Org2MSP",
    28  			Domain:        "org2.example.com",
    29  			EnableNodeOUs: true,
    30  			Users:         2,
    31  			CA:            &CA{Hostname: "ca"},
    32  		}},
    33  		Consortiums: []*Consortium{{
    34  			Name: "SampleConsortium",
    35  			Organizations: []string{
    36  				"Org1",
    37  				"Org2",
    38  			},
    39  		}},
    40  		Consensus: &Consensus{
    41  			Type: "solo",
    42  		},
    43  		SystemChannel: &SystemChannel{
    44  			Name:    "systemchannel",
    45  			Profile: "TwoOrgsOrdererGenesis",
    46  		},
    47  		Orderers: []*Orderer{
    48  			{Name: "orderer", Organization: "OrdererOrg"},
    49  		},
    50  		Channels: []*Channel{
    51  			{Name: "testchannel", Profile: "TwoOrgsChannel"},
    52  		},
    53  		Peers: []*Peer{{
    54  			Name:         "peer0",
    55  			Organization: "Org1",
    56  			Channels: []*PeerChannel{
    57  				{Name: "testchannel", Anchor: true},
    58  			},
    59  		}, {
    60  			Name:         "peer1",
    61  			Organization: "Org1",
    62  			Channels: []*PeerChannel{
    63  				{Name: "testchannel", Anchor: false},
    64  			},
    65  		}, {
    66  			Name:         "peer0",
    67  			Organization: "Org2",
    68  			Channels: []*PeerChannel{
    69  				{Name: "testchannel", Anchor: true},
    70  			},
    71  		}, {
    72  			Name:         "peer1",
    73  			Organization: "Org2",
    74  			Channels: []*PeerChannel{
    75  				{Name: "testchannel", Anchor: false},
    76  			},
    77  		}},
    78  		Profiles: []*Profile{{
    79  			Name:     "TwoOrgsOrdererGenesis",
    80  			Orderers: []string{"orderer"},
    81  		}, {
    82  			Name:          "TwoOrgsChannel",
    83  			Consortium:    "SampleConsortium",
    84  			Organizations: []string{"Org1", "Org2"},
    85  		}},
    86  	}
    87  }
    88  
    89  func BasicSoloWithIdemix() *Config {
    90  	config := BasicSolo()
    91  
    92  	// Add idemix organization
    93  	config.Organizations = append(config.Organizations, &Organization{
    94  		Name:          "Org3",
    95  		MSPID:         "Org3MSP",
    96  		MSPType:       "idemix",
    97  		Domain:        "org3.example.com",
    98  		EnableNodeOUs: false,
    99  		Users:         0,
   100  		CA:            &CA{Hostname: "ca"},
   101  	})
   102  	// Add idemix organization to consortium
   103  	config.Consortiums[0].Organizations = append(config.Consortiums[0].Organizations, "Org3")
   104  	config.Profiles[1].Organizations = append(config.Profiles[1].Organizations, "Org3")
   105  
   106  	return config
   107  }
   108  
   109  func MultiChannelBasicSolo() *Config {
   110  	config := BasicSolo()
   111  
   112  	config.Channels = []*Channel{
   113  		{Name: "testchannel", Profile: "TwoOrgsChannel"},
   114  		{Name: "testchannel2", Profile: "TwoOrgsChannel"}}
   115  
   116  	for _, peer := range config.Peers {
   117  		peer.Channels = []*PeerChannel{
   118  			{Name: "testchannel", Anchor: true},
   119  			{Name: "testchannel2", Anchor: true},
   120  		}
   121  	}
   122  
   123  	return config
   124  }
   125  
   126  func BasicKafka() *Config {
   127  	config := BasicSolo()
   128  	config.Consensus.Type = "kafka"
   129  	config.Consensus.ZooKeepers = 1
   130  	config.Consensus.Brokers = 1
   131  	return config
   132  }
   133  
   134  func BasicEtcdRaft() *Config {
   135  	config := BasicSolo()
   136  	config.Consensus.Type = "etcdraft"
   137  	config.Profiles = []*Profile{{
   138  		Name:     "SampleDevModeEtcdRaft",
   139  		Orderers: []string{"orderer"},
   140  	}, {
   141  		Name:          "TwoOrgsChannel",
   142  		Consortium:    "SampleConsortium",
   143  		Organizations: []string{"Org1", "Org2"},
   144  	}}
   145  	config.SystemChannel.Profile = "SampleDevModeEtcdRaft"
   146  	return config
   147  }
   148  
   149  func MinimalRaft() *Config {
   150  	config := BasicEtcdRaft()
   151  	config.Peers[1].Channels = nil
   152  	config.Peers[2].Channels = nil
   153  	config.Peers[3].Channels = nil
   154  	config.Profiles[1].Organizations = []string{"Org1"}
   155  	return config
   156  }
   157  
   158  func MultiChannelEtcdRaft() *Config {
   159  	config := MultiChannelBasicSolo()
   160  
   161  	config.Consensus.Type = "etcdraft"
   162  	config.Profiles = []*Profile{{
   163  		Name:     "SampleDevModeEtcdRaft",
   164  		Orderers: []string{"orderer"},
   165  	}, {
   166  		Name:          "TwoOrgsChannel",
   167  		Consortium:    "SampleConsortium",
   168  		Organizations: []string{"Org1", "Org2"},
   169  	}}
   170  	config.SystemChannel.Profile = "SampleDevModeEtcdRaft"
   171  
   172  	return config
   173  }
   174  
   175  func MultiNodeEtcdRaft() *Config {
   176  	config := BasicEtcdRaft()
   177  	config.Orderers = []*Orderer{
   178  		{Name: "orderer1", Organization: "OrdererOrg"},
   179  		{Name: "orderer2", Organization: "OrdererOrg"},
   180  		{Name: "orderer3", Organization: "OrdererOrg"},
   181  	}
   182  	config.Profiles = []*Profile{{
   183  		Name:     "SampleDevModeEtcdRaft",
   184  		Orderers: []string{"orderer1", "orderer2", "orderer3"},
   185  	}, {
   186  		Name:          "TwoOrgsChannel",
   187  		Consortium:    "SampleConsortium",
   188  		Organizations: []string{"Org1", "Org2"},
   189  	}}
   190  	return config
   191  }