diff options
author | Sridhar K. N. Rao <sridhar.rao@spirent.com> | 2021-10-01 09:34:54 +0530 |
---|---|---|
committer | Al Morton <acm@research.att.com> | 2021-10-01 21:01:49 +0000 |
commit | b298cbad4e39cfacead75debcb743e9b844efbd0 (patch) | |
tree | 5db9d85d3a11c40a6ead685cc17f618d6699c8e0 /tools | |
parent | 467a22c1c2cbfc3c4a8448b7170d84dc26d658ec (diff) |
Docker: ViNePerf Container
This patch adds support for new vineperf container
1. Both T-Rex and Prox support
2. SSH support added to run in K8S cluster.
Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com>
Change-Id: I993807acf0abaa873c82b22e0286b5156a1954cf
Diffstat (limited to 'tools')
-rw-r--r-- | tools/docker/vineperf/Dockerfile | 50 | ||||
-rw-r--r-- | tools/docker/vineperf/deploytools.sh | 43 | ||||
-rwxr-xr-x | tools/docker/vineperf/start.sh | 6 | ||||
-rw-r--r-- | tools/docker/vineperf/vineperf | 38 | ||||
-rw-r--r-- | tools/docker/vineperf/vineperf.pub | 1 |
5 files changed, 138 insertions, 0 deletions
diff --git a/tools/docker/vineperf/Dockerfile b/tools/docker/vineperf/Dockerfile new file mode 100644 index 00000000..05cc1f93 --- /dev/null +++ b/tools/docker/vineperf/Dockerfile @@ -0,0 +1,50 @@ +# To Build +# docker build --rm -t vsperf . + +# -------- Builder stage. +FROM python:3.9.7-slim-buster +MAINTAINER Sridhar Rao <sridhar.rao@spirent.com> + +# +# Update and Install required packages +# +ARG BUILD_DIR=/opt/vineperf +COPY ./deploytools.sh ${BUILD_DIR}/ +RUN chmod +x ${BUILD_DIR}/deploytools.sh \ + && ${BUILD_DIR}/deploytools.sh + +WORKDIR /root +# +# Get vineperf +# +RUN git clone https://gerrit.opnfv.org/gerrit/vineperf + +# +# Remove unnecessary python packages. +# +RUN cd vineperf && \ + sed -e '/numpy/ s/^#*/#\ /' -i requirements.txt && \ + sed -e '/matplotlib/ s/^#*/#\ /' -i requirements.txt && \ + sed -e '/pycrypto/ s/^#*/#\ /' -i requirements.txt && \ + sed -e '/pypsi/ s/^#*/#\ /' -i requirements.txt && \ + sed -e '/pyzmq/ s/^#*/#\ /' -i requirements.txt && \ + sed -e "\$apyzmq" -i requirements.txt + +# +# Build VINEPERF +# +RUN cd vineperf/systems && ./build_base_machine.sh --trafficgen +RUN cd vineperf/systems/pythonlibs && /bin/bash -c ./add_prox.sh --trafficgen + +# Expose SSH and PROX ports +EXPOSE 22 8474 + +# Copy SSH keys +#COPY ./vineperf.pub /home/opnfv/.ssh/authorized_keys +COPY ./vineperf.pub /root/.ssh/authorized_keys + +# Copy startup script +COPY ./start.sh /start.sh +RUN chmod +x /start.sh + +ENTRYPOINT ["/start.sh"] diff --git a/tools/docker/vineperf/deploytools.sh b/tools/docker/vineperf/deploytools.sh new file mode 100644 index 00000000..c82e394c --- /dev/null +++ b/tools/docker/vineperf/deploytools.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# If already running from root, no need for sudo +SUDO="" +[ $(id -u) -ne 0 ] && SUDO="sudo" + +function os_pkgs_install() +{ + ${SUDO} apt-get -y update + # Install required packages + ${SUDO} apt-get install -y git wget iputils-ping iproute2 unzip openssh-server openssh-client tk sudo +} + +function os_cfg() +{ + [ ! -f /etc/ssh/ssh_host_rsa_key ] && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + [ ! -f /etc/ssh/ssh_host_ecdsa_key ] && ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' + [ ! -f /etc/ssh/ssh_host_ed25519_key ] && ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N '' + + [ ! -d /var/run/sshd ] && mkdir -p /var/run/sshd + + USER_NAME="opnfv" + USER_PWD="opnfv" + ROOT_USER="root" + + useradd -m -d /home/${USER_NAME} -s /bin/bash -U ${USER_NAME} + echo "${USER_NAME}:${USER_PWD}" | chpasswd + echo "${ROOT_USER}:${USER_PWD}" | chpasswd + usermod -aG sudo ${USER_NAME} + + echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USER_NAME} +} + +function cleanup() +{ + ${SUDO} apt-get autoremove -y + ${SUDO} apt-get clean all + ${SUDO} rm -rf /var/cache/apt +} + +os_pkgs_install +os_cfg +cleanup diff --git a/tools/docker/vineperf/start.sh b/tools/docker/vineperf/start.sh new file mode 100755 index 00000000..277436b3 --- /dev/null +++ b/tools/docker/vineperf/start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Start SSH server in background +/usr/sbin/sshd + +exec sleep infinity diff --git a/tools/docker/vineperf/vineperf b/tools/docker/vineperf/vineperf new file mode 100644 index 00000000..6d72099f --- /dev/null +++ b/tools/docker/vineperf/vineperf @@ -0,0 +1,38 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEAtBRGuKwot8TmGCBgaonHM6UIiOpeirNd8IhG+6gST6uRcNe2UKCc +6m/8WU+PrOtAQ53jRVWJIVVI3UsuOXX3hBYkgZBbfIKGfB1RHjwzL61upCCQ7wSgwgDU5v +N2phoxM7nTHE881mUYtf0d6R9htRziu4g3u8o7pdpsmpcY8m5gsgIL63qiEk/A4Ju6pEZM +oK9J8TqO7sYANsOtzNCbfuTPNtACUJGQVI9NNSfD6LfXMIcJ+DVaf9/JFUvtPonVSYtnRD +uGGO6HXQYDM6WpYbIEthv2yctWmo7cFd9qgd1Bfv1CZevFoxDRUEcr3tO3q13e9lFTn//q +owVl17MnrrD57H/AAuYm1YOvRKefVDS02tTGYy3C7ecRz8UaUVs4lyksbtVBSA50fHEIrB +1/tUWX4NPIbsAwjcGoUjpDLmneYJ0dDPQDw1bxy5RAamLfnUgjFFPjSrFdXu5PsmT7bvbJ +BVspBwWQbMmLfeFvGAhKPkrHl0BAx4Hh+2eVuF6bAAAFiNpn5b3aZ+W9AAAAB3NzaC1yc2 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AMEAvv1T+2L3rpwz2AwJRCxGDAjP4QhysFXb5FU0BtSdEdLw2H6XONtSqNybgzewOff5zj +59TBxl8HI/9BfhOSQqnbigKJig3Y6mN1IGDQiLaWRpQzeerM93ICgAiGUC6Lz7qU1M2xRO +Dfkyt/ewtScPU9wPe/SgN9JP1DRKiQRlIZQp+JMFc2GRMrMnzhn1lTAVZIdtPdvMM/I6G0 +edHyS3AmLFm/LocE8q6j6kPpU2AHeWJP9WOfBCs/C4xwsRCAfgAAAAwQDrMdWZk0X/tLF/ +ACXN8lFy+e2W/9S71nv4APj4TOvhpmpLWSfCMdIDnJxSuQsCWjuOGmWeHishuWt1HsiTGr +nEIMHZMapIpL5Acl8BMEAGtvBH9Pvy3cuCgOKJWIql9P9ImIFdx/vAsJwJlYgLDtiM46yS +mTBO+gOO7wkhuom9UgYAWJVhumcMdqj/dedu2yG8UsOAp9eeS/tFl0pgjcXXRo19fIAr49 +MyIQN677nHmqiDFrm9kPvqR5Sj8EYmZrkAAADBAMQCTzvpzbctPlbTgtSRJ3tZgYkuQ3f7 +Tajd4R6ZPNGLyEtc6j51uenL89/ZkH5iys4/AEta/viXBrJeTkUZUEDT9uaMl34agmBXrq +/4a/GlDSkSu3X1XxjLepFtwL3ZkhDy7ZbYLIfsHeovZ9OFj1G9W6Gek8tQuUywUddQIEJ+ +M0d8d2bvp3yHGhP7rYSIjBV/RwYO0LTKGEova6VKPb0O1ynLOjarbRtvPylwdzv2byFk8a +JWRSC6ZNSBx71F8wAAAA1zcmlkaGFyQGZyZXlhAQIDBA== +-----END OPENSSH PRIVATE KEY----- diff --git a/tools/docker/vineperf/vineperf.pub b/tools/docker/vineperf/vineperf.pub new file mode 100644 index 00000000..2055bdc6 --- /dev/null +++ b/tools/docker/vineperf/vineperf.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC0FEa4rCi3xOYYIGBqicczpQiI6l6Ks13wiEb7qBJPq5Fw17ZQoJzqb/xZT4+s60BDneNFVYkhVUjdSy45dfeEFiSBkFt8goZ8HVEePDMvrW6kIJDvBKDCANTm83amGjEzudMcTzzWZRi1/R3pH2G1HOK7iDe7yjul2myalxjybmCyAgvreqIST8Dgm7qkRkygr0nxOo7uxgA2w63M0Jt+5M820AJQkZBUj001J8Pot9cwhwn4NVp/38kVS+0+idVJi2dEO4YY7oddBgMzpalhsgS2G/bJy1aajtwV32qB3UF+/UJl68WjENFQRyve07erXd72UVOf/+qjBWXXsyeusPnsf8AC5ibVg69Ep59UNLTa1MZjLcLt5xHPxRpRWziXKSxu1UFIDnR8cQisHX+1RZfg08huwDCNwahSOkMuad5gnR0M9APDVvHLlEBqYt+dSCMUU+NKsV1e7k+yZPtu9skFWykHBZBsyYt94W8YCEo+SseXQEDHgeH7Z5W4Xps= sridhar@freya |