func initializeNode(nodeName string, clusterName string) { if nodeName == "random_name" { nodeName = utils.GetRandomName(0) } counter := -2 for nameExist(nodeName, clusterName) { nodeName = utils.GetRandomName(counter) counter++ } log.Debugln("Node name: ", nodeName) node.CreateNode(nodeName, res.GetResources()) }
func createMockPeers(nPeers int) map[string]string { mockPeers := make(map[string]string, nPeers) for i := 0; i < nPeers-1; i++ { name := utils.GetRandomName(0) mockPeers[name] = string(rand.Intn(nPeers)) } return mockPeers }