Commit 4f5ad661 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent 1ec240fd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ spec:
            - name: ALLOW_EXPLICIT_ADD_LINK_TO_TOPOLOGY
              value: "FALSE"
            - name: CRDB_DATABASE
              value: "tfs_ip_context"
              value: "tfs_context"
          envFrom:
            - secretRef:
                name: crdb-data
+2 −4
Original line number Diff line number Diff line


#!/bin/bash
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
@@ -20,11 +18,11 @@ PROJECTDIR=`pwd`
cd $PROJECTDIR/src

# test DSCM NBI functions
/home/ubuntu/dscm/bin/python -m pytest --log-level=INFO --log-cli-level=INFO --verbose \
python3 -m pytest --log-level=INFO --log-cli-level=INFO --verbose \
    nbi/tests/test_dscm_restconf.py::test_post_get_delete_leaf_optical_channel_frequency

# # test JSON to Proto conversion functions
# /home/ubuntu/dscm/bin/python -m pytest --log-level=INFO --log-cli-level=INFO --verbose \
# python3 -m pytest --log-level=INFO --log-cli-level=INFO --verbose \
#     nbi/tests/test_json_to_proto.py::test_create_pluggable_request_hub_format \
#     nbi/tests/test_json_to_proto.py::test_create_pluggable_request_leaf_format \
#     nbi/tests/test_json_to_proto.py::test_configure_pluggable_request_hub_format \
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ jsonschema==4.4.0 # 3.2.0 is incompatible
kafka-python==2.0.6
libyang==2.8.4
netaddr==0.9.0
netconf-console2==3.0.1
pyang==2.6.0
pydantic==2.6.3
python-socketio==5.12.1
+0 −60
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 nbi.service.rest_server import RestServer
from typing import  Dict
from urllib.parse import quote
import pytest, time, logging, os
import requests
from .DSCM_MockWebServer import nbi_service_rest, mock_service
import json

LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)

# Test configuration
# BASE_URL = "http://192.168.202.254:80/restconf/data/"
BASE_URL = "http://127.0.0.1:18080/restconf/data"

PATH = "/ietf-l3vpn-svc:l3vpn-svc/vpn-services"


@pytest.fixture(autouse=True)
def log_each(request):
    LOGGER.info(f">>>>>> START {request.node.name} >>>>>>")
    yield
    LOGGER.info(f"<<<<<< END   {request.node.name} <<<<<<")

def test_post_service(nbi_service_rest: RestServer):

    # service_file = 'descriptors/pablo_request.json'
    service_file = 'nbi/tests/ietf_l3vpn_req_my_topology.json'
    # service_file = 'descriptors/ietf_l3vpn_req_my_topology.json'

    with open(service_file, 'r') as file:
        json_data = json.load(file)
    headers = {
                'Content-Type': 'application/json',
                'Accept': 'application/json'
            }

    URL = f"{BASE_URL}{PATH}"
    LOGGER.info(f"POST {URL}")
    LOGGER.info("--------------")
    response = requests.post(URL, headers=headers, json=json_data)
    time.sleep(10)
    LOGGER.info(response.status_code)
    LOGGER.info("--------------")
    LOGGER.info(response.text)