Skip to content

Commit

Permalink
Merge "Adds client side functions for quantum 'detail' actions."
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Mar 14, 2012
2 parents 2de3db0 + 8e5453e commit 46783f1
Show file tree
Hide file tree
Showing 5 changed files with 751 additions and 93 deletions.
53 changes: 51 additions & 2 deletions quantum/client/__init__.py
Expand Up @@ -167,6 +167,7 @@ class Client(object):
ports_path = "/networks/%s/ports"
port_path = "/networks/%s/ports/%s"
attachment_path = "/networks/%s/ports/%s/attachment"
detail_path = "/detail"

def __init__(self, host="127.0.0.1", port=9696, use_ssl=False, tenant=None,
format="xml", testingStub=None, key_file=None, cert_file=None,
Expand Down Expand Up @@ -347,12 +348,27 @@ def list_networks(self):
"""
return self.do_request("GET", self.networks_path)

@ApiCall
def list_networks_details(self):
"""
Fetches a detailed list of all networks for a tenant
"""
return self.do_request("GET", self.networks_path + self.detail_path)

@ApiCall
def show_network(self, network):
"""
Fetches information of a certain network
"""
return self.do_request("GET", self.network_path % (network))

@ApiCall
def show_network_details(self, network):
"""
Fetches the details of a certain network
"""
return self.do_request("GET", self.network_path % (network))
return self.do_request("GET", (self.network_path + self.detail_path)
% (network))

@ApiCall
def create_network(self, body=None):
Expand Down Expand Up @@ -382,12 +398,28 @@ def list_ports(self, network):
"""
return self.do_request("GET", self.ports_path % (network))

@ApiCall
def list_ports_details(self, network):
"""
Fetches a detailed list of ports on a given network
"""
return self.do_request("GET", (self.ports_path + self.detail_path)
% (network))

@ApiCall
def show_port(self, network, port):
"""
Fetches the information of a certain port
"""
return self.do_request("GET", self.port_path % (network, port))

@ApiCall
def show_port_details(self, network, port):
"""
Fetches the details of a certain port
"""
return self.do_request("GET", self.port_path % (network, port))
return self.do_request("GET", (self.port_path + self.detail_path)
% (network, port))

@ApiCall
def create_port(self, network, body=None):
Expand Down Expand Up @@ -449,6 +481,14 @@ def list_networks(self, **filters):
# Pass filters in "params" argument to do_request
return self.do_request("GET", self.networks_path, params=filters)

@ApiCall
def list_networks_details(self, **filters):
"""
Fetches a detailed list of all networks for a tenant
"""
return self.do_request("GET", self.networks_path + self.detail_path,
params=filters)

@ApiCall
def list_ports(self, network, **filters):
"""
Expand All @@ -457,3 +497,12 @@ def list_ports(self, network, **filters):
# Pass filters in "params" argument to do_request
return self.do_request("GET", self.ports_path % (network),
params=filters)

@ApiCall
def list_ports_details(self, network, **filters):
"""
Fetches a detailed list of ports on a given network
"""
return self.do_request("GET", (self.ports_path + self.detail_path)
% (network),
params=filters)
29 changes: 28 additions & 1 deletion quantum/client/cli.py
Expand Up @@ -51,6 +51,9 @@
"list_nets": {
"func": cli_lib.list_nets,
"args": ["tenant-id"]},
"list_nets_detail": {
"func": cli_lib.list_nets_detail,
"args": ["tenant-id"]},
"create_net": {
"func": cli_lib.create_net,
"args": ["tenant-id", "net-name"]},
Expand All @@ -60,12 +63,18 @@
"show_net": {
"func": cli_lib.show_net,
"args": ["tenant-id", "net-id"]},
"update_net": {
"show_net_detail": {
"func": cli_lib.show_net_detail,
"args": ["tenant-id", "net-id"]},
"update_net": {
"func": cli_lib.update_net,
"args": ["tenant-id", "net-id", "new-name"]},
"list_ports": {
"func": cli_lib.list_ports,
"args": ["tenant-id", "net-id"]},
"list_ports_detail": {
"func": cli_lib.list_ports_detail,
"args": ["tenant-id", "net-id"]},
"create_port": {
"func": cli_lib.create_port,
"args": ["tenant-id", "net-id"]},
Expand All @@ -78,11 +87,17 @@
"show_port": {
"func": cli_lib.show_port,
"args": ["tenant-id", "net-id", "port-id"]},
"show_port_detail": {
"func": cli_lib.show_port_detail,
"args": ["tenant-id", "net-id", "port-id"]},
"plug_iface": {
"func": cli_lib.plug_iface,
"args": ["tenant-id", "net-id", "port-id", "iface-id"]},
"unplug_iface": {
"func": cli_lib.unplug_iface,
"args": ["tenant-id", "net-id", "port-id"]},
"show_iface": {
"func": cli_lib.show_iface,
"args": ["tenant-id", "net-id", "port-id"]}, }

commands_v11 = commands_v10.copy()
Expand All @@ -92,10 +107,19 @@
"args": ["tenant-id"],
"filters": ["name", "op-status", "port-op-status", "port-state",
"has-attachment", "attachment", "port"]},
"list_nets_detail": {
"func": cli_lib.list_nets_detail_v11,
"args": ["tenant-id"],
"filters": ["name", "op-status", "port-op-status", "port-state",
"has-attachment", "attachment", "port"]},
"list_ports": {
"func": cli_lib.list_ports_v11,
"args": ["tenant-id", "net-id"],
"filters": ["name", "op-status", "has-attachment", "attachment"]},
"list_ports_detail": {
"func": cli_lib.list_ports_detail_v11,
"args": ["tenant-id", "net-id"],
"filters": ["name", "op-status", "has-attachment", "attachment"]},
})
commands = {
'1.0': commands_v10,
Expand Down Expand Up @@ -275,3 +299,6 @@ def main():

LOG.info("Command execution completed")
sys.exit(0)

if __name__ == '__main__':
main()

0 comments on commit 46783f1

Please sign in to comment.