[3.2.2.0-31]OpServerUtils.get_query_result not returning the result

Bug #1674283 reported by Ankit Jain
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R3.0
New
High
Sandip Dey
R3.0.3.x
New
High
Sandip Dey
R3.1
New
High
Sandip Dey
R3.2
Fix Committed
High
Sandip Dey
R4.0
Fix Committed
High
Sandip Dey
R4.1
Fix Committed
High
Sandip Dey
Trunk
Fix Committed
High
Sandip Dey

Bug Description

AnalyticsTestSanityWithResource.test_verify_flow_tables test case failed
due to this issue.

Failing in the following :

[Build "Ubuntu 14.04.4 LTS" 3.0.3.3-21~kilo] Multi-Interface HA Sanity[mgmt, ctrl=data] Report

[Build "Ubuntu 14.04.4 LTS" 3.0.3.3-21~kilo] Multi-Interface HA Sanity[mgmt, ctrl=data] Report

[Build "Ubuntu 14.04.5 LTS" 3.2.2.0-31~kilo] Multi-Node Virtual Testbed Sanity[mgmt, ctrl=data] Report

[Build "Ubuntu 14.04.5 LTS" 3.2.2.0-31~mitaka] Multi-Node Virtual Testbed Contrail Networking Package Sanity Report

OpServerUtils.get_query_result(Async query) not returning the result.

In the following code, OpServerUtils.get_query_result is not returning anything:

                try:
                    qid = resp['href'].rsplit('/', 1)[1]
                    result = OpServerUtils.get_query_result(
                        self._ip, str(self._port), qid, headers)
                    for item in result:
                        res.append(item)
                except Exception as e:
                    if 'value' in resp:
                        for item in resp['value']:
                            res.append(item)

The following was the query:

http://10.204.217.172:8081/analytics/query/9ed98ea8-0d55-11e7-9b75-00000accd9ac/chunk-final/0

and the query did not return anything as opposed to the script expectation.

Looks like an issue with the where clause when async query is done.
In this case, src vn and dst were specified as shown below.. When

Query:
(Pdb) query_dict
{'table': 'FlowRecordTable', 'start_time': 1490024059000000, 'where': [[{'value2': None, 'name': 'sourcevn', 'value': 'default-domain:ctest-AnalyticsTestSanityWithResource-27927104:ctest-vn1-74822829', 'op': 1}, {'value2': None, 'name': 'destvn', 'value': 'default-domain:ctest-AnalyticsTestSanityWithResource-27927104:ctest-vn2-71443793', 'op': 1}]], 'end_time': 1490004657344320, 'select_fields': ['sourcevn', 'sourceip', 'destvn', 'destip', 'setup_time', 'teardown_time', 'agg-packets']}

Logs:

> /root/contrail-test-ci/tcutils/collector/opserver_introspect_utils.py(297)post_query()

-> flows_url = OpServerUtils.opserver_query_url(self._ip, str(self._port))
 flows_url
'http://10.204.217.172:8081/analytics/query'

-> query_dict = OpServerUtils.get_query_dict(table, start_time, end_time,select_fields,where_clause,sort_fields, sort, limit, filter, dir)
(Pdb) query_dict
{'table': 'FlowRecordTable', 'start_time': 1490024059000000, 'where': [[{'value2': None, 'name': 'sourcevn', 'value': 'default-domain:ctest-AnalyticsTestSanityWithResource-27927104:ctest-vn1-74822829', 'op': 1}, {'value2': None, 'name': 'destvn', 'value': 'default-domain:ctest-AnalyticsTestSanityWithResource-27927104:ctest-vn2-71443793', 'op': 1}]], 'end_time': 1490004657344320, 'select_fields': ['sourcevn', 'sourceip', 'destvn', 'destip', 'setup_time', 'teardown_time', 'agg-packets']}

-> resp = OpServerUtils.post_url_http(flows_url, json.dumps(query_dict), headers)

 resp
u'{"href": "/analytics/query/9ed98ea8-0d55-11e7-9b75-00000accd9ac"}'

-> qid = resp['href'].rsplit('/', 1)[1]

