Loading src/tests/tools/mock_nce_fan_ctrl/Dockerfile 0 → 100644 +62 −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 RUN python3 -m pip install --upgrade setuptools wheel RUN python3 -m pip install --upgrade pip-tools # Create component sub-folders, get specific Python packages RUN mkdir -p /var/teraflow/nce_fan_ctrl/ WORKDIR /var/teraflow/nce_fan_ctrl/ COPY ./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 ./yang/. ./yang/ COPY ./nce_fan_ctrl/*.py ./nce_fan_ctrl/ COPY ./nce_fan_ctrl/simap_client/*.py ./nce_fan_ctrl/simap_client/ COPY ./startup.json ./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", "nce_fan_ctrl.app:app"] src/tests/tools/mock_nce_fan_ctrl/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # RESTCONF-based NCE-FAN Controller This server implements a basic RESTCONF Server that can load, potentially, any YANG data model. In this case, it is prepared to load a NCE-FAN Controller based on: - IETF Network Topology - IETF YANG Data Model for Transport Network Client Signals - IETF YANG Data Model for Traffic Engineering Tunnels, Label Switched Paths and Interfaces ## Build the Docker image ```bash ./build.sh ``` ## Deploy the Controller ```bash ./deploy.sh ``` ## Destroy the Controller ```bash ./destroy.sh ``` src/tests/tools/mock_nce_fan_ctrl/build.sh 0 → 100755 +22 −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. # Make folder containing the script the root folder for its execution cd $(dirname $0) # Build image for NCE-FAN Controller docker buildx build -t nce-fan-ctrl:test -f Dockerfile . #docker tag nce-fan-ctrl:test localhost:32000/tfs/nce-fan-ctrl:test #docker push localhost:32000/tfs/nce-fan-ctrl:test src/tests/tools/mock_nce_fan_ctrl/deploy.sh 0 → 100755 +27 −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. # Cleanup docker rm --force nce-fan-ctrl # Create NCE-FAN Controller docker run --detach --name nce-fan-ctrl --publish 8080:8080 nce-fan-ctrl:test sleep 2 # Dump Docker containers docker ps -a echo "Bye!" src/tests/tools/mock_nce_fan_ctrl/destroy.sh 0 → 100755 +22 −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. # Cleanup docker rm --force nce-fan-ctrl # Dump Docker containers docker ps -a echo "Bye!" Loading
src/tests/tools/mock_nce_fan_ctrl/Dockerfile 0 → 100644 +62 −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 RUN python3 -m pip install --upgrade setuptools wheel RUN python3 -m pip install --upgrade pip-tools # Create component sub-folders, get specific Python packages RUN mkdir -p /var/teraflow/nce_fan_ctrl/ WORKDIR /var/teraflow/nce_fan_ctrl/ COPY ./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 ./yang/. ./yang/ COPY ./nce_fan_ctrl/*.py ./nce_fan_ctrl/ COPY ./nce_fan_ctrl/simap_client/*.py ./nce_fan_ctrl/simap_client/ COPY ./startup.json ./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", "nce_fan_ctrl.app:app"]
src/tests/tools/mock_nce_fan_ctrl/README.md 0 → 100644 +23 −0 Original line number Diff line number Diff line # RESTCONF-based NCE-FAN Controller This server implements a basic RESTCONF Server that can load, potentially, any YANG data model. In this case, it is prepared to load a NCE-FAN Controller based on: - IETF Network Topology - IETF YANG Data Model for Transport Network Client Signals - IETF YANG Data Model for Traffic Engineering Tunnels, Label Switched Paths and Interfaces ## Build the Docker image ```bash ./build.sh ``` ## Deploy the Controller ```bash ./deploy.sh ``` ## Destroy the Controller ```bash ./destroy.sh ```
src/tests/tools/mock_nce_fan_ctrl/build.sh 0 → 100755 +22 −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. # Make folder containing the script the root folder for its execution cd $(dirname $0) # Build image for NCE-FAN Controller docker buildx build -t nce-fan-ctrl:test -f Dockerfile . #docker tag nce-fan-ctrl:test localhost:32000/tfs/nce-fan-ctrl:test #docker push localhost:32000/tfs/nce-fan-ctrl:test
src/tests/tools/mock_nce_fan_ctrl/deploy.sh 0 → 100755 +27 −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. # Cleanup docker rm --force nce-fan-ctrl # Create NCE-FAN Controller docker run --detach --name nce-fan-ctrl --publish 8080:8080 nce-fan-ctrl:test sleep 2 # Dump Docker containers docker ps -a echo "Bye!"
src/tests/tools/mock_nce_fan_ctrl/destroy.sh 0 → 100755 +22 −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. # Cleanup docker rm --force nce-fan-ctrl # Dump Docker containers docker ps -a echo "Bye!"