diff --git a/src/context/service/database/EndPointModel.py b/src/context/service/database/EndPointModel.py
index 38b87d6f37c4e99dd3790f4d8802acd03873f77d..f1239ac124df42a74575e15d247c98b6dd2a88bb 100644
--- a/src/context/service/database/EndPointModel.py
+++ b/src/context/service/database/EndPointModel.py
@@ -1,10 +1,14 @@
 import logging
-from typing import Dict
+from typing import Dict, List
+from common.orm.Database import Database
+from common.orm.backend.Tools import key_to_str
+from common.orm.fields.EnumeratedField import EnumeratedField
 from common.orm.fields.ForeignKeyField import ForeignKeyField
 from common.orm.fields.PrimaryKeyField import PrimaryKeyField
 from common.orm.fields.StringField import StringField
 from common.orm.model.Model import Model
 from .DeviceModel import DeviceModel
+from .KpiSampleType import ORM_KpiSampleTypeEnum, grpc_to_enum__kpi_sample_type
 from .TopologyModel import TopologyModel
 
 LOGGER = logging.getLogger(__name__)
@@ -26,8 +30,34 @@ class EndPointModel(Model):
             result['topology_id'] = TopologyModel(self.database, self.topology_fk).dump_id()
         return result
 
-    def dump(self) -> Dict:
-        return {
+    def dump_kpi_sample_types(self) -> List[int]:
+        db_kpi_sample_type_pks = self.references(KpiSampleTypeModel)
+        return [KpiSampleTypeModel(self.database, pk).dump() for pk,_ in db_kpi_sample_type_pks]
+
+    def dump(   # pylint: disable=arguments-differ
+            self, include_kpi_sample_types=True
+        ) -> Dict:
+        result = {
             'endpoint_id': self.dump_id(),
             'endpoint_type': self.endpoint_type,
         }
+        if include_kpi_sample_types: result['kpi_sample_types'] = self.dump_kpi_sample_types()
+        return result
+
+class KpiSampleTypeModel(Model): # pylint: disable=abstract-method
+    pk = PrimaryKeyField()
+    endpoint_fk = ForeignKeyField(EndPointModel)
+    kpi_sample_type = EnumeratedField(ORM_KpiSampleTypeEnum, required=True)
+
+    def dump(self) -> Dict:
+        return self.kpi_sample_type.value
+
+def set_kpi_sample_types(database : Database, db_endpoint : EndPointModel, grpc_endpoint_kpi_sample_types):
+    db_endpoint_pk = db_endpoint.pk
+    for kpi_sample_type in grpc_endpoint_kpi_sample_types:
+        orm_kpi_sample_type = grpc_to_enum__kpi_sample_type(kpi_sample_type)
+        str_endpoint_kpi_sample_type_key = key_to_str([db_endpoint_pk, orm_kpi_sample_type.name])
+        db_endpoint_kpi_sample_type = KpiSampleTypeModel(database, str_endpoint_kpi_sample_type_key)
+        db_endpoint_kpi_sample_type.endpoint_fk = db_endpoint
+        db_endpoint_kpi_sample_type.kpi_sample_type = orm_kpi_sample_type
+        db_endpoint_kpi_sample_type.save()
diff --git a/src/context/service/database/KpiSampleType.py b/src/context/service/database/KpiSampleType.py
new file mode 100644
index 0000000000000000000000000000000000000000..50cbcd8a6641f1a598b2153cac840d6259462f96
--- /dev/null
+++ b/src/context/service/database/KpiSampleType.py
@@ -0,0 +1,14 @@
+import functools
+from enum import Enum
+from context.proto.kpi_sample_types_pb2 import KpiSampleType
+from .Tools import grpc_to_enum
+
+class ORM_KpiSampleTypeEnum(Enum):
+    UNKNOWN             = KpiSampleType.KPISAMPLETYPE_UNKNOWN
+    PACKETS_TRANSMITTED = KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED
+    PACKETS_RECEIVED    = KpiSampleType.KPISAMPLETYPE_PACKETS_RECEIVED
+    BYTES_TRANSMITTED   = KpiSampleType.KPISAMPLETYPE_BYTES_TRANSMITTED
+    BYTES_RECEIVED      = KpiSampleType.KPISAMPLETYPE_BYTES_RECEIVED
+
+grpc_to_enum__kpi_sample_type = functools.partial(
+    grpc_to_enum, KpiSampleType, ORM_KpiSampleTypeEnum)
diff --git a/src/context/service/grpc_server/ContextServiceServicerImpl.py b/src/context/service/grpc_server/ContextServiceServicerImpl.py
index e76c399cd4e17578a01ac7bf88cb0fc3f7017b8e..3d03babb47161cfd84fe164c2a8061b598489466 100644
--- a/src/context/service/grpc_server/ContextServiceServicerImpl.py
+++ b/src/context/service/grpc_server/ContextServiceServicerImpl.py
@@ -17,7 +17,7 @@ from context.service.database.ConstraintModel import ConstraintModel, Constraint
 from context.service.database.ContextModel import ContextModel
 from context.service.database.DeviceModel import (
     DeviceModel, DriverModel, grpc_to_enum__device_operational_status, set_drivers)
-from context.service.database.EndPointModel import EndPointModel
+from context.service.database.EndPointModel import EndPointModel, KpiSampleTypeModel, set_kpi_sample_types
 from context.service.database.Events import notify_event
 from context.service.database.LinkModel import LinkModel
 from context.service.database.RelationModels import (
@@ -279,7 +279,9 @@ class ContextServiceServicerImpl(ContextServiceServicer):
 
             result : Tuple[EndPointModel, bool] = update_or_create_object(
                 self.database, EndPointModel, str_endpoint_key, endpoint_attributes)
-            #db_endpoint, updated = result
+            db_endpoint, endpoint_updated = result
+
+            set_kpi_sample_types(self.database, db_endpoint, endpoint.kpi_sample_types)
 
         event_type = EventTypeEnum.EVENTTYPE_UPDATE if updated else EventTypeEnum.EVENTTYPE_CREATE
         dict_device_id = db_device.dump_id()
@@ -296,7 +298,10 @@ class ContextServiceServicerImpl(ContextServiceServicer):
         dict_device_id = db_device.dump_id()
 
         for db_endpoint_pk,_ in db_device.references(EndPointModel):
-            EndPointModel(self.database, db_endpoint_pk).delete()
+            db_endpoint = EndPointModel(self.database, db_endpoint_pk)
+            for db_kpi_sample_type_pk,_ in db_endpoint.references(KpiSampleTypeModel):
+                KpiSampleTypeModel(self.database, db_kpi_sample_type_pk).delete()
+            db_endpoint.delete()
 
         for db_topology_device_pk,_ in db_device.references(TopologyDeviceModel):
             TopologyDeviceModel(self.database, db_topology_device_pk).delete()
diff --git a/src/context/tests/Tools.py b/src/context/tests/Tools.py
new file mode 100644
index 0000000000000000000000000000000000000000..b4d1d8953126fb74b8ab17a71fbba3b19acba733
--- /dev/null
+++ b/src/context/tests/Tools.py
@@ -0,0 +1,27 @@
+import json
+from copy import deepcopy
+from typing import Any, Dict, Union
+from context.proto.context_pb2 import ConfigActionEnum
+
+def config_rule(action : ConfigActionEnum, resource_key : str, resource_value : Union[str, Dict[str, Any]]):
+    if not isinstance(resource_value, str): resource_value = json.dumps(resource_value, sort_keys=True)
+    return {'action': action, 'resource_key': resource_key, 'resource_value': resource_value}
+
+def config_rule_set(resource_key : str, resource_value : Union[str, Dict[str, Any]]):
+    return config_rule(ConfigActionEnum.CONFIGACTION_SET, resource_key, resource_value)
+
+def config_rule_delete(resource_key : str, resource_value : Union[str, Dict[str, Any]]):
+    return config_rule(ConfigActionEnum.CONFIGACTION_DELETE, resource_key, resource_value)
+
+def endpoint_id(device_id, endpoint_uuid, topology_id=None):
+    result = {'device_id': deepcopy(device_id), 'endpoint_uuid': {'uuid': endpoint_uuid}}
+    if topology_id is not None: result['topology_id'] = deepcopy(topology_id)
+    return result
+
+def endpoint(device_id, endpoint_uuid, endpoint_type, topology_id=None, kpi_sample_types=[]):
+    result = {
+        'endpoint_id': endpoint_id(device_id, endpoint_uuid, topology_id=topology_id),
+        'endpoint_type': endpoint_type,
+    }
+    if len(kpi_sample_types) > 0: result['kpi_sample_types'] = deepcopy(kpi_sample_types)
+    return result
diff --git a/src/context/tests/example_objects.py b/src/context/tests/example_objects.py
index 81339c04e1fe77667bd41179f3fa0813c5fc69df..61e0f4c7475539afa0502587cf50009260099258 100644
--- a/src/context/tests/example_objects.py
+++ b/src/context/tests/example_objects.py
@@ -1,21 +1,12 @@
 from copy import deepcopy
 from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
 from context.proto.context_pb2 import (
-    ConfigActionEnum, DeviceDriverEnum, DeviceOperationalStatusEnum, ServiceStatusEnum, ServiceTypeEnum)
+    DeviceDriverEnum, DeviceOperationalStatusEnum, ServiceStatusEnum, ServiceTypeEnum)
+from context.proto.kpi_sample_types_pb2 import KpiSampleType
+from .Tools import config_rule_set, endpoint, endpoint_id
 
 # Some example objects to be used by the tests
 
-# Helper methods
-def config_rule(action, resource_key, resource_value):
-    return {'action': action, 'resource_key': resource_key, 'resource_value': resource_value}
-
-def endpoint_id(topology_id, device_id, endpoint_uuid):
-    return {'topology_id': deepcopy(topology_id), 'device_id': deepcopy(device_id),
-            'endpoint_uuid': {'uuid': endpoint_uuid}}
-
-def endpoint(topology_id, device_id, endpoint_uuid, endpoint_type):
-    return {'endpoint_id': endpoint_id(topology_id, device_id, endpoint_uuid), 'endpoint_type': endpoint_type}
-
 ## use "deepcopy" to prevent propagating forced changes during tests
 CONTEXT_ID = {'context_uuid': {'uuid': DEFAULT_CONTEXT_UUID}}
 CONTEXT = {
@@ -34,22 +25,36 @@ TOPOLOGY = {
     'link_ids': [],
 }
 
+PACKET_PORT_SAMPLE_TYPES = [
+    KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED,
+    KpiSampleType.KPISAMPLETYPE_PACKETS_RECEIVED,
+    KpiSampleType.KPISAMPLETYPE_BYTES_TRANSMITTED,
+    KpiSampleType.KPISAMPLETYPE_BYTES_RECEIVED,
+]
+
+def _endpoint_id(device_id, endpoint_uuid):
+    return endpoint_id(device_id, endpoint_uuid, topology_id=TOPOLOGY_ID)
+
+def _endpoint(device_id, endpoint_uuid, endpoint_type):
+    return endpoint(
+        device_id, endpoint_uuid, endpoint_type, topology_id=TOPOLOGY_ID, kpi_sample_types=PACKET_PORT_SAMPLE_TYPES)
+
 DEVICE1_UUID = 'DEV1'
 DEVICE1_ID = {'device_uuid': {'uuid': DEVICE1_UUID}}
 DEVICE1 = {
     'device_id': deepcopy(DEVICE1_ID),
     'device_type': 'packet-router',
     'device_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value1'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value2'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value3'),
+        config_rule_set('dev/rsrc1/value', 'value1'),
+        config_rule_set('dev/rsrc2/value', 'value2'),
+        config_rule_set('dev/rsrc3/value', 'value3'),
     ]},
     'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED,
     'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4],
     'device_endpoints': [
-        endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP2', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP3', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP100', 'port-packet-10G'),
+        _endpoint(DEVICE1_ID, 'EP2',   'port-packet-100G'),
+        _endpoint(DEVICE1_ID, 'EP3',   'port-packet-100G'),
+        _endpoint(DEVICE1_ID, 'EP100', 'port-packet-10G' ),
     ],
 }
 
