Commit abdf48d5 authored by Dionysis Grigoropoulos's avatar Dionysis Grigoropoulos
Browse files

cyclades: Update snf-manage subnet-* commands

* Update snf-manage commands to use the new userid and public fields
introduced in commit bdedfd9d79be7f1c00764b5d56a326d30b30b474
parent 91d4b423
......@@ -64,6 +64,12 @@ class Command(ListCommand):
dest="dhcp",
default=False,
help="List only subnets that have DHCP/SLAC enabled"),
make_option(
"--public",
action="store_true",
dest="public",
default=False,
help="List only public subnets"),
)
object_class = Subnet
......@@ -75,15 +81,16 @@ class Command(ListCommand):
"id": ("id", "ID of the subnet"),
"network": ("network_id", "ID of the network the subnet belongs to"),
"name": ("name", "Name of the subnet"),
"user.uuid": ("network.userid", "The UUID of the subnet's owner"),
"user.uuid": ("userid", "The UUID of the subnet's owner"),
"cidr": ("cidr", "The CIDR of the subnet"),
"ipversion": ("ipversion", "The IP version of the subnet"),
"gateway": ("gateway", "The gateway IP of the subnet"),
"dhcp": ("dhcp", "DHCP flag of the subnet"),
"public": ("public", "Public flag of the subnet"),
}
fields = ["id", "network", "name", "user.uuid", "cidr", "ipversion",
"gateway", "dhcp"]
"gateway", "dhcp", "public"]
def handle_args(self, *args, **options):
if options["ipv4"] and options["ipv6"]:
......@@ -97,3 +104,6 @@ class Command(ListCommand):
if options["dhcp"]:
self.filters["dhcp"] = True
if options["public"]:
self.filters["public"] = True
......@@ -135,10 +135,12 @@ def pprint_subnet_in_db(subnet, stdout=None, title=None):
info = OrderedDict([("ID", subnet.id),
("Network_ID", subnet.network.id),
# If a user names his subnet "-", what happens then?
("User_ID", subnet.userid),
("Name", "-" if subnet.name == "" else subnet.name),
("IP_Version", subnet.ipversion),
("CIDR", subnet.cidr),
("Gateway", subnet.gateway),
("Public", subnet.public),
("DHCP/SLAAC", subnet.dhcp),
("Host_Routes", subnet.host_routes),
("DNS_Nameservers", subnet.dns_nameservers)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment