* Changed docker builds
* `clixon-test` built in `docker/test`
* Renamed from `clixon-system` built in `docker/main`
* `clixon-example` built in `docker/example`
* Added netconf ssh subsystem
* Renamed from `clixon` built in `docker/base`
* Added ietf-yang-schema-mount@2019-01-14.yang
This commit is contained in:
parent
571e26e0d6
commit
61e2f014be
30 changed files with 14044 additions and 2634 deletions
142
docker/test/Dockerfile
Normal file
142
docker/test/Dockerfile
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
#
|
||||
# Clixon dockerfile without restconf
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update git make build-base gcc flex bison curl-dev
|
||||
|
||||
# For netsnmp
|
||||
RUN apk add --update net-snmp net-snmp-dev
|
||||
|
||||
WORKDIR /usr/local/share
|
||||
|
||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||
RUN mkdir yang
|
||||
|
||||
WORKDIR /usr/local/share/yang
|
||||
|
||||
RUN git config --global init.defaultBranch master
|
||||
RUN git init;
|
||||
RUN git remote add -f origin https://github.com/YangModels/yang;
|
||||
RUN git config core.sparseCheckout true
|
||||
RUN echo "standard/" >> .git/info/sparse-checkout
|
||||
RUN echo "experimental/" >> .git/info/sparse-checkout
|
||||
|
||||
WORKDIR /usr/local/share/yang
|
||||
RUN git pull origin main
|
||||
|
||||
# Create a directory to hold source-code, dependencies etc
|
||||
RUN mkdir /clixon
|
||||
RUN mkdir /clixon/build
|
||||
WORKDIR /clixon
|
||||
|
||||
# Clone cligen
|
||||
RUN git clone https://github.com/clicon/cligen.git
|
||||
|
||||
# Build cligen
|
||||
WORKDIR /clixon/cligen
|
||||
RUN ./configure --prefix=/clixon/build
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Copy Clixon from local dir
|
||||
RUN mkdir /clixon/clixon
|
||||
WORKDIR /clixon/clixon
|
||||
COPY clixon .
|
||||
|
||||
# Configure, build and install clixon
|
||||
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --without-restconf --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Install utils (for tests)
|
||||
WORKDIR /clixon/clixon/util
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Build and install the clixon example
|
||||
WORKDIR /clixon/clixon/example/main
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN install example.xml /clixon/build/etc/clixon.xml
|
||||
|
||||
# Copy tests
|
||||
WORKDIR /clixon/clixon/test
|
||||
RUN install -d /clixon/build/bin/test
|
||||
RUN install *.sh /clixon/build/bin/test
|
||||
RUN install *.exp /clixon/build/bin/test
|
||||
RUN install clixon.png /clixon/build/bin/test
|
||||
|
||||
# Copy startscript
|
||||
WORKDIR /clixon
|
||||
COPY startsystem.sh startsystem.sh
|
||||
RUN install startsystem.sh /clixon/build/bin/
|
||||
|
||||
# Add our generated YANG files
|
||||
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
|
||||
|
||||
#
|
||||
# Stage 2
|
||||
# The second step skips the development environment and builds a runtime system
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison fcgi-dev
|
||||
|
||||
# For SNMP
|
||||
RUN apk add --update net-snmp net-snmp-tools
|
||||
|
||||
# Some custom configuration for SNMP
|
||||
RUN echo "master agentx" > /etc/snmp/snmpd.conf
|
||||
RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
|
||||
|
||||
# Test-specific (for test scripts)
|
||||
RUN apk add --update sudo curl procps grep make bash expect
|
||||
|
||||
# Create clicon user and group
|
||||
RUN adduser -D -H clicon
|
||||
|
||||
COPY --from=0 /clixon/build/ /usr/local/
|
||||
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
|
||||
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/
|
||||
|
||||
# Log to stderr.
|
||||
CMD /usr/local/bin/startsystem.sh
|
||||
171
docker/test/Dockerfile.fcgi
Normal file
171
docker/test/Dockerfile.fcgi
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
#
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update git make build-base gcc flex bison fcgi-dev curl-dev
|
||||
|
||||
# For netsnmp
|
||||
RUN apk add --update net-snmp net-snmp-dev
|
||||
|
||||
# Checkut models
|
||||
WORKDIR /usr/local/share/
|
||||
|
||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||
RUN mkdir yang
|
||||
|
||||
WORKDIR /usr/local/share/yang
|
||||
|
||||
RUN git config --global init.defaultBranch master
|
||||
RUN git init;
|
||||
RUN git remote add -f origin https://github.com/YangModels/yang;
|
||||
RUN git config core.sparseCheckout true
|
||||
RUN echo "standard/" >> .git/info/sparse-checkout
|
||||
RUN echo "experimental/" >> .git/info/sparse-checkout
|
||||
|
||||
RUN git pull origin main
|
||||
|
||||
RUN mkdir /usr/local/share/openconfig
|
||||
WORKDIR /usr/local/share/openconfig
|
||||
|
||||
# Checkut Openconfig models for tests
|
||||
RUN git clone https://github.com/openconfig/public
|
||||
|
||||
# Create a directory to hold source-code, dependencies etc
|
||||
RUN mkdir /clixon
|
||||
RUN mkdir /clixon/build
|
||||
WORKDIR /clixon
|
||||
|
||||
# Clone cligen
|
||||
RUN git clone https://github.com/clicon/cligen.git
|
||||
|
||||
# Build cligen
|
||||
WORKDIR /clixon/cligen
|
||||
RUN ./configure --prefix=/clixon/build
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Copy Clixon from local dir
|
||||
RUN mkdir /clixon/clixon
|
||||
WORKDIR /clixon/clixon
|
||||
COPY clixon .
|
||||
|
||||
# Need to add www user manually, but group www-data already exists on Alpine
|
||||
RUN adduser -D -H -G www-data www-data
|
||||
# nginx adds group www-data
|
||||
RUN apk add --update nginx
|
||||
|
||||
# Configure, build and install clixon
|
||||
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=fcgi --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Install utils (for tests)
|
||||
WORKDIR /clixon/clixon/util
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Build and install the clixon example
|
||||
WORKDIR /clixon/clixon/example/main
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN install example.xml /clixon/build/etc/clixon.xml
|
||||
|
||||
# Copy tests
|
||||
WORKDIR /clixon/clixon/test
|
||||
RUN install -d /clixon/build/bin/test
|
||||
RUN install *.sh /clixon/build/bin/test
|
||||
RUN install *.exp /clixon/build/bin/test
|
||||
RUN install clixon.png /clixon/build/bin/test
|
||||
|
||||
RUN install -d /clixon/build/mibs
|
||||
RUN install mibs/* /clixon/build/mibs
|
||||
|
||||
# Copy startscript
|
||||
WORKDIR /clixon
|
||||
COPY startsystem_fcgi.sh startsystem.sh
|
||||
RUN install startsystem.sh /clixon/build/bin/
|
||||
|
||||
# Add our generated YANG files
|
||||
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
|
||||
|
||||
#
|
||||
# Stage 2
|
||||
# The second step skips the development environment and builds a runtime system
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison fcgi-dev
|
||||
|
||||
# For SNMP
|
||||
RUN apk add --update net-snmp net-snmp-tools
|
||||
|
||||
# Some custom configuration for SNMP
|
||||
RUN echo "master agentx" > /etc/snmp/snmpd.conf
|
||||
RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
|
||||
|
||||
# Need to add www user manually, but group www-data already exists on Alpine
|
||||
RUN adduser -D -H -G www-data www-data
|
||||
# nginx adds group www-data
|
||||
RUN apk add --update nginx
|
||||
|
||||
# Test-specific (for test scripts)
|
||||
RUN apk add --update sudo curl procps grep make bash expect
|
||||
|
||||
# Expose nginx port for restconf
|
||||
EXPOSE 80
|
||||
|
||||
# Create clicon user and group
|
||||
RUN adduser -D -H clicon
|
||||
RUN adduser nginx clicon
|
||||
RUN adduser www-data clicon
|
||||
|
||||
COPY --from=0 /clixon/build/ /usr/local/
|
||||
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
|
||||
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/
|
||||
COPY --from=0 /clixon/build/mibs/* /usr/share/snmp/mibs/
|
||||
|
||||
# Manually created
|
||||
RUN mkdir /www-data
|
||||
RUN chown www-data /www-data
|
||||
RUN chgrp www-data /www-data
|
||||
|
||||
# Log to stderr.
|
||||
CMD /usr/local/bin/startsystem.sh
|
||||
171
docker/test/Dockerfile.native
Normal file
171
docker/test/Dockerfile.native
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
#
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update git make build-base gcc flex bison curl-dev
|
||||
|
||||
# nghttp2 dependencies
|
||||
RUN apk add --update nghttp2
|
||||
|
||||
# For netsnmp
|
||||
RUN apk add --update net-snmp net-snmp-dev
|
||||
|
||||
# Checkut models
|
||||
WORKDIR /usr/local/share/
|
||||
|
||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||
RUN mkdir yang
|
||||
|
||||
WORKDIR /usr/local/share/yang
|
||||
|
||||
RUN git config --global init.defaultBranch master
|
||||
RUN git init;
|
||||
RUN git remote add -f origin https://github.com/YangModels/yang;
|
||||
RUN git config core.sparseCheckout true
|
||||
RUN echo "standard/" >> .git/info/sparse-checkout
|
||||
RUN echo "experimental/" >> .git/info/sparse-checkout
|
||||
|
||||
RUN git pull origin main
|
||||
|
||||
RUN mkdir /usr/local/share/openconfig
|
||||
WORKDIR /usr/local/share/openconfig
|
||||
|
||||
# Checkut Openconfig models for tests
|
||||
RUN git clone https://github.com/openconfig/public
|
||||
|
||||
# Create a directory to hold source-code, dependencies etc
|
||||
RUN mkdir /clixon
|
||||
RUN mkdir /clixon/build
|
||||
WORKDIR /clixon
|
||||
|
||||
# Clone cligen
|
||||
RUN git clone https://github.com/clicon/cligen.git
|
||||
|
||||
# Build cligen
|
||||
WORKDIR /clixon/cligen
|
||||
RUN ./configure --prefix=/clixon/build
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Need to add www user manually
|
||||
RUN adduser -D -H -G www-data www-data
|
||||
|
||||
# Copy Clixon from local dir
|
||||
RUN mkdir /clixon/clixon
|
||||
WORKDIR /clixon/clixon
|
||||
COPY clixon .
|
||||
|
||||
# Configure, build and install clixon
|
||||
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-restconf=native --enable-nghttp2 --enable-http1 --with-yang-standard-dir=/usr/local/share/yang/standard --enable-netsnmp --with-mib-generated-yang-dir=/usr/local/share/mib-yangs/
|
||||
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Install utils (for tests)
|
||||
WORKDIR /clixon/clixon/util
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# Build and install the clixon example
|
||||
WORKDIR /clixon/clixon/example/main
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN install example.xml /clixon/build/etc/clixon.xml
|
||||
|
||||
# Copy tests
|
||||
WORKDIR /clixon/clixon/test
|
||||
RUN install -d /clixon/build/bin/test
|
||||
RUN install *.sh /clixon/build/bin/test
|
||||
RUN install *.exp /clixon/build/bin/test
|
||||
RUN install clixon.png /clixon/build/bin/test
|
||||
|
||||
RUN install -d /clixon/build/mibs
|
||||
RUN install mibs/* /clixon/build/mibs
|
||||
|
||||
# Copy startscript
|
||||
WORKDIR /clixon
|
||||
COPY startsystem_native.sh startsystem.sh
|
||||
RUN install startsystem.sh /clixon/build/bin/
|
||||
|
||||
# Add our generated YANG files
|
||||
RUN git clone https://github.com/clicon/mib-yangs.git /usr/local/share/mib-yangs
|
||||
|
||||
#
|
||||
# Stage 2
|
||||
# The second step skips the development environment and builds a runtime system
|
||||
FROM alpine
|
||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||
|
||||
# For clixon and cligen
|
||||
RUN apk add --update flex bison
|
||||
|
||||
# need to add www user manually
|
||||
RUN adduser -D -H -G www-data www-data
|
||||
|
||||
RUN apk add --update openssl
|
||||
|
||||
# nghttp2 dependencies
|
||||
RUN apk add --update nghttp2
|
||||
|
||||
# Test-specific (for test scripts)
|
||||
RUN apk add --update sudo curl procps grep make bash expect
|
||||
|
||||
# For SNMP
|
||||
RUN apk add --update net-snmp net-snmp-tools
|
||||
|
||||
# Some custom configuration for SNMP
|
||||
RUN echo "master agentx" > /etc/snmp/snmpd.conf
|
||||
RUN echo "agentaddress 127.0.0.1" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "rwcommunity public localhost" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf
|
||||
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
|
||||
|
||||
# Expose https port for restconf
|
||||
EXPOSE 80/tcp
|
||||
EXPOSE 443/tcp
|
||||
|
||||
# Create clicon user and group
|
||||
RUN adduser -D -H clicon
|
||||
|
||||
COPY --from=0 /clixon/build/ /usr/local/
|
||||
COPY --from=0 /usr/local/share/yang/ /usr/local/share/yang/
|
||||
COPY --from=0 /usr/local/share/openconfig/* /usr/local/share/openconfig/
|
||||
COPY --from=0 /usr/local/share/mib-yangs/* /usr/local/share/mib-yangs/
|
||||
COPY --from=0 /clixon/build/mibs/* /usr/share/snmp/mibs/
|
||||
|
||||
# Start daemons
|
||||
CMD /usr/local/bin/startsystem.sh
|
||||
95
docker/test/Makefile.in
Normal file
95
docker/test/Makefile.in
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
#
|
||||
# Build, compile and test a clixon-system container
|
||||
# This is used in CI
|
||||
# NOTE: restconf config is controlled at install time with ./configure --with-restconf=... option
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
with_restconf = @with_restconf@
|
||||
ifdef with_restconf
|
||||
DOCKERFILE = Dockerfile.$(with_restconf)
|
||||
else
|
||||
DOCKERFILE = Dockerfile
|
||||
endif
|
||||
|
||||
#DOCKERFLAGS="--no-cache"
|
||||
|
||||
# Example docker image. CHANGE THIS IF YOU PUSH
|
||||
IMG = clixon/clixon-system
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
.PHONY: all clean distclean docker test push depend install-include install uninstall
|
||||
|
||||
all:
|
||||
echo "Run make docker to build docker image"
|
||||
|
||||
# (recursively) clone the repo from top-level - NOTE changes must be committed
|
||||
clixon:
|
||||
git clone file://$(realpath ${top_srcdir})
|
||||
|
||||
clean:
|
||||
rm -rf clixon # clone of top-srcdir
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile *~ .depend
|
||||
|
||||
docker: clixon $(DOCKERFILE)
|
||||
sudo docker build -f $(DOCKERFILE) -t $(IMG) $(DOCKERFLAGS) .
|
||||
|
||||
push:
|
||||
sudo docker push $(IMG)
|
||||
|
||||
# Start the clixon system container and run the test script
|
||||
# Note tests will kill the daemons started in the start scrips
|
||||
# Note when start.sh is completed, the internal startsystem.sh script may still be running
|
||||
# therefore the sleep 1 before tests start
|
||||
test: docker
|
||||
./cleanup.sh ; ./start.sh # kill (ignore error) and the start it
|
||||
sudo docker exec -t clixon-system bash -c 'cd /usr/local/bin/test && detail=true ./sum.sh'
|
||||
|
||||
depend:
|
||||
|
||||
install-include:
|
||||
|
||||
install:
|
||||
|
||||
uninstall:
|
||||
|
||||
81
docker/test/README.md
Normal file
81
docker/test/README.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Clixon example test container
|
||||
|
||||
This directory show how to build a "monolithic" clixon docker
|
||||
container exporting port 80 and contains the example application with
|
||||
both restconf, netconf, cli and backend. It also includes packages to be able to run the [Clixon tests](../../test).
|
||||
|
||||
Note that restconf capability depends on how clixon was configured using the `--with-restconf` option.
|
||||
|
||||
The directory contains the following files:
|
||||
- cleanup.sh Kill containers
|
||||
- Dockerfile Docker build instructions without restconf
|
||||
- Dockerfile.fcgi Docker build instructions with nginx/fcgi restconf (this is default)
|
||||
- Dockerfile.native Docker build instructions with native restconf
|
||||
- Makefile.in "make docker" builds the container
|
||||
- README.md This file
|
||||
- start.sh Start containers
|
||||
- startsystem.sh Internal start script copied to inside the container (dont run from shell).
|
||||
- startsystem_fcgi.sh Variant for nginx/fcgi (default)
|
||||
- startsystem_native.sh Variant for native restconf
|
||||
|
||||
How to run the tests:
|
||||
```
|
||||
$ make test
|
||||
```
|
||||
|
||||
How to build and start the container (called clixon-system):
|
||||
```
|
||||
$ make docker
|
||||
$ ./start.sh
|
||||
```
|
||||
|
||||
The start.sh has a number of environment variables to alter the default behaviour:
|
||||
* PORT - Nginx exposes port 80 per default. Set `PORT=8080` for example to access restconf using 8080.
|
||||
* DBG - Set debug. The clixon_backend will be shown on docker logs.
|
||||
* CONFIG - Set XML configuration file other than the default example.
|
||||
* STORE - Set running datastore content to other than default.
|
||||
|
||||
Example:
|
||||
```
|
||||
$ DBG=1 PORT=8080 ./start.sh
|
||||
```
|
||||
|
||||
Once running you can access it in different ways as follows:
|
||||
As CLI:
|
||||
```
|
||||
$ sudo docker exec -it clixon-system clixon_cli
|
||||
```
|
||||
As netconf via stdin/stdout:
|
||||
```
|
||||
$ sudo docker exec -it clixon-system clixon_netconf -f /usr/local/etc/example.xml
|
||||
```
|
||||
As restconf using curl on exposed port 80:
|
||||
```
|
||||
$ curl -X GET http://localhost/restconf
|
||||
{
|
||||
"ietf-restconf:restconf": {
|
||||
"data": {},
|
||||
"operations": {},
|
||||
"yang-library-version": "2019-01-04"
|
||||
}
|
||||
}
|
||||
```
|
||||
Or run tests:
|
||||
```
|
||||
$ sudo docker exec -it clixon-system bash -c 'cd /usr/local/bin/test && ./all.sh'
|
||||
```
|
||||
|
||||
To check status and then kill it:
|
||||
```
|
||||
$ sudo docker ps --all
|
||||
$ ./cleanup.sh
|
||||
```
|
||||
|
||||
You trigger the test scripts inside the container using `make test`.
|
||||
|
||||
## Changing code
|
||||
|
||||
If you want to edit clixon code so it runs in the container?
|
||||
You either:
|
||||
1. "persistent": make your changes in the actual clixon code and commit; make clean to remove the local clone; make test again
|
||||
2. "volatile" edit the local clone, (in the subdir); `make test`.
|
||||
7
docker/test/cleanup.sh
Executable file
7
docker/test/cleanup.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Kill all controller containers (optionally do `make clean`)
|
||||
sudo docker kill clixon-system 2> /dev/null # ignore errors
|
||||
|
||||
|
||||
|
||||
98
docker/test/start.sh
Executable file
98
docker/test/start.sh
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
#!/usr/bin/env bash
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Usage: ./startup.sh
|
||||
# Debug: DBG=1 ./startup.sh
|
||||
# This script runs _outside_ the container on the host, and triggers the startsystem.sh that runs
|
||||
# _inside_ the container.
|
||||
# @see cleanup.sh and startsystem.sh
|
||||
#
|
||||
>&2 echo "Running script: $0"
|
||||
|
||||
# Error function
|
||||
# usage: err $msg
|
||||
err(){
|
||||
echo "\e[31m\n[Error $1]"
|
||||
echo "\e[0m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Turn on debug in containers (restconf, backend)
|
||||
DBG=${DBG:-0}
|
||||
|
||||
# Expose other host port than port 80
|
||||
PORT=${PORT:-8080}
|
||||
|
||||
SPORT=${SPORT:-8443}
|
||||
|
||||
# Initial running datastore content (other than empty)
|
||||
STORE=${STORE:-}
|
||||
|
||||
CONFIG0=$(cat <<EOF
|
||||
<clixon-config xmlns="http://clicon.org/config">
|
||||
<CLICON_CONFIGFILE>/usr/local/etc/example.xml</CLICON_CONFIGFILE>
|
||||
<CLICON_FEATURE>*:*</CLICON_FEATURE>
|
||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>clixon-example</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_CLI_MODE>example</CLICON_CLI_MODE>
|
||||
<CLICON_BACKEND_DIR>/usr/local/lib/example/backend</CLICON_BACKEND_DIR>
|
||||
<CLICON_NETCONF_DIR>/usr/local/lib/example/netconf</CLICON_NETCONF_DIR>
|
||||
<CLICON_RESTCONF_DIR>/usr/local/lib/example/restconf</CLICON_RESTCONF_DIR>
|
||||
<CLICON_CLI_DIR>/usr/local/lib/example/cli</CLICON_CLI_DIR>
|
||||
<CLICON_CLISPEC_DIR>/usr/local/lib/example/clispec</CLICON_CLISPEC_DIR>
|
||||
<CLICON_SOCK>/usr/local/var/example/example.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/example/example.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_CLI_GENMODEL_COMPLETION>1</CLICON_CLI_GENMODEL_COMPLETION>
|
||||
<CLICON_CLI_GENMODEL_TYPE>VARS</CLICON_CLI_GENMODEL_TYPE>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/example</CLICON_XMLDB_DIR>
|
||||
<CLICON_CLI_LINESCROLLING>0</CLICON_CLI_LINESCROLLING>
|
||||
<CLICON_STARTUP_MODE>init</CLICON_STARTUP_MODE>
|
||||
<CLICON_NACM_MODE>disabled</CLICON_NACM_MODE>
|
||||
</clixon-config>
|
||||
EOF
|
||||
)
|
||||
|
||||
CONFIG=${CONFIG:-$CONFIG0}
|
||||
|
||||
# Start clixon-example backend
|
||||
>&2 echo -n "Starting Backend..."
|
||||
sudo docker run -p $PORT:80 -p $SPORT:443 --name clixon-system --rm -e DBG=$DBG -e CONFIG="$CONFIG" -e STORE="$STORE" -td clixon/clixon-system || err "Error starting clixon-system"
|
||||
|
||||
# Wait for snmpd to start
|
||||
sudo docker exec -t clixon-system bash -c 'while [ ! -S /var/run/snmp.sock ]; do sleep 1; done'
|
||||
|
||||
>&2 echo "clixon-system started"
|
||||
|
||||
|
||||
|
||||
|
||||
91
docker/test/startsystem.sh
Executable file
91
docker/test/startsystem.sh
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/env bash
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Clixon start script without restconf. NOTE TESTS are very restricted
|
||||
# This script is copied into the container on build time and runs
|
||||
# _inside_ the container at start in runtime. It gets environment variables
|
||||
# from the start.sh script.
|
||||
# It starts a backend and the sleeps
|
||||
# for restconf.
|
||||
# See also Dockerfile of the example
|
||||
# Log msg, see with docker logs
|
||||
|
||||
set -ux # e but clixon_backend may fail if test is run in parallell
|
||||
|
||||
>&2 echo "$0"
|
||||
|
||||
DBG=${DBG:-0}
|
||||
|
||||
# Initiate clixon configuration (env variable)
|
||||
echo "$CONFIG" > /usr/local/etc/clixon.xml
|
||||
|
||||
# Initiate running db (env variable)
|
||||
echo "$STORE" > /usr/local/var/example/running_db
|
||||
|
||||
# This is a clixon site test file.
|
||||
# Add to skiplist:
|
||||
# - all 3rd party model testing (you need to download the repos)
|
||||
# - test_install.sh since you dont have the make environment
|
||||
# - test_order.sh XXX this is a bug need debugging
|
||||
# - NOTE all restconf tests skipped which makes these tests very constrained
|
||||
cat <<EOF > /usr/local/bin/test/site.sh
|
||||
# Add your local site specific env variables (or tests) here.
|
||||
SKIPLIST="test_api.sh test_c++.sh test_install.sh test_privileges.sh test_augment.sh test_choice.sh test_identity.sh test_nacm_datanode_read.sh test_nacm_datanode.sh test_nacm_datanode_write.sh test_nacm_default.sh test_nacm_ext.sh test_nacm_module_read.sh test_nacm_module_write.sh test_nacm_protocol.sh test_nacm.sh test_nacm_recovery.sh test_perf.sh test_perf_state_only.sh test_perf_state.sh test_restconf2.sh test_restconf_err.sh test_restconf_jukebox.sh test_restconf_listkey.sh test_restconf_patch.sh test_restconf.sh test_restconf_startup.sh test_rpc.sh test_ssl_certs.sh test_stream.sh test_submodule.sh test_upgrade_auto.sh test_upgrade_interfaces.sh test_upgrade_repair.sh test_yang_namespace.sh"
|
||||
# Parse yangmodels from https://github.com/YangModels/yang
|
||||
EOF
|
||||
|
||||
# Patch to override YANG_INSTALLDIRS
|
||||
cat <<EOF >> /usr/local/bin/test/config.sh
|
||||
YANG_INSTALLDIR=/usr/local/share/clixon
|
||||
EOF
|
||||
|
||||
# Patch yang syntax errors
|
||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||
|
||||
# Workaround for this error output:
|
||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||
|
||||
chmod 775 /usr/local/bin/test/site.sh
|
||||
|
||||
# Start clixon backend (tests will kill this)
|
||||
/usr/local/sbin/clixon_backend -D $DBG -s running -l e # logs on docker logs
|
||||
>&2 echo "clixon_backend started"
|
||||
|
||||
# Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can
|
||||
# use Docker logs to see what's happening.
|
||||
snmpd -Lo -p /var/run/snmpd.pid -I -ifXTable -I -ifTable -I -system_mib -I -sysORTable -I -snmpNotifyFilterTable -I -snmpNotifyTable -I -snmpNotifyFilterProfileTable
|
||||
|
||||
# Alt: let backend be in foreground, but test scripts may
|
||||
# want to restart backend
|
||||
/bin/sleep 100000000
|
||||
140
docker/test/startsystem_fcgi.sh
Executable file
140
docker/test/startsystem_fcgi.sh
Executable file
|
|
@ -0,0 +1,140 @@
|
|||
#!/usr/bin/env bash
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Clixon startscript for fcgi/nginx and http
|
||||
# This script is copied into the container on build time and runs
|
||||
# _inside_ the container at start in runtime. It gets environment variables
|
||||
# from the start.sh script.
|
||||
# It starts a backend, a restconf daemon, a nginx daemon, exposes ports and the sleeps
|
||||
# for restconf.
|
||||
# See also Dockerfile of the example
|
||||
# Log msg, see with docker logs
|
||||
|
||||
set -ux # e but clixon_backend may fail if test is run in parallell
|
||||
|
||||
>&2 echo "$0"
|
||||
|
||||
# If set, enable debugging (of backend and restconf daemons)
|
||||
: ${DBG:=0}
|
||||
|
||||
# Initiate clixon configuration (env variable)
|
||||
echo "$CONFIG" > /usr/local/etc/clixon.xml
|
||||
|
||||
# Initiate running db (env variable)
|
||||
echo "$STORE" > /usr/local/var/example/running_db
|
||||
|
||||
>&2 echo "Write nginx config files"
|
||||
# nginx site config file
|
||||
# Note alpine has switched between /etc/nginx/conf.d/ and /etc/nginx/http.d/
|
||||
cat <<EOF > /etc/nginx/http.d/default.conf
|
||||
#
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen localhost:80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name localhost;
|
||||
server_name _;
|
||||
location / {
|
||||
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
||||
include fastcgi_params;
|
||||
}
|
||||
location /restconf {
|
||||
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
||||
include fastcgi_params;
|
||||
}
|
||||
location /streams {
|
||||
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
|
||||
include fastcgi_params;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# This is a clixon site test file.
|
||||
# Add to skiplist:
|
||||
# - all 3rd party model testing (you need to download the repos)
|
||||
# - test_install.sh since you dont have the make environment
|
||||
# - test_order.sh XXX this is a bug need debugging
|
||||
# Note use only http, for https you need to reconfig nginx
|
||||
cat <<EOF > /usr/local/bin/test/site.sh
|
||||
# Add your local site specific env variables (or tests) here.
|
||||
SKIPLIST="test_api.sh test_client.sh test_c++.sh test_install.sh test_privileges.sh"
|
||||
RCPROTO=http # Because nginx
|
||||
# Parse yangmodels from https://github.com/YangModels/yang
|
||||
EOF
|
||||
|
||||
# Patch to override YANG_INSTALLDIRS
|
||||
cat <<EOF >> /usr/local/bin/test/config.sh
|
||||
YANG_INSTALLDIR=/usr/local/share/clixon
|
||||
OPENCONFIG=/usr/local/share/openconfig
|
||||
EOF
|
||||
|
||||
# Patch yang syntax errors
|
||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||
|
||||
# Workaround for this error output:
|
||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||
|
||||
chmod 775 /usr/local/bin/test/site.sh
|
||||
|
||||
if [ ! -d /run/nginx ]; then
|
||||
mkdir /run/nginx
|
||||
fi
|
||||
|
||||
# Start nginx
|
||||
#/usr/sbin/nginx -g 'daemon off;' -c /etc/nginx/nginx.conf
|
||||
/usr/sbin/nginx -c /etc/nginx/nginx.conf
|
||||
>&2 echo "nginx started"
|
||||
|
||||
# Start clixon_restconf (tests will kill this)
|
||||
/usr/local/sbin/clixon_restconf -l f/var/log/restconf.log -D $DBG &
|
||||
>&2 echo "clixon_restconf started"
|
||||
|
||||
# Set grp write XXX do this when creating
|
||||
chmod g+w /www-data/fastcgi_restconf.sock
|
||||
|
||||
# Start clixon backend (tests will kill this)
|
||||
# Note if tests start too quickly, a backend may only be running and get error when start here,
|
||||
# therefore test starts need to be delayed slightly
|
||||
/usr/local/sbin/clixon_backend -D $DBG -s running -l e # logs on docker logs
|
||||
>&2 echo "clixon_backend started"
|
||||
|
||||
# Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can
|
||||
# use Docker logs to see what's happening.
|
||||
snmpd -Lo -p /var/run/snmpd.pid -I -ifXTable -I -ifTable -I -system_mib -I -sysORTable -I -snmpNotifyFilterTable -I -snmpNotifyTable -I -snmpNotifyFilterProfileTable
|
||||
|
||||
# Alt: let backend be in foreground, but test scripts may
|
||||
# want to restart backend
|
||||
/bin/sleep 100000000
|
||||
134
docker/test/startsystem_native.sh
Executable file
134
docker/test/startsystem_native.sh
Executable file
|
|
@ -0,0 +1,134 @@
|
|||
#!/usr/bin/env bash
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright (C) 2017-2019 Olof Hagsand
|
||||
# Copyright (C) 2020-2022 Olof Hagsand and Rubicon Communications, LLC(Netgate)
|
||||
#
|
||||
# This file is part of CLIXON
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||
# in which case the provisions of the GPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of the GPL, and not to allow others to
|
||||
# use your version of this file under the terms of Apache License version 2,
|
||||
# indicate your decision by deleting the provisions above and replace them with
|
||||
# the notice and other provisions required by the GPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the Apache License version 2 or the GPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Clixon startscript for native restconf and https
|
||||
# This script is copied into the container on build time and runs
|
||||
# _inside_ the container at start in runtime. It gets environment variables
|
||||
# from the start.sh script.
|
||||
# It starts a backend, a restconf daemon and exposes ports for restconf, and the sleeps
|
||||
# See also Dockerfile of the example
|
||||
# Log msg, see with docker logs
|
||||
|
||||
set -ux # e but clixon_backend may fail if test is run in parallell
|
||||
|
||||
>&2 echo "$0"
|
||||
|
||||
# If set, enable debugging (of backend and restconf daemons)
|
||||
: ${DBG:=0}
|
||||
|
||||
# Initiate clixon configuration (env variable)
|
||||
echo "$CONFIG" > /usr/local/etc/clixon.xml
|
||||
|
||||
# Initiate running db (env variable)
|
||||
echo "$STORE" > /usr/local/var/example/running_db
|
||||
|
||||
# This is a clixon site test file.
|
||||
# Add to skiplist:
|
||||
# - all 3rd party model testing (you need to download the repos)
|
||||
# - test_install.sh since you dont have the make environment
|
||||
cat <<EOF > /usr/local/bin/test/site.sh
|
||||
# Add your local site specific env variables (or tests) here.
|
||||
SKIPLIST="test_api.sh test_client.sh test_c++.sh test_install.sh test_privileges.sh"
|
||||
EOF
|
||||
|
||||
# Patch to override YANG_INSTALLDIRS
|
||||
cat <<EOF >> /usr/local/bin/test/config.sh
|
||||
YANG_INSTALLDIR=/usr/local/share/clixon
|
||||
OPENCONFIG=/usr/local/share/openconfig
|
||||
EOF
|
||||
|
||||
# Patch yang syntax errors
|
||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||
|
||||
# Workaround for this error output:
|
||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||
|
||||
chmod 775 /usr/local/bin/test/site.sh
|
||||
|
||||
# Generate self-signed server certificates
|
||||
cat<<EOF > ./ca.cnf
|
||||
[ ca ]
|
||||
default_ca = CA_default
|
||||
|
||||
[ CA_default ]
|
||||
serial = ca-serial
|
||||
crl = ca-crl.pem
|
||||
database = ca-database.txt
|
||||
name_opt = CA_default
|
||||
cert_opt = CA_default
|
||||
default_crl_days = 9999
|
||||
default_md = md5
|
||||
|
||||
[ req ]
|
||||
default_bits = 2048
|
||||
days = 1
|
||||
distinguished_name = req_distinguished_name
|
||||
attributes = req_attributes
|
||||
prompt = no
|
||||
output_password = password
|
||||
|
||||
[ req_distinguished_name ]
|
||||
C = SE
|
||||
L = Stockholm
|
||||
O = Clixon
|
||||
OU = clixon
|
||||
CN = ca
|
||||
emailAddress = olof@hagsand.se
|
||||
|
||||
[ req_attributes ]
|
||||
challengePassword = test
|
||||
EOF
|
||||
|
||||
# Generate self-signed server certificates
|
||||
openssl req -x509 -config ./ca.cnf -nodes -newkey rsa:4096 -keyout /etc/ssl/private/clixon-server-key.pem -out /etc/ssl/certs/clixon-server-crt.pem -days 365
|
||||
|
||||
# Start clixon_restconf
|
||||
# -s https
|
||||
# But dont use -s exposing local ports since there is problem with self-signed certs?
|
||||
/usr/local/bin/clixon_restconf -l f/var/log/restconf.log -D $DBG &
|
||||
>&2 echo "clixon_restconf started"
|
||||
|
||||
# Start clixon backend (tests will kill this)
|
||||
# Note if tests start too quickly, a backend may only be running and get error when start here,
|
||||
# therefore test starts need to be delayed slightly
|
||||
/usr/local/sbin/clixon_backend -D $DBG -s running -l e # logs on docker logs
|
||||
>&2 echo "clixon_backend started"
|
||||
|
||||
# Start snmpd, we need this for the SNMP tests and the app clixon_snmp. Log to stdout, then we can
|
||||
# use Docker logs to see what's happening.
|
||||
snmpd -Lo -p /var/run/snmpd.pid -I -ifXTable -I -ifTable -I -system_mib -I -sysORTable -I -snmpNotifyFilterTable -I -snmpNotifyTable -I -snmpNotifyFilterProfileTable
|
||||
|
||||
# Alt: let backend be in foreground, but test scripts may
|
||||
# want to restart backend
|
||||
/bin/sleep 100000000
|
||||
Loading…
Add table
Add a link
Reference in a new issue