From 2354efe6caaa2f028bb1587af029410172127ea1 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Thu, 21 Jan 2016 12:38:39 +0100 Subject: [PATCH] Pass the proper params to getPorts call Fixes the proper params to pass for the neutron ports call by accepting a dictionary with param_name:value as this is whats expected from neutron client/API Change-Id: I75d63f561cac97d2f8e0370f39f260a40029d685 Closes-Bug: #1536586 --- .../openstack-service-api/neutron.service.js | 39 +++++++++++++++++-- .../neutron.service.spec.js | 10 ++++- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.js b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.js index c60ad676df..e162095a3e 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.js @@ -220,11 +220,42 @@ * The listing result is an object with property "items". Each item is * a port. * - * @param {string} networkId - * The network id to retrieve ports for. Required. + * @param {string} params.status + * The port status. Value is ACTIVE or DOWN. + * + * @param {string} params.display_name + * The port name. + * + * @param {boolean} params.admin_state + * The administrative state of the router, which is up (true) or down (false). + * + * @param {string} params.network_id + * The UUID of the attached network. + * + * @param {string} params.tenant_id + * The UUID of the tenant who owns the network. + * Only administrative users can specify a tenant UUID other than their own. + * You cannot change this value through authorization policies. + * + * @param {string} params.device_owner + * The UUID of the entity that uses this port. For example, a DHCP agent. + * + * @param {string} params.mac_address + * The MAC address of the port. + * + * @param {string} params.port_id + * The UUID of the port. + * + * @param {Array} params.security_groups + * The UUIDs of any attached security groups. + * + * @param {string} params.device_id + * The UUID of the device that uses this port. For example, a virtual server. + * */ - function getPorts(networkId) { - return apiService.get('/api/neutron/ports/', networkId) + function getPorts(params) { + var config = (params) ? { 'params' : params} : {}; + return apiService.get('/api/neutron/ports/', config) .error(function () { toastService.add('error', gettext('Unable to retrieve the ports.')); }); diff --git a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js index d8fbf12274..6cd37eadd4 100644 --- a/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js +++ b/openstack_dashboard/static/app/core/openstack-service-api/neutron.service.spec.js @@ -81,10 +81,16 @@ "func": "getPorts", "method": "get", "path": "/api/neutron/ports/", - "data": 42, + "data": { + params: { + network_id: 42 + } + }, "error": "Unable to retrieve the ports.", "testInput": [ - 42 + { + network_id: 42 + } ] }, {