diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..0fe970a8e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python # support for pip, used to install ncclient +sudo: required +services: + - docker +before_install: + - pip install ncclient +script: + - docker build -t yuma . + - docker run -d -p 8300:830 -p 2200:22 --name yuma yuma + - while ! docker logs yuma | grep 'Running netconfd server'; do sleep 1; done + - sleep 5 + - python -c "from ncclient import manager; m = manager.connect(host='127.0.0.1', port=8300, username='admin', password='admin', hostkey_verify=False); print(m.get_config(source='running'))" + - docker stop yuma diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f85549f72 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM ubuntu:14.04 + +# install required packages +ENV DEBIAN_FRONTEND noninteractive +RUN ["apt-get", "update"] +RUN ["apt-get", "install", "-y", "git", "autoconf", "gcc", "libtool", "libxml2-dev", "libssl-dev", "make", "libncurses5-dev", "libssh2-1-dev", "openssh-server"] + +# setup admin user that yuma will use +RUN set -x -e; \ + mkdir /var/run/sshd; \ + adduser --gecos '' --disabled-password admin; \ + echo "admin:admin" | chpasswd + +# copy and build yuma, setup the container to start it by default +COPY . /usr/src/yuma123 +WORKDIR /usr/src/yuma123 +RUN set -x -e; \ + autoreconf -i -f; \ + ./configure CFLAGS='-g -O0' CXXFLAGS='-g -O0' --prefix=/usr; \ + make; \ + sudo make install; \ + touch /tmp/startup-cfg.xml; \ + printf 'Port 830\nSubsystem netconf "/usr/sbin/netconf-subsystem --ncxserver-sockname=830@/tmp/ncxserver.sock"\n' >> /etc/ssh/sshd_config; \ + printf '#!/bin/bash\nset -e -x\n/usr/sbin/netconfd --module=helloworld --startup=/tmp/startup-cfg.xml --superuser=admin &\nsleep 1\n/usr/sbin/sshd -D &\nwait\nkill %%\n' > /root/start.sh; \ + chmod 0755 /root/start.sh +CMD ["/root/start.sh"] + +# finishing touches +EXPOSE 22 +EXPOSE 830 diff --git a/README b/README.md similarity index 51% rename from README rename to README.md index 61b6abd4e..24001aeae 100644 --- a/README +++ b/README.md @@ -1,17 +1,27 @@ -Yuma123 README ------------ +Yuma123 +======= Last Updated: 2015-06-18 (v2.5-1) -==What is Yuma123== -The purpose of the Yuma123 project is to provide an opensource YANG API in C and netconf cli (yangcli) and server (netconfd) appications. -Branching from the last BSD licensed branch of the Yuma project the code has evolved in the following direction: + +What is Yuma123 +--------------- + +The purpose of the Yuma123 project is to provide an opensource YANG API in C +and netconf cli (yangcli) and server (netconfd) appications. + +Branching from the last BSD licensed branch of the Yuma project the code has +evolved in the following direction: - a more mainstream build system based on autoconf/automake was added - a number of critical bugs have been fixed - new IETF standards support was added (ietf-nacm, ietf-system, etc.) - support was added for new YANG extensions -==Checkout, Build and Installation steps (ment for Debian should be easy to figure out on other systems)== + +Manual installation steps +------------------------- + +~~~ sudo apt-get install git autoconf gcc libtool libxml2-dev libssl-dev libssh2-1-dev git clone git://git.code.sf.net/p/yuma123/git yuma123-git @@ -22,22 +32,59 @@ make sudo make install touch /tmp/startup-cfg.xml /usr/sbin/netconfd --module=helloworld --startup=/tmp/startup-cfg.xml --log-level="debug4" --superuser="$USER" +~~~ -If there were no missing dependencies the server is now started with the example helloworld module. +If there were no missing dependencies the server is now started with the +example helloworld module. -Tell sshd to listen on port 830. Add the following 2 lines to /etc/ssh/sshd_config: +Tell sshd to listen on port 830 by adding the following 2 lines +to `/etc/ssh/sshd_config`: +~~~ Port 830 Subsystem netconf "/usr/sbin/netconf-subsystem --ncxserver-sockname=830@/tmp/ncxserver.sock" +~~~ +And restart the server: +~~~ sudo /etc/init.d/ssh restart +~~~ You can verify everything is OK: +~~~ yangcli --user="$USER" --server=localhost ... xget /helloworld +~~~ or +~~~ xget / +~~~ + + +Testing with docker +------------------- + +This repository has a `Dockerfile` that can be used to create a container that +builds yuma and starts the service. You need a linux with working [docker] +installation to use it. + +To build the container: +~~~ +docker build -t yuma . +~~~ + +To start it: +~~~ +docker run -it --rm -p 8300:830 -p 2200:22 --name yuma yuma +~~~ + +The line above maps yuma's netconf port to 8300 on the host. You can connect +to that port with ncclient. + +To use *yangcli* as mentioned above, you `docker exec yuma /bin/bash` to enter +the running container. Use *admin* as both the user and password. + diff --git a/configure.ac b/configure.ac index 23627dead..3469fda3e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_INIT([yuma123], [2.4.0], [vladimir@transpacket.com]) AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AM_INIT_AUTOMAKE([-Wall foreign]) LT_INIT([disable-static]) AC_PROG_CC