Sign inSign up

spirent/ndo

By spirent

Updated 13 days ago

Network DevOps Agent Container on Ubuntu 24.04 for Docker

Image
Networking
Developer tools
Monitoring & observability
0

3.8K

spirent/ndo repository overview

What is Network DevOps Agent?

The Network DevOps Agent is a fully automated solution for executing tests and reporting results within a production network. It is a streamlined execution environment that requires only a single container and is controlled via a REST API.

How to use this image

The instructions below apply to Network DevOps Agent images of version 24.4.0 and higher.

Start a Network DevOps Agent

You can quickly start a Network DevOps Agent with one command:

$ docker run -p <host port>:8443 --name <container name> --env LICENSE_SERVER=<license server url> spirent/ndo:<tag>

In following example the default Network DevOps Agent container port 8443 is mapped to the 8443 host port. The command sets the license server url in a LICENSE_SERVER environment variable and uses 24.4.0 tag of spirent/ndo image.

$ docker run -p 8443:8443 --name ndo-agent --env LICENSE_SERVER=lic://example.licenceserver.com:27000 spirent/ndo:24.4.0

Build a custom image based on Network DevOps Agent

You may use Dockerfile to build customized Network DevOps Agent Docker image.

Create a Dockerfile

Create a Dockerfile in a separate directory. You may also put files needed for docker image build in that directory.

Below is a sample Dockerfile for Network DevOps Agent. Visit Dockerfile reference to learn more about Dockerfile instructions.

# Specify base NDO image using 'FROM spirent/ndo:<tag>' syntax. 
FROM spirent/ndo:24.4.0

