Skip to content

Commit ba20646

Browse files
committed
Merge remote-tracking branch 'origin/apl-fy24' into 78-initial-amm-rule-support
2 parents 6f99072 + 41b6301 commit ba20646

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6018
-289
lines changed

.github/workflows/build-test.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ jobs:
134134
run: ./item-test/run.sh
135135

136136
integration-test:
137+
strategy:
138+
fail-fast: false
139+
matrix:
140+
transport: ['socket', 'ion']
141+
name: Integration Test (${{matrix.transport}})
137142
runs-on: ubuntu-24.04
138143
steps:
139144
- name: Checkout repository
@@ -144,9 +149,9 @@ jobs:
144149
- name: Set up Docker Buildx
145150
uses: docker/setup-buildx-action@v3
146151
- name: Start
147-
run: ./integration-test-socket/run.sh start
152+
run: ./integration-test-${{matrix.transport}}/run.sh start
148153
- name: Test
149-
run: ./integration-test-socket/run.sh check
154+
run: ./integration-test-${{matrix.transport}}/run.sh check
150155
- name: Stop
151156
if: always()
152-
run: ./integration-test-socket/run.sh stop
157+
run: ./integration-test-${{matrix.transport}}/run.sh stop

CMakeLists.txt

+20-10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ option(BUILD_DOCS_API "Enable API documentation building" OFF)
2525
option(BUILD_DOCS_MAN "Enable manpage building" OFF)
2626
option(BUILD_AGENT "Build the Agent library and executable" ON)
2727
option(BUILD_MANAGER "Build the Manager library and executable" ON)
28+
option(TRANSPORT_UNIX_SOCKET "Enable transport bindings for UNIX datagram sockets" ON)
29+
option(TRANSPORT_ION_BP "Enable transport bindings for ION BP" ON)
2830
option(ARI_TEXT_PARSE "Build ARI text-form parsing capability" ON)
2931
option(ENABLE_LUT_CACHE "Enable runtime lookup caching" ON)
3032
option(REFDM_UI_CLI "Enable text UI CLI for refdm" OFF)
@@ -181,27 +183,35 @@ pkg_search_module(PCRE libpcre2-8 IMPORTED_TARGET)
181183
message(STATUS "Found PCRE version ${PCRE_VERSION}")
182184
pkg_search_module(LIBSYSTEMD libsystemd IMPORTED_TARGET)
183185
message(STATUS "Found libsystemd version ${LIBSYSTEMD_VERSION}")
184-
find_package(ION)
185186

187+
if(TRANSPORT_ION_BP)
188+
find_package(ION REQUIRED)
189+
message(STATUS "Found ION ${ION_FOUND}")
190+
endif(TRANSPORT_ION_BP)
186191
if(ARI_TEXT_PARSE)
187-
find_package(FLEX REQUIRED)
188-
find_package(BISON REQUIRED)
192+
find_package(FLEX REQUIRED)
193+
message(STATUS "Found FLEX version ${FLEX_VERSION}")
194+
find_package(BISON REQUIRED)
195+
message(STATUS "Found BISON version ${BISON_VERSION}")
189196
endif(ARI_TEXT_PARSE)
190197

191198
if(BUILD_MANAGER)
192-
# All these are optional
193-
pkg_search_module(MYSQLCLIENT mysqlclient IMPORTED_TARGET)
194-
find_package(PostgreSQL)
195-
find_package(civetweb)
196-
find_package(cJSON)
199+
# All these are optional
200+
pkg_search_module(MYSQLCLIENT mysqlclient IMPORTED_TARGET)
201+
message(STATUS "Found MySQLClient version ${MYSQLCLIENT_VERSION}")
202+
find_package(PostgreSQL)
203+
message(STATUS "Found PostgreSQL version ${PostgreSQL_VERSION}")
204+
find_package(civetweb)
205+
message(STATUS "Found civetweb version ${civetweb_VERSION}")
206+
find_package(cJSON)
197207
endif(BUILD_MANAGER)
198208

199209
add_subdirectory(src)
200210

201211
if(BUILD_TESTING)
202-
add_subdirectory(test)
212+
add_subdirectory(test)
203213
endif(BUILD_TESTING)
204214

205215
if(BUILD_DOCS_API OR BUILD_DOCS_MAN)
206-
add_subdirectory(docs)
216+
add_subdirectory(docs)
207217
endif(BUILD_DOCS_API OR BUILD_DOCS_MAN)

