Code Structure

system plugin

Code structure for plugins will be by using the ietf-system-plugin (opens in a new tab). Clone the plugin and head to the src/ directory.

Code structure

The code of plugins is split into 5 parts:

  • startup: code which works with the startup datastore
  • subscription: subscription callbacks (operational, rpc/action and module change callbacks)
  • system: main plugin code - APIs for every part of the YANG module and also data structure helper functions like _init()/_free() pairs etc.
  • utils: some utilities for allocating and freeing data
  • other files like common.h, system.h and their .c equivalent: setup plugin code (init() and cleanup() plugin callbacks) and macro definitions

The rest of the code structure documentation is provided in the code-structure folder and follows the same approach - step based look at the system-plugin code. Each of the 5 parts is described as well as the build of the plugin.