Commit 8a2d7da7 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Tests - Tools - Mock NCE-FAN / NCE-T Controllers

- Upgraded component to use common RESTConf tools
parent 930544cc
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -45,18 +45,24 @@ 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
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 ./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
COPY src/common/tools/rest_conf/server/restconf_server/ ./nce_fan_ctrl/
COPY src/tests/tools/mock_nce_fan_ctrl/nce_fan_ctrl/*.py ./nce_fan_ctrl/
COPY src/tests/tools/mock_nce_fan_ctrl/nce_fan_ctrl/simap_client/*.py ./nce_fan_ctrl/simap_client/
COPY src/tests/tools/mock_nce_fan_ctrl/yang/. ./yang/
COPY src/tests/tools/mock_nce_fan_ctrl/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
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"]
+4 −3
Original line number Diff line number Diff line
@@ -5,19 +5,20 @@ 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
- BBF App-Flow (preview)


## Build the Docker image
## Build the RESTCONF-based NCE-FAN Controller Docker image
```bash
./build.sh
```

## Deploy the Controller
## Deploy the RESTCONF-based NCE-FAN Controller
```bash
./deploy.sh
```

## Destroy the Controller
## Destroy the RESTCONF-based NCE-FAN Controller
```bash
./destroy.sh
```
+2 −2
Original line number Diff line number Diff line
@@ -14,9 +14,9 @@
# limitations under the License.

# Make folder containing the script the root folder for its execution
cd $(dirname $0)
cd $(dirname $0)/../../../../

# Build image for NCE-FAN Controller
docker buildx build -t nce-fan-ctrl:test -f Dockerfile .
docker buildx build -t nce-fan-ctrl:test -f ./src/tests/tools/mock_nce_fan_ctrl/Dockerfile .
#docker tag nce-fan-ctrl:test localhost:32000/tfs/nce-fan-ctrl:test
#docker push localhost:32000/tfs/nce-fan-ctrl:test
+6 −1
Original line number Diff line number Diff line
@@ -13,15 +13,20 @@
# 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

# Dump NCE-FAN Controller container
docker ps -a


echo "Bye!"
+3 −0
Original line number Diff line number Diff line
@@ -13,10 +13,13 @@
# 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