p4lang / tdi

Table-Driven Interface (TDI) for a P4-programmable backend device.
Apache License 2.0
40 stars 23 forks source link

tdi_python dynamic API refactoring #98

Closed satish153 closed 1 year ago

satish153 commented 1 year ago

Same changes as in https://github.com/p4lang/tdi/pull/91 Creating new PR as the old one was reverted.

Approach used to bifurcate dynamic APIs into target independent and dependents parts:

Target derives TDILeaf and overrides dynamic API generation functions(eg: _create_add_with_action). In these functions, code_str is set with the code that is to be used to generate APIs. The target then calls the corresponding parent class function, which creates and adds the dynamic function.