Skip to content

Commit

Permalink
Orderer v3: clean solo from integration framework
Browse files Browse the repository at this point in the history
Signed-off-by: Yoav Tock <tock@il.ibm.com>
Change-Id: I4c2f64caff2c44f9706f4a4cde3f6200fa610737
  • Loading branch information
tock-ibm authored and ale-linux committed Nov 1, 2022
1 parent 1d483ff commit 0c4d3b9
Showing 1 changed file with 38 additions and 125 deletions.
163 changes: 38 additions & 125 deletions integration/nwo/standard_networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ SPDX-License-Identifier: Apache-2.0

package nwo

// BasicSolo is a configuration with two organizations and one peer per org.
func BasicSolo() *Config {
// BasicConfig is a configuration with two organizations and one peer per org.
// This configuration does not specify a consensus type.
func BasicConfig() *Config {
return &Config{
Organizations: []*Organization{{
Name: "OrdererOrg",
Expand Down Expand Up @@ -39,7 +40,6 @@ func BasicSolo() *Config {
},
}},
Consensus: &Consensus{
Type: "solo",
BootstrapMethod: "file",
},
SystemChannel: &SystemChannel{
Expand All @@ -65,82 +65,18 @@ func BasicSolo() *Config {
{Name: "testchannel", Anchor: true},
},
}},
Profiles: []*Profile{{
Name: "TwoOrgsOrdererGenesis",
Orderers: []string{"orderer"},
}, {
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
}},
}
}

// ThreeOrgSolo returns a simple configuration with three organizations instead
// of two.
func ThreeOrgSolo() *Config {
config := BasicSolo()
config.Organizations = append(
config.Organizations,
&Organization{
Name: "Org3",
MSPID: "Org3MSP",
Domain: "org3.example.com",
Users: 2,
CA: &CA{Hostname: "ca"},
},
)
config.Consortiums[0].Organizations = append(
config.Consortiums[0].Organizations,
"Org3",
)
config.SystemChannel.Profile = "ThreeOrgsOrdererGenesis"
config.Channels[0].Profile = "ThreeOrgsChannel"
config.Peers = append(
config.Peers,
&Peer{
Name: "peer0",
Organization: "Org3",
Channels: []*PeerChannel{
{Name: "testchannel", Anchor: true},
Profiles: []*Profile{
{
Name: "TwoOrgsOrdererGenesis",
Orderers: []string{"orderer"},
},
},
)
config.Profiles = []*Profile{{
Name: "ThreeOrgsOrdererGenesis",
Orderers: []string{"orderer"},
}, {
Name: "ThreeOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2", "Org3"},
}}

return config
}

// FullSolo is a configuration with two organizations and two peers per org.
func FullSolo() *Config {
config := BasicSolo()

config.Peers = append(
config.Peers,
&Peer{
Name: "peer1",
Organization: "Org1",
Channels: []*PeerChannel{
{Name: "testchannel", Anchor: false},
{
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
},
},
&Peer{
Name: "peer1",
Organization: "Org2",
Channels: []*PeerChannel{
{Name: "testchannel", Anchor: false},
},
},
)

return config
}
}

// ThreeOrgEtcdRaft returns a simple configuration with three organizations instead
Expand Down Expand Up @@ -230,46 +166,8 @@ func BasicEtcdRaftWithIdemix() *Config {
return config
}

func BasicSoloWithIdemix() *Config {
config := BasicSolo()

// Add idemix organization
config.Organizations = append(config.Organizations, &Organization{
Name: "Org3",
MSPID: "Org3MSP",
MSPType: "idemix",
Domain: "org3.example.com",
EnableNodeOUs: false,
Users: 0,
CA: &CA{Hostname: "ca"},
})
// Add idemix organization to consortium
config.Consortiums[0].Organizations = append(config.Consortiums[0].Organizations, "Org3")
config.Profiles[1].Organizations = append(config.Profiles[1].Organizations, "Org3")

return config
}

func MultiChannelBasicSolo() *Config {
config := BasicSolo()

config.Channels = []*Channel{
{Name: "testchannel", Profile: "TwoOrgsChannel"},
{Name: "testchannel2", Profile: "TwoOrgsChannel"},
}

for _, peer := range config.Peers {
peer.Channels = []*PeerChannel{
{Name: "testchannel", Anchor: true},
{Name: "testchannel2", Anchor: true},
}
}

return config
}

func BasicEtcdRaft() *Config {
config := BasicSolo()
config := BasicConfig()

config.Consensus.Type = "etcdraft"
config.Profiles = []*Profile{{
Expand Down Expand Up @@ -346,9 +244,21 @@ func ThreeOrgRaft() *Config {
}

func MultiChannelEtcdRaft() *Config {
config := MultiChannelBasicSolo()
config := BasicConfig()

config.Consensus.Type = "etcdraft"
config.Channels = []*Channel{
{Name: "testchannel", Profile: "TwoOrgsChannel"},
{Name: "testchannel2", Profile: "TwoOrgsChannel"},
}

for _, peer := range config.Peers {
peer.Channels = []*PeerChannel{
{Name: "testchannel", Anchor: true},
{Name: "testchannel2", Anchor: true},
}
}

config.Profiles = []*Profile{{
Name: "SampleDevModeEtcdRaft",
Orderers: []string{"orderer"},
Expand Down Expand Up @@ -381,22 +291,25 @@ func MultiNodeEtcdRaft() *Config {
}

func MultiNodeBFT() *Config {
config := BasicSolo()
config := BasicConfig()

config.Consensus.Type = "BFT"
config.Orderers = []*Orderer{
{Name: "orderer1", Organization: "OrdererOrg"},
{Name: "orderer2", Organization: "OrdererOrg"},
{Name: "orderer3", Organization: "OrdererOrg"},
}
config.Profiles = []*Profile{{
Name: "SampleDevModeBFT",
Orderers: []string{"orderer1", "orderer2", "orderer3"},
}, {
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
}}
config.Profiles = []*Profile{
{
Name: "SampleDevModeBFT",
Orderers: []string{"orderer1", "orderer2", "orderer3"},
},
{
Name: "TwoOrgsChannel",
Consortium: "SampleConsortium",
Organizations: []string{"Org1", "Org2"},
},
}
config.SystemChannel.Profile = "SampleDevModeBFT"

return config
Expand Down

0 comments on commit 0c4d3b9

Please sign in to comment.