cmake/FindION.cmake

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Sets ION_FOUND based on finding all libraries
12
# Imports targets for using ION libraries:
23
# ION::ICI for libici
34
# ION::BP for libbp
@@ -64,6 +65,8 @@ if(LTP_HEADER AND LTP_LIB)
6465
target_link_libraries(ION::LTP INTERFACE ION::ICI)
6566
endif()
6667

67-
if (NOT ICI_HEADER OR NOT BP_HEADER OR NOT LTP_HEADER)
68+
if (ICI_HEADER AND BP_HEADER AND LTP_HEADER)
69+
set(ION_FOUND true)
70+
else()
6871
set(ION_FOUND false)
69-
endif()
72+
endif()

deps.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#
2121
# From a fresh checkout install local-sourced dependencies.
22+
# The environment DEPS_BUILD_ION being set to "0" will disable
23+
# the ION source from being built and installed.
2224
#
2325
set -e
2426

@@ -30,7 +32,7 @@ BUILDDIR=${BUILDDIR:-${SELFDIR}/deps/build}
3032
echo "Building in ${BUILDDIR}"
3133
echo "Installing to ${DESTDIR}"
3234

33-
if [ -z "false" -a ! -e ${DESTDIR}/usr/include/ion.h ]
35+
if [ "${DEPS_BUILD_ION:-1}" -ne 0 -a ! -e ${DESTDIR}/usr/include/ion.h ]
3436
then
3537
mkdir -p ${BUILDDIR}
3638
rsync --recursive ${DEPSDIR}/ion/ ${BUILDDIR}/ion/
@@ -40,9 +42,10 @@ then
4042
patch -p1 <${SELFDIR}/deps/ion-4.1.2-local-deliver.patch
4143
patch -p1 <${SELFDIR}/deps/ion-4.1.2-private-headers.patch
4244
autoreconf -vif
45+
export CFLAGS="-std=gnu99"
4346
./configure --prefix=/usr
44-
make -j$(nproc) clean
4547
make -j$(nproc)
48+
export -n CFLAGS
4649
make install DESTDIR=${DESTDIR}
4750
make -j$(nproc) clean
4851
popd
@@ -85,6 +88,7 @@ then
8588
-DCMAKE_BUILD_TYPE=Debug \
8689
-DCMAKE_INSTALL_PREFIX=${DESTDIR}${PREFIX}
8790
cmake --build ${BUILDDIR}/unity -v
91+
export -n CFLAGS
8892
cmake --install ${BUILDDIR}/unity
8993
rm -rf ${BUILDDIR}/unity
9094
popd

testenv/Dockerfile integration-test-ion/Containerfile

+64-28
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
## See the License for the specific language governing permissions and
1616
## limitations under the License.
1717
##
18-
FROM ubuntu:22.04 AS systemd-base
18+
FROM ubuntu:24.04 AS systemd-base
1919
ENV DEBIAN_FRONTEND="noninteractive"
2020

2121
# APL network configuration from
@@ -43,80 +43,116 @@ CMD [ "/sbin/init" ]
4343
# Testing utilities
4444
RUN apt-get update && apt-get install -y \
4545
net-tools iproute2 iputils-ping \
46-
lsof iftop gdb valgrind socat
46+
lsof iftop gdb valgrind xxd socat jq ruby && \
47+
gem install cbor-diag
4748

4849

49-
FROM ubuntu:22.04 AS deps-local
50+
FROM ubuntu:24.04 AS deps-local
5051

5152
RUN apt-get update && apt-get install -y \
5253
build-essential \
53-
autoconf libtool
54-
COPY deps/ion /usr/src/nm/deps/ion
54+
cmake autoconf libtool && \
55+
echo "/usr/local/lib" >/etc/ld.so.conf.d/local.conf
56+
57+
COPY deps/ion /usr/src/nm/deps/ion
5558
COPY deps/ion*.patch /usr/src/nm/deps/
5659
RUN cd /usr/src/nm/deps/ion && \
5760
patch -p1 <../ion-4.1.2-remove-nm.patch && \
5861
patch -p1 <../ion-4.1.2-local-deliver.patch && \
5962
patch -p1 <../ion-4.1.2-private-headers.patch && \
6063
autoreconf -vif && \
64+
export CFLAGS="-std=gnu99" && \
6165
./configure && \
6266
make -j$(nproc) && \
6367
make install && \
6468
make -j$(nproc) clean
6569

