Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orderer v3: clean solo from integration framework #3759

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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