cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
456
Views
5
Helpful
1
Replies

How to build a NETCONF NED without ietf-netconf-monitoring

Scarfido
Level 1
Level 1

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 ?

1 Accepted Solution

Accepted Solutions

Scarfido
Level 1
Level 1

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.yang

My 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: clean

And 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>

View solution in original post

1 Reply 1

Scarfido
Level 1
Level 1

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.yang

My 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: clean

And 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>
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: