test(infra): port-NAT opc-plc fixture for the NAT browse tests; wire OPCUA_NAT_ENDPOINT into CI (#813)
Docker/nat/docker-compose.yml (stack /opt/otopcua-opcuaclient-nat on 10.100.0.35, project: lmxopcua label): opc-plc 2.14.10 advertising --ph=otopcua-opc-plc-nat-private.invalid on internal 50000, published on 50010, so every advertised URL is unreachable on host AND port. Deployed; NatPublishedEndpointBrowseTests 3/3 against opc.tcp://10.100.0.35:50010 (and the secure case positive once, with the fixture cert temporarily trusted). CI: integration-fixtures.sh starts a throwaway otopcua-ci-opcplc-nat (50110->50000) and exports OPCUA_NAT_ENDPOINT; v2-e2e.yml points it at the shared stack. infra/README.md, scripts/ci/README.md and the fixture README document it.
This commit is contained in:
+5
-1
@@ -14,8 +14,12 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Browser.IntegrationTests;
|
||||
/// whose internal port differs from the published one, so its GetEndpoints advertise an address this machine
|
||||
/// cannot reach:
|
||||
/// <code>
|
||||
/// # shared docker host (#813): compose in Driver.OpcUaClient.IntegrationTests/Docker/nat/
|
||||
/// ssh dohertj2@10.100.0.35 'cd /opt/otopcua-opcuaclient-nat && docker compose up -d'
|
||||
/// OPCUA_NAT_ENDPOINT=opc.tcp://10.100.0.35:50010 dotnet test --filter Fixture=opc-plc-nat
|
||||
/// # or locally / in CI (scripts/ci/integration-fixtures.sh starts the same shape as otopcua-ci-opcplc-nat):
|
||||
/// docker run -d --rm --name otopcua-806-nat --hostname otopcua-806-nat-parity -p 32781:50000 \
|
||||
/// mcr.microsoft.com/iotedge/opc-plc:2.14.10 --pn=50000 --autoaccept --ut
|
||||
/// mcr.microsoft.com/iotedge/opc-plc:2.14.10 --pn=50000 --ph=otopcua-806-nat-parity.invalid --autoaccept --ut
|
||||
/// OPCUA_NAT_ENDPOINT=opc.tcp://127.0.0.1:32781 dotnet test --filter Fixture=opc-plc-nat
|
||||
/// </code>
|
||||
/// Skipped unless <c>OPCUA_NAT_ENDPOINT</c> is set and accepts TCP. Every test first proves the premise (the
|
||||
|
||||
@@ -10,6 +10,7 @@ here since opc-plc ships pre-containerized.
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| [`docker-compose.yml`](docker-compose.yml) | Service definition for `otopcua-opc-plc` — image pin, port map, command flags. |
|
||||
| [`nat/docker-compose.yml`](nat/docker-compose.yml) | `otopcua-opc-plc-nat` — a SEPARATE stack (`/opt/otopcua-opcuaclient-nat` on the shared host): opc-plc advertising a private `.invalid` host on internal port 50000, published on 50010. For `NatPublishedEndpointBrowseTests` (`OPCUA_NAT_ENDPOINT=opc.tcp://10.100.0.35:50010`, #806/#813); see the compose file's header. |
|
||||
| (this file) | How to run it. |
|
||||
|
||||
## Install
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
# opc-plc behind a port NAT — the #806/#813 fixture for NatPublishedEndpointBrowseTests
|
||||
# (tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Browser.IntegrationTests, Fixture=opc-plc-nat).
|
||||
#
|
||||
# The point of this stack is what the server ADVERTISES, not what it simulates. opc-plc builds its
|
||||
# GetEndpoints EndpointUrl from its PLC hostname (--ph; default = the container's short hostname) + its
|
||||
# listen port, so with
|
||||
# * a private hostname that cannot resolve from any client (named explicitly via --ph: `.invalid` is
|
||||
# reserved by RFC 6761 and guaranteed never to resolve, so no resolver search domain or wildcard can make
|
||||
# the premise pass; the container `hostname:` alone would advertise the bare short name), and
|
||||
# * a published host port (50010) different from the internal listen port (50000),
|
||||
# every advertised endpoint is opc.tcp://otopcua-opc-plc-nat-private.invalid:50000/ — unreachable on BOTH host
|
||||
# and port. A client that follows the advertised URL fails DNS; one that keeps the operator-configured
|
||||
# host:port (OpcUaEndpointUrlRewriter) reaches the server. The tests assert that premise first.
|
||||
#
|
||||
# A SEPARATE stack from ../docker-compose.yml (deployed to /opt/otopcua-opcuaclient-nat, not
|
||||
# /opt/otopcua-opcuaclient) so bringing it up/down never touches the plain otopcua-opc-plc fixture.
|
||||
#
|
||||
# rsync -av tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.IntegrationTests/Docker/nat/ \
|
||||
# dohertj2@10.100.0.35:/opt/otopcua-opcuaclient-nat/
|
||||
# ssh dohertj2@10.100.0.35 'cd /opt/otopcua-opcuaclient-nat && docker compose up -d'
|
||||
# OPCUA_NAT_ENDPOINT=opc.tcp://10.100.0.35:50010 dotnet test \
|
||||
# tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Browser.IntegrationTests --filter Fixture=opc-plc-nat
|
||||
services:
|
||||
opc-plc-nat:
|
||||
image: mcr.microsoft.com/iotedge/opc-plc:2.14.10
|
||||
container_name: otopcua-opc-plc-nat
|
||||
hostname: otopcua-opc-plc-nat-private
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
project: lmxopcua
|
||||
ports:
|
||||
# published 50010 -> internal 50000: the port half of the NAT. Do NOT make these equal.
|
||||
- "50010:50000"
|
||||
command:
|
||||
- "--pn=50000"
|
||||
# --ph: the host part of every advertised EndpointUrl (and the server cert's DNS name).
|
||||
- "--ph=otopcua-opc-plc-nat-private.invalid"
|
||||
# --ut: also advertise SecurityPolicy=None (the secure policies stay advertised; the secure test uses them).
|
||||
- "--ut"
|
||||
# --aa: accept the browser's self-signed client cert. Trust in the OTHER direction (the browser trusting
|
||||
# this server's cert) is deliberately not automatic — that is what the secure test pins.
|
||||
- "--aa"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "netstat -an | grep -q ':50000.*LISTEN' || exit 1"]
|
||||
interval: 5s
|
||||
timeout: 2s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
Reference in New Issue
Block a user