Commit 08b636d6 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Fix CI/CD pipeline

parent cb9c8be4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ include:
  - local: '/src/ztp/.gitlab-ci.yml'
  - local: '/src/policy/.gitlab-ci.yml'
  - local: '/src/forecaster/.gitlab-ci.yml'
  - local: '/src/webui/.gitlab-ci.yml'
  #- local: '/src/webui/.gitlab-ci.yml'
  #- local: '/src/l3_distributedattackdetector/.gitlab-ci.yml'
  #- local: '/src/l3_centralizedattackdetector/.gitlab-ci.yml'
  #- local: '/src/l3_attackmitigator/.gitlab-ci.yml'
+1 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ COPY src/device/__init__.py device/__init__.py
COPY src/device/client/. device/client/
COPY src/forecaster/__init__.py forecaster/__init__.py
COPY src/forecaster/client/. forecaster/client/
COPY src/forecaster/service/. forecaster/service/
COPY src/monitoring/__init__.py monitoring/__init__.py
COPY src/monitoring/client/. monitoring/client/
COPY src/service/__init__.py service/__init__.py
+1 −4
Original line number Diff line number Diff line
@@ -17,18 +17,15 @@ import json
import requests
import uuid
from common.Constants import *
from typing import Dict, List
from typing import List
from common.proto.context_pb2 import(
    Device, DeviceId, Service, Connection, EndPointId, TopologyId, ContextId, Uuid,
    ConfigRule, ConfigActionEnum, ConfigRule_Custom
)
from common.proto.pathcomp_pb2 import PathCompReply
from typing import Dict, List, Optional, Tuple
from common.Constants import ServiceNameEnum
from common.Settings import (
    ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name
)
from context.service.database.uuids.EndPoint import endpoint_get_uuid
from service.service.tools.replies import reply_uni_txt, optical_band_uni_txt, reply_bid_txt, optical_band_bid_txt

log = logging.getLogger(__name__)
+24 −24
Original line number Diff line number Diff line
@@ -12,34 +12,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging, os, pytest
from common.Constants import ServiceNameEnum
from common.Settings import (
    ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_service_port_grpc)
from slice.client.SliceClient import SliceClient
from slice.service.SliceService import SliceService
#import logging, os, pytest
#from common.Constants import ServiceNameEnum
#from common.Settings import (
#    ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_service_port_grpc)
#from slice.client.SliceClient import SliceClient
#from slice.service.SliceService import SliceService

LOCAL_HOST = '127.0.0.1'
MOCKSERVICE_PORT = 10000
SLICE_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEnum.SLICE) # avoid privileged ports
os.environ[get_env_var_name(ServiceNameEnum.SLICE, ENVVAR_SUFIX_SERVICE_HOST     )] = str(LOCAL_HOST)
os.environ[get_env_var_name(ServiceNameEnum.SLICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(SLICE_SERVICE_PORT)
#LOCAL_HOST = '127.0.0.1'
#MOCKSERVICE_PORT = 10000
#SLICE_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEnum.SLICE) # avoid privileged ports
#os.environ[get_env_var_name(ServiceNameEnum.SLICE, ENVVAR_SUFIX_SERVICE_HOST     )] = str(LOCAL_HOST)
#os.environ[get_env_var_name(ServiceNameEnum.SLICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(SLICE_SERVICE_PORT)

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

@pytest.fixture(scope='session')
def slice_service():
    _service = SliceService()
    _service.start()
    yield _service
    _service.stop()
#@pytest.fixture(scope='session')
#def slice_service():
#    _service = SliceService()
#    _service.start()
#    yield _service
#    _service.stop()

@pytest.fixture(scope='session')
def slice_client(slice_service : SliceService): # pylint: disable=redefined-outer-name
    _client = SliceClient()
    yield _client
    _client.close()
#@pytest.fixture(scope='session')
#def slice_client(slice_service : SliceService): # pylint: disable=redefined-outer-name
#    _client = SliceClient()
#    yield _client
#    _client.close()

#def test_add_device_wrong_attributes(slice_client : SliceClient):
#    # should fail with slice uuid is empty