Using non-existing policy name in policy src or dest leads to error.

Bug #1365948 reported by Ritam Gangopadhyay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R1.1
Fix Released
Critical
Sachin Bansal
Trunk
Fix Released
High
Sachin Bansal

Bug Description

If a non-existing policy name is specified in the source or destination of another policy, error is seen in schema transformer.

Steps to reproduce:

1. create a VNs say vn1(10.1.1.0/24)
3. create a policy P12 with rules:
       a. deny protocol icmp network vn1 port any <> NEWPOL port any
       where NEWPOL is name of a policy which is not configured
4. attach the Policy P12 to VN - vn1

<type 'exceptions.NameError'>
Python 2.7.3: /usr/bin/python
Fri Sep 5 15:44:36 2014

A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py in launch_arc(transformer=<schema_transformer.to_bgp.SchemaTransformer object>, ssrc_mapc=<cfgm_common.ifmap.client.client instance>)
 3516 result = arc_mapc.call('poll', pollreq)
 3517 try:
 3518 transformer.process_poll_result(result)
 3519 except Exception as e:
 3520 try:
transformer = <schema_transformer.to_bgp.SchemaTransformer object>
transformer.process_poll_result = <bound method SchemaTransformer.process_poll_res...ema_transformer.to_bgp.SchemaTransformer object>>
result = '<?xml version="1.0" encoding="UTF-8" standalone=...lResult></ns2:response></ns3:Body></ns3:Envelope>'

 /usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py in process_poll_result(self=<schema_transformer.to_bgp.SchemaTransformer object>, poll_result_str='<?xml version="1.0" encoding="UTF-8" standalone=...lResult></ns2:response></ns3:Body></ns3:Envelope>')
 3184 for prule in policy.rules:
 3185 acl_rule_list = virtual_network.policy_to_acl_rule(
 3186 prule, dynamic)
 3187 acl_rule_list.update_acl_entries(acl_entries)
 3188 for arule in acl_rule_list.get_list():
prule = <vnc_api.gen.resource_xsd.PolicyRuleType object>
dynamic = False

 /usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py in policy_to_acl_rule(self=<schema_transformer.to_bgp.VirtualNetworkST object>, prule=<vnc_api.gen.resource_xsd.PolicyRuleType object>, dynamic=False)
 1050 _sandesh._logger.debug(
 1051 "Policy %s not found while applying policy "
 1052 "to network %s", dadr_match.network_policy,
 1053 self.name)
 1054 continue
dadr_match undefined
<type 'exceptions.NameError'>: global name 'dadr_match' is not defined
    __class__ = <type 'exceptions.NameError'>
    __delattr__ = <method-wrapper '__delattr__' of exceptions.NameError object>
    __dict__ = {}
    __doc__ = 'Name not found globally.'
    __format__ = <built-in method __format__ of exceptions.NameError object>
    __getattribute__ = <method-wrapper '__getattribute__' of exceptions.NameError object>
    __getitem__ = <method-wrapper '__getitem__' of exceptions.NameError object>
    __getslice__ = <method-wrapper '__getslice__' of exceptions.NameError object>
    __hash__ = <method-wrapper '__hash__' of exceptions.NameError object>
    __init__ = <method-wrapper '__init__' of exceptions.NameError object>
    __new__ = <built-in method __new__ of type object>
    __reduce__ = <built-in method __reduce__ of exceptions.NameError object>
    __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.NameError object>
    __repr__ = <method-wrapper '__repr__' of exceptions.NameError object>
    __setattr__ = <method-wrapper '__setattr__' of exceptions.NameError object>
    __setstate__ = <built-in method __setstate__ of exceptions.NameError object>
    __sizeof__ = <built-in method __sizeof__ of exceptions.NameError object>
    __str__ = <method-wrapper '__str__' of exceptions.NameError object>
    __subclasshook__ = <built-in method __subclasshook__ of type object>
    __unicode__ = <built-in method __unicode__ of exceptions.NameError object>
    args = ("global name 'dadr_match' is not defined",)
    message = "global name 'dadr_match' is not defined"

The above is a description of an error in a Python program. Here is
the original traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py", line 3518, in launch_arc
    transformer.process_poll_result(result)
  File "/usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py", line 3186, in process_poll_result
    prule, dynamic)
  File "/usr/lib/python2.7/dist-packages/schema_transformer/to_bgp.py", line 1052, in policy_to_acl_rule
    "to network %s", dadr_match.network_policy,
NameError: global name 'dadr_match' is not defined

Tags: config
Revision history for this message
Sachin Bansal (sbansal) wrote :
information type: Proprietary → Public
Revision history for this message
Sachin Bansal (sbansal) wrote :
Revision history for this message
Ritam Gangopadhyay (ritam) wrote :

Fix verified on build R1.10 - 34.

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.