Loading src/tests/tools/mock_qkd_node_ng/Dockerfile 0 → 100644 +66 −0 Original line number Diff line number Diff line # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. FROM python:3.9-slim # Install dependencies RUN apt-get --yes --quiet --quiet update && \ apt-get --yes --quiet --quiet install git build-essential cmake libpcre2-dev python3-dev python3-cffi && \ rm -rf /var/lib/apt/lists/* # Download, build and install libyang. Note that APT package is outdated # - Ref: https://github.com/CESNET/libyang # - Ref: https://github.com/CESNET/libyang-python/ RUN mkdir -p /var/libyang RUN git clone https://github.com/CESNET/libyang.git /var/libyang WORKDIR /var/libyang RUN git fetch RUN git checkout v2.1.148 RUN mkdir -p /var/libyang/build WORKDIR /var/libyang/build RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. RUN make RUN make install RUN ldconfig # Set Python to show logs as they occur ENV PYTHONUNBUFFERED=0 # Get generic Python packages RUN python3 -m pip install --upgrade 'pip==25.2' RUN python3 -m pip install --upgrade 'setuptools==79.0.0' 'wheel==0.45.1' RUN python3 -m pip install --upgrade 'pip-tools==7.3.0' # Create component sub-folders, get specific Python packages RUN mkdir -p /var/teraflow/mock_qkd_node_ng/ WORKDIR /var/teraflow/mock_qkd_node_ng/ COPY src/common/tools/rest_conf/server/requirements.in ./requirements.in RUN pip-compile --quiet --output-file=requirements.txt requirements.in RUN python3 -m pip install -r requirements.txt # Add component files into working directory COPY src/common/tools/rest_conf/server/restconf_server/ ./mock_qkd_node_ng/ COPY src/tests/tools/mock_qkd_node_ng/yang/*.yang ./yang/ COPY src/tests/tools/mock_qkd_node_ng/startup.json ./startup.json # Configure RESTCONF Server ENV RESTCONF_PREFIX="/restconf" ENV YANG_SEARCH_PATH="./yang" ENV STARTUP_FILE="./startup.json" # Configure Flask for production ENV FLASK_ENV="production" # Start the service ENTRYPOINT ["gunicorn", "--workers", "1", "--worker-class", "eventlet", "--bind", "0.0.0.0:8080", "mock_qkd_node_ng.app:app"] src/tests/tools/mock_qkd_node_ng/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Mock QKD Node (NG) This mock provides a RESTCONF-based ETSI GS QKD 015 SD-QKD node controller using the built-in RESTCONF server. ## Build the Mock QKD Node (NG) Docker image ```bash ./build.sh ``` ## Run the Mock QKD Node (NG) container ```bash ./deploy.sh ``` ## Run tests ```bash ./tests.sh ``` ## Destroy the Mock QKD Node (NG) container ```bash ./destroy.sh ``` src/tests/tools/mock_qkd_node_ng/TODO.md 0 → 100644 +12 −0 Original line number Diff line number Diff line validate list-only payload works properly as per RESTCONF codex resume 019cc982-892b-7c41-bdb1-654ebc64cec6 commands: curl -X PUT -d '{"qkd_link": [{"qkdl_id": "0bb70282-bf74-400e-9b57-03fb5990a6e0", "qkdl_type": "etsi-qkd-node-types:PHYS"}]}' http://172.254.250.101:8080/restconf/data/etsi-qkd-sdn-node:qkd_node/qkd_links/qkd_link curl -o qkd1.json http://172.254.250.101:8080/restconf/data/etsi-qkd-sdn-node: curl -o qkd2.json http://172.254.250.102:8080/restconf/data/etsi-qkd-sdn-node: curl -o qkd3.json http://172.254.250.103:8080/restconf/data/etsi-qkd-sdn-node: src/tests/tools/mock_qkd_node_ng/__init__.py 0 → 100644 +13 −0 Original line number Diff line number Diff line # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. src/tests/tools/mock_qkd_node_ng/build.sh 0 → 100755 +23 −0 Original line number Diff line number Diff line #!/bin/bash # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e # Make repo root folder the root folder for its execution cd $(dirname $0)/../../../../ docker buildx build -t mock-qkd-node-ng:test -f ./src/tests/tools/mock_qkd_node_ng/Dockerfile . #docker tag mock-qkd-node-ng:test localhost:32000/tfs/mock-qkd-node-ng:test #docker push localhost:32000/tfs/mock-qkd-node-ng:test Loading
src/tests/tools/mock_qkd_node_ng/Dockerfile 0 → 100644 +66 −0 Original line number Diff line number Diff line # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. FROM python:3.9-slim # Install dependencies RUN apt-get --yes --quiet --quiet update && \ apt-get --yes --quiet --quiet install git build-essential cmake libpcre2-dev python3-dev python3-cffi && \ rm -rf /var/lib/apt/lists/* # Download, build and install libyang. Note that APT package is outdated # - Ref: https://github.com/CESNET/libyang # - Ref: https://github.com/CESNET/libyang-python/ RUN mkdir -p /var/libyang RUN git clone https://github.com/CESNET/libyang.git /var/libyang WORKDIR /var/libyang RUN git fetch RUN git checkout v2.1.148 RUN mkdir -p /var/libyang/build WORKDIR /var/libyang/build RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. RUN make RUN make install RUN ldconfig # Set Python to show logs as they occur ENV PYTHONUNBUFFERED=0 # Get generic Python packages RUN python3 -m pip install --upgrade 'pip==25.2' RUN python3 -m pip install --upgrade 'setuptools==79.0.0' 'wheel==0.45.1' RUN python3 -m pip install --upgrade 'pip-tools==7.3.0' # Create component sub-folders, get specific Python packages RUN mkdir -p /var/teraflow/mock_qkd_node_ng/ WORKDIR /var/teraflow/mock_qkd_node_ng/ COPY src/common/tools/rest_conf/server/requirements.in ./requirements.in RUN pip-compile --quiet --output-file=requirements.txt requirements.in RUN python3 -m pip install -r requirements.txt # Add component files into working directory COPY src/common/tools/rest_conf/server/restconf_server/ ./mock_qkd_node_ng/ COPY src/tests/tools/mock_qkd_node_ng/yang/*.yang ./yang/ COPY src/tests/tools/mock_qkd_node_ng/startup.json ./startup.json # Configure RESTCONF Server ENV RESTCONF_PREFIX="/restconf" ENV YANG_SEARCH_PATH="./yang" ENV STARTUP_FILE="./startup.json" # Configure Flask for production ENV FLASK_ENV="production" # Start the service ENTRYPOINT ["gunicorn", "--workers", "1", "--worker-class", "eventlet", "--bind", "0.0.0.0:8080", "mock_qkd_node_ng.app:app"]
src/tests/tools/mock_qkd_node_ng/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # Mock QKD Node (NG) This mock provides a RESTCONF-based ETSI GS QKD 015 SD-QKD node controller using the built-in RESTCONF server. ## Build the Mock QKD Node (NG) Docker image ```bash ./build.sh ``` ## Run the Mock QKD Node (NG) container ```bash ./deploy.sh ``` ## Run tests ```bash ./tests.sh ``` ## Destroy the Mock QKD Node (NG) container ```bash ./destroy.sh ```
src/tests/tools/mock_qkd_node_ng/TODO.md 0 → 100644 +12 −0 Original line number Diff line number Diff line validate list-only payload works properly as per RESTCONF codex resume 019cc982-892b-7c41-bdb1-654ebc64cec6 commands: curl -X PUT -d '{"qkd_link": [{"qkdl_id": "0bb70282-bf74-400e-9b57-03fb5990a6e0", "qkdl_type": "etsi-qkd-node-types:PHYS"}]}' http://172.254.250.101:8080/restconf/data/etsi-qkd-sdn-node:qkd_node/qkd_links/qkd_link curl -o qkd1.json http://172.254.250.101:8080/restconf/data/etsi-qkd-sdn-node: curl -o qkd2.json http://172.254.250.102:8080/restconf/data/etsi-qkd-sdn-node: curl -o qkd3.json http://172.254.250.103:8080/restconf/data/etsi-qkd-sdn-node:
src/tests/tools/mock_qkd_node_ng/__init__.py 0 → 100644 +13 −0 Original line number Diff line number Diff line # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
src/tests/tools/mock_qkd_node_ng/build.sh 0 → 100755 +23 −0 Original line number Diff line number Diff line #!/bin/bash # Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -e # Make repo root folder the root folder for its execution cd $(dirname $0)/../../../../ docker buildx build -t mock-qkd-node-ng:test -f ./src/tests/tools/mock_qkd_node_ng/Dockerfile . #docker tag mock-qkd-node-ng:test localhost:32000/tfs/mock-qkd-node-ng:test #docker push localhost:32000/tfs/mock-qkd-node-ng:test