This description expects the NED to be built with the structure
as defined by the ncs-make-package
.
If this doesn't hold then the adaptations has to be done
otherwise with an outcome that resembles the one described below.
-
package-meta-data.xml
In the
top
directory of the NED:mv package-meta-data.xml src/package-meta-data.xml.in
-
Makefile
In
src/Makefile
add the following make variable at the top after the other make variables, change XXXX and YYYY to name found in the module statement in the YANG file insrc/yang
.Check the existing YANG file for the existing ned-id, verify it is named according to the most common patterns and has the name:
tailf-ned-XXXX-YYYY-id.yang
this can be seen in the Makefile by searching for the string 'id'. If this is not the case the Make variable
JAVA_ID_FILE
has to be explicitly set.YANG_MODULE = tailf-ned-XXXX-YYYY 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) ifeq ($(NED_ID_ARG),) NED_ID_FILE = $(YANG_MODULE)-id else NED_ID_FILE = tailf-ned-id-$(shell echo $(NED_ID_ARG) | cut -d: -f2) endif JAVA_ID_FILE = $(shell echo $(YANG_MODULE) | \ perl -pe 's/-ned//;s/(^|-)./uc($$&)/ge;s/-//ge;s/(.)/lc($$&)/e')Id
Add the following dependencies first among dependencies to the
all:
target:../package-meta-data.xml ned-id-file
to the
clean:
target add:rm -f ../package-meta-data.xml
Add the following new targets:
../package-meta-data.xml: package-meta-data.xml.in 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 $@ ned-id-file: if [ -x ${NCS_DIR}/support/ned-make-package-meta-data ]; then \ echo -n "$(NED_ID_FILE) is built by: "; \ echo "support/ned-make-package-meta-data"; \ else \ $(NCSC) -c yang/$(NED_ID_FILE).yang \ -o ../load-dir/$(NED_ID_FILE).fxs; \ fi $(NCSC) $(JFLAGS)/$(JAVA_ID_FILE).java ../load-dir/$(NED_ID_FILE).fxs
The make variable
$(NED_ID_ARG)
needs to be added as an argument to all targets which arencsc
compiled. Look for everything which uses the option'--ncs-device-type'
And finally find and remove all the old dependencies and targets for the old ned-id file.
-
Remove identity from Java-code
If NED is implemented in Java remove the identity method:
- /** - * Display NED identity - */ - public String identity() { - return "asa-id:cisco-asa"; - } -
-
build.xml
Add the file
package-meta-data.xml
to the private jar file of the package by updatingsrc/java/build.xml
. Add the following, between .... snip ...., to the compile task:<target name="package" depends="compile"> .... snip .... <jar update="true" destfile="${privatejar.dir}/${package}.jar" basedir="../.." includes="package-meta-data.xml"/> .... snip .... </target>
-
Verify changes
Verify
Makefile
Compile code for both versions < 5.0 and versions >= 5.0:
make -C src make -C src
twice without any errors then do:
make -C src clean make -C src clean
twice without any errors.
Everything now should have been cleaned, if this is not the case update the
clean:
of the relevantMakefile