######################
# Internal structure #
######################

Note (1): for containers like topologies, devices, links, services, etc. two containers are defined:
list    List is a sorted list containing the uuid's of th elements belonging to the parent element. It is used to
        define the order of the elements and enable to iterate them deterministically.

set     Set is an unordered set containing the uuid's of the elements belonging to the parent element. It is used to
        check existence of elements within the parent in O(1).


Context structure
-----------------
context[<context_uuid>]/lock
    String containing the mutex owner key of that user/process/thread that is currently managing the context.
    Example:
        context[ctx-test]/lock
            dc56647a-9539-446e-9a61-cbc67de328e4

context[<context_uuid>]/topologies_<container>
    Containers (see Note 1) with the topology_uuid's belonging to the context.
    Examples:
        context[ctx-test]/topologies_list
            ['base-topo', 'other-topo']
        context[ctx-test]/topologies_set
            {'base-topo', 'other-topo'}

context[<context_uuid>]/services_<container>
    Containers (see Note 1) with the service_uuid's belonging to the context.
    Examples:
        context[ctx-test]/service_list
            ['service-1', 'service-2']
        context[ctx-test]/service_set
            {'service-1', 'service-2'}


Topology structure:
-------------------
context[<context_uuid>]/topology[<topology_uuid>]
    Hash set containing the attributes for the topology.
    NOTE: Currently not used.
    Example: <none>

context[<context_uuid>]/topology[<topology_uuid>]/devices_<container>
    Containers (see Note 1) with the device_uuid's belonging to the topology.
    Examples:
        context[ctx-test]/topology[base-topo]/device_list
            ['dev1', 'dev2', 'dev3', 'dev4']
        context[ctx-test]/topology[base-topo]/device_set
            {'dev2', 'dev3', 'dev4', 'dev1'}

context[<context_uuid>]/topology[<topology_uuid>]/links_<container>
    Containers (see Note 1) with the link_uuid's belonging to the topology.
    Examples:
        context[ctx-test]/topology[base-topo]/link_list
            ['dev1/to-dev2 ==> dev2/to-dev1', 'dev1/to-dev3 ==> dev3/to-dev1', 'dev2/to-dev1 ==> dev1/to-dev2', ...]
        context[ctx-test]/topology[base-topo]/link_set
            {'dev2/to-dev1 ==> dev1/to-dev2', 'dev1/to-dev2 ==> dev2/to-dev1', 'dev1/to-dev3 ==> dev3/to-dev1', ...}


Device structure:
-----------------
context[<context_uuid>]/topology[<topology_uuid>]/device[<device_uuid>]
    Hash set containing the attributes for the device.
    Defined attributes are:
        device_type              : string
        device_config            : string
        device_operational_status: string "0" (KEEP_STATUS) / "-1" (DISABLED) / "1" (ENABLED)
    Example: {'device_type': 'ROADM', 'device_config': '<config/>', 'device_operational_status': '1'}

context[<context_uuid>]/topology[<topology_uuid>]/device[<device_uuid>]/endpoints_<container>
    Containers (see Note 1) with the device_endpoints_uuid's belonging to the device.
    Examples:
        context[ctx-test]/topology[base-topo]/device[dev1]/endpoints_list
            ['to-dev2', 'to-dev3', 'to-dev4']
        context[ctx-test]/topology[base-topo]/device[dev1]/endpoints_set
            {'to-dev3', 'to-dev2', 'to-dev4'}


Device Endpoint structure:
--------------------------
context[<context_uuid>]/topology[<topology_uuid>]/device[<device_uuid>]/endpoint[<device_endpoint_uuid>]
    Hash set containing the attributes for the device_endpoint.
    Defined attributes are:
        port_type: string
    Example: {'port_type': 'WDM'}


Link structure:
---------------
context[<context_uuid>]/topology[<topology_uuid>]/link[<link_uuid>]
    Hash set containing the attributes for the link.
    NOTE: Currently not used.
    Example: <none>

context[<context_uuid>]/topology[<topology_uuid>]/link[<link_uuid>]/endpoints_<container>
    Containers (see Note 1) with the link_endpoint_uuid's belonging to the link.
    Examples:
        context[ctx-test]/topology[base-topo]/link[dev2/to-dev1 ==> dev1/to-dev2]/endpoints_list
            ['dev2/to-dev1', 'dev1/to-dev2']
        context[ctx-test]/topology[base-topo]/link[dev2/to-dev1 ==> dev1/to-dev2]/endpoints_set
            {'dev2/to-dev1', 'dev1/to-dev2'}


Link Endpoint structure:
------------------------
context[<context_uuid>]/topology[<topology_uuid>]/link[<link_uuid>]/endpoint[<link_endpoint_uuid>]
    Hash set containing the attributes for the link_endpoint.
    Defined attributes are:
        device_uuid: string
        endpoint_uuid: string
    Example:
        context[ctx-test]/topology[base-topo]/link[dev1/to-dev2 ==> dev2/to-dev1]/endpoint[dev1/to-dev2]
            {'device_uuid': 'dev1', 'endpoint_uuid': 'to-dev2'}


Service structure:
------------------
context[<context_uuid>]/service[<service_uuid>]
    Hash set containing the attributes for the service.
    Defined attributes are:
        service_type  : string "0" (UNKNOWN) / "1" (L3NM) / "2" (L2NM) / "3" (TAPI_CONNECTIVITY_SERVICE)
        service_config: string
        service_state : string "0" (PLANNED) / "1" (ACTIVE) / "2" (PENDING_REMOVAL)
    Example: ...

context[<context_uuid>]/service[<service_uuid>]/endpoints_<container>
    Containers (see Note 1) with the service_endpoint_uuid's belonging to the service.
    Examples:
        context[ctx-test]/service[service-1]/endpoints_list
            ['base-topo:dev2/to-dev1', 'base-topo:dev3/to-dev1']
        context[ctx-test]/service[service-1]/endpoints_set
            {'base-topo:dev2/to-dev1', 'base-topo:dev3/to-dev1'}

context[<context_uuid>]/service[<service_uuid>]/constraints_<container>
    Containers (see Note 1) with the constraint_type's belonging to the service.
    Examples:
        context[ctx-test]/service[service-1]/constraints_list
            ['latency_ms', 'hops']
        context[ctx-test]/service[service-1]/constraints_set
            {'latency_ms', 'hops'}


Service Endpoint structure:
---------------------------
context[<context_uuid>]/service[<service_uuid>]/endpoint[<service_endpoint_uuid>]
    Hash set containing the attributes for the service_endpoint.
    Defined attributes are:
        topology_uuid: string
        device_uuid: string
        endpoint_uuid: string
    Example:
        context[ctx-test]/service[service-1]/endpoint[dev2/to-dev1]
            {'topology_uuid': 'base-topo', 'device_uuid': 'dev2', 'endpoint_uuid': 'to-dev1'}

Service Constraint structure:
-----------------------------
context[<context_uuid>]/service[<service_uuid>]/constraint[<constraint_type>]
    Hash set containing the attributes for the constraint.
    Defined attributes are:
        constraint_value: string
    Example:
        context[ctx-test]/service[service-1]/constraint['latency_ms']
            {'constraint_value': '100'}
