Yang module usage from another yang module

Let’s say there’s module X which already exist.
I want to use X module functionality, but using my modeling.

For example:
1.
Module SNMPv2-MIB already exist. It has a leaf: SNMPv2-MIB system sysName.
I want to config this leaf using the path: snmp sys-name.

2.
Module SNMP-USER-BASED-SM-MIB already exist. It has a list: SNMP-USER-BASED-SM-MIB usmUserTable usmUserEntry. This list has two keys.
I want to configure this list, but turn it into a one key list under the path: snmp v3-users.
I want some leaves that appear under SNMP-USER-BASED-SM-MIB usmUserTable usmUserEntry, not to be seen under my new list snmp v3-users.

In order to solve 1. I can create a module and a container named snmp, then create a leaf inside which is a tailf:link to the SNMPv2-MIB system sysName.
Can I solve 2. ?

I know these next tools/solutions may help but not sure I know what’s the best approach / what entirely solves these problems:

a. tailf:link, tailf:symlink, leafref.
b. clispec (move).
c. I can treat SNMP-USER-BASED-SM-MIB and SNMPv2-MIB as an external DB, and create my module under snmp container, with the list v3-users, and the leaf sys-name. then for each commit/show command, with callpoints, contact the actual modules (SNMP-USER-BASED-SM-MIB, SNMPv2-MIB) and commit/show from them.

As I see it, option c. is the worst option in respect to code writing.

I hope I was clear enough. Please let me know if I wasn’t.

Thanks.

Hi,

I believe that what you are looking for is to do a “transform”.

See ConfD UG chapter “Transformations, Hooks, Hidden Data and Symlinks”, and in particular the subchapter “AAA Transform” as a very good introduction example.

See also the examples.confd/misc/aaa_transform example. The AAA transform example project README and source code is helpful.

Then take a look at examples.confd/snmpa/7-transform which is an example that illustrates how to transform between a standard SNMP MIB and a high-level data model.

1 Like

Hi,
I tried follow the examples.confd/snmpa/7-transform example for my SNMP-USER-BASED-SM-MIB.
I’ve put a tailf:callpoint tailf:transformation true on the usmUserEntry.

Now, when I’m starting ConfD I get an error from the snmpa:

<ERR> 17-Aug-2016::14:48:59.082 ubuntu confd[83931]: devel-c no registration found for callpoint my_cp/get_next of type=external path /SNMP_USER_BASED_SM_MIB:SNMP-USER-BASED-SM-MIB/usmUserTable/usmUserEntry
<ERR> 17-Aug-2016::14:48:59.088 ubuntu confd[83931]: devel-snmpa error: table get-next: /SNMP-USER-BASED-SM-MIB/usmUserTable/usmUserEntry (error: application communication failure)

I understood I should start ConfD with phase0, then start my application in order to register the callback, and then continue with the ConfD initialization.

Is there another way to start ConfD in spite of the fact that snmpa cannot get the appropriate data?

If not, does it mean that if the ConfD daemon and my application are bound together, and I can’t start ConfD CLI without a working application?

I mean: If my application will fail, i wouldn’t be able to start ConfD.
This case is contrary to a case when there’s no tailf:callpoint tailf:transform true on the SNMP USM and I can start ConfD daemon without my application.

Thanks

Hi,

Yes, your application is responsible for providing the correct data for your usmUserEntry.

But the application cannot connect to ConfD because it hasn’t started yet, so snmpAgent will fail.
And ConfD can’t start because the application isn’t registered to the callpoint.

I believe you answered your question yourself perviously ;-)

1 Like