04-20-2022 12:25 AM
I'm currently trying to build a NED for a NETCONF device (thought it would be a good exercice) but I'm stuck because the device doesn't have the ietf-netconf-monitoring capabilty and netconf-ned-builder can't pull the model off the device.
Fortunately, I have all the YANG models (a blend of vendor specifics and standards ones) and I'm trying to put the together inside a NED. I've imitated the folder structure of a NED build by netconf-ned-builder (put all my models in ./src/yang, created a package-meta-data.xml.in file, created 2 yang file in ./src, etc...) and now I'm stuck on the Makefile. I have very little experience writing those and I'm struggling to adapt the ones from other NEDs and examples.
Is there a Makefile that I can use ? Or maybe a nice set of ncsc parameters ?
Solved! Go to Solution.
04-20-2022 05:25 AM - edited 04-20-2022 05:26 AM
So, after trial and error, I've managed to get something to work.
The directory structure I have is (before any building) :
myned-nc-1.0/
└── src
├── Makefile
├── package-meta-data.xml.in
└── yang
├── mymodel.yang
└── myothermodel.yangMy Makefile (heavely based on the one from the junos NED) :
all: fxs
.PHONY: all
# Include standard NCS examples build definitions and rules
include $(NCS_DIR)/src/ncs/build/include.ncs.mk
NCSC_DEVICE_DIR = ./ncsc-out
src=$(wildcard yang/*.yang)
NFXS = ncsc-out/modules/fxs
FXS = $(SRC:yang/%.yang=../load-dir/%.fxs)
DIRS = ncsc-out ncsc-out/modules $(NFXS) ../load-dir
NED_ID_ARG = $(shell [ -x ${NCS_DIR}/support/ned-ncs-ned-id-arg ] && \
${NCS_DIR}/support/ned-ncs-ned-id-arg package-meta-data.xml.in)
fxs: $(DIRS) ../package-meta-data.xml $(FXS)
.PHONY: fxs
$(DIRS):
mkdir -p $@
../package-meta-data.xml: package-meta-data.xml.in
#ned-id built by: support/ned-make-package-meta-data"
rm -rf $@
if [ -x ${NCS_DIR}/support/ned-make-package-meta-data ]; then \
${NCS_DIR}/support/ned-make-package-meta-data $<; \
else \
cp $< $@; \
fi
chmod -w $@
$(NFXS)/%.fxs: yang/%.yang
rm -f $@ || true
mkdir -p $(NCSC_DEVICE_DIR)
$(NCSC) --use-description \
--ncs-compile-module $< \
--ncs-device-dir $(NCSC_DEVICE_DIR) \
--ncs-skip-statistics \
--ncs-device-type netconf \
$(NED_ID_ARG) | 2>&1 \
grep -v 'has no actionpoint' || true
../load-dir/%.fxs: $(NFXS)/%.fxs
rm -f $@
ln -s ../src/$< $@
.PRECIOUS: $(NFXS)/%.fxs
clean:
rm -rf $(DIRS)
rm -rf ../package-meta-data.xml
rm -rf ./*.yang
.PHONY: cleanAnd my package-meta-data.xml.in
<ncs-package xmlns="http://tail-f.com/ns/ncs-packages">
<name>myned</name>
<package-version>1.0</package-version>
<description>NED for my devices</description>
<ncs-min-version>5.7</ncs-min-version>
<component>
<name>mydevice</name>
<ned>
<netconf/>
<device>
<vendor>Me</vendor>
</device>
</ned>
</component>
</ncs-package>
04-20-2022 05:25 AM - edited 04-20-2022 05:26 AM
So, after trial and error, I've managed to get something to work.
The directory structure I have is (before any building) :
myned-nc-1.0/
└── src
├── Makefile
├── package-meta-data.xml.in
└── yang
├── mymodel.yang
└── myothermodel.yangMy Makefile (heavely based on the one from the junos NED) :
all: fxs
.PHONY: all
# Include standard NCS examples build definitions and rules
include $(NCS_DIR)/src/ncs/build/include.ncs.mk
NCSC_DEVICE_DIR = ./ncsc-out
src=$(wildcard yang/*.yang)
NFXS = ncsc-out/modules/fxs
FXS = $(SRC:yang/%.yang=../load-dir/%.fxs)
DIRS = ncsc-out ncsc-out/modules $(NFXS) ../load-dir
NED_ID_ARG = $(shell [ -x ${NCS_DIR}/support/ned-ncs-ned-id-arg ] && \
${NCS_DIR}/support/ned-ncs-ned-id-arg package-meta-data.xml.in)
fxs: $(DIRS) ../package-meta-data.xml $(FXS)
.PHONY: fxs
$(DIRS):
mkdir -p $@
../package-meta-data.xml: package-meta-data.xml.in
#ned-id built by: support/ned-make-package-meta-data"
rm -rf $@
if [ -x ${NCS_DIR}/support/ned-make-package-meta-data ]; then \
${NCS_DIR}/support/ned-make-package-meta-data $<; \
else \
cp $< $@; \
fi
chmod -w $@
$(NFXS)/%.fxs: yang/%.yang
rm -f $@ || true
mkdir -p $(NCSC_DEVICE_DIR)
$(NCSC) --use-description \
--ncs-compile-module $< \
--ncs-device-dir $(NCSC_DEVICE_DIR) \
--ncs-skip-statistics \
--ncs-device-type netconf \
$(NED_ID_ARG) | 2>&1 \
grep -v 'has no actionpoint' || true
../load-dir/%.fxs: $(NFXS)/%.fxs
rm -f $@
ln -s ../src/$< $@
.PRECIOUS: $(NFXS)/%.fxs
clean:
rm -rf $(DIRS)
rm -rf ../package-meta-data.xml
rm -rf ./*.yang
.PHONY: cleanAnd my package-meta-data.xml.in
<ncs-package xmlns="http://tail-f.com/ns/ncs-packages">
<name>myned</name>
<package-version>1.0</package-version>
<description>NED for my devices</description>
<ncs-min-version>5.7</ncs-min-version>
<component>
<name>mydevice</name>
<ned>
<netconf/>
<device>
<vendor>Me</vendor>
</device>
</ned>
</component>
</ncs-package>
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide