[R3.1.1.0-41]: AttributeError while adding policy to VN

Bug #1642279 reported by alok kumar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R3.1
Fix Released
High
alok kumar
R3.1.1.x
In Progress
High
alok kumar
R3.2
Fix Released
High
alok kumar
Trunk
Fix Committed
High
alok kumar

Bug Description

getting below AttributeError while adding policy to VN:

Traceback (most recent call last):
  File "tcutils/wrappers.py", line 73, in wrapper
    result = function(self, *args, **kwargs)
  File "scripts/policy/test_policy_acl.py", line 182, in test_policy_inheritance_src_vn_dst_pol
    project_name=self.project.project_name,options='contrail'))
  File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 679, in useFixture
    reraise(*exc_info)
  File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 666, in useFixture
    fixture.setUp()
  File "/root/contrail-test-ci/fixtures/vn_policy_test.py", line 72, in setUp
    sequence=vnc_api.SequenceType(major=seq, minor=0)))
  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/resource_client.py", line 15297, in add_network_policy
    super(VirtualNetwork, self).add_network_policy(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/vnc_api/gen/resource_common.py", line 25767, in add_network_policy
    ref_info = {'to':ref_obj.get_fq_name(), 'attr':ref_data}
AttributeError: '_DictWithMeta' object has no attribute 'get_fq_name'

setup is available to debug:

env.roledefs = {
    'all': [host1,host2,host3,host4],
    'cfgm': [host1],
    'openstack':[host1],
    'control': [host1,host2],
    'compute': [host3,host4],
    'collector': [host1],
    'webui': [host1],
    'database': [host2],
    'build': [host_build],
}

env.hostnames = {
    'all': ['nodec64', 'nodeg18', 'nodec62', 'nodec12']
}

Run this test case at nodec64:
root@nodec64:~/contrail-test-ci# PYTHONPATH=./scripts:./fixtures TEST_CONFIG_FILE=sanity_params.ini python -m testtools.run scripts.policy.test_policy_acl.TestPolicyAcl.test_policy_inheritance_src_vn_dst_pol

sanity report having this error:
http://10.204.216.50/Docs/logs/3.1.1.0-41_jenkins-ubuntu-14-04_mitaka_Multi_Node_Sanity-98/junit-noframes.html

alok kumar (kalok)
information type: Proprietary → Public
Revision history for this message
Sachin Bansal (sbansal) wrote :

This is a test issue. In add_network_policy call, the policy object should be an instance of NetworkPolicy class, but a _DictWithMeta was passed.

 71 vnc_obj.add_network_policy(conf_policy,
 72 vnc_api.VirtualNetworkPolicyType(
 73 -> sequence=vnc_api.SequenceType(major=seq, minor=0)))

(Pdb) conf_policy
{u'policy': {u'tenant_id': u'f361c44f65644665a9468634ba6efceb', u'entries': {u'policy_rule': [{u'direction': u'<>', u'protocol': u'icmp', u'dst_addresses': [{u'security_group': None, u'subnet': None, u'network_policy': None, u'subnet_list': [], u'virtual_network': u'default-domain:ctest-TestPolicyAcl-12452605:VN2'}], u'action_list': {u'gateway_name': None, u'log': False, u'alert': False, u'qos_action': None, u'assign_routing_instance': None, u'mirror_to': None, u'simple_action': u'pass', u'apply_service': []}, u'rule_uuid': None, u'dst_ports': [{u'end_port': -1, u'start_port': -1}], u'application': [], u'ethertype': None, u'src_addresses': [{u'security_group': None, u'subnet': None, u'network_policy': None, u'subnet_list': [], u'virtual_network': u'default-domain:ctest-TestPolicyAcl-12452605:VN1'}], u'rule_sequence': None, u'src_ports': [{u'end_port': -1, u'start_port': -1}]}]}, u'fq_name': [u'default-domain', u'ctest-TestPolicyAcl-12452605', u'policy12'], u'id': u'54355653-627e-4579-82ff-5501b49d48dd', u'name': u'policy12'}}

tags: removed: api config
Revision history for this message
alok kumar (kalok) wrote :

There is a recent change in script which passes 'contrail' option in vn_policy fixture in test case test_policy_inheritance_src_vn_dst_pol, but policy was still created via openstack.

https://github.com/Juniper/contrail-test/commit/d7d7555d52700dbaedc71d3110e4589884229c9d#diff-c1f2ce56859a44b2b9a52c2c761febe7

Test failed after this commit.

we need to change the option to api for policy fixture too in the test case, so corresponding correct object can be used while attaching the policy to VN in vn_policy fixture.

alok kumar (kalok)
tags: added: automation
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R3.1

Review in progress for https://review.opencontrail.org/26205
Submitter: alok kumar (<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/26206
Submitter: alok kumar (<email address hidden>)

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

Review in progress for https://review.opencontrail.org/26207
Submitter: alok kumar (<email address hidden>)

Revision history for this message
Jeba Paulaiyan (jebap) wrote :

Automation bug. Removing 3.1.1.0 milestone to unblock release

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

Reviewed: https://review.opencontrail.org/26205
Committed: http://github.org/Juniper/contrail-test/commit/28c74718e1a1f5c82b66488f38e826d9c551f5f2
Submitter: Zuul (<email address hidden>)
Branch: R3.1

commit 28c74718e1a1f5c82b66488f38e826d9c551f5f2
Author: Alok Kumar <email address hidden>
Date: Thu Nov 17 00:22:46 2016 -0800

closes bug:1642279
Use contrail api to create policy when attach policy is via contrail.

Change-Id: I0f0a5cfa9306076207dcc844090cb986f716e2e4

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

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

commit c86b06489468bb2b206acf7b7ec81e21d95e8cd2
Author: Alok Kumar <email address hidden>
Date: Thu Nov 17 00:22:46 2016 -0800

closes bug:1642279
Use contrail api to create policy when attach policy is via contrail.
cherry-pick 28c74718e1a1f5c82b66488f38e826d9c551f5f2

Change-Id: I0f0a5cfa9306076207dcc844090cb986f716e2e4

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

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

commit de9b0defd8c0fd13abc52720231d77f6ab144d0a
Author: Alok Kumar <email address hidden>
Date: Thu Nov 17 00:22:46 2016 -0800

closes bug:1642279(cherry-pick 28c74718e1a1f5c82b66488f38e826d9c551f5f2)
Use contrail api to create policy when attach policy is via contrail.

Change-Id: I0f0a5cfa9306076207dcc844090cb986f716e2e4

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

Review in progress for https://review.opencontrail.org/27716
Submitter: alok kumar (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/27716
Committed: http://github.org/Juniper/contrail-test/commit/5f2c5666e815554b81ebc9f8084f45a72dd67325
Submitter: Zuul (<email address hidden>)
Branch: R3.1.1.x

commit 5f2c5666e815554b81ebc9f8084f45a72dd67325
Author: Alok Kumar <email address hidden>
Date: Thu Nov 17 00:22:46 2016 -0800

closes bug:1642279
Use contrail api to create policy when attach policy is via contrail.

Change-Id: I0f0a5cfa9306076207dcc844090cb986f716e2e4

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.