R3.1 build 17: AlarmOperand2 instance when tried to create by passing only json_value throws an error

Bug #1610661 reported by Ankit Jain
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R3.1
Fix Committed
High
Sundaresan Rajangam
Trunk
Fix Committed
High
Sundaresan Rajangam

Bug Description

operand2 = AlarmOperand2(json_value=value) <---------------Passing only json_value, not uve_attribute

rules = {
        "or_list":[
                {
                 "and_list": [
                    {
                     "operand1": "ContrailConfig.elements.display_name",
                     "operand2": operand2,
                     "operation": "==",
                     "variables": ["ContrailConfig.elements.display_name"],

                     },
                              ]
(Pdb) operand2
<vnc_api.gen.resource_xsd.AlarmOperand2 object at 0x7f3216935d90>
(Pdb) json.dumps(operand2, default=obj_serializer)

'{"uve_attribute": null, "json_value": "\\"vn1\\""}' <----Uve_attribute is getting added in the final json_body causing request to be failed.

Passing only json_value or uve_attribute should be allowed.

  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/resource_test.py", line 993, in setUp
    self._conn_drv.alarm_create(self._obj)
  File "/usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py", line 40, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py", line 349, in _object_create
    json_body = '{"%s":%s}' %(res_type, obj_json_param)
  File "/usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py", line 707, in _request_server
    retry_count=retry_count)
  File "/usr/lib/python2.7/dist-packages/vnc_api/vnc_api.py", line 768, in _request
    raise BadRequest(status, content)
cfgm_common.exceptions.BadRequest: operand2 should have either "uve_attribute" or "json_value", not both

Tags: analytics
Changed in juniperopenstack:
importance: Undecided → Critical
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R3.1

Review in progress for https://review.opencontrail.org/23063
Submitter: Sundaresan Rajangam (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/23063
Committed: http://github.org/Juniper/contrail-controller/commit/c2d5a986420726f56c2e91aff1c24c34a223fc65
Submitter: Zuul
Branch: R3.1

commit c2d5a986420726f56c2e91aff1c24c34a223fc65
Author: Sundaresan Rajangam <email address hidden>
Date: Mon Aug 8 15:03:25 2016 -0700

Fix validation of alarm rules

Alarm config validation code should handle the case when both
"uve_attribute" and "json_value" are passed in AlarmOperand2, but one of
these values is None

Change-Id: Iebee9d8f7f4a6e308d9be8993ed0f78a74a3754c
Closes-Bug: #1610661

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

Review in progress for https://review.opencontrail.org/23190
Submitter: Sundaresan Rajangam (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/23190
Committed: http://github.org/Juniper/contrail-controller/commit/a55ab2c1453b23f4944203945ca7575d5b6a6473
Submitter: Zuul
Branch: master

commit a55ab2c1453b23f4944203945ca7575d5b6a6473
Author: Sundaresan Rajangam <email address hidden>
Date: Mon Aug 8 15:03:25 2016 -0700

Fix validation of alarm rules

Alarm config validation code should handle the case when both
"uve_attribute" and "json_value" are passed in AlarmOperand2, but one of
these values is None

Change-Id: Iebee9d8f7f4a6e308d9be8993ed0f78a74a3754c
Closes-Bug: #1610661
(cherry picked from commit c2d5a986420726f56c2e91aff1c24c34a223fc65)

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.