ConfD User Community

How to compile openconfig/public YANG to confd basic

How to compile openconfig/public YANG to confd basic?
I download the openconfig/public from [https://github.com/openconfig/public].
There are many YANG files in /release/models/;
How to batch compile the YANG files to .fxs?

You compile YANG files in a regular way with confdc. See examples.confd. You need to write appropriate Makefile target. Regarding OC, I remember the YANGS are/were not RFC compliant, maybe some corrections would be necessary. See possible WARNINGS/ERRORS from confdc compiler.

Here is a sample of Makefile target that builds all FXS (you may need to adapt it, add options, paths to YANG locations, etc.)

CONFD_FLAGS = -c confd.conf \
              --addloadpath $(CONFD_DIR)/etc/confd
SCHEMAS = $(wildcard *.yang)
FXS = $(SCHEMAS:%.yang=%.fxs)

%.fxs: %.yang
	$(CONFDC) -c -o $@ -- $<

build_fxs: $(FXS)

After I modify a Makefile,how to compile the YANG files。Which command ?

depends what name has your Makefile target, in sample I have provided, it it build_fxs

https://cisco.box.com/s/asq1ycskcyq6su2smp01llanhkml9qb3

I have some older sample that you can try to adapt, use make all to compile OC yang files to ConfD fxs.

I can not access the url.

https://cisco.box.com/s/txpbqck5a3ypad7yz8uytn2lwflc7e2x

New link, unfortunately box expires links too soon.

1 Like