config: Use introspection more than code autogeneration for better maintainability

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

Bug Description

Currently code generation (generateDS/ifmap_frontend.py) is being used for 2 things
1. schema based types to python classes (gen/resource_*.py)
2. singleton class for api-server/api-library/db-layer (gen/vnc_api_*.py)

Since there is significant interaction between item 2. (in contrail-generateDS repo) and item 2. derived classes (in contrail-controller repo in api-server/*) bug fixes + release has too much dependency.

By removing item 2. to an introspection based model within contrail-controller things will be streamlined (and even sets up a possibility of supporting dynamically supporting new types in future if we choose to).

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

Review in progress for https://review.opencontrail.org/11954
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/11954
Committed: http://github.org/Juniper/contrail-generateDS/commit/5b77f788d9b0d43f16de43eb34ac73c9447ce087
Submitter: Zuul
Branch: master

commit 5b77f788d9b0d43f16de43eb34ac73c9447ce087
Author: Hampapur Ajay <email address hidden>
Date: Thu May 7 10:52:09 2015 -0700

Generate extra metadata from schema and fill in Api resource class.

Expose the types of properties, types of reference link and types
of children field which can be used in a later commit to define
generic CRUD methods in api server.

Partial-Bug: #1440269
Change-Id: I92e19a7f3951e9e79e5d972568a915370e18b6d1

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

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

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

Review in progress for https://review.opencontrail.org/12257
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/12257
Committed: http://github.org/Juniper/contrail-generateDS/commit/88831530c65f8ba7271e7de806ee547b980340cb
Submitter: Zuul
Branch: master

commit 88831530c65f8ba7271e7de806ee547b980340cb
Author: Hampapur Ajay <email address hidden>
Date: Tue Jul 7 17:49:31 2015 -0700

config: generate metaname used for children and backrefs on object.

Change-Id: I5213d94730d45c9d6e31547a3fc72cd13d02e97c
Partial-Bug: #1440269

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

Review in progress for https://review.opencontrail.org/12125
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/12125
Committed: http://github.org/Juniper/contrail-controller/commit/b7d7105278f379eae406c01affe83b41e018a469
Submitter: Zuul
Branch: master

commit b7d7105278f379eae406c01affe83b41e018a469
Author: Hampapur Ajay <email address hidden>
Date: Wed Jul 1 10:31:41 2015 -0700

config: absorb generated singleton class methods into parent class.

Before this patch, there were a set of classes of form
class Foo(FooGen)
where FooGen had methods per type for CRUD. The business logic
was spread across contrail-controller and contrail-generateDS
repo making it hard to add a feature or fix bugs spanning repos.

This patchset implements generic CRUD methods in client, server
and db layers with resource_type as a parameter and using
functools.partial still retains the old interface of method per
type.

In particular following autogenerated classes will no longer be
needed:
VncApiClientGen
VncApiServerGen
VncIfmapClientGen
VncCassandraClientGen

Closes-Bug: #1440269
Change-Id: Idc8a58a3d641415810ecfd5c435cf8823ac72b43

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

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

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

Review in progress for https://review.opencontrail.org/12444
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/12443
Committed: http://github.org/Juniper/contrail-generateDS/commit/30e665563f688676a93737b75c9db107203fa8e7
Submitter: Zuul
Branch: R2.22-dev

commit 30e665563f688676a93737b75c9db107203fa8e7
Author: Hampapur Ajay <email address hidden>
Date: Thu May 7 10:52:09 2015 -0700

Generate extra metadata from schema and fill in Api resource class.

Expose the types of properties, types of reference link and types
of children field which can be used in a later commit to define
generic CRUD methods in api server.

Partial-Bug: #1440269
Change-Id: I92e19a7f3951e9e79e5d972568a915370e18b6d1
(cherry picked from commit 5b77f788d9b0d43f16de43eb34ac73c9447ce087)

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

Reviewed: https://review.opencontrail.org/12444
Committed: http://github.org/Juniper/contrail-generateDS/commit/edb7f48de0402914600fc71b478d81bd2b9237ba
Submitter: Zuul
Branch: R2.22-dev

commit edb7f48de0402914600fc71b478d81bd2b9237ba
Author: Hampapur Ajay <email address hidden>
Date: Tue Jul 7 17:49:31 2015 -0700

config: generate metaname used for children and backrefs on object.

Change-Id: I5213d94730d45c9d6e31547a3fc72cd13d02e97c
Partial-Bug: #1440269
(cherry picked from commit 88831530c65f8ba7271e7de806ee547b980340cb)

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

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

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

Review in progress for https://review.opencontrail.org/12766
Submitter: Sachin Bansal (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/12766
Committed: http://github.org/Juniper/contrail-controller/commit/e8ed7f5a5f8a088e8058d9ae4f017697599f24b0
Submitter: Zuul
Branch: R2.22-dev

commit e8ed7f5a5f8a088e8058d9ae4f017697599f24b0
Author: Hampapur Ajay <email address hidden>
Date: Wed Jul 1 10:31:41 2015 -0700

config: absorb generated singleton class methods into parent class.

Before this patch, there were a set of classes of form
class Foo(FooGen)
where FooGen had methods per type for CRUD. The business logic
was spread across contrail-controller and contrail-generateDS
repo making it hard to add a feature or fix bugs spanning repos.

This patchset implements generic CRUD methods in client, server
and db layers with resource_type as a parameter and using
functools.partial still retains the old interface of method per
type.

In particular following autogenerated classes will no longer be
needed:
VncApiClientGen
VncApiServerGen
VncIfmapClientGen
VncCassandraClientGen

Closes-Bug: #1440269
Change-Id: Idc8a58a3d641415810ecfd5c435cf8823ac72b43
(cherry picked from commit b7d7105278f379eae406c01affe83b41e018a469)

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

Review in progress for https://review.opencontrail.org/14087
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/14087
Committed: http://github.org/Juniper/contrail-controller/commit/b8e258494628d09a60e4ad177bb2aedc5f42237c
Submitter: Zuul
Branch: master

commit b8e258494628d09a60e4ad177bb2aedc5f42237c
Author: Hampapur Ajay <email address hidden>
Date: Mon Sep 28 09:54:00 2015 -0700

Preparation for removing autogen for Vnc* singleton class

Change-Id: Ie7d2c4fd08eaf2c44fe81a72d0ac66e8f4e373ed
Partial-Bug: #1440269

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

Review in progress for https://review.opencontrail.org/14147
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/14147
Committed: http://github.org/Juniper/contrail-generateDS/commit/0e0c33f6d4053e2a5839466ce2685e87cb4168cd
Submitter: Zuul
Branch: master

commit 0e0c33f6d4053e2a5839466ce2685e87cb4168cd
Author: Hampapur Ajay <email address hidden>
Date: Thu Oct 1 03:25:22 2015 -0700

Stop autogeneration of Vnc* singleton - it is done with introspection

The bits in contrail-controller repo (vnc_cfg_ifmap.py etc.) generate
crud handlers by inspecting the metadata generated by ifmap_frontend.py

Change-Id: I5512d1040868ffb84d4d48e1a48433d3ffc1a793
Closes-Bug: #1440269

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

Review in progress for https://review.opencontrail.org/14648
Submitter: Sachin Bansal (<email address hidden>)

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

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

commit 61f07ec4ad9b5c23e4a7dc7de815b8a04272e699
Author: Sachin Bansal <email address hidden>
Date: Mon Oct 26 11:06:31 2015 -0700

Remove unnecessary wrappers for various curdl functions

We have multiple layers of wrapper functions for curdl functions in cassandra
and ifmap. With this commit, we remove all those wrappers and simplify the code.

Change-Id: I832111a68700d54218b2f03d3f4fcd40cad02b9b
Closes-Bug: 1440269

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

Review in progress for https://review.opencontrail.org/17931
Submitter: Sachin Bansal (<email address hidden>)

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

Review in progress for https://review.opencontrail.org/17970
Submitter: Sachin Bansal (<email address hidden>)

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

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

commit 7aa816ef912c6c8942900d33079a01bf90c89481
Author: Sachin Bansal <email address hidden>
Date: Sat Feb 27 19:38:48 2016 -0800

Remove resource_server.py as it is not used any more

Change-Id: Ic10930a230e29ea4357ff40351d79541fcdcb0f6
Related-Bug: 1440269

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

Review in progress for https://review.opencontrail.org/17931
Submitter: Sachin Bansal (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/17931
Committed: http://github.org/Juniper/contrail-generateDS/commit/90149c61838923a858a005b2a4c407b4a7c574ac
Submitter: Zuul
Branch: master

commit 90149c61838923a858a005b2a4c407b4a7c574ac
Author: Sachin Bansal <email address hidden>
Date: Fri Feb 26 13:24:03 2016 -0800

Remove resource_server.py as it is not used any more

This file will not be generated any more

Change-Id: I1fb7845699c24d4eae80c7817adb54377b010cb1
Related-Bug: 1440269

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

Review in progress for https://review.opencontrail.org/18076
Submitter: Sachin Bansal (<email address hidden>)

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

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

commit a8ea16422ec3ea53f172fa81c19d84d58482498d
Author: Sachin Bansal <email address hidden>
Date: Tue Mar 1 13:36:52 2016 -0800

Use all_recource_types from vnc_api_client_gen

We currently have these types generated in two places. We will remove
vnc_api_server_gen after this change.

Change-Id: Ibb443f72e2d7ba5982406c726d7c3fbbf37843a5
Related-Bug: 1440269

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

Review in progress for https://review.opencontrail.org/18087
Submitter: Sachin Bansal (<email address hidden>)

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

Reviewed: https://review.opencontrail.org/18087
Committed: http://github.org/Juniper/contrail-generateDS/commit/9e54450f4f74541c9891a411dc05ee6b98d804f2
Submitter: Zuul
Branch: master

commit 9e54450f4f74541c9891a411dc05ee6b98d804f2
Author: Sachin Bansal <email address hidden>
Date: Tue Mar 1 21:28:11 2016 -0800

Remove vnc_api_server_gen.py as it is not used

Change-Id: If916e11e76ccb8cffbf38d49711cc4d3bbb7003a
Related-Bug: 1440269

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

Review in progress for https://review.opencontrail.org/18188
Submitter: Sachin Bansal (<email address hidden>)

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

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

commit c076d5df9869cecba3f65b3e91fa384a63c33f2d
Author: Sachin Bansal <email address hidden>
Date: Fri Mar 4 17:26:41 2016 -0800

Select resource class automatically from vnc_cfg_types

If a resource class is defined in vnc_cfg_types, select it
automatically instead of having to be explicitly set.

Change-Id: Id4bd84875e842d49d4c5382af9972bcd422d3ba6
Related-Bug: 1440269

Changed in juniperopenstack:
milestone: none → r3.1.0.0-fcs
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/23269
Submitter: Sachin Bansal (<email address hidden>)

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

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

commit 5b8b7946ffda2996c813050b7b5d3a50eae096f7
Author: Sachin Bansal <email address hidden>
Date: Fri Aug 12 17:11:51 2016 -0700

Do not generate default objects for all resources by default

Instead, we will now generate default instances only when
specifically requested. This way, we will not create unused objects
whenever new classes are added in schema.

Change-Id: I7cb3fcd120ae6647bf09920983a51bb307b039c8
Closes-Bug: 1440269

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.