func cliClearVLANs(c *minicli.Command, resp *minicli.Response) error { namespace := GetNamespaceName() prefix := c.StringArgs["prefix"] if namespace != "" { prefix = namespace + vlans.AliasSep + prefix } if prefix == "" { // Clearing everything allocatedVLANs = vlans.NewAllocatedVLANs() } else { allocatedVLANs.Delete(namespace, prefix) } return nil }
// Copyright (2015) Sandia Corporation. // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. package main import ( "errors" "minicli" log "minilog" "strconv" "strings" "vlans" ) var allocatedVLANs = vlans.NewAllocatedVLANs() var vlansCLIHandlers = []minicli.Handler{ { // vlans HelpShort: "display allocated VLANs", HelpLong: ` Display information about allocated VLANs. With no arguments, prints out the known VLAN aliases. The following subcommands are supported: range - view or set the VLAN range add - add an alias blacklist - view or create blacklisted VLAN Note: this command is namespace aware so, for example, adding a range applies to all *new* VLAN aliases in the current namespace.`, Patterns: []string{