# Copy files to the image filesystem using 'COPY <source_1> .. <source_n> <destination>' command. 
# For example, copy custom languages configuration file into docker image. 
COPY extensible_languages.ini /spirent/config/extensible_languages.ini
# Add assets to itars directory 
COPY itars/* /spirent/data/itars

# Set environment variables using 'ENV <key>=<value>'
# You may use this capability to set variables defined in agent.conf file, define your own variables or override container variables. 
# For example, set PROCESS_COUNT from the agent.conf.
ENV PROCESS_COUNT=3
# Override java options for the NDO application
ENV OVERRIDE_JAVA_OPTS=-Xss6M

# You can perform arbitrary shell commands using 'RUN <shell command>' instruction.

# Install additional packages with 'RUN apt-get update && apt-get install <package_1> .. <package_n>'.
# Use backslash \ to break long command into lines. Below is an example of ping and tracepath utilities and ruby interpreter installation.

# Changing user to root is required to run apt-get
USER root
RUN apt-get update \
 && apt-get install iputils-ping \
   iputils-tracepath \
   ruby-full \
 && rm -rf /var/lib/apt/lists/*
# Change the user back to ndaagent
USER ndaagent

# Use 'RUN python3 -m pip install <libname_1> <libname_2> .. <libname_n>' to install additional Python libraries. 
# Below is an example on how to install html5lib and Pandas libraries.
RUN python3 -m pip install html5lib pandas

Notes on the Dockerfile development

Always use apt-get update and apt-get install in one RUN instruction to avoid caching issues. Cleanup apt cache (/var/lib/apt/lists directory) after packages installation to reduce image size. Use chain && operator to combine commands in one instruction.

RUN apt-get update && apt-get install <package_1> .. <package_n> && rm -rf /var/lib/apt/lists/*

Network DevOps Agent runs under ndaagent user so you need to change user with USER root instruction if you run the command that requires root access (for example, apt-get command). The user must be changed back to ndaagent after the command is performed:

# Changing user to root is required to run apt-get
USER root
RUN apt-get update \
 && apt-get install iputils-ping \
   iputils-tracepath \
   ruby-full \
 && rm -rf /var/lib/apt/lists/*
# Do not forget to change the user back to ndaagent
USER ndaagent
Build the image

Run the following command in the directory with Dockerfile to build the image. Assign custom name and tag to the built image.

$ docker build -t custom-ndo:custom-tag .

Note. docker build command last argument is a build context. Build context is a set of files which are accessible to the build and can be referenced by Dockerfile instructions (such as COPY). In the example above, build context is set to current directory (.). That is, Dockerfile and files needed for the build should be placed in the directory where docker build command is run. See Build contexts article to learn more about build contexts.

You can then run the image with docker run command by specifying the built image name and tag.

$ docker run -p 8443:8443 --name ndo-agent --env LICENSE_SERVER=lic://example.licenceserver.com:27000 custom-ndo:custom-tag

Configuration and customization details

Network DevOps Agent configuration and data files include:

  • /spirent/data/passwd - user/password mappings file. Auto-generated if not provided, the password and username are printed into the log.
  • /spirent/data/itar - a directory with automation assets. Empty by default.
  • /spirent/config/host.p12 - host SSL certificate file in PKCS12 format. If absent, the certificate is auto-generated in /spirent/data/host.p12 location and printed into the log. The password should be provided in PKCS12_CERTIFICATE_PASSWD environment variable.
  • /spirent/config/key.pem and /spirent/config/cert.pem - host SSL private key and certificate files in PEM format. If absent, PKCS12 certificate configuration is used. Private key passphrase should be provided in PEM_SSL_PASSWORD environment variable.
  • /spirent/config/keystore.jks - keystore used for asset validation. If absent, built-in certificate store is used. Password should be provided in KEYSTORE_PASSWORD environment variable.
  • /spirent/config/extensible_languages.ini - external script interpreters configuration. By default, Network DevOps Agent image supports Python and Bash script languages.
  • /spirent/config/license.lic - a file with Network DevOps Agent license. Required if no LICENSE_SERVER is given.
  • /spirent/config/templates - a directory with custom templates for execution reports. Empty by default.
  • /spirent/config/agent.conf - a self-documented file with Network DevOps Agent configuration values. Default file content is provided below.

Important: It is not recommended to build custom images with embedded security-sensitive content, such as certificates, password files and credentials. That is, Dockerfile COPY instruction shouldn't be used to provide sensitive files for custom image, and ENV instruction shouldn't be used to set passwords. Instead, provide sensitive files and passwords at the container runtime using --mount and --env options:

$ docker run -p 8443:8443 --name ndo-agent --mount type=bind,source=/home/user/ndo_docker/host.p12,destination=/spirent/config/host.p12
--env PKCS12_CERTIFICATE_PASSWD=encrypted_password custom-ndo:custom-tag

Below is a default agent.conf included into the image.

# General Network DevOps Agent configuration
# Agent Name prefix
AGENT_NAME=Agent
# The number of agent processes to run
# If you are planning to run CPU-intensive tests, set this to the number of
# cores on the system. Otherwise, the limit is the amount of RAM available.
# Since memory usage depends on the nature of tests being run, there is no
# ideal value to recommend. Each instance requires one NETWORK_DEVOPS_AGENT license.
PROCESS_COUNT=5

# Overridden JVM options
#OVERRIDE_JAVA_OPTS=

# The value that will be substituted as a prefix for NDO launch command.
#AGENT_LAUNCHER=

# Additional NDO options that are not listed in agent.conf. When enabled, these options will be used for launching NDO.
#AGENT_EXTRA_OPTIONS=

# License server configuration - comma separated list of URIs lic://<server ip/hostname>[:<port>]
#LICENSE_SERVER=lic://myserver.address,lic://[fd53:5043:5000:8c4c::23]:27000

# Reports archive options
# Number of reports to be archived before the rotation process for archived reports would take place
ARCHIVED_REPORTS_COUNT_LIMIT=10000
# Total size of archived reports in megabytes, exceeding which will enable the rotation process
ARCHIVED_REPORTS_SIZE_LIMIT=10000
# Maximum time (in minutes) for which archived reports will be retained
ARCHIVED_REPORTS_TIME_LIMIT=1440

## The following values are necessary only if you plan to run tests that use
# NTAF automation.
# The IP address or host name of the NTAF server
NTAF_SERVER=
# Port of the NTAF server
NTAF_PORT=
# Credentials for the agent as a client of the NTAF server
NTAF_USER=
NTAF_PASSWORD=
#Color for Chart
CHART_COLOR=iTest

# Certificate's password masked with iTest Encode capability. The certificate itself (PKCS12) shall be put in /spirent/config/host.p12
PKCS12_CERTIFICATE_PASSWD=

# PEM private key passphrase encrypted with iTest/Tools/Encrypt tool.
# Paths to the host's SSL private key and certificate in PEM format shall be put in
# /spirent/config/key.pem and /spirent/config/cert.pem.
PEM_SSL_PASSWORD=

# Timeout configured for token liveness in minutes. Default value if not passed 1 day
AUTH_TOKEN_TIMEOUT=1440

# Keystore that contains digital certificates of automation content signers: If not set (or commented), the default spirent.apt.keystore.jks will be used. The keystore is only used when ENABLE_SIGNATURE_VERIFICATION is set to True.
KEYSTORE_FILE=
# Keystore password: This password should be encoded using the password encoding tool within the iTest GUI. If not set (or commented), the default "changeit" will be used.
KEYSTORE_PASSWORD=
# Enable or disable signature verification for automation archives - valid choices are True or False
ENABLE_SIGNATURE_VERIFICATION=False

# Telemetry options
# URL of telemetry server (optional). When enabled, the agent will send telemetry data such as memory usage, CPU consumption, test execution start/complete/pass/fail statistics, REST requests, exceptions to the specified server. URL format: http://<host>:<port>/<statistics_endpoint_url>
TELEMETRY_SERVER=
# Interval of sending telemetry data to server in seconds (optional). Default is 60 (i.e. one minute).
TELEMETRY_INTERVAL=
# Delay between cpu and heap usage info measurements in milliseconds (optional). Default is 1000 (i.e. one second)
TELEMETRY_MEASUREMENTS_DELAY=
Overriding agent.conf values

You can replace the agent.conf contents in the container runtime using --mount option of the docker run command:

$ docker run -p 8443:8443 --name ndo-agent --mount type=bind,source=/home/user/ndo_docker/agent.conf,destination=/spirent/config/agent.conf spirent/ndo:24.4.0

Use --env option of the docker run to override the individual values from agent.conf in the container runtime:

$ docker run -p 8443:8443 --name ndo-agent --env LICENSE_SERVER=lic://example.server.com:27000 --env PROCESS_COUNT=10 --env OVERRIDE_JAVA_OPTS=-Xss6M spirent/ndo:24.4.0

If you're building a custom image, you can replace the agent.conf using COPY Dockerfile instruction:

COPY agent.conf /spirent/config/agent.conf

To override the individual agent.conf values in the build time, use ENV Dockerfile instruction:

ENV LICENSE_SERVER=lic://example.server.com:27000
ENV PROCESS_COUNT=10
ENV OVERRIDE_JAVA_OPTS=-Xss6M

Order of configuration value source priorities:

  1. Values defined in agent.conf have the lowest priority. Replacing agent.conf means replacing the whole set of configuration variables. Order of agent.conf sources, from lowest to highest priority:
    1. Values from Network DevOps Agent image default agent.conf
    2. Values from agent.conf provided when building custom image (COPY Dockerfile instruction)
    3. Values from agent.conf mounted when the container is run (docker run --mount option)
  2. Values provided in environment variables have higher priority than values defined in agent.conf. Environment variables override individual configuration values. Order of environment variable sources, from lowest to highest priority:
    1. Environment variables set when building custom image (ENV Dockerfile instruction)
    2. Variables overridden when the container is run (docker run --env option)
Installing an additional language interpreter

You can customize Network DevOps Agent image to run external scripts of languages additional to Python and Bash supported by default. The following Dockerfile copies custom language configuration (extensible_languages.ini file) into Docker image and installs Ruby interpreter using RUN instruction.

FROM spirent/ndo:24.4.0

# For example, copy custom languages configuration file into docker image. 
COPY extensible_languages.ini /spirent/config/extensible_languages.ini

# Changing user to root is required to run apt-get
USER root
# Install ruby interpreter.
RUN apt-get update \
 && apt-get install ruby-full \
 && rm -rf /var/lib/apt/lists/*
# Do not forget to change the user back to ndaagent
USER ndaagent

Below is extensible_languages.ini used for this example. Custom language configuration replaces default language configuration, so you need to include Python and Bash languages to the configuration if you want to preserve the default ability to run Python and Bash scripts.

[python]
COMMAND=python3

[bash]
COMMAND=bash

[ruby]
COMMAND=ruby

Tag summary

Content type

Image

Digest

sha256:806151d34

Size

1.2 GB

Last updated

13 days ago

docker pull spirent/ndo:26.3.0