6670
COPY deps/QCBOR /usr/src/nm/deps/QCBOR
6771
RUN cd /usr/src/nm/deps/QCBOR && \
68-
make -j$(nproc) && \
69-
make install && \
70-
make -j$(nproc) clean
72+
cmake -S . -B build \
73+
-DCMAKE_BUILD_TYPE=Debug \
74+
-DBUILD_SHARED_LIBS=YES && \
75+
cmake --build build && \
76+
cmake --install build && \
77+
ldconfig && \
78+
rm -rf build
7179

7280
COPY deps/mlib /usr/src/nm/deps/mlib
7381
RUN cd /usr/src/nm/deps/mlib && \
7482
make -j$(nproc) && \
7583
make install && \
84+
ldconfig && \
7685
make -j$(nproc) clean
7786

87+
COPY deps/timespec /usr/src/nm/deps/timespec
88+
COPY deps/timespec-CMakeLists.txt /usr/src/nm/deps/timespec/CMakeLists.txt
89+
RUN cd /usr/src/nm/deps/timespec && \
90+
cmake -S . -B build \
91+
-DCMAKE_BUILD_TYPE=Debug && \
92+
cmake --build build && \
93+
cmake --install build && \
94+
ldconfig && \
95+
rm -rf build
96+
7897

79-
FROM systemd-base
98+
FROM systemd-base AS testenv
8099
COPY --from=deps-local /usr/local /usr/local
81100

82101
# Helper utilities
83102
RUN apt-get update && apt-get install -y \
84-
python3 python3-pip \
85-
gcc python3-dev libsystemd-dev pkg-config && \
86-
pip3 install --upgrade pip && \
87-
pip3 install systemd-python
88-
COPY --chmod=755 testenv/ion_nm_wrap.py /usr/local/bin/ion_nm_wrap
89-
COPY --chmod=755 testenv/ion_ping_peers.sh /usr/local/bin/ion_ping_peers
90-
COPY --chmod=755 testenv/service_is_running.sh /usr/local/bin/service_is_running
103+
python3 python3-pip
104+
COPY --chmod=755 systemd/service_is_running.sh /usr/local/bin/service_is_running
91105

92106
# Test tools
93107
RUN apt-get update && apt-get install -y \
94-
curl git tshark && \
95-
pip3 install git+https://github.com/NASA-AMMOS/anms-ace.git
108+
curl git tshark postgresql-client
109+
RUN pip3 install --break-system-packages git+https://github.com/JHUAPL-DTNMA/dtnma-ace.git@apl-fy24
110+
RUN git clone --branch apl-fy24 https://github.com/JHUAPL-DTNMA/dtnma-adms.git /usr/local/share/ace/adms
96111

97-
# Agent to test
112+
# REFDA and REFDM to test
98113
RUN apt-get update && apt-get install -y \
99-
cmake ninja-build ruby \
100-
flex libfl-dev bison civetweb libcivetweb-dev libssl-dev libcjson-dev
114+
cmake ninja-build ruby pkg-config \
115+
flex libfl-dev bison libpcre2-dev libpq-dev civetweb libcivetweb-dev libssl-dev libcjson-dev libsystemd-dev
101116
COPY deps /usr/src/nm/deps
102117
COPY cmake /usr/src/nm/cmake
103118
COPY src /usr/src/nm/src
104-
COPY test /usr/src/nm/test
105119
COPY CMakeLists.txt /usr/src/nm/
106120
RUN ls -lt /usr/src/nm/
107121
RUN cd /usr/src/nm && \
108122
cmake -S . -B build/default \
109123
-DCMAKE_BUILD_TYPE=Debug \
124+
-DTRANSPORT_UNIX_SOCKET=OFF \
125+
-DTRANSPORT_ION_BP=ON \
126+
-DBUILD_TESTING=OFF \
127+
-DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF \
110128
-G Ninja && \
111129
cmake --build build/default && \
112-
cmake --install build/default
130+
cmake --install build/default && \
131+
ldconfig
132+
# keep build artifacts for debuginfo
133+
134+
135+
FROM testenv AS manager
136+
137+
# Systemd services
138+
COPY integration-test-ion/tmpfiles.conf /etc/tmpfiles.d/ion.conf
139+
COPY --chmod=644 systemd/ion.service systemd/ref*-ion.service systemd/[email protected] systemd/dumpcap.service \
140+
/usr/local/lib/systemd/system/
141+
RUN systemctl enable ion bpecho@4 refdm-ion refda-ion dumpcap && \
142+
mkdir -p /var/run/ion
143+
144+
# Runtime config for this container
145+
COPY integration-test-ion/node-*.rc /etc/ion/
146+
147+
148+
FROM testenv AS agent
113149

