Difference between revisions of "Sweetcomb/NewModel"

From fd.io
Jump to: navigation, search
(Created page with "== Implementing a new YANG model in Sweetcomb == === Adding YANG model file to sweetcomb === Download the YANG model file to appropriate sweetcomb location under plugin subd...")
 
m (Developp and add callbacks)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Implementing a new YANG model in Sweetcomb ==
+
= Implementing a new YANG model in Sweetcomb =
  
=== Adding YANG model file to sweetcomb ===
+
== Adding YANG model file to sweetcomb ==
  
 
Download the YANG model file to appropriate sweetcomb location under plugin subdirectory.
 
Download the YANG model file to appropriate sweetcomb location under plugin subdirectory.
 
Your Yang model must be named <model>@<revision>.yang
 
Your Yang model must be named <model>@<revision>.yang
  
=== Developp scvpp helper functions ===
+
== Developp scvpp helper functions ==
  
 
All interaction with VAPI must be made in scvpp source code.
 
All interaction with VAPI must be made in scvpp source code.
 
Please, leverage as much as possible existing maccros such as:
 
Please, leverage as much as possible existing maccros such as:
* VAPI_RETVAL_CB
+
* '''VAPI_CALL''' : Wait until all messages have been received from VAPI
* VAPI_COPY_CB
+
* '''VAPI_RETVAL_CB''' : Return retval field of payload from VAPI reply message
* VAPI_CALL
+
* '''VAPI_COPY_CB''' : Perform a copy of a single VAPI reply message because VAPI frees its message after some time
 +
* '''VAPI_DUMP_LIST_CB''' : Put multiple received message from VAPI into a stack datastructure and return pointer to stack head.
  
=== Developp and add callbacks ===
+
== Developp and add callbacks ==
  
 
A yang model can be represented as a tree and its elements accessed using XPATH syntax.
 
A yang model can be represented as a tree and its elements accessed using XPATH syntax.
Line 20: Line 21:
  
 
//TODO: xpath_t structure, new file, register_model
 
//TODO: xpath_t structure, new file, register_model
 +
 +
Now, you should read [[Sweetcomb/Sysrepo]]

Latest revision as of 15:28, 28 March 2019

Implementing a new YANG model in Sweetcomb

Adding YANG model file to sweetcomb

Download the YANG model file to appropriate sweetcomb location under plugin subdirectory. Your Yang model must be named <model>@<revision>.yang

Developp scvpp helper functions

All interaction with VAPI must be made in scvpp source code. Please, leverage as much as possible existing maccros such as:

  • VAPI_CALL : Wait until all messages have been received from VAPI
  • VAPI_RETVAL_CB : Return retval field of payload from VAPI reply message
  • VAPI_COPY_CB : Perform a copy of a single VAPI reply message because VAPI frees its message after some time
  • VAPI_DUMP_LIST_CB : Put multiple received message from VAPI into a stack datastructure and return pointer to stack head.

Developp and add callbacks

A yang model can be represented as a tree and its elements accessed using XPATH syntax. You need to know which XPATH you want to support in your YANG model.

//TODO: xpath_t structure, new file, register_model

Now, you should read Sweetcomb/Sysrepo