@@ -59,16 +64,16 @@ DEVICE2 = {
     'device_id': deepcopy(DEVICE2_ID),
     'device_type': 'packet-router',
     'device_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value4'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value5'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value6'),
+        config_rule_set('dev/rsrc1/value', 'value4'),
+        config_rule_set('dev/rsrc2/value', 'value5'),
+        config_rule_set('dev/rsrc3/value', 'value6'),
     ]},
     'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED,
     'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4],
     'device_endpoints': [
-        endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP1', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP3', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP100', 'port-packet-10G'),
+        _endpoint(DEVICE2_ID, 'EP1',   'port-packet-100G'),
+        _endpoint(DEVICE2_ID, 'EP3',   'port-packet-100G'),
+        _endpoint(DEVICE2_ID, 'EP100', 'port-packet-10G' ),
     ],
 }
 
@@ -78,16 +83,16 @@ DEVICE3 = {
     'device_id': deepcopy(DEVICE3_ID),
     'device_type': 'packet-router',
     'device_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value4'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value5'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value6'),
+        config_rule_set('dev/rsrc1/value', 'value4'),
+        config_rule_set('dev/rsrc2/value', 'value5'),
+        config_rule_set('dev/rsrc3/value', 'value6'),
     ]},
     'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED,
     'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4],
     'device_endpoints': [
-        endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP1', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP2', 'port-packet-100G'),
-        endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP100', 'port-packet-10G'),
+        _endpoint(DEVICE3_ID, 'EP1',   'port-packet-100G'),
+        _endpoint(DEVICE3_ID, 'EP2',   'port-packet-100G'),
+        _endpoint(DEVICE3_ID, 'EP100', 'port-packet-10G' ),
     ],
 }
 
@@ -96,8 +101,8 @@ LINK_DEV1_DEV2_ID = {'link_uuid': {'uuid': LINK_DEV1_DEV2_UUID}}
 LINK_DEV1_DEV2 = {
     'link_id': deepcopy(LINK_DEV1_DEV2_ID),
     'link_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP2'),
-        endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP1'),
+        _endpoint_id(DEVICE1_ID, 'EP2'),
+        _endpoint_id(DEVICE2_ID, 'EP1'),
     ]
 }
 
@@ -106,8 +111,8 @@ LINK_DEV2_DEV3_ID = {'link_uuid': {'uuid': LINK_DEV2_DEV3_UUID}}
 LINK_DEV2_DEV3 = {
     'link_id': deepcopy(LINK_DEV2_DEV3_ID),
     'link_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP3'),
-        endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP2'),
+        _endpoint_id(DEVICE2_ID, 'EP3'),
+        _endpoint_id(DEVICE3_ID, 'EP2'),
     ]
 }
 
@@ -116,8 +121,8 @@ LINK_DEV1_DEV3_ID = {'link_uuid': {'uuid': LINK_DEV1_DEV3_UUID}}
 LINK_DEV1_DEV3 = {
     'link_id': deepcopy(LINK_DEV1_DEV3_ID),
     'link_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP3'),
-        endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP1'),
+        _endpoint_id(DEVICE1_ID, 'EP3'),
+        _endpoint_id(DEVICE3_ID, 'EP1'),
     ]
 }
 
@@ -130,8 +135,8 @@ SERVICE_DEV1_DEV2 = {
     'service_id': deepcopy(SERVICE_DEV1_DEV2_ID),
     'service_type': ServiceTypeEnum.SERVICETYPE_L3NM,
     'service_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP100'),
-        endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP100'),
+        _endpoint_id(DEVICE1_ID, 'EP100'),
+        _endpoint_id(DEVICE2_ID, 'EP100'),
     ],
     'service_constraints': [
         {'constraint_type': 'latency_ms', 'constraint_value': '15.2'},
@@ -139,9 +144,9 @@ SERVICE_DEV1_DEV2 = {
     ],
     'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE},
     'service_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'),
+        config_rule_set('svc/rsrc1/value', 'value7'),
+        config_rule_set('svc/rsrc2/value', 'value8'),
+        config_rule_set('svc/rsrc3/value', 'value9'),
     ]},
 }
 
@@ -154,8 +159,8 @@ SERVICE_DEV1_DEV3 = {
     'service_id': deepcopy(SERVICE_DEV1_DEV3_ID),
     'service_type': ServiceTypeEnum.SERVICETYPE_L3NM,
     'service_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP100'),
-        endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP100'),
+        _endpoint_id(DEVICE1_ID, 'EP100'),
+        _endpoint_id(DEVICE3_ID, 'EP100'),
     ],
     'service_constraints': [
         {'constraint_type': 'latency_ms', 'constraint_value': '5.8'},
@@ -163,9 +168,9 @@ SERVICE_DEV1_DEV3 = {
     ],
     'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE},
     'service_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'),
+        config_rule_set('svc/rsrc1/value', 'value7'),
+        config_rule_set('svc/rsrc2/value', 'value8'),
+        config_rule_set('svc/rsrc3/value', 'value9'),
     ]},
 }
 
