func TestIPAMCleanup(t *testing.T) { ecc.Delete(dataStore, "192.170.0.0/24") ecc.Delete(dataStore, "192.170.32.0/20") ecc.Delete(dataStore, "192.167.1.0/24") ecc.Delete(dataStore, "192.168.0.0/16") ecc.Delete(dataStore, "192.169.32.0/20") LeaveDatastore() }
func DeleteNetwork(id string) error { network, err := GetNetwork(id) if err != nil { return err } if ovs == nil { return errors.New("OVS not connected") } eccerror := ecc.Delete(networkStore, id) if eccerror != ecc.OK { return errors.New("Error deleting network") } releaseVlan(network.Vlan) deletePort(ovs, defaultBridgeName, id) return nil }
func main() { ecc.Start(true, true, "eth1", dataDir) listener := eccListener{} go ecc.RegisterForNodeUpdates(listener) go ecc.RegisterForKeyUpdates("network", "web", listener) keyUpdates("web") ecc.Delete("network", "web") go ecc.RegisterForKeyUpdates("network", "db", listener) keyUpdates("db") keyUpdates("web") // Ctrl+C handling ecc.Leave() time.Sleep(time.Second * 15) ecc.Start(true, true, "eth1", dataDir) handler := make(chan os.Signal, 1) signal.Notify(handler, os.Interrupt) for sig := range handler { if sig == os.Interrupt { time.Sleep(1e9) break } } }