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

Tests:

- Updated according to new definition of endpoint descriptors
parent 275094b4
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -15,14 +15,18 @@
from common.proto.kpi_sample_types_pb2 import KpiSampleType
from common.tools.object_factory.ConfigRule import json_config_rule_delete, json_config_rule_set
from common.tools.object_factory.Device import (
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id)
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id,
    json_endpoint_descriptor)
from device.tests.CommonObjects import PACKET_PORT_SAMPLE_TYPES

DEVICE_EMU_UUID     = 'R1-EMU'
DEVICE_EMU_ID       = json_device_id(DEVICE_EMU_UUID)
DEVICE_EMU          = json_device_emulated_packet_router_disabled(DEVICE_EMU_UUID)
DEVICE_EMU_EP_UUIDS = ['EP1', 'EP2', 'EP3', 'EP4']
DEVICE_EMU_EP_DESCS = [(ep_uuid, '10Gbps', PACKET_PORT_SAMPLE_TYPES) for ep_uuid in DEVICE_EMU_EP_UUIDS]
DEVICE_EMU_EP_DESCS = [
    json_endpoint_descriptor(ep_uuid, '10Gbps', sample_types=PACKET_PORT_SAMPLE_TYPES)
    for ep_uuid in DEVICE_EMU_EP_UUIDS
]
DEVICE_EMU_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_EMU_EP_DESCS)

RSRC_EP       = '/endpoints/endpoint[{:s}]'
+4 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@

from common.proto.kpi_sample_types_pb2 import KpiSampleType
from common.tools.object_factory.Device import (
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled)
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_endpoint_descriptor)

PACKET_PORT_SAMPLE_TYPES = [
    KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED,
@@ -25,6 +25,8 @@ PACKET_PORT_SAMPLE_TYPES = [

DEVICE_DEV1_UUID          = 'DEV1'
ENDPOINT_END1_UUID        = 'END1'
DEVICE_DEV1_ENDPOINT_DEFS = [(ENDPOINT_END1_UUID, 'copper', PACKET_PORT_SAMPLE_TYPES)]
DEVICE_DEV1_ENDPOINT_DEFS = [
    json_endpoint_descriptor(ENDPOINT_END1_UUID, 'copper', sample_types=PACKET_PORT_SAMPLE_TYPES)
]
DEVICE_DEV1               = json_device_emulated_packet_router_disabled(DEVICE_DEV1_UUID)
DEVICE_DEV1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_DEV1_ENDPOINT_DEFS)
+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ from common.tools.object_factory.Constraint import json_constraint_sla_capacity,
from common.tools.object_factory.Context import json_context, json_context_id
from common.tools.object_factory.Device import (
    json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled,
    json_device_emulated_packet_router_disabled, json_device_id)
    json_device_emulated_packet_router_disabled, json_device_id, json_endpoint_descriptor)
from common.tools.object_factory.EndPoint import json_endpoints
from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id
from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned
@@ -29,7 +29,7 @@ ADD_CONNECT_RULES_TO_DEVICES = False