> /root/contrail-test-ci/tcutils/collector/opserver_introspect_utils.py(315)post_query()
-> result = OpServerUtils.get_query_result(self._ip, str(self._port), qid, headers)

-> print resp.__dict__

{'cookies': <<class 'requests.cookies.RequestsCookieJar'>[]>, '_content': False, 'headers': CaseInsensitiveDict({'date': 'Mon, 20 Mar 2017 10:12:16 GMT', 'transfer-encoding': 'chunked', 'content-type': 'application/json'}), 'url': u'http://10.204.217.172:8081/analytics/query/9ed98ea8-0d55-11e7-9b75-00000accd9ac/chunk-final/0', 'status_code': 200, '_content_consumed': False, 'encoding': None, 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x7ff9946d1d50>, 'elapsed': datetime.timedelta(0, 0, 6647), 'raw': <urllib3.response.HTTPResponse object at 0x7ff994702310>, 'reason': 'OK', 'history': []}

> /root/contrail-test-ci/tcutils/collector/opserver_util.py(140)get_query_result()
-> for chunk in status['chunks']:
status['chunks']
[{u'count': 0, u'start_time': u'1490024059000000', u'lines': 0, u'href': u'/analytics/query/9ed98ea8-0d55-11e7-9b75-00000accd9ac/chunk-final/0', u'end_time': u'1490004657344320', u'ttl': 271, u'progress': 100}]

http://10.204.217.172:8081/analytics/query/9ed98ea8-0d55-11e7-9b75-00000accd9ac/chunk-final/0
{
value: [ ]
}

root/contrail-test-ci/serial_scripts/analytics/test_analytics_resource.py(874)test_verify_flow_tables()
-> self.logger.info("Query output: %s" % (self.res2))
(Pdb) n
2017-03-20 10:31:00,726 - INFO - Query output: []

Discussed with Nikhil.

Tags: automation
Ankit Jain (ankitja)
Changed in juniperopenstack:
importance: Undecided → High
Ankit Jain (ankitja)
Changed in juniperopenstack:
milestone: r3.2.2.0 → none
Ankit Jain (ankitja)
description: updated
Jeba Paulaiyan (jebap)
tags: removed: sanity
Revision history for this message
Nikhil Bansal (nikhilb-u) wrote :

start_time and end_time are passed from different timezones. One is IST and other one is UTC. Because of this, delta time is 1 microsecond and query engine does not find anything.

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

Review in progress for https://review.opencontrail.org/30497
Submitter: Sandip Dey (<email address hidden>)

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

Review in progress for https://review.opencontrail.org/30498
Submitter: Sandip Dey (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/30498
Committed: http://github.org/Juniper/contrail-test-ci/commit/73958f1604956a531e2a8739adc6efa0d5654d76
Submitter: Zuul (<email address hidden>)
Branch: master

commit 73958f1604956a531e2a8739adc6efa0d5654d76
Author: Sandip Dey <email address hidden>
Date: Mon Apr 17 10:24:39 2017 -0700

Fix for bug 1674283

Docker time zone was UTC, but the cfgm time zone was IST.
So the time difference calculation went incorrect as start time
was taken from cfgm and the end time from docker.

Made a change to calculate UTC time for start time before sending the query

Change-Id: I80c8c92d21dd52f9cce8af8f6ad483de4eaa2f79

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/30497
Committed: http://github.org/Juniper/contrail-test-ci/commit/76709321aee9445f401219a1c12dc3a18c8d85c8
Submitter: Zuul (<email address hidden>)
Branch: R3.2

commit 76709321aee9445f401219a1c12dc3a18c8d85c8
Author: Sandip Dey <email address hidden>
Date: Mon Apr 17 10:24:39 2017 -0700

Fix for bug 1674283

Docker time zone was UTC, but the cfgm time zone was IST.
So the time difference calculation went incorrect as start time
was taken from cfgm and the end time from docker.

Made a change to calculate UTC time for start time before sending the query

Change-Id: I80c8c92d21dd52f9cce8af8f6ad483de4eaa2f79

Raj Reddy (rajreddy)
tags: added: automation
removed: analytics
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.