Skip to content
Snippets Groups Projects
Select Git revision
  • a5a3da5d69979b53dbb61ea1b52d59d0c7a80756
  • master default
  • feat/301-cttc-dscm-pluggables
  • cnit_ofc26
  • feat/344-implement-a-new-firewall-agent-controllable-through-restconf-openconfig
  • feat/343-integration-of-mimir-deployment-in-production-environment
  • ofc_polimi
  • feat/305-cttc-enhanced-netconf-openconfig-sbi-driver-for-dscm-pluggables
  • feat/306-cttc-enhanced-restconf-based-openconfig-nbi-for-dscm-pluggables
  • CTTC-IMPLEMENT-NBI-CONNECTOR-NOS-ZTP
  • CTTC-TEST-SMARTNICS-6GMICROSDN-ZTP
  • develop protected
  • feat/327-tid-new-service-to-ipowdm-controller-to-manage-transceivers-configuration-on-external-agent
  • cnit_tapi
  • feat/330-tid-pcep-component
  • feat/tid-newer-pcep-component
  • feat/116-ubi-updates-in-telemetry-backend-to-support-p4-in-band-network-telemetry
  • feat/292-cttc-implement-integration-test-for-ryu-openflow
  • cnit-p2mp-premerge
  • feat/325-tid-nbi-e2e-to-manage-e2e-path-computation
  • feat/326-tid-external-management-of-devices-telemetry-nbi
  • feat/324-tid-nbi-ietf_l3vpn-deploy-fail
  • v5.0.0 protected
  • v4.0.0 protected
  • demo-dpiab-eucnc2024
  • v3.0.0 protected
  • v2.1.0 protected
  • v2.0.0 protected
  • v1.0.0 protected
29 results

test_unitary.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_unitary.py 1.15 KiB
    import logging, pytest, sys
    
    from pathlib import Path
    sys.path.append(__file__.split('src')[0] + 'src')
    print(sys.path)
    
    from context.client.ContextClient import ContextClient
    from context.database.Factory import get_database, DatabaseEngineEnum
    from context.proto.context_pb2 import Empty
    from context.service.ContextService import ContextService
    from context.Config import SERVICE_PORT, MAX_WORKERS, GRACE_PERIOD
    from context.tests.tools.ValidateTopology import validate_topology_dict
    
    LOGGER = logging.getLogger(__name__)
    LOGGER.setLevel(logging.DEBUG)
    
    @pytest.fixture(scope='session')
    def local_context_service():
        database = get_database(engine=DatabaseEngineEnum.INMEMORY, filepath='data/topo_nsfnet.json')
        _service = ContextService(database, port=SERVICE_PORT, max_workers=MAX_WORKERS, grace_period=GRACE_PERIOD)
        _service.start()
        yield _service
        _service.stop()
    
    @pytest.fixture(scope='session')
    def local_context_client(local_context_service):
        return ContextClient(address='127.0.0.1', port=SERVICE_PORT)
    
    def test_local_get_topology(local_context_client):
        response = local_context_client.GetTopology(Empty())
        validate_topology_dict(response)