switch.go
func MakeConnectedSwitches(n int, initSwitch func(int, *Switch) *Switch, connect func([]*Switch, int, int)) []*Switch {
	switches := make([]*Switch, n)
	for i := 0; i < n; i++ {
		switches[i] = makeSwitch(i, "testing", "123.123.123", initSwitch)
	}

	if err := StartSwitches(switches); err != nil {
		panic(err)
	}

	for i := 0; i < n; i++ {
		for j := i; j < n; j++ {
			connect(switches, i, j)
		}
	}

	return switches
}
func MakeConnectedSwitches(n int, initSwitch func(int, *Switch) *Switch, connect func([]*Switch, int, int)) []*Switch {
	switches := make([]*Switch, n)
	for i := 0; i < n; i++ {
		switches[i] = makeSwitch(i, "testing", "123.123.123", initSwitch)
	}

	if err := StartSwitches(switches); err != nil {
		panic(err)
	}

	for i := 0; i < n; i++ {
		for j := i; j < n; j++ {
			connect(switches, i, j)
		}
	}

	return switches
}
func MakeConnectedSwitches ( n int , initSwitch func ( int , * Switch ) * Switch , connect func ( [ ] * Switch , int , int ) ) [ ] * Switch { switches := make ( [ ] * Switch , n ) for i := 0 ; i < n ; i ++ { switches [ i ] = makeSwitch ( i , " " , " " , initSwitch ) } if err := StartSwitches ( switches ) ; err != nil { panic ( err ) } for i := 0 ; i < n ; i ++ { for j := i ; j < n ; j ++ { connect ( switches , i , j ) } } return switches }
//------------------------------------------------------------------
// Switches connected via arbitrary net.Conn; useful for testing
// Returns n switches, connected according to the connect func.
// If connect==Connect2Switches, the switches will be fully connected.
// initSwitch defines how the ith switch should be initialized (ie. with what reactors).
// NOTE: panics if any switch fails to start.
------------------------------------------------------------------ Switches connected via arbitrary net . Conn ; useful for testing Returns n switches connected according to the connect func . If connect == Connect2Switches the switches will be fully connected . initSwitch defines how the ith switch should be initialized ( ie . with what reactors ) . NOTE : panics if any switch fails to start .