Revision 86961519 snf-cyclades-app/synnefo/api/management/commands/port-list.py
b/snf-cyclades-app/synnefo/api/management/commands/port-list.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from optparse import make_option |
|
34 |
#from optparse import make_option
|
|
35 | 35 |
|
36 | 36 |
from snf_django.management.commands import ListCommand |
37 | 37 |
from synnefo.db.models import NetworkInterface |
... | ... | |
45 | 45 |
class Command(ListCommand): |
46 | 46 |
help = "List ports" |
47 | 47 |
|
48 |
|
|
49 | 48 |
object_class = NetworkInterface |
50 | 49 |
user_uuid_field = "userid" |
51 | 50 |
astakos_url = ASTAKOS_BASE_URL |
... | ... | |
54 | 53 |
def get_fixed_ips(ip): |
55 | 54 |
|
56 | 55 |
def labels((a, b)): |
57 |
return str({"subnet": b, "ip_address": str(a) })
|
|
56 |
return str({"subnet": b, "ip_address": str(a)}) |
|
58 | 57 |
|
59 | 58 |
lista = ip.get_ip_addresses_subnets() |
60 | 59 |
lista = map(labels, lista) |
... | ... | |
66 | 65 |
"user.uuid": ("userid", "The UUID of the port's owner"), |
67 | 66 |
"mac_address": ("mac", "The MAC address of the port"), |
68 | 67 |
"device_id": ("machine.id", "The vm's id the port is conncted to"), |
69 |
"status": ("status", "The port's status"),
|
|
68 |
"state": ("state", "The port's status"),
|
|
70 | 69 |
"device_owner": ("device_owner", "The owner of the port (vm/router)"), |
71 | 70 |
"network": ("network.id", "The network's ID the port is\ |
72 | 71 |
connected to"), |
... | ... | |
77 | 76 |
} |
78 | 77 |
|
79 | 78 |
fields = ["id", "name", "user.uuid", "mac_address", "network", |
80 |
"device_id", "fixed_ips"] |
|
79 |
"device_id", "fixed_ips", "state"] |
Also available in: Unified diff