Autogeneration error in python API binding with multiple parents

Bug #1659920 reported by Hampapur Ajay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
Trunk
Fix Committed
Undecided
Hampapur Ajay

Bug Description

In the config schema files (vnc_cfg.xsd, alarm.xsd etc.) if there is a situation like below:

Obj-Type-A child of Obj-Type-1
Obj-Type-A child of Obj-Type-2
Obj-Type-B child of Obj-Type-A

Then generation of constructor of class ObjTypeB in resource_common.py encounters an error at getDefaultFQName() with traceback:

Traceback (most recent call last):

  File "tools/generateds/generateDS.py", line 5694, in <module>

    main()

  File "tools/generateds/generateDS.py", line 5683, in main

    pgenr.parseAndGenerate()

  File "tools/generateds/generateDS.py", line 1138, in parseAndGenerate

    self._Generator.generate(root, infile, self.outFilename)

  File "/root/SB-6Jan/tools/generateds/ccmap.py", line 195, in generate

    self._GenerateFrontendClassDefinitions(root)

  File "/root/SB-6Jan/tools/generateds/ccmap.py", line 159, in _GenerateFrontendClassDefinitions

    apigen.Generate(self._Parser.outFilename)

  File "/root/SB-6Jan/tools/generateds/ifmap_frontend.py", line 51, in Generate

    self._generate_common_classes(gen_filepath_pfx)

  File "/root/SB-6Jan/tools/generateds/ifmap_frontend.py", line 460, in _generate_common_classes

    parent_default_fq_name = parent_ident.getDefaultFQName()

  File "/root/SB-6Jan/tools/generateds/ifmap_model.py", line 119, in getDefaultFQName

    raise Exception('parent_type should be specified')

Exception: parent_type should be specified

scons: *** [build/debug/config/api-server/vnc_cfg_api_server/gen/__init__.py] Error 1

scons: building terminated because of errors.

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

Review in progress for https://review.opencontrail.org/28240
Submitter: Hampapur Ajay (<email address hidden>)

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

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

commit ba6201374be8c70059cac37aa913c1979c90bdf0
Author: Hampapur Ajay <email address hidden>
Date: Fri Jan 27 10:41:00 2017 -0800

When parent-type could have multiple parent-types of its own,
insist on parent_obj or parent_type+fq_name in the constructor
for python binding class.

Change-Id: I613ad19b17de175c8b57855cb835a9a2bdabd32e
Closes-Bug: 1659920

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.