port-show filter is also returning binding-attribute fields along with the required fields

Bug #1468616 reported by Vedamurthy Joshi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R2.20
Fix Committed
Medium
Hampapur Ajay
Trunk
Fix Committed
Medium
Hampapur Ajay

Bug Description

R2.20 Build 60 Ubuntu 14.04

http://10.204.216.50/Docs/logs/2.20-57_2015_06_20_15_08_00/junit-noframes.html
Test TestCRUD.test_network_subnet_port_crud failed with assertion :

raceback (most recent call last):
File "tcutils/wrappers.py", line 145, in wrapper
raise TestFailed("\n ".join(errmsg))
tcutils.cores.TestFailed: Test failed:
File "tcutils/wrappers.py", line 63, in wrapper
result = function(self, *args, **kwargs)
File "scripts/neutron/test_crud.py", line 90, in test_network_subnet_port_crud
self._test_subnets(response['network'])
File "tcutils/util.py", line 536, in wrapper
return f(*args, **kwargs)
File "scripts/neutron/test_crud.py", line 205, in _test_subnets
self._test_ports(network_obj, response['subnet'])
File "tcutils/util.py", line 536, in wrapper
return f(*args, **kwargs)
File "scripts/neutron/test_crud.py", line 343, in _test_ports
self.read_port_tests(port_obj)
File "tcutils/util.py", line 536, in wrapper
return f(*args, **kwargs)
File "scripts/neutron/test_crud.py", line 435, in read_port_tests
"Expected : %s, Got: %s" % (fields, response['port'])

AssertionError:
Mismatch in number of fields returned!Expected : {'fields': ['status']}, Got: {u'status': u'DOWN', u'binding:vif_type': u'vrouter', u'binding:vif_details': {u'port_filter': True}}
=========================================

Below, the user had just asked to return status field. But he got two other attributes also.

root@nodec1:~# neutron port-show -F status 2aa943e0-2519-4f78-b96a-019ae11489a3
+---------------------+-----------------------+
| Field | Value |
+---------------------+-----------------------+
| binding:vif_details | {"port_filter": true} |
| binding:vif_type | vrouter |
| status | DOWN |
+---------------------+-----------------------+
root@nodec1:~# neutron port-show -v -F status 2aa943e0-2519-4f78-b96a-019ae11489a3
DEBUG: keystoneclient.session REQ: curl -i -X GET http://10.204.216.184:5000/v2.0/ -H "Accept: application/json" -H "User-Agent: python-keystoneclient"
DEBUG: keystoneclient.session RESP: [200] CaseInsensitiveDict({'date': 'Thu, 25 Jun 2015 05:35:40 GMT', 'vary': 'X-Auth-Token', 'content-length': '424', 'content-type': 'application/json', 'x-distribution': 'Ubuntu'})
RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}, {"base": "application/xml", "type": "application/vnd.openstack.identity-v2.0+xml"}], "id": "v2.0", "links": [{"href": "http://10.204.216.184:5000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}

DEBUG: stevedore.extension found extension EntryPoint.parse('table = cliff.formatters.table:TableFormatter')
DEBUG: stevedore.extension found extension EntryPoint.parse('shell = cliff.formatters.shell:ShellFormatter')
DEBUG: stevedore.extension found extension EntryPoint.parse('value = cliff.formatters.value:ValueFormatter')
DEBUG: neutronclient.neutron.v2_0.port.ShowPort get_data(Namespace(columns=[], fields=[u'status'], formatter='table', id=u'2aa943e0-2519-4f78-b96a-019ae11489a3', max_width=0, prefix='', request_format='json', show_details=False, variables=[]))
DEBUG: keystoneclient.auth.identity.v2 Making authentication request to http://10.204.216.184:5000/v2.0/tokens
DEBUG: keystoneclient.session REQ: curl -i -X GET http://10.204.216.184:9696/v2.0/ports.json?fields=id&id=2aa943e0-2519-4f78-b96a-019ae11489a3 -H "User-Agent: python-neutronclient" -H "Accept: application/json" -H "X-Auth-Token: 414fd86c3da44ad593a5e680b6391129"
DEBUG: keystoneclient.session RESP: [200] CaseInsensitiveDict({'date': 'Thu, 25 Jun 2015 05:35:40 GMT', 'content-length': '136', 'content-type': 'application/json; charset=UTF-8', 'x-openstack-request-id': 'req-7094147b-1575-4827-8714-31d9b1c4ae76'})
RESP BODY: {"ports": [{"binding:vif_type": "vrouter", "binding:vif_details": {"port_filter": true}, "id": "2aa943e0-2519-4f78-b96a-019ae11489a3"}]}

DEBUG: keystoneclient.session REQ: curl -i -X GET http://10.204.216.184:9696/v2.0/ports/2aa943e0-2519-4f78-b96a-019ae11489a3.json?fields=status -H "User-Agent: python-neutronclient" -H "Accept: application/json" -H "X-Auth-Token: 414fd86c3da44ad593a5e680b6391129"
DEBUG: keystoneclient.session RESP: [200] CaseInsensitiveDict({'date': 'Thu, 25 Jun 2015 05:35:40 GMT', 'content-length': '105', 'content-type': 'application/json; charset=UTF-8', 'x-openstack-request-id': 'req-1af3234b-93ba-4ba8-a0da-4a3b62640373'})
RESP BODY: {"port": {"status": "DOWN", "binding:vif_type": "vrouter", "binding:vif_details": {"port_filter": true}}}

+---------------------+-----------------------+
| Field | Value |
+---------------------+-----------------------+
| binding:vif_details | {"port_filter": true} |
| binding:vif_type | vrouter |
| status | DOWN |
+---------------------+-----------------------+
root@nodec1:~#

Revision history for this message
Sachin Bansal (sbansal) wrote :

I don’t see the issue on mainline:

root@b4s9:/usr/lib/python2.7/dist-packages/vnc_cfg_api_server# neutron port-show -F status 4a7c9e53-336b-4e42-b29b-98f031cc4d4e
+--------+-------+
| Field | Value |
+--------+-------+
| status | DOWN |
+--------+———+

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/17691
Submitter: Sachin Bansal (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/17691
Committed: http://github.org/Juniper/contrail-neutron-plugin/commit/542d26070916626f524935e3859814b8c12b77ae
Submitter: Zuul
Branch: R2.20

commit 542d26070916626f524935e3859814b8c12b77ae
Author: Sachin Bansal <email address hidden>
Date: Tue Feb 23 15:15:57 2016 -0800

pass fields to _make_port_dict

We were not passing fields to _make_port_dict, so it was always adding
the bindings.

Change-Id: Ic35df9e1795dafdbe1cbe10ead34a306f9e9ea33
Closes-Bug: 1468616

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.