Commit afff124f authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Renamed TeraFlowSDN Debug-API to TFS-API

parent f9141ded
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ spec:
                name: nbiservice
                port:
                  number: 8080
          - path: /()(debug-api/.*)
          - path: /()(tfs-api/.*)
            pathType: Prefix
            backend:
              service:
+1 −1
Original line number Diff line number Diff line
@@ -22,4 +22,4 @@ RCFILE=$PROJECTDIR/coverage/.coveragerc
# Run unitary tests and analyze coverage of code at same time
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    nbi/tests/test_debug_api.py
    nbi/tests/test_tfs_api.py
+4 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ from device.service.driver_api._Driver import _Driver
from . import ALL_RESOURCE_KEYS
from .Tools import find_key, add_lightpath, del_lightpath, get_lightpaths
from device.service.driver_api._Driver import _Driver, RESOURCE_ENDPOINTS
from device.service.drivers.ietf_l2vpn.TfsDebugApiClient import TfsDebugApiClient
from device.service.drivers.ietf_l2vpn.TfsApiClient import TfsApiClient
from device.service.driver_api.ImportTopologyEnum import ImportTopologyEnum, get_import_topology

LOGGER = logging.getLogger(__name__)
@@ -40,7 +40,7 @@ class FlexScaleDriver(_Driver):
        password = self.settings.get('password')
        self.__auth = HTTPBasicAuth(username, password) if username is not None and password is not None else None
        scheme = self.settings.get('scheme', 'http')
        self.dac = TfsDebugApiClient(self.address, int(self.port), scheme=scheme, username=username, password=password)
        self.tac = TfsApiClient(self.address, int(self.port), scheme=scheme, username=username, password=password)
        self.__flexscale_root = '{:s}://{:s}:{:d}'.format(scheme, self.address, int(self.port))
        self.__timeout = int(self.settings.get('timeout', 120))

@@ -90,8 +90,8 @@ class FlexScaleDriver(_Driver):
                chk_string(str_resource_name, resource_key, allow_empty=False)

                if resource_key == RESOURCE_ENDPOINTS:
                    # return endpoints through debug-api and list-devices method
                    results.extend(self.dac.get_devices_endpoints(self.__import_topology))
                    # return endpoints through TFS NBI API and list-devices method
                    results.extend(self.tac.get_devices_endpoints(self.__import_topology))

                # results.extend(get_lightpaths(
                #     self.__flexscale_root, resource_key, timeout=self.__timeout, auth=self.__auth))
+4 −4
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ from common.tools.object_factory.EndPoint import json_endpoint_id
from common.type_checkers.Checkers import chk_string, chk_type
from device.service.driver_api._Driver import _Driver, RESOURCE_ENDPOINTS, RESOURCE_SERVICES
from device.service.driver_api.ImportTopologyEnum import ImportTopologyEnum, get_import_topology
from device.service.drivers.ietf_l2vpn.TfsDebugApiClient import TfsDebugApiClient
from device.service.drivers.ietf_l2vpn.TfsApiClient import TfsApiClient
from .Tools import connection_point, wim_mapping
from .WimconnectorIETFL2VPN import WimconnectorIETFL2VPN

@@ -56,7 +56,7 @@ class IetfL2VpnDriver(_Driver):
        wim_account = {'user': username, 'password': password}
        # Mapping updated dynamically with each request
        config = {'mapping_not_needed': False, 'service_endpoint_mapping': []}
        self.dac = TfsDebugApiClient(self.address, int(self.port), scheme=scheme, username=username, password=password)
        self.tac = TfsApiClient(self.address, int(self.port), scheme=scheme, username=username, password=password)
        self.wim = WimconnectorIETFL2VPN(wim, wim_account, config=config)
        self.conn_info = {} # internal database emulating OSM storage provided to WIM Connectors

@@ -101,8 +101,8 @@ class IetfL2VpnDriver(_Driver):
                try:
                    chk_string(str_resource_name, resource_key, allow_empty=False)
                    if resource_key == RESOURCE_ENDPOINTS:
                        # return endpoints through debug-api and list-devices method
                        results.extend(self.dac.get_devices_endpoints(self.__import_topology))
                        # return endpoints through TFS NBI API and list-devices method
                        results.extend(self.tac.get_devices_endpoints(self.__import_topology))
                    elif resource_key == RESOURCE_SERVICES:
                        # return all services through 
                        reply = self.wim.get_all_active_connectivity_services()
+3 −3
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ from requests.auth import HTTPBasicAuth
from typing import Dict, List, Optional
from device.service.driver_api.ImportTopologyEnum import ImportTopologyEnum

GET_DEVICES_URL = '{:s}://{:s}:{:d}/restconf/debug-api/devices'
GET_LINKS_URL   = '{:s}://{:s}:{:d}/restconf/debug-api/links'
GET_DEVICES_URL = '{:s}://{:s}:{:d}/tfs-api/devices'
GET_LINKS_URL   = '{:s}://{:s}:{:d}/tfs-api/links'
TIMEOUT = 30

HTTP_OK_CODES = {
@@ -51,7 +51,7 @@ MSG_ERROR = 'Could not retrieve devices in remote TeraFlowSDN instance({:s}). st

LOGGER = logging.getLogger(__name__)

class TfsDebugApiClient:
class TfsApiClient:
    def __init__(
        self, address : str, port : int, scheme : str = 'http',
        username : Optional[str] = None, password : Optional[str] = None
Loading