@@ -178,8 +183,8 @@ SERVICE_DEV2_DEV3 = {
     'service_id': deepcopy(SERVICE_DEV2_DEV3_ID),
     'service_type': ServiceTypeEnum.SERVICETYPE_L3NM,
     'service_endpoint_ids' : [
-        endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP100'),
-        endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP100'),
+        _endpoint_id(DEVICE2_ID, 'EP100'),
+        _endpoint_id(DEVICE3_ID, 'EP100'),
     ],
     'service_constraints': [
         {'constraint_type': 'latency_ms', 'constraint_value': '23.1'},
@@ -187,8 +192,8 @@ SERVICE_DEV2_DEV3 = {
     ],
     'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE},
     'service_config': {'config_rules': [
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'),
-        config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'),
+        config_rule_set('svc/rsrc1/value', 'value7'),
+        config_rule_set('svc/rsrc2/value', 'value8'),
+        config_rule_set('svc/rsrc3/value', 'value9'),
     ]},
 }
diff --git a/src/context/tests/test_unitary.py b/src/context/tests/test_unitary.py
index 02343f458b06808e33955e43a93bf1a7f9308b34..750fa2a311bd35d0f47e04da3e424ca9d10345f7 100644
--- a/src/context/tests/test_unitary.py
+++ b/src/context/tests/test_unitary.py
@@ -484,7 +484,7 @@ def test_grpc_device(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 25
+    assert len(db_entries) == 41
 
     # ----- Get when the object exists ---------------------------------------------------------------------------------
     response = context_client_grpc.GetDevice(DeviceId(**DEVICE1_ID))
@@ -537,7 +537,7 @@ def test_grpc_device(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 25
+    assert len(db_entries) == 41
 
     # ----- Remove the object ------------------------------------------------------------------------------------------
     context_client_grpc.RemoveDevice(DeviceId(**DEVICE1_ID))
@@ -639,7 +639,7 @@ def test_grpc_link(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 38
+    assert len(db_entries) == 69
 
     # ----- Create the object ------------------------------------------------------------------------------------------
     response = context_client_grpc.SetLink(Link(**LINK_DEV1_DEV2))
@@ -667,7 +667,7 @@ def test_grpc_link(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 48
+    assert len(db_entries) == 77
 
     # ----- Get when the object exists ---------------------------------------------------------------------------------
     response = context_client_grpc.GetLink(LinkId(**LINK_DEV1_DEV2_ID))
@@ -713,7 +713,7 @@ def test_grpc_link(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 48
+    assert len(db_entries) == 77
 
     # ----- Remove the object ------------------------------------------------------------------------------------------
     context_client_grpc.RemoveLink(LinkId(**LINK_DEV1_DEV2_ID))
@@ -827,7 +827,7 @@ def test_grpc_service(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 38
+    assert len(db_entries) == 69
 
     # ----- Create the object ------------------------------------------------------------------------------------------
     with pytest.raises(grpc.RpcError) as e:
@@ -879,7 +879,7 @@ def test_grpc_service(
     for db_entry in db_entries:
         LOGGER.info('  [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
     LOGGER.info('-----------------------------------------------------------')
-    assert len(db_entries) == 57
+    assert len(db_entries) == 86
 
     # ----- Get when the object exists ---------------------------------------------------------------------------------
     response = context_client_grpc.GetService(ServiceId(**SERVICE_DEV1_DEV2_ID))
diff --git a/src/device/.gitlab-ci.yml b/src/device/.gitlab-ci.yml
index 840c698a006a647cbdead60507a3fea86692b58c..8656e01fede917d6a6ef13d0c0cb5fac618c444c 100644
--- a/src/device/.gitlab-ci.yml
+++ b/src/device/.gitlab-ci.yml
@@ -39,7 +39,7 @@ unit test device:
     - docker run --name $IMAGE_NAME -d -p 2020:2020 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG
     - sleep 5
     - docker ps -a
-    - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary_driverapi.py $IMAGE_NAME/tests/test_unitary.py"
+    - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py"
   after_script:
     - docker rm -f $IMAGE_NAME
     - docker network rm teraflowbridge
diff --git a/src/device/service/DeviceServiceServicerImpl.py b/src/device/service/DeviceServiceServicerImpl.py
index e452d8fdd0cd8325d7167f90b072409cae2635bf..e72b4b610b8a718fcc726e38db09a7b0d8ced089 100644
--- a/src/device/service/DeviceServiceServicerImpl.py
+++ b/src/device/service/DeviceServiceServicerImpl.py
@@ -21,7 +21,7 @@ from .database.DatabaseTools import (
 from .database.DeviceModel import DeviceModel, DriverModel
 from .database.EndPointModel import EndPointModel, EndPointMonitorModel
 from .database.KpiModel import KpiModel
-from .database.KpiSampleType import ORM_KpiSampleType, grpc_to_enum__kpi_sample_type
+from .database.KpiSampleType import ORM_KpiSampleTypeEnum, grpc_to_enum__kpi_sample_type
 from .driver_api._Driver import _Driver, RESOURCE_ENDPOINTS #, RESOURCE_INTERFACES, RESOURCE_NETWORK_INSTANCES
 from .driver_api.DriverInstanceCache import DriverInstanceCache
 from .driver_api.Tools import (
@@ -352,7 +352,7 @@ class DeviceServiceServicerImpl(DeviceServiceServicer):
             endpoint_uuid = db_endpoint.endpoint_uuid
             str_endpoint_key = db_endpoint.pk
 
-            kpi_sample_type : ORM_KpiSampleType = db_kpi.kpi_sample_type
+            kpi_sample_type : ORM_KpiSampleTypeEnum = db_kpi.kpi_sample_type
             sample_type = kpi_sample_type.value
             str_endpoint_monitor_key = key_to_str([str_endpoint_key, str(sample_type)])
             db_endpoint_monitor : EndPointMonitorModel = get_object(
diff --git a/src/device/service/Tools.py b/src/device/service/Tools.py
deleted file mode 100644
index 26b5a5d90c34d7e23e52e12642178b18338891b2..0000000000000000000000000000000000000000
--- a/src/device/service/Tools.py
+++ /dev/null
@@ -1,120 +0,0 @@
-import grpc, logging
-from typing import Dict, List, Set, Tuple
-from common.Checkers import chk_options, chk_string
-from common.database.api.Database import Database
-from common.database.api.context.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID
-from common.database.api.context.topology.device.Endpoint import Endpoint
-from common.database.api.context.topology.device.OperationalStatus import OperationalStatus, \
-    operationalstatus_enum_values, to_operationalstatus_enum
-from common.exceptions.ServiceException import ServiceException
-from common.tools.service.DeviceCheckers import check_device_endpoint_exists
-from common.tools.service.EndpointIdCheckers import check_endpoint_id
-from common.tools.service.EnumCheckers import check_enum
-from common.tools.service.DeviceCheckers import check_device_exists, check_device_not_exists
-from device.proto.context_pb2 import Device, DeviceId
-
-# For each method name, define acceptable device operational statuses. Empty set means accept all.
-ACCEPTED_DEVICE_OPERATIONAL_STATUSES : Dict[str, Set[OperationalStatus]] = {
-    'AddDevice': set([OperationalStatus.ENABLED, OperationalStatus.DISABLED]),
-    'UpdateDevice': set([OperationalStatus.KEEP_STATE, OperationalStatus.ENABLED, OperationalStatus.DISABLED]),
-}
-
-def _check_device_exists(method_name : str, database : Database, device_id : str):
-    if method_name in ['AddDevice']:
-        check_device_not_exists(database, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, device_id)
-    elif method_name in ['UpdateDevice', 'DeleteDevice']:
-        check_device_exists(database, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, device_id)
-    else:                                       # pragma: no cover (test requires malforming the code)
-        msg = 'Unexpected condition [_check_device_exists(method_name={}, device_id={})]'
-        msg = msg.format(str(method_name), str(device_id))
-        raise ServiceException(grpc.StatusCode.UNIMPLEMENTED, msg)
-
-def _check_device_endpoint_exists_or_get_pointer(
-    method_name : str, database : Database, parent_name : str, device_id : str, endpoint_id : str):
-
-    if method_name in ['AddDevice']:
-        db_context = database.context(DEFAULT_CONTEXT_ID)
-        db_topology = db_context.topology(DEFAULT_TOPOLOGY_ID)
-        db_device = db_topology.device(device_id)
-        return db_device.endpoint(endpoint_id)
-    elif method_name in ['UpdateDevice', 'DeleteDevice']:
-        return check_device_endpoint_exists(
-            database, parent_name, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, device_id, endpoint_id)
-    else:                                       # pragma: no cover (test requires malforming the code)
-        msg = 'Unexpected condition [_check_device_exists(method_name={}, device_id={})]'
-        msg = msg.format(str(method_name), str(device_id))
-        raise ServiceException(grpc.StatusCode.UNIMPLEMENTED, msg)
-
-def check_device_operational_status(method_name : str, value : str) -> OperationalStatus:
-    return check_enum(
-        'OperationalStatus', method_name, value, to_operationalstatus_enum, ACCEPTED_DEVICE_OPERATIONAL_STATUSES)
-
-def check_device_request(
-    method_name : str, request : Device, database : Database, logger : logging.Logger
-    ) -> Tuple[str, str, str, OperationalStatus, List[Tuple[Endpoint, str]]]:
-
-    # ----- Parse attributes -------------------------------------------------------------------------------------------
-    try:
-        device_id     = chk_string ('device.device_id.device_id.uuid',
-                                    request.device_id.device_id.uuid,
-                                    allow_empty=False)
-        device_type   = chk_string ('device.device_type',
-                                    request.device_type,
-                                    allow_empty=False)
-        device_config = chk_string ('device.device_config.device_config',
-                                    request.device_config.device_config,
-                                    allow_empty=True)
-        device_opstat = chk_options('device.devOperationalStatus',
-                                    request.devOperationalStatus,
-                                    operationalstatus_enum_values())
-    except Exception as e:
-        logger.exception('Invalid arguments:')
-        raise ServiceException(grpc.StatusCode.INVALID_ARGUMENT, str(e))
-
-    device_opstat = check_device_operational_status(method_name, device_opstat)
-
-    # ----- Check if device exists in database -------------------------------------------------------------------------
-    _check_device_exists(method_name, database, device_id)
-
-    # ----- Parse endpoints and check if they exist in the database as device endpoints --------------------------------
-    add_topology_devices_endpoints : Dict[str, Dict[str, Set[str]]] = {}
-    db_endpoints__port_types : List[Tuple[Endpoint, str]] = []
-    for endpoint_number,endpoint in enumerate(request.endpointList):
-        parent_name = 'Endpoint(#{}) of Context({})/Topology({})/Device({})'
-        parent_name = parent_name.format(endpoint_number, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, device_id)
-
-        _, ep_device_id, ep_port_id = check_endpoint_id(
-            logger, endpoint_number, parent_name, endpoint.port_id, add_topology_devices_endpoints,
-            predefined_device_id=device_id, acceptable_device_ids=set([device_id]),
-            prevent_same_device_multiple_times=False)
-
-        try:
-            ep_port_type = chk_string('endpoint[#{}].port_type'.format(endpoint_number),
-                                      endpoint.port_type,
-                                      allow_empty=False)
-        except Exception as e:
-            logger.exception('Invalid arguments:')
-            raise ServiceException(grpc.StatusCode.INVALID_ARGUMENT, str(e))
-
-        db_endpoint = _check_device_endpoint_exists_or_get_pointer(
-            method_name, database, parent_name, ep_device_id, ep_port_id)
-        db_endpoints__port_types.append((db_endpoint, ep_port_type))
-
-    return device_id, device_type, device_config, device_opstat, db_endpoints__port_types
-
-def check_device_id_request(
-    method_name : str, request : DeviceId, database : Database, logger : logging.Logger) -> str:
-
-    # ----- Parse attributes -------------------------------------------------------------------------------------------
-    try:
-        device_id = chk_string('device_id.device_id.uuid',
-                               request.device_id.uuid,
-                               allow_empty=False)
-    except Exception as e:
-        logger.exception('Invalid arguments:')
-        raise ServiceException(grpc.StatusCode.INVALID_ARGUMENT, str(e))
-
-    # ----- Check if device exists in database ---------------------------------------------------------------------------
-    _check_device_exists(method_name, database, device_id)
-
-    return device_id
diff --git a/src/device/service/database/DatabaseTools.py b/src/device/service/database/DatabaseTools.py
index 5b43aae70af054f5d6da0bd92d9f2e59d152dc84..27a5f89a579451e9e512bc7288ca8690a25de27d 100644
--- a/src/device/service/database/DatabaseTools.py
+++ b/src/device/service/database/DatabaseTools.py
@@ -10,7 +10,7 @@ from device.service.driver_api.FilterFields import FilterFieldEnum
 from .ConfigModel import delete_all_config_rules, grpc_config_rules_to_raw, update_config
 from .ContextModel import ContextModel
 from .DeviceModel import DeviceModel, DriverModel, grpc_to_enum__device_operational_status, set_drivers
-from .EndPointModel import EndPointModel
+from .EndPointModel import EndPointModel, set_endpoint_monitors
 from .TopologyModel import TopologyModel
 
 def update_device_in_local_database(database : Database, device : Device) -> Tuple[DeviceModel, bool]:
@@ -74,7 +74,10 @@ def update_device_in_local_database(database : Database, device : Device) -> Tup
 
         result : Tuple[EndPointModel, bool] = update_or_create_object(
             database, EndPointModel, str_endpoint_key, endpoint_attributes)
-        _, db_endpoint_updated = result
+        db_endpoint, db_endpoint_updated = result
+
+        set_endpoint_monitors(database, db_endpoint, endpoint.kpi_sample_types)
+
         updated = updated or db_endpoint_updated
 
     return db_device, updated
diff --git a/src/device/service/database/EndPointModel.py b/src/device/service/database/EndPointModel.py
index da10a67e676ca990f24cc1455bf6acc0999c1cc5..7e0832c51f70cabe49cd4b19d7c23bf923bcf98e 100644
--- a/src/device/service/database/EndPointModel.py
+++ b/src/device/service/database/EndPointModel.py
@@ -1,12 +1,14 @@
 import logging
-from typing import Dict
+from typing import Dict, List
+from common.orm.Database import Database
+from common.orm.backend.Tools import key_to_str
 from common.orm.fields.EnumeratedField import EnumeratedField
 from common.orm.fields.ForeignKeyField import ForeignKeyField
 from common.orm.fields.PrimaryKeyField import PrimaryKeyField
 from common.orm.fields.StringField import StringField
 from common.orm.model.Model import Model
 from .DeviceModel import DeviceModel
-from .KpiSampleType import ORM_KpiSampleType
+from .KpiSampleType import ORM_KpiSampleTypeEnum, grpc_to_enum__kpi_sample_type
 from .TopologyModel import TopologyModel
 
 LOGGER = logging.getLogger(__name__)
@@ -29,14 +31,36 @@ class EndPointModel(Model):
             result['topology_id'] = TopologyModel(self.database, self.topology_fk).dump_id()
         return result
 
-    def dump(self) -> Dict:
-        return {
+    def dump_kpi_sample_types(self) -> List[int]:
+        db_kpi_sample_type_pks = self.references(EndPointMonitorModel)
+        return [EndPointMonitorModel(self.database, pk).dump() for pk,_ in db_kpi_sample_type_pks]
+
+    def dump(   # pylint: disable=arguments-differ
+            self, include_kpi_sample_types=True
+        ) -> Dict:
+        result = {
             'endpoint_id': self.dump_id(),
             'endpoint_type': self.endpoint_type,
         }
+        if include_kpi_sample_types: result['kpi_sample_types'] = self.dump_kpi_sample_types()
+        return result
 
-class EndPointMonitorModel(Model):
+class EndPointMonitorModel(Model): # pylint: disable=abstract-method
     pk = PrimaryKeyField()
     endpoint_fk = ForeignKeyField(EndPointModel)
-    resource_key = StringField(required=True, allow_empty=False)
-    kpi_sample_type = EnumeratedField(ORM_KpiSampleType, required=True)
+    resource_key = StringField(required=True, allow_empty=True)
+    kpi_sample_type = EnumeratedField(ORM_KpiSampleTypeEnum, required=True)
+
+    def dump(self) -> Dict:
+        return self.kpi_sample_type.value
+
+def set_endpoint_monitors(database : Database, db_endpoint : EndPointModel, grpc_endpoint_kpi_sample_types):
+    db_endpoint_pk = db_endpoint.pk
+    for kpi_sample_type in grpc_endpoint_kpi_sample_types:
+        orm_kpi_sample_type = grpc_to_enum__kpi_sample_type(kpi_sample_type)
+        str_endpoint_kpi_sample_type_key = key_to_str([db_endpoint_pk, orm_kpi_sample_type.name])
+        db_endpoint_kpi_sample_type = EndPointMonitorModel(database, str_endpoint_kpi_sample_type_key)
+        db_endpoint_kpi_sample_type.endpoint_fk = db_endpoint
+        db_endpoint_kpi_sample_type.resource_key = '' # during initialization, allow empty value
+        db_endpoint_kpi_sample_type.kpi_sample_type = orm_kpi_sample_type
+        db_endpoint_kpi_sample_type.save()
diff --git a/src/device/service/database/KpiModel.py b/src/device/service/database/KpiModel.py
index 1bed9fc7a169665eb459b295a6fc9903513e13f0..3ec78f60f233f5492d4780009e7cbf815f5e5248 100644
--- a/src/device/service/database/KpiModel.py
+++ b/src/device/service/database/KpiModel.py
@@ -8,7 +8,7 @@ from common.orm.fields.StringField import StringField
 from common.orm.model.Model import Model
 from .DeviceModel import DeviceModel
 from .EndPointModel import EndPointModel
-from .KpiSampleType import ORM_KpiSampleType
+from .KpiSampleType import ORM_KpiSampleTypeEnum
 
 LOGGER = logging.getLogger(__name__)
 
@@ -16,7 +16,7 @@ class KpiModel(Model):
     pk = PrimaryKeyField()
     kpi_uuid = StringField(required=True, allow_empty=False)
     kpi_description = StringField(required=False, allow_empty=True)
-    kpi_sample_type = EnumeratedField(ORM_KpiSampleType, required=True)
+    kpi_sample_type = EnumeratedField(ORM_KpiSampleTypeEnum, required=True)
     device_fk = ForeignKeyField(DeviceModel)
     endpoint_fk = ForeignKeyField(EndPointModel)
     sampling_duration = FloatField(min_value=0, required=True)
diff --git a/src/device/service/database/KpiSampleType.py b/src/device/service/database/KpiSampleType.py
index 397b208a57537201cc891e18159c975edf7147a9..24ac67200e85bb7fe29cf0971de020351b2b45da 100644
--- a/src/device/service/database/KpiSampleType.py
+++ b/src/device/service/database/KpiSampleType.py
@@ -3,7 +3,7 @@ from enum import Enum
 from device.proto.kpi_sample_types_pb2 import KpiSampleType
 from .Tools import grpc_to_enum
 
-class ORM_KpiSampleType(Enum):
+class ORM_KpiSampleTypeEnum(Enum):
     UNKNOWN             = KpiSampleType.KPISAMPLETYPE_UNKNOWN
     PACKETS_TRANSMITTED = KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED
     PACKETS_RECEIVED    = KpiSampleType.KPISAMPLETYPE_PACKETS_RECEIVED
@@ -11,4 +11,4 @@ class ORM_KpiSampleType(Enum):
     BYTES_RECEIVED      = KpiSampleType.KPISAMPLETYPE_BYTES_RECEIVED
 
 grpc_to_enum__kpi_sample_type = functools.partial(
-    grpc_to_enum, KpiSampleType, ORM_KpiSampleType)
+    grpc_to_enum, KpiSampleType, ORM_KpiSampleTypeEnum)
diff --git a/src/device/service/drivers/emulated/EmulatedDriver.py b/src/device/service/drivers/emulated/EmulatedDriver.py
index ae273890e29678f5fba9f3b8c84be88c65b3e142..c92554fe30bd86066e3b9e31f09412b1dd82020a 100644
--- a/src/device/service/drivers/emulated/EmulatedDriver.py
+++ b/src/device/service/drivers/emulated/EmulatedDriver.py
@@ -7,7 +7,7 @@ from apscheduler.job import Job
 from apscheduler.jobstores.memory import MemoryJobStore
 from apscheduler.schedulers.background import BackgroundScheduler
 from common.type_checkers.Checkers import chk_float, chk_length, chk_string, chk_type
-from device.service.database.KpiSampleType import ORM_KpiSampleType, grpc_to_enum__kpi_sample_type
+from device.service.database.KpiSampleType import ORM_KpiSampleTypeEnum, grpc_to_enum__kpi_sample_type
 from device.service.driver_api._Driver import (
     RESOURCE_ENDPOINTS, RESOURCE_INTERFACES, RESOURCE_NETWORK_INSTANCES,
     _Driver)
@@ -35,7 +35,7 @@ def compose_resource_endpoint(endpoint_data : Dict[str, Any]) -> Tuple[str, Any]
     sample_types = {}
     for endpoint_sample_type in endpoint_sample_types:
         try:
-            kpi_sample_type : ORM_KpiSampleType = grpc_to_enum__kpi_sample_type(endpoint_sample_type)
+            kpi_sample_type : ORM_KpiSampleTypeEnum = grpc_to_enum__kpi_sample_type(endpoint_sample_type)
         except: # pylint: disable=bare-except
             LOGGER.warning('Unknown EndpointSampleType({:s}) for Endpoint({:s}). Ignoring and continuing...'.format(
                 str(endpoint_sample_type), str(endpoint_data)))
diff --git a/src/device/service/drivers/openconfig/templates/EndPoints.py b/src/device/service/drivers/openconfig/templates/EndPoints.py
index e6dd5ac87fb49dece5c1415abbdd3fb2058c5659..a7d5c9be6ce9dd53d3b31998b4d4a269c972eb22 100644
--- a/src/device/service/drivers/openconfig/templates/EndPoints.py
+++ b/src/device/service/drivers/openconfig/templates/EndPoints.py
@@ -1,13 +1,13 @@
 import logging, lxml.etree as ET
 from typing import Any, Dict, List, Tuple
-from device.service.database.KpiSampleType import ORM_KpiSampleType
+from device.service.database.KpiSampleType import ORM_KpiSampleTypeEnum
 from .Namespace import NAMESPACES
 from .Tools import add_value_from_collection, add_value_from_tag
 
 LOGGER = logging.getLogger(__name__)
 
 XPATH_PORTS = "//ocp:components/ocp:component/ocp:state[ocp:type='PORT']/.."
-XPATH_INTERFACE_COUNTER = "//oci:interfaces/oci:interface[oci:name='{:s}']/state/counters/{:s}"
+XPATH_IFACE_COUNTER = "//oci:interfaces/oci:interface[oci:name='{:s}']/state/counters/{:s}"
 
 def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
     response = []
@@ -25,10 +25,10 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
         add_value_from_tag(endpoint, 'type', component_type)
 
         sample_types = {
-            ORM_KpiSampleType.BYTES_RECEIVED.value     : XPATH_INTERFACE_COUNTER.format(endpoint['uuid'], 'in-octets' ),
-            ORM_KpiSampleType.BYTES_TRANSMITTED.value  : XPATH_INTERFACE_COUNTER.format(endpoint['uuid'], 'out-octets'),
-            ORM_KpiSampleType.PACKETS_RECEIVED.value   : XPATH_INTERFACE_COUNTER.format(endpoint['uuid'], 'in-pkts'   ),
-            ORM_KpiSampleType.PACKETS_TRANSMITTED.value: XPATH_INTERFACE_COUNTER.format(endpoint['uuid'], 'out-pkts'  ),
+            ORM_KpiSampleTypeEnum.BYTES_RECEIVED.value     : XPATH_IFACE_COUNTER.format(endpoint['uuid'], 'in-octets' ),
+            ORM_KpiSampleTypeEnum.BYTES_TRANSMITTED.value  : XPATH_IFACE_COUNTER.format(endpoint['uuid'], 'out-octets'),
+            ORM_KpiSampleTypeEnum.PACKETS_RECEIVED.value   : XPATH_IFACE_COUNTER.format(endpoint['uuid'], 'in-pkts'   ),
+            ORM_KpiSampleTypeEnum.PACKETS_TRANSMITTED.value: XPATH_IFACE_COUNTER.format(endpoint['uuid'], 'out-pkts'  ),
         }
         add_value_from_collection(endpoint, 'sample_types', sample_types)
 
diff --git a/src/device/tests/Device_Emulated.py b/src/device/tests/Device_Emulated.py
index 7f097f1c4936a69fc530391558227ebbdfb65c0f..27595dd8afed8b2985c76338ffc88d81fc9cc2d0 100644
--- a/src/device/tests/Device_Emulated.py
+++ b/src/device/tests/Device_Emulated.py
@@ -1,7 +1,7 @@
 import operator
 from copy import deepcopy
 from device.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum
-from device.service.database.KpiSampleType import ORM_KpiSampleType
+from device.service.database.KpiSampleType import ORM_KpiSampleTypeEnum
 from .Tools import config_rule_set, config_rule_delete
 
 # use "deepcopy" to prevent propagating forced changes during tests
@@ -23,10 +23,10 @@ DEVICE_EMU = {
 }
 
 PACKET_PORT_SAMPLE_TYPES = [
-    ORM_KpiSampleType.PACKETS_TRANSMITTED,
-    ORM_KpiSampleType.PACKETS_RECEIVED,
-    ORM_KpiSampleType.BYTES_TRANSMITTED,
-    ORM_KpiSampleType.BYTES_RECEIVED,
+    ORM_KpiSampleTypeEnum.PACKETS_TRANSMITTED,
+    ORM_KpiSampleTypeEnum.PACKETS_RECEIVED,
+    ORM_KpiSampleTypeEnum.BYTES_TRANSMITTED,
+    ORM_KpiSampleTypeEnum.BYTES_RECEIVED,
 ]
 
 ENDPOINT_UUIDS = ['EP1', 'EP2', 'EP3', 'EP4']
diff --git a/src/opticalcentralizedattackdetector/proto/context_pb2.py b/src/opticalcentralizedattackdetector/proto/context_pb2.py
index 658c58897615b33a435c7004d05b0a291abf95b7..43d80f01d7ee513ff2d91abb704e9e95cf12f0b6 100644
--- a/src/opticalcentralizedattackdetector/proto/context_pb2.py
+++ b/src/opticalcentralizedattackdetector/proto/context_pb2.py
@@ -21,7 +21,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
   syntax='proto3',
   serialized_options=None,
   create_key=_descriptor._internal_create_key,
-  serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\x1a\x16kpi_sample_types.proto\"\x07\n\x05\x45mpty\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"F\n\x05\x45vent\x12\x11\n\ttimestamp\x18\x01 \x01(\x01\x12*\n\nevent_type\x18\x02 \x01(\x0e\x32\x16.context.EventTypeEnum\"0\n\tContextId\x12#\n\x0c\x63ontext_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\xb6\x01\n\x07\x43ontext\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12)\n\x0ctopology_ids\x18\x02 \x03(\x0b\x32\x13.context.TopologyId\x12\'\n\x0bservice_ids\x18\x03 \x03(\x0b\x32\x12.context.ServiceId\x12/\n\ncontroller\x18\x04 \x01(\x0b\x32\x1b.context.TeraFlowController\"8\n\rContextIdList\x12\'\n\x0b\x63ontext_ids\x18\x01 \x03(\x0b\x32\x12.context.ContextId\"1\n\x0b\x43ontextList\x12\"\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x10.context.Context\"U\n\x0c\x43ontextEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\ncontext_id\x18\x02 \x01(\x0b\x32\x12.context.ContextId\"Z\n\nTopologyId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12$\n\rtopology_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"~\n\x08Topology\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12%\n\ndevice_ids\x18\x02 \x03(\x0b\x32\x11.context.DeviceId\x12!\n\x08link_ids\x18\x03 \x03(\x0b\x32\x0f.context.LinkId\";\n\x0eTopologyIdList\x12)\n\x0ctopology_ids\x18\x01 \x03(\x0b\x32\x13.context.TopologyId\"5\n\x0cTopologyList\x12%\n\ntopologies\x18\x01 \x03(\x0b\x32\x11.context.Topology\"X\n\rTopologyEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12(\n\x0btopology_id\x18\x02 \x01(\x0b\x32\x13.context.TopologyId\".\n\x08\x44\x65viceId\x12\"\n\x0b\x64\x65vice_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x9a\x02\n\x06\x44\x65vice\x12$\n\tdevice_id\x18\x01 \x01(\x0b\x32\x11.context.DeviceId\x12\x13\n\x0b\x64\x65vice_type\x18\x02 \x01(\t\x12,\n\rdevice_config\x18\x03 \x01(\x0b\x32\x15.context.DeviceConfig\x12G\n\x19\x64\x65vice_operational_status\x18\x04 \x01(\x0e\x32$.context.DeviceOperationalStatusEnum\x12\x31\n\x0e\x64\x65vice_drivers\x18\x05 \x03(\x0e\x32\x19.context.DeviceDriverEnum\x12+\n\x10\x64\x65vice_endpoints\x18\x06 \x03(\x0b\x32\x11.context.EndPoint\"9\n\x0c\x44\x65viceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"5\n\x0c\x44\x65viceIdList\x12%\n\ndevice_ids\x18\x01 \x03(\x0b\x32\x11.context.DeviceId\".\n\nDeviceList\x12 \n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x0f.context.Device\"R\n\x0b\x44\x65viceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\"*\n\x06LinkId\x12 \n\tlink_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"X\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12.\n\x11link_endpoint_ids\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\"/\n\nLinkIdList\x12!\n\x08link_ids\x18\x01 \x03(\x0b\x32\x0f.context.LinkId\"(\n\x08LinkList\x12\x1c\n\x05links\x18\x01 \x03(\x0b\x32\r.context.Link\"L\n\tLinkEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12 \n\x07link_id\x18\x02 \x01(\x0b\x32\x0f.context.LinkId\"X\n\tServiceId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12#\n\x0cservice_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"\xa6\x02\n\x07Service\x12&\n\nservice_id\x18\x01 \x01(\x0b\x32\x12.context.ServiceId\x12.\n\x0cservice_type\x18\x02 \x01(\x0e\x32\x18.context.ServiceTypeEnum\x12\x31\n\x14service_endpoint_ids\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12\x30\n\x13service_constraints\x18\x04 \x03(\x0b\x32\x13.context.Constraint\x12.\n\x0eservice_status\x18\x05 \x01(\x0b\x32\x16.context.ServiceStatus\x12.\n\x0eservice_config\x18\x06 \x01(\x0b\x32\x16.context.ServiceConfig\"C\n\rServiceStatus\x12\x32\n\x0eservice_status\x18\x01 \x01(\x0e\x32\x1a.context.ServiceStatusEnum\":\n\rServiceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"8\n\rServiceIdList\x12\'\n\x0bservice_ids\x18\x01 \x03(\x0b\x32\x12.context.ServiceId\"1\n\x0bServiceList\x12\"\n\x08services\x18\x01 \x03(\x0b\x32\x10.context.Service\"U\n\x0cServiceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\nservice_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\"\x82\x01\n\nEndPointId\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\x12$\n\rendpoint_uuid\x18\x03 \x01(\x0b\x32\r.context.Uuid\"K\n\x08\x45ndPoint\x12(\n\x0b\x65ndpoint_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x15\n\rendpoint_type\x18\x02 \x01(\t\"\x9f\x01\n\nConfigRule\x12)\n\x06\x61\x63tion\x18\x01 \x01(\x0e\x32\x19.context.ConfigActionEnum\x12\x14\n\x0cresource_key\x18\x02 \x01(\t\x12\x16\n\x0eresource_value\x18\x03 \x01(\t\x12\x38\n\x0fkpi_sample_type\x18\x04 \x01(\x0e\x32\x1f.kpi_sample_types.KpiSampleType\"?\n\nConstraint\x12\x17\n\x0f\x63onstraint_type\x18\x01 \x01(\t\x12\x18\n\x10\x63onstraint_value\x18\x02 \x01(\t\"6\n\x0c\x43onnectionId\x12&\n\x0f\x63onnection_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x8d\x01\n\nConnection\x12,\n\rconnection_id\x18\x01 \x01(\x0b\x32\x15.context.ConnectionId\x12.\n\x12related_service_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\x12!\n\x04path\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\"A\n\x10\x43onnectionIdList\x12-\n\x0e\x63onnection_ids\x18\x01 \x03(\x0b\x32\x15.context.ConnectionId\":\n\x0e\x43onnectionList\x12(\n\x0b\x63onnections\x18\x01 \x03(\x0b\x32\x13.context.Connection\"^\n\x12TeraFlowController\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\r\"U\n\x14\x41uthenticationResult\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x15\n\rauthenticated\x18\x02 \x01(\x08*j\n\rEventTypeEnum\x12\x17\n\x13\x45VENTTYPE_UNDEFINED\x10\x00\x12\x14\n\x10\x45VENTTYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENTTYPE_UPDATE\x10\x02\x12\x14\n\x10\x45VENTTYPE_REMOVE\x10\x03*\xc5\x01\n\x10\x44\x65viceDriverEnum\x12\x1a\n\x16\x44\x45VICEDRIVER_UNDEFINED\x10\x00\x12\x1b\n\x17\x44\x45VICEDRIVER_OPENCONFIG\x10\x01\x12\x1e\n\x1a\x44\x45VICEDRIVER_TRANSPORT_API\x10\x02\x12\x13\n\x0f\x44\x45VICEDRIVER_P4\x10\x03\x12&\n\"DEVICEDRIVER_IETF_NETWORK_TOPOLOGY\x10\x04\x12\x1b\n\x17\x44\x45VICEDRIVER_ONF_TR_352\x10\x05*\x8f\x01\n\x1b\x44\x65viceOperationalStatusEnum\x12%\n!DEVICEOPERATIONALSTATUS_UNDEFINED\x10\x00\x12$\n DEVICEOPERATIONALSTATUS_DISABLED\x10\x01\x12#\n\x1f\x44\x45VICEOPERATIONALSTATUS_ENABLED\x10\x02*\x81\x01\n\x0fServiceTypeEnum\x12\x17\n\x13SERVICETYPE_UNKNOWN\x10\x00\x12\x14\n\x10SERVICETYPE_L3NM\x10\x01\x12\x14\n\x10SERVICETYPE_L2NM\x10\x02\x12)\n%SERVICETYPE_TAPI_CONNECTIVITY_SERVICE\x10\x03*\x88\x01\n\x11ServiceStatusEnum\x12\x1b\n\x17SERVICESTATUS_UNDEFINED\x10\x00\x12\x19\n\x15SERVICESTATUS_PLANNED\x10\x01\x12\x18\n\x14SERVICESTATUS_ACTIVE\x10\x02\x12!\n\x1dSERVICESTATUS_PENDING_REMOVAL\x10\x03*]\n\x10\x43onfigActionEnum\x12\x1a\n\x16\x43ONFIGACTION_UNDEFINED\x10\x00\x12\x14\n\x10\x43ONFIGACTION_SET\x10\x01\x12\x17\n\x13\x43ONFIGACTION_DELETE\x10\x02\x32\xa5\r\n\x0e\x43ontextService\x12:\n\x0eListContextIds\x12\x0e.context.Empty\x1a\x16.context.ContextIdList\"\x00\x12\x36\n\x0cListContexts\x12\x0e.context.Empty\x1a\x14.context.ContextList\"\x00\x12\x34\n\nGetContext\x12\x12.context.ContextId\x1a\x10.context.Context\"\x00\x12\x34\n\nSetContext\x12\x10.context.Context\x1a\x12.context.ContextId\"\x00\x12\x35\n\rRemoveContext\x12\x12.context.ContextId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetContextEvents\x12\x0e.context.Empty\x1a\x15.context.ContextEvent\"\x00\x30\x01\x12@\n\x0fListTopologyIds\x12\x12.context.ContextId\x1a\x17.context.TopologyIdList\"\x00\x12=\n\x0eListTopologies\x12\x12.context.ContextId\x1a\x15.context.TopologyList\"\x00\x12\x37\n\x0bGetTopology\x12\x13.context.TopologyId\x1a\x11.context.Topology\"\x00\x12\x37\n\x0bSetTopology\x12\x11.context.Topology\x1a\x13.context.TopologyId\"\x00\x12\x37\n\x0eRemoveTopology\x12\x13.context.TopologyId\x1a\x0e.context.Empty\"\x00\x12?\n\x11GetTopologyEvents\x12\x0e.context.Empty\x1a\x16.context.TopologyEvent\"\x00\x30\x01\x12\x38\n\rListDeviceIds\x12\x0e.context.Empty\x1a\x15.context.DeviceIdList\"\x00\x12\x34\n\x0bListDevices\x12\x0e.context.Empty\x1a\x13.context.DeviceList\"\x00\x12\x31\n\tGetDevice\x12\x11.context.DeviceId\x1a\x0f.context.Device\"\x00\x12\x31\n\tSetDevice\x12\x0f.context.Device\x1a\x11.context.DeviceId\"\x00\x12\x33\n\x0cRemoveDevice\x12\x11.context.DeviceId\x1a\x0e.context.Empty\"\x00\x12;\n\x0fGetDeviceEvents\x12\x0e.context.Empty\x1a\x14.context.DeviceEvent\"\x00\x30\x01\x12\x34\n\x0bListLinkIds\x12\x0e.context.Empty\x1a\x13.context.LinkIdList\"\x00\x12\x30\n\tListLinks\x12\x0e.context.Empty\x1a\x11.context.LinkList\"\x00\x12+\n\x07GetLink\x12\x0f.context.LinkId\x1a\r.context.Link\"\x00\x12+\n\x07SetLink\x12\r.context.Link\x1a\x0f.context.LinkId\"\x00\x12/\n\nRemoveLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x12\x37\n\rGetLinkEvents\x12\x0e.context.Empty\x1a\x12.context.LinkEvent\"\x00\x30\x01\x12>\n\x0eListServiceIds\x12\x12.context.ContextId\x1a\x16.context.ServiceIdList\"\x00\x12:\n\x0cListServices\x12\x12.context.ContextId\x1a\x14.context.ServiceList\"\x00\x12\x34\n\nGetService\x12\x12.context.ServiceId\x1a\x10.context.Service\"\x00\x12\x34\n\nSetService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x35\n\rRemoveService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetServiceEvents\x12\x0e.context.Empty\x1a\x15.context.ServiceEvent\"\x00\x30\x01\x62\x06proto3'
+  serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\x1a\x16kpi_sample_types.proto\"\x07\n\x05\x45mpty\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"F\n\x05\x45vent\x12\x11\n\ttimestamp\x18\x01 \x01(\x01\x12*\n\nevent_type\x18\x02 \x01(\x0e\x32\x16.context.EventTypeEnum\"0\n\tContextId\x12#\n\x0c\x63ontext_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\xb6\x01\n\x07\x43ontext\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12)\n\x0ctopology_ids\x18\x02 \x03(\x0b\x32\x13.context.TopologyId\x12\'\n\x0bservice_ids\x18\x03 \x03(\x0b\x32\x12.context.ServiceId\x12/\n\ncontroller\x18\x04 \x01(\x0b\x32\x1b.context.TeraFlowController\"8\n\rContextIdList\x12\'\n\x0b\x63ontext_ids\x18\x01 \x03(\x0b\x32\x12.context.ContextId\"1\n\x0b\x43ontextList\x12\"\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x10.context.Context\"U\n\x0c\x43ontextEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\ncontext_id\x18\x02 \x01(\x0b\x32\x12.context.ContextId\"Z\n\nTopologyId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12$\n\rtopology_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"~\n\x08Topology\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12%\n\ndevice_ids\x18\x02 \x03(\x0b\x32\x11.context.DeviceId\x12!\n\x08link_ids\x18\x03 \x03(\x0b\x32\x0f.context.LinkId\";\n\x0eTopologyIdList\x12)\n\x0ctopology_ids\x18\x01 \x03(\x0b\x32\x13.context.TopologyId\"5\n\x0cTopologyList\x12%\n\ntopologies\x18\x01 \x03(\x0b\x32\x11.context.Topology\"X\n\rTopologyEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12(\n\x0btopology_id\x18\x02 \x01(\x0b\x32\x13.context.TopologyId\".\n\x08\x44\x65viceId\x12\"\n\x0b\x64\x65vice_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x9a\x02\n\x06\x44\x65vice\x12$\n\tdevice_id\x18\x01 \x01(\x0b\x32\x11.context.DeviceId\x12\x13\n\x0b\x64\x65vice_type\x18\x02 \x01(\t\x12,\n\rdevice_config\x18\x03 \x01(\x0b\x32\x15.context.DeviceConfig\x12G\n\x19\x64\x65vice_operational_status\x18\x04 \x01(\x0e\x32$.context.DeviceOperationalStatusEnum\x12\x31\n\x0e\x64\x65vice_drivers\x18\x05 \x03(\x0e\x32\x19.context.DeviceDriverEnum\x12+\n\x10\x64\x65vice_endpoints\x18\x06 \x03(\x0b\x32\x11.context.EndPoint\"9\n\x0c\x44\x65viceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"5\n\x0c\x44\x65viceIdList\x12%\n\ndevice_ids\x18\x01 \x03(\x0b\x32\x11.context.DeviceId\".\n\nDeviceList\x12 \n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x0f.context.Device\"R\n\x0b\x44\x65viceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\"*\n\x06LinkId\x12 \n\tlink_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"X\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12.\n\x11link_endpoint_ids\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\"/\n\nLinkIdList\x12!\n\x08link_ids\x18\x01 \x03(\x0b\x32\x0f.context.LinkId\"(\n\x08LinkList\x12\x1c\n\x05links\x18\x01 \x03(\x0b\x32\r.context.Link\"L\n\tLinkEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12 \n\x07link_id\x18\x02 \x01(\x0b\x32\x0f.context.LinkId\"X\n\tServiceId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12#\n\x0cservice_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"\xa6\x02\n\x07Service\x12&\n\nservice_id\x18\x01 \x01(\x0b\x32\x12.context.ServiceId\x12.\n\x0cservice_type\x18\x02 \x01(\x0e\x32\x18.context.ServiceTypeEnum\x12\x31\n\x14service_endpoint_ids\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12\x30\n\x13service_constraints\x18\x04 \x03(\x0b\x32\x13.context.Constraint\x12.\n\x0eservice_status\x18\x05 \x01(\x0b\x32\x16.context.ServiceStatus\x12.\n\x0eservice_config\x18\x06 \x01(\x0b\x32\x16.context.ServiceConfig\"C\n\rServiceStatus\x12\x32\n\x0eservice_status\x18\x01 \x01(\x0e\x32\x1a.context.ServiceStatusEnum\":\n\rServiceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"8\n\rServiceIdList\x12\'\n\x0bservice_ids\x18\x01 \x03(\x0b\x32\x12.context.ServiceId\"1\n\x0bServiceList\x12\"\n\x08services\x18\x01 \x03(\x0b\x32\x10.context.Service\"U\n\x0cServiceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\nservice_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\"\x82\x01\n\nEndPointId\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\x12$\n\rendpoint_uuid\x18\x03 \x01(\x0b\x32\r.context.Uuid\"\x86\x01\n\x08\x45ndPoint\x12(\n\x0b\x65ndpoint_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x15\n\rendpoint_type\x18\x02 \x01(\t\x12\x39\n\x10kpi_sample_types\x18\x03 \x03(\x0e\x32\x1f.kpi_sample_types.KpiSampleType\"e\n\nConfigRule\x12)\n\x06\x61\x63tion\x18\x01 \x01(\x0e\x32\x19.context.ConfigActionEnum\x12\x14\n\x0cresource_key\x18\x02 \x01(\t\x12\x16\n\x0eresource_value\x18\x03 \x01(\t\"?\n\nConstraint\x12\x17\n\x0f\x63onstraint_type\x18\x01 \x01(\t\x12\x18\n\x10\x63onstraint_value\x18\x02 \x01(\t\"6\n\x0c\x43onnectionId\x12&\n\x0f\x63onnection_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x8d\x01\n\nConnection\x12,\n\rconnection_id\x18\x01 \x01(\x0b\x32\x15.context.ConnectionId\x12.\n\x12related_service_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\x12!\n\x04path\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\"A\n\x10\x43onnectionIdList\x12-\n\x0e\x63onnection_ids\x18\x01 \x03(\x0b\x32\x15.context.ConnectionId\":\n\x0e\x43onnectionList\x12(\n\x0b\x63onnections\x18\x01 \x03(\x0b\x32\x13.context.Connection\"^\n\x12TeraFlowController\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\r\"U\n\x14\x41uthenticationResult\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x15\n\rauthenticated\x18\x02 \x01(\x08*j\n\rEventTypeEnum\x12\x17\n\x13\x45VENTTYPE_UNDEFINED\x10\x00\x12\x14\n\x10\x45VENTTYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENTTYPE_UPDATE\x10\x02\x12\x14\n\x10\x45VENTTYPE_REMOVE\x10\x03*\xc5\x01\n\x10\x44\x65viceDriverEnum\x12\x1a\n\x16\x44\x45VICEDRIVER_UNDEFINED\x10\x00\x12\x1b\n\x17\x44\x45VICEDRIVER_OPENCONFIG\x10\x01\x12\x1e\n\x1a\x44\x45VICEDRIVER_TRANSPORT_API\x10\x02\x12\x13\n\x0f\x44\x45VICEDRIVER_P4\x10\x03\x12&\n\"DEVICEDRIVER_IETF_NETWORK_TOPOLOGY\x10\x04\x12\x1b\n\x17\x44\x45VICEDRIVER_ONF_TR_352\x10\x05*\x8f\x01\n\x1b\x44\x65viceOperationalStatusEnum\x12%\n!DEVICEOPERATIONALSTATUS_UNDEFINED\x10\x00\x12$\n DEVICEOPERATIONALSTATUS_DISABLED\x10\x01\x12#\n\x1f\x44\x45VICEOPERATIONALSTATUS_ENABLED\x10\x02*\x81\x01\n\x0fServiceTypeEnum\x12\x17\n\x13SERVICETYPE_UNKNOWN\x10\x00\x12\x14\n\x10SERVICETYPE_L3NM\x10\x01\x12\x14\n\x10SERVICETYPE_L2NM\x10\x02\x12)\n%SERVICETYPE_TAPI_CONNECTIVITY_SERVICE\x10\x03*\x88\x01\n\x11ServiceStatusEnum\x12\x1b\n\x17SERVICESTATUS_UNDEFINED\x10\x00\x12\x19\n\x15SERVICESTATUS_PLANNED\x10\x01\x12\x18\n\x14SERVICESTATUS_ACTIVE\x10\x02\x12!\n\x1dSERVICESTATUS_PENDING_REMOVAL\x10\x03*]\n\x10\x43onfigActionEnum\x12\x1a\n\x16\x43ONFIGACTION_UNDEFINED\x10\x00\x12\x14\n\x10\x43ONFIGACTION_SET\x10\x01\x12\x17\n\x13\x43ONFIGACTION_DELETE\x10\x02\x32\xa5\r\n\x0e\x43ontextService\x12:\n\x0eListContextIds\x12\x0e.context.Empty\x1a\x16.context.ContextIdList\"\x00\x12\x36\n\x0cListContexts\x12\x0e.context.Empty\x1a\x14.context.ContextList\"\x00\x12\x34\n\nGetContext\x12\x12.context.ContextId\x1a\x10.context.Context\"\x00\x12\x34\n\nSetContext\x12\x10.context.Context\x1a\x12.context.ContextId\"\x00\x12\x35\n\rRemoveContext\x12\x12.context.ContextId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetContextEvents\x12\x0e.context.Empty\x1a\x15.context.ContextEvent\"\x00\x30\x01\x12@\n\x0fListTopologyIds\x12\x12.context.ContextId\x1a\x17.context.TopologyIdList\"\x00\x12=\n\x0eListTopologies\x12\x12.context.ContextId\x1a\x15.context.TopologyList\"\x00\x12\x37\n\x0bGetTopology\x12\x13.context.TopologyId\x1a\x11.context.Topology\"\x00\x12\x37\n\x0bSetTopology\x12\x11.context.Topology\x1a\x13.context.TopologyId\"\x00\x12\x37\n\x0eRemoveTopology\x12\x13.context.TopologyId\x1a\x0e.context.Empty\"\x00\x12?\n\x11GetTopologyEvents\x12\x0e.context.Empty\x1a\x16.context.TopologyEvent\"\x00\x30\x01\x12\x38\n\rListDeviceIds\x12\x0e.context.Empty\x1a\x15.context.DeviceIdList\"\x00\x12\x34\n\x0bListDevices\x12\x0e.context.Empty\x1a\x13.context.DeviceList\"\x00\x12\x31\n\tGetDevice\x12\x11.context.DeviceId\x1a\x0f.context.Device\"\x00\x12\x31\n\tSetDevice\x12\x0f.context.Device\x1a\x11.context.DeviceId\"\x00\x12\x33\n\x0cRemoveDevice\x12\x11.context.DeviceId\x1a\x0e.context.Empty\"\x00\x12;\n\x0fGetDeviceEvents\x12\x0e.context.Empty\x1a\x14.context.DeviceEvent\"\x00\x30\x01\x12\x34\n\x0bListLinkIds\x12\x0e.context.Empty\x1a\x13.context.LinkIdList\"\x00\x12\x30\n\tListLinks\x12\x0e.context.Empty\x1a\x11.context.LinkList\"\x00\x12+\n\x07GetLink\x12\x0f.context.LinkId\x1a\r.context.Link\"\x00\x12+\n\x07SetLink\x12\r.context.Link\x1a\x0f.context.LinkId\"\x00\x12/\n\nRemoveLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x12\x37\n\rGetLinkEvents\x12\x0e.context.Empty\x1a\x12.context.LinkEvent\"\x00\x30\x01\x12>\n\x0eListServiceIds\x12\x12.context.ContextId\x1a\x16.context.ServiceIdList\"\x00\x12:\n\x0cListServices\x12\x12.context.ContextId\x1a\x14.context.ServiceList\"\x00\x12\x34\n\nGetService\x12\x12.context.ServiceId\x1a\x10.context.Service\"\x00\x12\x34\n\nSetService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x35\n\rRemoveService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetServiceEvents\x12\x0e.context.Empty\x1a\x15.context.ServiceEvent\"\x00\x30\x01\x62\x06proto3'
   ,
   dependencies=[kpi__sample__types__pb2.DESCRIPTOR,])
 
@@ -55,8 +55,8 @@ _EVENTTYPEENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=3551,
-  serialized_end=3657,
+  serialized_start=3552,
+  serialized_end=3658,
 )
 _sym_db.RegisterEnumDescriptor(_EVENTTYPEENUM)
 
@@ -101,8 +101,8 @@ _DEVICEDRIVERENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=3660,
-  serialized_end=3857,
+  serialized_start=3661,
+  serialized_end=3858,
 )
 _sym_db.RegisterEnumDescriptor(_DEVICEDRIVERENUM)
 
@@ -132,8 +132,8 @@ _DEVICEOPERATIONALSTATUSENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=3860,
-  serialized_end=4003,
+  serialized_start=3861,
+  serialized_end=4004,
 )
 _sym_db.RegisterEnumDescriptor(_DEVICEOPERATIONALSTATUSENUM)
 
@@ -168,8 +168,8 @@ _SERVICETYPEENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=4006,
-  serialized_end=4135,
+  serialized_start=4007,
+  serialized_end=4136,
 )
 _sym_db.RegisterEnumDescriptor(_SERVICETYPEENUM)
 
@@ -204,8 +204,8 @@ _SERVICESTATUSENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=4138,
-  serialized_end=4274,
+  serialized_start=4139,
+  serialized_end=4275,
 )
 _sym_db.RegisterEnumDescriptor(_SERVICESTATUSENUM)
 
@@ -235,8 +235,8 @@ _CONFIGACTIONENUM = _descriptor.EnumDescriptor(
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=4276,
-  serialized_end=4369,
+  serialized_start=4277,
+  serialized_end=4370,
 )
 _sym_db.RegisterEnumDescriptor(_CONFIGACTIONENUM)
 
@@ -1489,6 +1489,13 @@ _ENDPOINT = _descriptor.Descriptor(
       message_type=None, enum_type=None, containing_type=None,
       is_extension=False, extension_scope=None,
       serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
+    _descriptor.FieldDescriptor(
+      name='kpi_sample_types', full_name='context.EndPoint.kpi_sample_types', index=2,
+      number=3, type=14, cpp_type=8, label=3,
+      has_default_value=False, default_value=[],
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
   ],
   extensions=[
   ],
@@ -1501,8 +1508,8 @@ _ENDPOINT = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=2737,
-  serialized_end=2812,
+  serialized_start=2738,
+  serialized_end=2872,
 )
 
 
@@ -1535,13 +1542,6 @@ _CONFIGRULE = _descriptor.Descriptor(
       message_type=None, enum_type=None, containing_type=None,
       is_extension=False, extension_scope=None,
       serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
-    _descriptor.FieldDescriptor(
-      name='kpi_sample_type', full_name='context.ConfigRule.kpi_sample_type', index=3,
-      number=4, type=14, cpp_type=8, label=1,
-      has_default_value=False, default_value=0,
-      message_type=None, enum_type=None, containing_type=None,
-      is_extension=False, extension_scope=None,
-      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
   ],
   extensions=[
   ],
@@ -1554,8 +1554,8 @@ _CONFIGRULE = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=2815,
-  serialized_end=2974,
+  serialized_start=2874,
+  serialized_end=2975,
 )
 
 
@@ -1593,8 +1593,8 @@ _CONSTRAINT = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=2976,
-  serialized_end=3039,
+  serialized_start=2977,
+  serialized_end=3040,
 )
 
 
@@ -1625,8 +1625,8 @@ _CONNECTIONID = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3041,
-  serialized_end=3095,
+  serialized_start=3042,
+  serialized_end=3096,
 )
 
 
@@ -1671,8 +1671,8 @@ _CONNECTION = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3098,
-  serialized_end=3239,
+  serialized_start=3099,
+  serialized_end=3240,
 )
 
 
@@ -1703,8 +1703,8 @@ _CONNECTIONIDLIST = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3241,
-  serialized_end=3306,
+  serialized_start=3242,
+  serialized_end=3307,
 )
 
 
@@ -1735,8 +1735,8 @@ _CONNECTIONLIST = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3308,
-  serialized_end=3366,
+  serialized_start=3309,
+  serialized_end=3367,
 )
 
 
@@ -1781,8 +1781,8 @@ _TERAFLOWCONTROLLER = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3368,
-  serialized_end=3462,
+  serialized_start=3369,
+  serialized_end=3463,
 )
 
 
@@ -1820,8 +1820,8 @@ _AUTHENTICATIONRESULT = _descriptor.Descriptor(
   extension_ranges=[],
   oneofs=[
   ],
-  serialized_start=3464,
-  serialized_end=3549,
+  serialized_start=3465,
+  serialized_end=3550,
 )
 
 _EVENT.fields_by_name['event_type'].enum_type = _EVENTTYPEENUM
@@ -1879,8 +1879,8 @@ _ENDPOINTID.fields_by_name['topology_id'].message_type = _TOPOLOGYID
 _ENDPOINTID.fields_by_name['device_id'].message_type = _DEVICEID
 _ENDPOINTID.fields_by_name['endpoint_uuid'].message_type = _UUID
 _ENDPOINT.fields_by_name['endpoint_id'].message_type = _ENDPOINTID
+_ENDPOINT.fields_by_name['kpi_sample_types'].enum_type = kpi__sample__types__pb2._KPISAMPLETYPE
 _CONFIGRULE.fields_by_name['action'].enum_type = _CONFIGACTIONENUM
-_CONFIGRULE.fields_by_name['kpi_sample_type'].enum_type = kpi__sample__types__pb2._KPISAMPLETYPE
 _CONNECTIONID.fields_by_name['connection_uuid'].message_type = _UUID
 _CONNECTION.fields_by_name['connection_id'].message_type = _CONNECTIONID
 _CONNECTION.fields_by_name['related_service_id'].message_type = _SERVICEID
@@ -2234,8 +2234,8 @@ _CONTEXTSERVICE = _descriptor.ServiceDescriptor(
   index=0,
   serialized_options=None,
   create_key=_descriptor._internal_create_key,
-  serialized_start=4372,
-  serialized_end=6073,
+  serialized_start=4373,
+  serialized_end=6074,
   methods=[
   _descriptor.MethodDescriptor(
     name='ListContextIds',
diff --git a/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py b/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py
index 31fbaa216bca629a4de4272091c490982c1aa166..ea7fd2f82757d4c3db02d7e2c7817e2787b0b490 100644
--- a/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py
+++ b/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py
@@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
   syntax='proto3',
   serialized_options=None,
   create_key=_descriptor._internal_create_key,
-  serialized_pb=b'\n\x16kpi_sample_types.proto\x12\x10kpi_sample_types*x\n\rKpiSampleType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x17\n\x13PACKETS_TRANSMITTED\x10\x65\x12\x14\n\x10PACKETS_RECEIVED\x10\x66\x12\x16\n\x11\x42YTES_TRANSMITTED\x10\xc9\x01\x12\x13\n\x0e\x42YTES_RECEIVED\x10\xca\x01\x62\x06proto3'
+  serialized_pb=b'\n\x16kpi_sample_types.proto\x12\x10kpi_sample_types*\xbe\x01\n\rKpiSampleType\x12\x19\n\x15KPISAMPLETYPE_UNKNOWN\x10\x00\x12%\n!KPISAMPLETYPE_PACKETS_TRANSMITTED\x10\x65\x12\"\n\x1eKPISAMPLETYPE_PACKETS_RECEIVED\x10\x66\x12$\n\x1fKPISAMPLETYPE_BYTES_TRANSMITTED\x10\xc9\x01\x12!\n\x1cKPISAMPLETYPE_BYTES_RECEIVED\x10\xca\x01\x62\x06proto3'
 )
 
 _KPISAMPLETYPE = _descriptor.EnumDescriptor(
@@ -31,44 +31,44 @@ _KPISAMPLETYPE = _descriptor.EnumDescriptor(
   create_key=_descriptor._internal_create_key,
   values=[
     _descriptor.EnumValueDescriptor(
-      name='UNKNOWN', index=0, number=0,
+      name='KPISAMPLETYPE_UNKNOWN', index=0, number=0,
       serialized_options=None,
       type=None,
       create_key=_descriptor._internal_create_key),
     _descriptor.EnumValueDescriptor(
-      name='PACKETS_TRANSMITTED', index=1, number=101,
+      name='KPISAMPLETYPE_PACKETS_TRANSMITTED', index=1, number=101,
       serialized_options=None,
       type=None,
       create_key=_descriptor._internal_create_key),
     _descriptor.EnumValueDescriptor(
-      name='PACKETS_RECEIVED', index=2, number=102,
+      name='KPISAMPLETYPE_PACKETS_RECEIVED', index=2, number=102,
       serialized_options=None,
       type=None,
       create_key=_descriptor._internal_create_key),
     _descriptor.EnumValueDescriptor(
-      name='BYTES_TRANSMITTED', index=3, number=201,
+      name='KPISAMPLETYPE_BYTES_TRANSMITTED', index=3, number=201,
       serialized_options=None,
       type=None,
       create_key=_descriptor._internal_create_key),
     _descriptor.EnumValueDescriptor(
-      name='BYTES_RECEIVED', index=4, number=202,
+      name='KPISAMPLETYPE_BYTES_RECEIVED', index=4, number=202,
       serialized_options=None,
       type=None,
       create_key=_descriptor._internal_create_key),
   ],
   containing_type=None,
   serialized_options=None,
-  serialized_start=44,
-  serialized_end=164,
+  serialized_start=45,
+  serialized_end=235,
 )
 _sym_db.RegisterEnumDescriptor(_KPISAMPLETYPE)
 
 KpiSampleType = enum_type_wrapper.EnumTypeWrapper(_KPISAMPLETYPE)
-UNKNOWN = 0
-PACKETS_TRANSMITTED = 101
-PACKETS_RECEIVED = 102
-BYTES_TRANSMITTED = 201
-BYTES_RECEIVED = 202
+KPISAMPLETYPE_UNKNOWN = 0
+KPISAMPLETYPE_PACKETS_TRANSMITTED = 101
+KPISAMPLETYPE_PACKETS_RECEIVED = 102
+KPISAMPLETYPE_BYTES_TRANSMITTED = 201
+KPISAMPLETYPE_BYTES_RECEIVED = 202
 
 
 DESCRIPTOR.enum_types_by_name['KpiSampleType'] = _KPISAMPLETYPE