This lesson will show you how Configuration Data is created and used in YumaPro SDK.
Pre-Requisites
You should have completed the YumaPro Installation Guide and the “Building and Installing the SIL”.
Example configuration data instrumentation
The first container in ietf-interfaces YANG module is container interfaces, it is a configuration container and provides YANG leafs that configure the system interfaces. Initially when you show the interfaces configuration with “sget /interfaces” you will see something as follows, an empty container:
user@localhost> sget /interfaces with-defaults=report-all Filling container /interfaces: RPC Data Reply 4 for session 3 [default]: rpc-reply{ data { interfaces { } } }
To configure an interface enter configuration from terminal mode, “conf term” and set some of the leafs of an interface. You need to create a name for the interface, such as“eth0”, and it must have a “type”. You will see below that when you enter “type ether” and then press <Tab> you will be prompted with options that are valid.
user@localhost> conf term user@localhost# interfaces interface eth0 user@localhost@localhost(interface)# type ether[<Tab>] ethernet3Mbit ethernetCsmacd user@localhost@localhost(interface)# type ethernetCsmacd user@localhost@localhost(interface)# description "some descriptive text" user@localhost@localhost(interface)# exit Applying 1 edit user@localhost@localhost(interfaces)# exit user@localhost@localhost# exit RPC Data Reply 9 for session 3 [default]: rpc-reply { data { interfaces { interface eth0 { name eth0 description 'some descriptive text' type ianaift:ethernetCsmacd } } } }
After exiting “conf term” mode the interface will be configured. You can see the interface now in using “sget /interfaces” again:
user@localhost> sget /interfaces with-defaults=report-all Filling container /interfaces: RPC Data Reply 10 for session 3 [default]: rpc-reply { data { interfaces { interface eth0 { name eth0 description 'some descriptive text' type ianaift:ethernetCsmacd enabled true } } } }
Code stubs in the SIL are created by make_sil_dir_pro for YANG configuration containers to mark where you should add your initialization, validation, apply, commit, rollback and cleanup code. You will see these with:
Code function or switch cases | Stub |
<module_name>_init | /* put your module initialization code here */ |
<module_name>_init2 | /* put your init2 code here */ |
AGT_CB_VALIDATE | /* description-stmt validation here */ |
AGT_CB_APPLY | /* database manipulation done here */ |
AGT_CB_COMMIT | /* device instrumentation done here */ |
AGT_CB_ROLLBACK | /* undo device instrumentation here */ |
<module_name>_cleanup | /* put your cleanup code here */ |
For more information see the section SIL and SIL-SA Overview of the YumaPro Developer Manual. |