Commit 76a5da98 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

End-to-end test - EUCNC24:

- Code Cleanup
parent 8f09b0e5
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -15,29 +15,22 @@
import pytest
from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient
from monitoring.client.MonitoringClient import MonitoringClient
from service.client.ServiceClient import ServiceClient

@pytest.fixture(scope='session')
def context_client():
def context_client() -> ContextClient:
    _client = ContextClient()
    yield _client
    _client.close()

@pytest.fixture(scope='session')
def device_client():
def device_client() -> DeviceClient:
    _client = DeviceClient()
    yield _client
    _client.close()

@pytest.fixture(scope='session')
def monitoring_client():
    _client = MonitoringClient()
    yield _client
    _client.close()

@pytest.fixture(scope='session')
def service_client():
def service_client() -> ServiceClient:
    _client = ServiceClient()
    yield _client
    _client.close()
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
# limitations under the License.

import json, logging, os
from typing import Dict
from common.Constants import DEFAULT_CONTEXT_NAME
from common.proto.context_pb2 import ContextId, ServiceStatusEnum, ServiceTypeEnum
from common.tools.grpc.Tools import grpc_message_to_json_string
+8 −4
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
# limitations under the License.

import logging, os
from typing import Dict, Set, Tuple
from typing import Set
from common.Constants import DEFAULT_CONTEXT_NAME
from common.proto.context_pb2 import ContextId, ServiceStatusEnum, ServiceTypeEnum
from common.tools.grpc.Tools import grpc_message_to_json_string
@@ -41,12 +41,16 @@ def test_service_ietf_removal(

    # Check there are no slices
    response = context_client.ListSlices(ADMIN_CONTEXT_ID)
    LOGGER.warning('Slices[{:d}] = {:s}'.format(len(response.slices), grpc_message_to_json_string(response)))
    LOGGER.warning('Slices[{:d}] = {:s}'.format(
        len(response.slices), grpc_message_to_json_string(response)
    ))
    assert len(response.slices) == 0

    # Check there is 1 service
    response = context_client.ListServices(ADMIN_CONTEXT_ID)
    LOGGER.warning('Services[{:d}] = {:s}'.format(len(response.services), grpc_message_to_json_string(response)))
    LOGGER.warning('Services[{:d}] = {:s}'.format(
        len(response.services), grpc_message_to_json_string(response)
    ))
    assert len(response.services) == 1

    service_uuids : Set[str] = set()
@@ -66,7 +70,7 @@ def test_service_ietf_removal(

    # Identify service to delete
    assert len(service_uuids) == 1
    service_uuid = set(service_uuids).pop()
    service_uuid = service_uuids.pop()

    URL = '/restconf/data/ietf-l3vpn-svc:l3vpn-svc/vpn-services/vpn-service={:s}/'.format(service_uuid)
    do_rest_delete_request(URL, logger=LOGGER, expected_status_codes={204})