114150
# Systemd services
115-
COPY testenv/tmpfiles.conf /etc/tmpfiles.d/ion.conf
116-
COPY --chmod=644 systemd/ion.service systemd/ion-nm-*.service systemd/[email protected] /usr/local/lib/systemd/system/
117-
RUN systemctl enable ion bpecho@4 ion-nm-mgr ion-nm-agent && \
151+
COPY integration-test-ion/tmpfiles.conf /etc/tmpfiles.d/ion.conf
152+
COPY --chmod=644 systemd/ion.service systemd/ref*-ion.service systemd/[email protected] systemd/dumpcap.service \
153+
/usr/local/lib/systemd/system/
154+
RUN systemctl enable ion bpecho@4 refda-ion dumpcap && \
118155
mkdir -p /var/run/ion
119156

120157
# Runtime config for this container
121-
COPY testenv/node-1.rc /etc/ion/
122-
COPY adms /usr/local/share/ace/adms
158+
COPY integration-test-ion/node-*.rc /etc/ion/

integration-test-ion/compose.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
volumes:
2+
postgres-data:
3+
# temporary storage
4+
5+
services:
6+
postgres:
7+
build:
8+
context: ../refdb-sql
9+
dockerfile: Containerfile
10+
hostname: postgres
11+
restart: no
12+
environment:
13+
POSTGRES_USER: ${DB_USER}
14+
POSTGRES_PASSWORD: ${DB_PASSWORD}
15+
POSTGRES_DB: ${DB_NAME}
16+
volumes:
17+
- "postgres-data:/var/lib/postgresql/data"
18+
19+
manager:
20+
hostname: manager
21+
build:
22+
context: ..
23+
dockerfile: integration-test-ion/Containerfile
24+
target: manager
25+
ports:
26+
- "8089:8089/tcp"
27+
depends_on:
28+
postgres:
29+
condition: service_healthy
30+
privileged: true
31+
tty: true
32+
cap_add:
33+
- NET_ADMIN
34+
- NET_RAW
35+
- SYS_NICE
36+
volumes:
37+
- /var/tmp/pcap:/var/log/pcap
38+
environment:
39+
container: docker
40+
DTNMA_LOGLEVEL: debug
41+
ION_NODE_NUM: 1
42+
MGR_NODE_NUM: 1
43+
DB_HOST: postgres
44+
DB_USER: ${DB_USER}
45+
DB_PASSWORD: ${DB_PASSWORD}
46+
DB_NAME: ${DB_NAME}
47+
DUMPCAP_OUTFILE: /var/log/pcap/manager.pcap
48+
DUMPCAP_OPTS: -i lo -i eth0
49+
50+
agent1:
51+
hostname: agent1
52+
build:
53+
context: ..
54+
dockerfile: integration-test-ion/Containerfile
55+
target: agent
56+
depends_on:
57+
manager:
58+
condition: service_started
59+
privileged: true
60+
tty: true
61+
cap_add:
62+
- NET_ADMIN
63+
- NET_RAW
64+
- SYS_NICE
65+
volumes:
66+
- /var/tmp/pcap:/var/log/pcap
67+
environment:
68+
container: docker
69+
DTNMA_LOGLEVEL: debug
70+
ION_NODE_NUM: 2
71+
MGR_NODE_NUM: 1
72+
DUMPCAP_OUTFILE: /var/log/pcap/agent1.pcap
73+
DUMPCAP_OPTS: -i lo -i eth0
File renamed without changes.

testenv/node-1.rc integration-test-ion/node-1.rc

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ION Configuration File for Node N1, ipn:1
1+
# ION Configuration File for Node N1, ipn:1, hostname manager
22
## begin ionadmin
33
1 1 ''
44
s
@@ -28,13 +28,15 @@ a protocol tcp 1400 100
2828
a induct udp 0.0.0.0:4556 udpcli
2929

3030
# Outducts
31-
a outduct udp localhost:4556 udpclo
31+
a outduct udp manager:4556 udpclo
32+
a outduct udp agent1:4556 udpclo
3233

3334
s
3435
## end bpadmin
3536

3637
## begin ipnadmin
37-
a plan 1 udp/localhost:4556
38+
a plan 1 udp/manager:4556
39+
a plan 2 udp/agent1:4556
3840

3941
## end ipnadmin
4042

0 commit comments

Comments
 (0)