Docker: enable ssh tests
Test: restore tty after restconf start
This commit is contained in:
parent
8601690c91
commit
cafbe7d200
10 changed files with 41 additions and 9 deletions
|
|
@ -45,6 +45,9 @@ RUN apk add --update net-snmp net-snmp-dev
|
||||||
# For groupadd/groupdel
|
# For groupadd/groupdel
|
||||||
RUN apk add --update shadow
|
RUN apk add --update shadow
|
||||||
|
|
||||||
|
# Test-specific (for test scripts)
|
||||||
|
RUN apk add --update openssh
|
||||||
|
|
||||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||||
RUN mkdir -p /usr/local/share/yang
|
RUN mkdir -p /usr/local/share/yang
|
||||||
WORKDIR /usr/local/share/yang
|
WORKDIR /usr/local/share/yang
|
||||||
|
|
@ -129,7 +132,7 @@ RUN echo "agentXSocket unix:/var/run/snmp.sock" >> /etc/snmp/snmpd.conf
|
||||||
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
|
RUN echo "agentxperms 777 777" >> /etc/snmp/snmpd.conf
|
||||||
|
|
||||||
# Test-specific (for test scripts)
|
# Test-specific (for test scripts)
|
||||||
RUN apk add --update sudo curl procps grep make bash expect
|
RUN apk add --update sudo curl procps grep make bash expect openssh
|
||||||
|
|
||||||
# Create clicon user and group
|
# Create clicon user and group
|
||||||
RUN adduser -D -H clicon
|
RUN adduser -D -H clicon
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ RUN apk add --update net-snmp net-snmp-dev
|
||||||
# For groupadd/groupdel
|
# For groupadd/groupdel
|
||||||
RUN apk add --update shadow
|
RUN apk add --update shadow
|
||||||
|
|
||||||
|
# Test-specific (for test scripts)
|
||||||
|
RUN apk add --update openssh
|
||||||
|
|
||||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||||
RUN mkdir -p /usr/local/share/yang
|
RUN mkdir -p /usr/local/share/yang
|
||||||
WORKDIR /usr/local/share/yang
|
WORKDIR /usr/local/share/yang
|
||||||
|
|
@ -142,7 +145,7 @@ RUN adduser -D -H -G www-data www-data
|
||||||
RUN apk add --update nginx
|
RUN apk add --update nginx
|
||||||
|
|
||||||
# Test-specific (for test scripts)
|
# Test-specific (for test scripts)
|
||||||
RUN apk add --update sudo curl procps grep make bash expect
|
RUN apk add --update sudo curl procps grep make bash expect openssh
|
||||||
|
|
||||||
# Expose nginx port for restconf
|
# Expose nginx port for restconf
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ RUN apk add --update net-snmp net-snmp-dev
|
||||||
# For groupadd/groupdel
|
# For groupadd/groupdel
|
||||||
RUN apk add --update shadow
|
RUN apk add --update shadow
|
||||||
|
|
||||||
|
# Test-specific (for test scripts)
|
||||||
|
RUN apk add --update openssh
|
||||||
|
|
||||||
# Checkout standard YANG models for tests (note >1G for full repo)
|
# Checkout standard YANG models for tests (note >1G for full repo)
|
||||||
RUN mkdir -p /usr/local/share/yang
|
RUN mkdir -p /usr/local/share/yang
|
||||||
WORKDIR /usr/local/share/yang
|
WORKDIR /usr/local/share/yang
|
||||||
|
|
@ -122,18 +125,16 @@ FROM alpine
|
||||||
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
MAINTAINER Olof Hagsand <olof@hagsand.se>
|
||||||
|
|
||||||
# For clixon and cligen
|
# For clixon and cligen
|
||||||
RUN apk add --update flex bison
|
RUN apk add --update flex bison openssl
|
||||||
|
|
||||||
# need to add www user manually
|
# need to add www user manually
|
||||||
RUN adduser -D -H -G www-data www-data
|
RUN adduser -D -H -G www-data www-data
|
||||||
|
|
||||||
RUN apk add --update openssl
|
|
||||||
|
|
||||||
# nghttp2 dependencies
|
# nghttp2 dependencies
|
||||||
RUN apk add --update nghttp2
|
RUN apk add --update nghttp2
|
||||||
|
|
||||||
# Test-specific (for test scripts)
|
# Test-specific (for test scripts)
|
||||||
RUN apk add --update sudo curl procps grep make bash expect
|
RUN apk add --update sudo curl procps grep make bash expect openssh
|
||||||
|
|
||||||
# For SNMP
|
# For SNMP
|
||||||
RUN apk add --update net-snmp net-snmp-tools
|
RUN apk add --update net-snmp net-snmp-tools
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ EOF
|
||||||
# Patch yang syntax errors
|
# Patch yang syntax errors
|
||||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||||
|
|
||||||
|
# Generate ssh host keys
|
||||||
|
ssh-keygen -A
|
||||||
|
|
||||||
# Workaround for this error output:
|
# Workaround for this error output:
|
||||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ EOF
|
||||||
# Patch yang syntax errors
|
# Patch yang syntax errors
|
||||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||||
|
|
||||||
|
# Generate ssh host keys
|
||||||
|
ssh-keygen -A
|
||||||
|
|
||||||
# Workaround for this error output:
|
# Workaround for this error output:
|
||||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@ EOF
|
||||||
# Patch yang syntax errors
|
# Patch yang syntax errors
|
||||||
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
sed -i s/=\ olt\'/=\ \'olt\'/g /usr/local/share/yang/standard/ieee/published/802.3/ieee802-ethernet-pon.yang
|
||||||
|
|
||||||
|
# Generate ssh host keys
|
||||||
|
ssh-keygen -A
|
||||||
|
|
||||||
# Workaround for this error output:
|
# Workaround for this error output:
|
||||||
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
# sudo: setrlimit(RLIMIT_CORE): Operation not permitted
|
||||||
echo "Set disable_coredump false" > /etc/sudo.conf
|
echo "Set disable_coredump false" > /etc/sudo.conf
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,13 @@ To download the openconfig and yang models required for the tests:
|
||||||
git pull origin main
|
git pull origin main
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## SSH and SSHD
|
||||||
|
|
||||||
|
Some tests require ssh and even sshd (eg test_netconf_ssh_callhome.sh), and requires generated host-keys:
|
||||||
|
```
|
||||||
|
# ssh-keygen -a
|
||||||
|
```
|
||||||
|
|
||||||
## Continuous Integration
|
## Continuous Integration
|
||||||
|
|
||||||
CI is done via github actions.
|
CI is done via github actions.
|
||||||
|
|
|
||||||
|
|
@ -637,6 +637,7 @@ function wait_restconf(){
|
||||||
fi
|
fi
|
||||||
# echo "curl $CURLOPTS -X GET $myproto://localhost/restconf"
|
# echo "curl $CURLOPTS -X GET $myproto://localhost/restconf"
|
||||||
hdr=$(curl $CURLOPTS -X GET $myproto://localhost/restconf 2> /dev/null)
|
hdr=$(curl $CURLOPTS -X GET $myproto://localhost/restconf 2> /dev/null)
|
||||||
|
stty $STTYSETTINGS >/dev/null
|
||||||
# echo "hdr:\"$hdr\""
|
# echo "hdr:\"$hdr\""
|
||||||
let i=0;
|
let i=0;
|
||||||
while [[ "$hdr" != *"200"* ]]; do
|
while [[ "$hdr" != *"200"* ]]; do
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Netconf callhome RFC 8071
|
# Netconf callhome RFC 8071
|
||||||
|
# Requires an openssh + opensshd install + ssh-keygen -A
|
||||||
|
|
||||||
# Magic line must be first in script (see README.md)
|
# Magic line must be first in script (see README.md)
|
||||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
@ -13,6 +14,13 @@ if ! [ -x "$ssh_bin" ]; then
|
||||||
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! [ -x "/usr/sbin/sshd" ]; then
|
||||||
|
echo "...sshd not installed"
|
||||||
|
rm -rf $dir
|
||||||
|
if [ "$s" = $0 ]; then exit 0; else return 0; fi # skip
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Dont run this test with valgrind
|
# Dont run this test with valgrind
|
||||||
if [ $valgrindtest -ne 0 ]; then
|
if [ $valgrindtest -ne 0 ]; then
|
||||||
echo "...skipped "
|
echo "...skipped "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue