tail-f-systems/JNC — pull request #34 by cohult (2014-09-26 13:12:55+00:00)
Title: Intro example

I created a "new" example (I named it ”0-intro”) in the JNC example collection folder. The example has been tested with ConfD 5.2.1 as NETCONF server, although any NETCONF server will work. Hence, the example serves as a very good introductory example, especially for ConfD users as ConfD is pre-integrated.

Besides the porting work, I only found and corrected a small annoying detail in the jnc.py script, it made the last character in a name in the YANG module into a lowercase char if it happened to be in uppercase. Not part of the naming convention for Java AFAIK.

E.g. "leaf-list domainA” became ”leaf-list domaina”

Short demo:
tailf@ncsvm:~/JNC-master/examples/0-intro$ cd confd; make stop clean all start; cd -; ant clean compile run
/home/tailf/confd-5.2.1/bin/confd --stop || true
connection refused (stop)
rm -rf *.o *.a *.xso *.fxs *.xsd *.log confderr.log.* *.db *.ccl \
host.key host.cert *_proto.h running.invalid global.data _tmp* \
aaa_cdb.* ./confd-cdb ssh-keydir etc localhost.access
rm *.log 2>/dev/null
make: [clean] Error 1 (ignored)
/home/tailf/confd-5.2.1/bin/confdc --java-package com.example.test -c hosts.yang
cp /home/tailf/confd-5.2.1/etc/confd/ietf-inet-types.fxs ietf-inet-types.fxs
/home/tailf/confd-5.2.1/bin/confdc -f /home/tailf/confd-5.2.1/etc/confd/ietf-inet-types.fxs \
--emit-xsd hosts.xsd hosts.fxs
ln -s /home/tailf/confd-5.2.1/etc/confd/ssh ssh-keydir
mkdir -p ./confd-cdb
cp /home/tailf/confd-5.2.1/var/confd/cdb/aaa_init.xml ./confd-cdb
cp hosts.xml ./confd-cdb
Build complete
echo "#!/bin/sh " > /tmp/action_script.sh
echo "echo res MYRES" >> /tmp/action_script.sh
echo "exit 0 " >> /tmp/action_script.sh
chmod +x /tmp/action_script.sh
/home/tailf/confd-5.2.1/bin/confd --addloadpath /home/tailf/confd-5.2.1/etc/confd -c confd.conf
/home/tailf/JNC-master/examples/0-intro
Buildfile: /home/tailf/JNC-master/examples/0-intro/build.xml

clean:

generate:
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/src/gen
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/src/gen/com
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/src/gen/com/example
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/src/gen/com/example/test
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/src/gen/com/example/test/inet

compile:
[mkdir] Created dir: /home/tailf/JNC-master/examples/0-intro/build/classes
[javac] Compiling 65 source files to /home/tailf/JNC-master/examples/0-intro/build/classes
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/hosts/package-info.class
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/ietfInetTypes/package-info.class
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/hosts/hosts/package-info.class
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/inet/ietfInetTypes/package-info.class
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/tailfCommon/package-info.class

generate:

compile:
[javac] Compiling 21 source files to /home/tailf/JNC-master/examples/0-intro/build/classes
[javac] Creating empty /home/tailf/JNC-master/examples/0-intro/build/classes/gen/com/example/test/inet/ietfInetTypes/package-info.class

run:
[copy] Copying 1 file to /home/tailf/JNC-master/examples/0-intro
[java] In MAIN
[java] TEST 1
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java] vera
[java] false
[java] 42
[java] 455
[java] a
[java]
[java]
[java]
[java] TEST 2
[java] Resulting config:
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java] vera
[java] false
[java] 42
[java] 455
[java] a
[java]
[java]
[java]
[java] TEST 3
[java] Resulting config:
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java] vera
[java] false
[java] 42
[java] 455
[java] a
[java]
[java]
[java]
[java] TEST 4
[java] cecilia
[java] ellen
[java] joe
[java] vera
[java] TEST 5
[java]
[java]
[java] Jupiter
[java]
[java]
[java] Saturn
[java]
[java]
[java]
[java] TEST 6
[java]
[java]
[java] Jupiter
[java]
[java]
[java] Saturn
[java]
[java]
[java]
[java] TEST 7
[java] Config With vera
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java] vera
[java] false
[java] 42
[java] 455
[java] a
[java]
[java]
[java]
[java] Config Without vera
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java]
[java] TEST 8
[java] Config With vera
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java]
[java] errorCode and opaqueData = rpc-reply error:
[java]
[java] application
[java] data-missing
[java] error
[java]
[java] /nc:rpc/nc:edit-config/nc:config/simple:hosts/simple:host[simple:name='vera_noExists']
[java]
[java]
[java] host
[java]
[java]
[java]
[java]
[java]
[java] TEST 9
[java] Create vera
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java]
[java] TEST 10
[java] Data =
[java]
[java]
[java] mymode
[java]
[java]
[java]
[java]
[java] Reply =
[java]
[java]
[java]
[java] MYRES
[java]
[java]
[java]
[java]
[java]
[java] TEST 11
[java] Create vera space
[java]
[java]
[java] cecilia
[java] true
[java] 5
[java]
[java]
[java] ellen
[java] true
[java] 100
[java]
[java]
[java] joe
[java] true
[java] 5
[java]
[java]
[java] vera
[java] 0
[java]
[java]
[java]
[java] OK

BUILD SUCCESSFUL
Total time: 9 seconds