def compose_router(device_uuid, endpoint_uuids, topology_id=None):
    device_id = json_device_id(device_uuid)
    r_endpoints = [(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids]
    r_endpoints = [json_endpoint_descriptor(endpoint_uuid, 'copper') for endpoint_uuid in endpoint_uuids]
    config_rules = json_device_emulated_connect_rules(r_endpoints) if ADD_CONNECT_RULES_TO_DEVICES else []
    endpoints = json_endpoints(device_id, r_endpoints, topology_id=topology_id)
    j_endpoints = [] if ADD_CONNECT_RULES_TO_DEVICES else endpoints
@@ -38,7 +38,7 @@ def compose_router(device_uuid, endpoint_uuids, topology_id=None):

def compose_datacenter(device_uuid, endpoint_uuids, topology_id=None):
    device_id = json_device_id(device_uuid)
    r_endpoints = [(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids]
    r_endpoints = [json_endpoint_descriptor(endpoint_uuid, 'copper') for endpoint_uuid in endpoint_uuids]
    config_rules = json_device_emulated_connect_rules(r_endpoints) if ADD_CONNECT_RULES_TO_DEVICES else []
    endpoints = json_endpoints(device_id, r_endpoints, topology_id=topology_id)
    j_endpoints = [] if ADD_CONNECT_RULES_TO_DEVICES else endpoints
+5 −4
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ from common.tools.object_factory.Constraint import json_constraint_sla_capacity,
from common.tools.object_factory.Context import json_context, json_context_id
from common.tools.object_factory.Device import (
    json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled,
    json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id)
    json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled,
    json_device_id, json_endpoint_descriptor)
from common.tools.object_factory.EndPoint import json_endpoints
from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id
from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned
@@ -30,7 +31,7 @@ ADD_CONNECT_RULES_TO_DEVICES = False

def compose_router(device_uuid, endpoint_uuids, topology_id=None):
    device_id = json_device_id(device_uuid)
    r_endpoints = [(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids]
    r_endpoints = [json_endpoint_descriptor(endpoint_uuid, 'copper') for endpoint_uuid in endpoint_uuids]
    config_rules = json_device_emulated_connect_rules(r_endpoints) if ADD_CONNECT_RULES_TO_DEVICES else []
    endpoints = json_endpoints(device_id, r_endpoints, topology_id=topology_id)
    j_endpoints = [] if ADD_CONNECT_RULES_TO_DEVICES else endpoints
@@ -39,7 +40,7 @@ def compose_router(device_uuid, endpoint_uuids, topology_id=None):

def compose_ols(device_uuid, endpoint_uuids, topology_id=None):
    device_id = json_device_id(device_uuid)
    r_endpoints = [(endpoint_uuid, 'optical', []) for endpoint_uuid in endpoint_uuids]
    r_endpoints = [json_endpoint_descriptor(endpoint_uuid, 'optical') for endpoint_uuid in endpoint_uuids]
    config_rules = json_device_emulated_connect_rules(r_endpoints) if ADD_CONNECT_RULES_TO_DEVICES else []
    endpoints = json_endpoints(device_id, r_endpoints, topology_id=topology_id)
    j_endpoints = [] if ADD_CONNECT_RULES_TO_DEVICES else endpoints
@@ -48,7 +49,7 @@ def compose_ols(device_uuid, endpoint_uuids, topology_id=None):

def compose_datacenter(device_uuid, endpoint_uuids, topology_id=None):
    device_id = json_device_id(device_uuid)
    r_endpoints = [(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids]
    r_endpoints = [json_endpoint_descriptor(endpoint_uuid, 'copper') for endpoint_uuid in endpoint_uuids]
    config_rules = json_device_emulated_connect_rules(r_endpoints) if ADD_CONNECT_RULES_TO_DEVICES else []
    endpoints = json_endpoints(device_id, r_endpoints, topology_id=topology_id)
    j_endpoints = [] if ADD_CONNECT_RULES_TO_DEVICES else endpoints
+10 −10
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ from common.tools.object_factory.Location import json_location, json_gps_positio
from common.tools.object_factory.ConfigRule import json_config_rule_set
from common.tools.object_factory.Constraint import json_constraint_custom, json_constraint_endpoint_location_gps
from common.tools.object_factory.Device import (
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id)
    json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id, json_endpoint_descriptor)
from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id
from common.tools.object_factory.Link import json_link, json_link_id
from common.tools.object_factory.Service import json_service_id, json_service_l3nm_planned
@@ -54,8 +54,8 @@ ALBACETE_GPS = (38.998249, -1.858145)
# ----- Devices --------------------------------------------------------------------------------------------------------
DEVICE_R1_UUID          = 'R1'
DEVICE_R1_ENDPOINT_DEFS = [
    ('EP1', 'optical', json_location(gps_position=json_gps_position(*BARCELONA_GPS))),
    ('EP100', 'copper', json_location(gps_position=json_gps_position(*BARCELONA_GPS)))
    json_endpoint_descriptor('EP1', 'optical', location=json_location(gps_position=json_gps_position(*BARCELONA_GPS))),
    json_endpoint_descriptor('EP100', 'copper', location=json_location(gps_position=json_gps_position(*BARCELONA_GPS)))
]
DEVICE_R1_ID            = json_device_id(DEVICE_R1_UUID)
DEVICE_R1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_R1_ENDPOINT_DEFS)
@@ -67,8 +67,8 @@ ENDPOINT_ID_R1_EP100 = DEVICE_R1_ENDPOINT_IDS[1]

DEVICE_R2_UUID          = 'R2'
DEVICE_R2_ENDPOINT_DEFS = [
    ('EP1', 'optical', json_location(gps_position=json_gps_position(*MADRID_GPS))),
    ('EP100', 'copper', json_location(gps_position=json_gps_position(*MADRID_GPS)))
    json_endpoint_descriptor('EP1', 'optical', location=json_location(gps_position=json_gps_position(*MADRID_GPS))),
    json_endpoint_descriptor('EP100', 'copper', location=json_location(gps_position=json_gps_position(*MADRID_GPS)))
]
DEVICE_R2_ID            = json_device_id(DEVICE_R2_UUID)
DEVICE_R2_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_R2_ENDPOINT_DEFS)
@@ -80,8 +80,8 @@ ENDPOINT_ID_R2_EP100 = DEVICE_R2_ENDPOINT_IDS[1]

DEVICE_R3_UUID          = 'R3'
DEVICE_R3_ENDPOINT_DEFS = [
    ('EP1', 'optical', json_location(gps_position=json_gps_position(*MALAGA_GPS))),
    ('EP100', 'copper', json_location(gps_position=json_gps_position(*MALAGA_GPS)))
    json_endpoint_descriptor('EP1', 'optical', location=json_location(gps_position=json_gps_position(*MALAGA_GPS))),
    json_endpoint_descriptor('EP100', 'copper', location=json_location(gps_position=json_gps_position(*MALAGA_GPS)))
]
DEVICE_R3_ID            = json_device_id(DEVICE_R3_UUID)
DEVICE_R2_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_R2_ENDPOINT_DEFS)
@@ -93,9 +93,9 @@ ENDPOINT_ID_R3_EP100 = DEVICE_R3_ENDPOINT_IDS[1]

DEVICE_O1_UUID          = 'O1'
DEVICE_O1_ENDPOINT_DEFS = [
    ('EP1', 'optical', json_location(gps_position=json_gps_position(*PONFERRADA_GPS))),
    ('EP2', 'optical', json_location(gps_position=json_gps_position(*PONFERRADA_GPS))),
    ('EP3', 'optical', json_location(gps_position=json_gps_position(*PONFERRADA_GPS)))
    json_endpoint_descriptor('EP1', 'optical', location=json_location(gps_position=json_gps_position(*PONFERRADA_GPS))),
    json_endpoint_descriptor('EP2', 'optical', location=json_location(gps_position=json_gps_position(*PONFERRADA_GPS))),
    json_endpoint_descriptor('EP3', 'optical', location=json_location(gps_position=json_gps_position(*PONFERRADA_GPS)))
]
DEVICE_O1_ID            = json_device_id(DEVICE_O1_UUID)
DEVICE_O1_CONNECT_RULES = json_device_emulated_connect_rules(DEVICE_O1_ENDPOINT_DEFS)
Loading