diff --git a/proto/context.proto b/proto/context.proto index e578f60fbaa78620abb09e81ad7fad2afaf39c07..b4ebbb8ba02ce5ee1fc8521518e61a5566cf637c 100644 --- a/proto/context.proto +++ b/proto/context.proto @@ -1,98 +1,255 @@ syntax = "proto3"; package context; - service ContextService { - rpc GetTopology (Empty) returns (Topology) {} + rpc GetContextIds (Empty ) returns (ContextIdList ) {} + rpc GetContexts (Empty ) returns (ContextList ) {} + rpc GetContext (ContextId ) returns (Context ) {} + rpc SetContext (Context ) returns (ContextId ) {} + rpc DeleteContext (ContextId ) returns (Empty ) {} + + rpc GetTopologyIds(ContextId ) returns (TopologyIdList) {} + rpc GetTopologies (ContextId ) returns (TopologyList ) {} + rpc GetTopology (TopologyId) returns (Topology ) {} + rpc SetTopology (Topology ) returns (TopologyId ) {} + rpc DeleteTopology(TopologyId) returns (Empty ) {} + + rpc GetDeviceIds (Empty ) returns (DeviceIdList ) {} + rpc GetDevices (Empty ) returns (DeviceList ) {} + rpc GetDevice (DeviceId ) returns (Device ) {} + rpc SetDevice (Device ) returns (DeviceId ) {} + rpc RemoveDevice (DeviceId ) returns (Empty ) {} + + rpc GetLinkIds (Empty ) returns (LinkIdList ) {} + rpc GetLinks (Empty ) returns (LinkList ) {} + rpc GetLink (LinkId ) returns (Link ) {} + rpc SetLink (Link ) returns (LinkId ) {} + rpc DeleteLink (LinkId ) returns (Empty ) {} + + rpc GetServiceIds (ContextId ) returns (ServiceIdList ) {} + rpc GetServices (ContextId ) returns (ServiceList ) {} + rpc GetService (ServiceId ) returns (Service ) {} + rpc SetService (Service ) returns (ServiceId ) {} + rpc DeleteService (ServiceId ) returns (Empty ) {} +} + +// ----- Generic ------------------------------------------------------------------------------------------------------- +message Empty {} - rpc AddLink(Link) returns (LinkId) {} - rpc DeleteLink(LinkId) returns (Empty) {} +message Uuid { + string uuid = 1; } -message Empty { +// ----- Context ------------------------------------------------------------------------------------------------------- +message ContextId { + Uuid context_uuid = 1; } message Context { - ContextId contextId= 1; - Topology topo = 2; - TeraFlowController ctl = 3; + ContextId context_id = 1; + repeated Topology topology = 2; + TeraFlowController controller = 3; } -message ContextId { - Uuid contextUuid = 1; +message ContextIdList { + repeated ContextId context_ids = 1; +} + +message ContextList { + repeated Context contexts = 1; +} + + +// ----- Topology ------------------------------------------------------------------------------------------------------ +message TopologyId { + ContextId context_id = 1; + Uuid topology_uuid = 2; } message Topology { - TopologyId topoId = 2; - repeated Device device = 3; - repeated Link link = 4; + TopologyId topology_id = 1; + repeated Device devices = 2; + repeated Link links = 3; } -message Link { - LinkId link_id = 1; - repeated EndPointId endpointList = 2; +message TopologyIdList { + repeated TopologyId topology_ids = 1; } -message TopologyId { - ContextId contextId = 1; - Uuid topoId = 2; +message TopologyList { + repeated Topology topologies = 1; } -message Constraint { - string constraint_type = 1; - string constraint_value = 2; + +// ----- Device -------------------------------------------------------------------------------------------------------- +message DeviceId { + Uuid device_uuid = 1; } message Device { DeviceId device_id = 1; string device_type = 2; DeviceConfig device_config = 3; - DeviceOperationalStatus devOperationalStatus = 4; - repeated EndPoint endpointList = 5; + DeviceOperationalStatus devive_operational_status = 4; + repeated DeviceDriver device_drivers = 5; + repeated EndPoint endpoints = 6; } message DeviceConfig { - string device_config = 1; + repeated ConfigRule config_rules = 1; +} + +enum DeviceDriver { + DRIVER_UNDEFINED = 0; // also used for emulated + DRIVER_OPENCONFIG = 1; + DRIVER_TRANSPORT_API = 2; + DRIVER_P4 = 3; + DRIVER_IETF_NETWORK_TOPOLOGY = 4; + DRIVER_ONF_TR_352 = 5; +} + +enum DeviceOperationalStatus { + KEEP_STATUS = 0; // Do not change operational status of device (used in configure) + DISABLED = -1; + ENABLED = 1; +} + +message DeviceIdList { + repeated DeviceId device_ids = 1; +} + +message DeviceList { + repeated Device devices = 1; +} + + +// ----- Link ---------------------------------------------------------------------------------------------------------- +message LinkId { + Uuid link_uuid = 1; +} + +message Link { + LinkId link_id = 1; + repeated EndPointId endpoints = 2; +} + +message LinkIdList { + repeated LinkId link_ids = 1; +} + +message LinkList { + repeated Link links = 1; +} + + +// ----- Service ------------------------------------------------------------------------------------------------------- +message ServiceId { + ContextId context_id = 1; + Uuid service_uuid = 2; +} + +message Service { + ServiceId service_id = 1; + ServiceType service_type = 2; + repeated EndPointId endpoints = 3; + repeated Constraint constraints = 4; + ServiceState service_state = 5; + ServiceConfig service_config = 6; +} + +enum ServiceType { + SERVICETYPE_UNKNOWN = 0; + SERVICETYPE_L3NM = 1; + SERVICETYPE_L2NM = 2; + SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3; +} + +enum ServiceStateEnum { + SERVICESTATUS_PLANNED = 0; + SERVICESTATUS_ACTIVE = 1; + SERVICESTATUS_PENDING_REMOVAL = 2; +} + +message ServiceState { + ServiceStateEnum service_state = 1; +} + +message ServiceConfig { + repeated ConfigRule config_rules = 1; +} + +message ServiceIdList { + repeated ServiceId service_ids = 1; +} + +message ServiceList { + repeated Service services = 1; +} + + +// ----- Endpoint ------------------------------------------------------------------------------------------------------ +message EndPointId { + TopologyId topology_id = 1; + DeviceId device_id = 2; + Uuid endpoint_uuid = 3; } message EndPoint { - EndPointId port_id = 1; + EndPointId endpoint_id = 1; string port_type = 2; } -message EndPointId { - TopologyId topoId = 1; - DeviceId dev_id = 2; - Uuid port_id = 3; + +// ----- Configuration ------------------------------------------------------------------------------------------------- +enum ConfigAction { + CONFIGACTION_UNDEFINED = 0; + CONFIGACTION_SET = 1; + CONFIGACTION_DELETE = 2; } -message DeviceId { - Uuid device_id = 1; +message ConfigRule { + ConfigAction action = 1; + string resource_key = 2; + string resource_value = 3; } -message LinkId { - Uuid link_id = 1; + +// ----- Constraint ---------------------------------------------------------------------------------------------------- +message Constraint { + string constraint_type = 1; + string constraint_value = 2; } -message Uuid { - string uuid = 1; + +// ----- Connection ---------------------------------------------------------------------------------------------------- +message ConnectionId { + Uuid connection_uuid = 1; } -enum DeviceOperationalStatus { - KEEP_STATUS = 0; // Do not change operational status of device (used in configure) - DISABLED = -1; - ENABLED = 1; +message Connection { + ConnectionId connection_id = 1; + ServiceId related_service_id = 2; + repeated EndPointId path = 3; +} + +message ConnectionIdList { + repeated ConnectionId connection_ids = 1; } +message ConnectionList { + repeated Connection connections = 1; +} + + +// ----- Miscellaneous ------------------------------------------------------------------------------------------------- message TeraFlowController { - ContextId ctl_id = 1; - string ipaddress = 2; + ContextId context_id = 1; + string ip_address = 2; + uint32 port = 3; } message AuthenticationResult { - ContextId ctl_id = 1; + ContextId context_id = 1; bool authenticated = 2; } - - diff --git a/proto/device.proto b/proto/device.proto index 4fe74b78afd3790e392c1df4df66d409316dda05..93e481b7ccef1924f9744e27bb5e04991653102e 100644 --- a/proto/device.proto +++ b/proto/device.proto @@ -4,7 +4,7 @@ package device; import "context.proto"; service DeviceService { - rpc AddDevice(context.Device) returns (context.DeviceId) {} - rpc ConfigureDevice(context.Device) returns (context.DeviceId) {} - rpc DeleteDevice(context.DeviceId) returns (context.Empty) {} + rpc AddDevice (context.Device ) returns (context.DeviceId) {} + rpc ConfigureDevice(context.Device ) returns (context.DeviceId) {} + rpc DeleteDevice (context.DeviceId) returns (context.Empty ) {} } diff --git a/proto/service.proto b/proto/service.proto index fb10d11b77b4c35d89bdb6047691045c71322644..6a6c1f0e1c6683d4d01946f9a8bb365c8dbdb2ef 100644 --- a/proto/service.proto +++ b/proto/service.proto @@ -1,73 +1,13 @@ -//Example of topology syntax = "proto3"; package service; import "context.proto"; service ServiceService { - rpc GetServiceList (context.Empty) returns (ServiceList) {} - rpc CreateService (Service) returns (ServiceId) {} - rpc UpdateService (Service) returns (ServiceId) {} - rpc DeleteService (ServiceId) returns (context.Empty) {} - rpc GetServiceById (ServiceId) returns (Service) {} - rpc GetConnectionList (context.Empty) returns (ConnectionList) {} - + rpc GetServiceList (context.Empty ) returns (context.ServiceList ) {} + rpc CreateService (context.Service ) returns (context.ServiceId ) {} + rpc UpdateService (context.Service ) returns (context.ServiceId ) {} + rpc DeleteService (context.ServiceId) returns (context.Empty ) {} + rpc GetServiceById (context.ServiceId) returns (context.Service ) {} + rpc GetConnectionList(context.Empty ) returns (context.ConnectionList) {} } - -message ServiceList { - repeated Service cs = 1; -} - -message Service { - ServiceId cs_id = 1; - ServiceType serviceType = 2; - repeated context.EndPointId endpointList = 3; - repeated context.Constraint constraint = 4; - ServiceState serviceState = 5; - ServiceConfig serviceConfig = 6; -} - -enum ServiceType { - UNKNOWN = 0; - L3NM = 1; - L2NM = 2; - TAPI_CONNECTIVITY_SERVICE = 3; -} - -message ServiceConfig { - string serviceConfig = 1; -} - -message ServiceId { - context.ContextId contextId = 1; - context.Uuid cs_id = 2; -} - -message ServiceIdList { - repeated ServiceId serviceIdList = 1; -} - -message ServiceState { - ServiceStateEnum serviceState = 1; -} - -enum ServiceStateEnum { - PLANNED = 0; - ACTIVE = 1; - PENDING_REMOVAL = 2; -} - -message ConnectionList { - repeated Connection connectionList = 1; -} - -message Connection { - ConnectionId con_id = 1; - ServiceId relatedServiceId = 2; - repeated context.EndPointId path = 3; -} - -message ConnectionId { - context.Uuid con_id = 1; -} - diff --git a/src/common/Constants.py b/src/common/Constants.py new file mode 100644 index 0000000000000000000000000000000000000000..2595a1606631fcea4152d43fdf32e7db0dbb560a --- /dev/null +++ b/src/common/Constants.py @@ -0,0 +1,2 @@ +DEFAULT_CONTEXT_UUID = 'admin' +DEFAULT_TOPOLOGY_UUID = 'admin' diff --git a/src/common/database/Factory.py b/src/common/database/Factory.py deleted file mode 100644 index e67036372f3b4f0fc76d3874f3c4cb0c1a6d666d..0000000000000000000000000000000000000000 --- a/src/common/database/Factory.py +++ /dev/null @@ -1,39 +0,0 @@ -import logging -from enum import Enum -from common.Settings import get_setting -from common.database.api.Database import Database -from common.database.engines.inmemory.InMemoryDatabaseEngine import InMemoryDatabaseEngine -from common.database.engines.redis.RedisDatabaseEngine import RedisDatabaseEngine - -LOGGER = logging.getLogger(__name__) - -class DatabaseEngineEnum(Enum): - INMEMORY = 'inmemory' - REDIS = 'redis' - #MONGO = 'mongo' - #RETHINK = 'rethink' - #ETCD = 'etcd' - -ENGINES = { - DatabaseEngineEnum.INMEMORY.value: InMemoryDatabaseEngine, - DatabaseEngineEnum.REDIS.value: RedisDatabaseEngine, - #DatabaseEngineEnum.MONGO.value: MongoDatabase, - #DatabaseEngineEnum.RETHINK.value: RethinkDatabase, - #DatabaseEngineEnum.ETCD.value: EtcdDatabase, -} - -DEFAULT_DB_ENGINE = DatabaseEngineEnum.INMEMORY - -def get_database(engine=None, **settings) -> Database: - # return an instance of Database initialized with selected engine. - # Engine is selected using following criteria (first that is not None is selected): - # 1. user selected by parameter (engine=...) - # 2. environment variable DB_ENGINE - # 3. default engine: INMEMORY - if engine is None: engine = get_setting('DB_ENGINE', default=DEFAULT_DB_ENGINE) - if engine is None: raise Exception('Database Engine not specified') - if isinstance(engine, DatabaseEngineEnum): engine = engine.value - engine_class = ENGINES.get(engine) - if engine_class is None: raise Exception('Unsupported DatabaseEngine({})'.format(engine)) - LOGGER.info('Selected Database Engine: {}'.format(engine)) - return Database(engine_class(**settings)) diff --git a/src/common/database/api/Database.py b/src/common/database/api/Database.py deleted file mode 100644 index 319f9bbd380241d11cf6a34cdd2f14a003aed560..0000000000000000000000000000000000000000 --- a/src/common/database/api/Database.py +++ /dev/null @@ -1,53 +0,0 @@ -import logging -from typing import List -from common.database.api.Exceptions import WrongDatabaseEngine, MutexException -from common.database.api.context.Context import Context -from common.database.api.context.Keys import KEY_CONTEXTS -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection -from common.database.engines._DatabaseEngine import _DatabaseEngine - -LOGGER = logging.getLogger(__name__) - -class Database(_Entity): - def __init__(self, database_engine : _DatabaseEngine): - if not isinstance(database_engine, _DatabaseEngine): - raise WrongDatabaseEngine('database_engine must inherit from _DatabaseEngine') - self._database_engine = database_engine - super().__init__(self, 'root', 'database', {}, {}) - self._acquired = False - self._owner_key = None - self._contexts = EntityCollection(self, KEY_CONTEXTS) - - @property - def parent(self) -> 'Database': return self - - @property - def database_engine(self) -> _DatabaseEngine: return self._database_engine - - def __enter__(self) -> '_DatabaseEngine': - self._acquired, self._owner_key = self._database_engine.lock() - if not self._acquired: raise MutexException('Unable to acquire database lock') - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self._database_engine.unlock(self._owner_key) - - def clear_all(self, keep_keys=set()): - LOGGER.info('Cleaning up...') - keys = self._database_engine.keys() - LOGGER.info(' keys before = {}'.format(str(keys))) - for key in keys: - if(key in keep_keys): continue - self._database_engine.delete(key) - LOGGER.info(' keys after = {}'.format(str(self._database_engine.keys()))) - - def dump(self) -> List[str]: - entries = self._database_engine.dump() - entries.sort() - return ['[{:>4s}] {:100s} :: {}'.format(k_type, k_name, k_value) for k_name,k_type,k_value in entries] - - @property - def contexts(self) -> EntityCollection: return self._contexts - - def context(self, context_uuid : str) -> Context: return Context(context_uuid, self) diff --git a/src/common/database/api/Exceptions.py b/src/common/database/api/Exceptions.py deleted file mode 100644 index ef60ac5f5ab9c3ec3de6cbf4c1af54dcc4389470..0000000000000000000000000000000000000000 --- a/src/common/database/api/Exceptions.py +++ /dev/null @@ -1,5 +0,0 @@ -class WrongDatabaseEngine(Exception): - pass - -class MutexException(Exception): - pass diff --git a/src/common/database/api/context/Constants.py b/src/common/database/api/context/Constants.py deleted file mode 100644 index 120b094a30e06a9476c1dce8bf91f42b383d0fa1..0000000000000000000000000000000000000000 --- a/src/common/database/api/context/Constants.py +++ /dev/null @@ -1,2 +0,0 @@ -DEFAULT_CONTEXT_ID = 'admin' -DEFAULT_TOPOLOGY_ID = 'admin' diff --git a/src/common/database/api/entity/EntityAttributes.py b/src/common/database/api/entity/EntityAttributes.py deleted file mode 100644 index b3e553453f7ebdda9439c81e11e1833ab32f1e41..0000000000000000000000000000000000000000 --- a/src/common/database/api/entity/EntityAttributes.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import annotations -import copy -from typing import Any, Dict, TYPE_CHECKING -from common.database.engines._DatabaseEngine import _DatabaseEngine -from common.database.api.entity.Tools import format_key - -if TYPE_CHECKING: - from common.database.api.entity._Entity import _Entity - -class EntityAttributes: - def __init__(self, parent : '_Entity', entity_key : str, validators : Dict, transcoders : Dict = {}): - self._parent = parent - self._database_engine : _DatabaseEngine = self._parent.database_engine - self._entity_key = format_key(entity_key, self._parent) - self._validators = validators - self._transcoders = transcoders - - def validate(self, update_attributes, remove_attributes, attribute_name): - remove_attributes.discard(attribute_name) - value = update_attributes.pop(attribute_name, None) - if value is None: return - validator = self._validators.get(attribute_name) - if validator is None: return - if not validator(value): raise AttributeError('{} is invalid'.format(attribute_name)) - - def transcode(self, attribute_name, attribute_value): - transcoder_set = self._transcoders.get(attribute_name, {}) - transcoder = transcoder_set.get(type(attribute_value)) - return attribute_value if transcoder is None else transcoder(attribute_value) - - def get(self, attributes=[]) -> Dict[str, Any]: - return { - k:self.transcode(k, v) - for k,v in self._database_engine.dict_get(self._entity_key, fields=attributes).items() - } - - def update(self, update_attributes={}, remove_attributes=[]): - remove_attributes = set(remove_attributes) - copy_update_attributes = copy.deepcopy(update_attributes) - copy_remove_attributes = copy.deepcopy(remove_attributes) - - for attribute_name in self._validators.keys(): - self.validate(copy_update_attributes, copy_remove_attributes, attribute_name) - attribute_value = update_attributes.get(attribute_name) - if attribute_value is None: continue - update_attributes[attribute_name] = self.transcode(attribute_name, attribute_value) - - if len(copy_update_attributes) > 0: - raise AttributeError('Unexpected update_attributes: {}'.format(str(copy_update_attributes))) - - if len(copy_remove_attributes) > 0: - raise AttributeError('Unexpected remove_attributes: {}'.format(str(copy_remove_attributes))) - - self._database_engine.dict_update(self._entity_key, update_attributes, remove_attributes) - return self - - def delete(self, attributes=[]): - self._database_engine.dict_delete(self._entity_key, attributes) diff --git a/src/common/database/api/entity/EntityCollection.py b/src/common/database/api/entity/EntityCollection.py deleted file mode 100644 index ed155370b43a91c7d64c921433d65327733fba54..0000000000000000000000000000000000000000 --- a/src/common/database/api/entity/EntityCollection.py +++ /dev/null @@ -1,30 +0,0 @@ -from __future__ import annotations -from typing import TYPE_CHECKING -from common.database.engines._DatabaseEngine import _DatabaseEngine -from common.database.api.entity.Tools import format_key - -if TYPE_CHECKING: - from common.database.api.entity._Entity import _Entity - -class EntityCollection: - def __init__(self, parent : '_Entity', entity_key : str): - self._parent = parent - self._database_engine : _DatabaseEngine = self._parent.database_engine - self._entity_key_list = format_key(entity_key, self._parent, container_name='_list') - self._entity_key_set = format_key(entity_key, self._parent, container_name='_set') - - def add(self, entity_uuid : str) -> None: - if self._database_engine.set_has(self._entity_key_set, entity_uuid): return - self._database_engine.set_add(self._entity_key_set, entity_uuid) - self._database_engine.list_push_last(self._entity_key_list, entity_uuid) - - def get(self): - return self._database_engine.list_get_all(self._entity_key_list) - - def contains(self, entity_uuid : str): - return self._database_engine.set_has(self._entity_key_set, entity_uuid) - - def delete(self, entity_uuid : str) -> None: - if not self._database_engine.set_has(self._entity_key_set, entity_uuid): return - self._database_engine.set_remove(self._entity_key_set, entity_uuid) - self._database_engine.list_remove_first_occurrence(self._entity_key_list, entity_uuid) diff --git a/src/common/database/api/entity/_Entity.py b/src/common/database/api/entity/_Entity.py deleted file mode 100644 index 784ffbf61c7958329c28f1c7ac371f5126289971..0000000000000000000000000000000000000000 --- a/src/common/database/api/entity/_Entity.py +++ /dev/null @@ -1,47 +0,0 @@ -from typing import Any, Callable, Dict -from common.database.engines._DatabaseEngine import _DatabaseEngine -from common.database.api.entity.EntityAttributes import EntityAttributes - -class _Entity: - def __init__(self, parent, entity_uuid : str, attributes_key : str, - attribute_validators : Dict[str, Callable[[Any], bool]], - attribute_transcoders : Dict[str, Dict[Any, Callable[[Any], Any]]]): - if not isinstance(parent, _Entity): - raise AttributeError('parent must be an instance of _Entity') - if (not isinstance(entity_uuid, str)) or (len(entity_uuid) == 0): - raise AttributeError('entity_uuid must be a non-empty instance of str') - if (not isinstance(attributes_key, str)) or (len(attributes_key) == 0): - raise AttributeError('attributes_key must be a non-empty instance of str') - if not isinstance(attribute_validators, dict): - raise AttributeError('attribute_validators must be an instance of dict') - if not isinstance(attribute_transcoders, dict): - raise AttributeError('attribute_transcoders must be an instance of dict') - - self._entity_uuid = entity_uuid - self._parent = parent - self._attributes = EntityAttributes(self, attributes_key, attribute_validators, - transcoders=attribute_transcoders) - - @property - def parent(self) -> '_Entity': return self._parent - - @property - def database_engine(self) -> _DatabaseEngine: return self._parent.database_engine - - @property - def attributes(self) -> EntityAttributes: return self._attributes - - def load(self): - raise NotImplementedError() - - def create(self): - raise NotImplementedError() - - def delete(self): - raise NotImplementedError() - - def dump_id(self) -> Dict: - raise NotImplementedError() - - def dump(self) -> Dict: - raise NotImplementedError() diff --git a/src/common/database/engines/inmemory/__init__.py b/src/common/database/engines/inmemory/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/common/database/engines/redis/__init__.py b/src/common/database/engines/redis/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/common/database/tests/__init__.py b/src/common/database/tests/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/common/tools/service/__init__.py b/src/common/tools/service/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/context/proto/context_pb2.py b/src/context/proto/context_pb2.py index a41b1de47f4df97a6e90b42a02fab7556feafd34..6dd94bccacb32c243ba649d8211b1a78223a31ec 100644 --- a/src/context/proto/context_pb2.py +++ b/src/context/proto/context_pb2.py @@ -20,9 +20,55 @@ DESCRIPTOR = _descriptor.FileDescriptor( syntax='proto3', serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\"\x07\n\x05\x45mpty\"{\n\x07\x43ontext\x12%\n\tcontextId\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x1f\n\x04topo\x18\x02 \x01(\x0b\x32\x11.context.Topology\x12(\n\x03\x63tl\x18\x03 \x01(\x0b\x32\x1b.context.TeraFlowController\"/\n\tContextId\x12\"\n\x0b\x63ontextUuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"m\n\x08Topology\x12#\n\x06topoId\x18\x02 \x01(\x0b\x32\x13.context.TopologyId\x12\x1f\n\x06\x64\x65vice\x18\x03 \x03(\x0b\x32\x0f.context.Device\x12\x1b\n\x04link\x18\x04 \x03(\x0b\x32\r.context.Link\"S\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12)\n\x0c\x65ndpointList\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\"R\n\nTopologyId\x12%\n\tcontextId\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x1d\n\x06topoId\x18\x02 \x01(\x0b\x32\r.context.Uuid\"?\n\nConstraint\x12\x17\n\x0f\x63onstraint_type\x18\x01 \x01(\t\x12\x18\n\x10\x63onstraint_value\x18\x02 \x01(\t\"\xda\x01\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\x12>\n\x14\x64\x65vOperationalStatus\x18\x04 \x01(\x0e\x32 .context.DeviceOperationalStatus\x12\'\n\x0c\x65ndpointList\x18\x05 \x03(\x0b\x32\x11.context.EndPoint\"%\n\x0c\x44\x65viceConfig\x12\x15\n\rdevice_config\x18\x01 \x01(\t\"C\n\x08\x45ndPoint\x12$\n\x07port_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x11\n\tport_type\x18\x02 \x01(\t\"t\n\nEndPointId\x12#\n\x06topoId\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12!\n\x06\x64\x65v_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\x12\x1e\n\x07port_id\x18\x03 \x01(\x0b\x32\r.context.Uuid\",\n\x08\x44\x65viceId\x12 \n\tdevice_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\"(\n\x06LinkId\x12\x1e\n\x07link_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"K\n\x12TeraFlowController\x12\"\n\x06\x63tl_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x11\n\tipaddress\x18\x02 \x01(\t\"Q\n\x14\x41uthenticationResult\x12\"\n\x06\x63tl_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x15\n\rauthenticated\x18\x02 \x01(\x08*N\n\x17\x44\x65viceOperationalStatus\x12\x0f\n\x0bKEEP_STATUS\x10\x00\x12\x15\n\x08\x44ISABLED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0b\n\x07\x45NABLED\x10\x01\x32\xa2\x01\n\x0e\x43ontextService\x12\x32\n\x0bGetTopology\x12\x0e.context.Empty\x1a\x11.context.Topology\"\x00\x12+\n\x07\x41\x64\x64Link\x12\r.context.Link\x1a\x0f.context.LinkId\"\x00\x12/\n\nDeleteLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x62\x06proto3' + serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\"\x07\n\x05\x45mpty\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"0\n\tContextId\x12#\n\x0c\x63ontext_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x87\x01\n\x07\x43ontext\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12#\n\x08topology\x18\x02 \x03(\x0b\x32\x11.context.Topology\x12/\n\ncontroller\x18\x03 \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\"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\"t\n\x08Topology\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12 \n\x07\x64\x65vices\x18\x02 \x03(\x0b\x32\x0f.context.Device\x12\x1c\n\x05links\x18\x03 \x03(\x0b\x32\r.context.Link\";\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\".\n\x08\x44\x65viceId\x12\"\n\x0b\x64\x65vice_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x8b\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\x12\x43\n\x19\x64\x65vive_operational_status\x18\x04 \x01(\x0e\x32 .context.DeviceOperationalStatus\x12-\n\x0e\x64\x65vice_drivers\x18\x05 \x03(\x0e\x32\x15.context.DeviceDriver\x12$\n\tendpoints\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\"*\n\x06LinkId\x12 \n\tlink_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"P\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12&\n\tendpoints\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\"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\"\x8d\x02\n\x07Service\x12&\n\nservice_id\x18\x01 \x01(\x0b\x32\x12.context.ServiceId\x12*\n\x0cservice_type\x18\x02 \x01(\x0e\x32\x14.context.ServiceType\x12&\n\tendpoints\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12(\n\x0b\x63onstraints\x18\x04 \x03(\x0b\x32\x13.context.Constraint\x12,\n\rservice_state\x18\x05 \x01(\x0b\x32\x15.context.ServiceState\x12.\n\x0eservice_config\x18\x06 \x01(\x0b\x32\x16.context.ServiceConfig\"@\n\x0cServiceState\x12\x30\n\rservice_state\x18\x01 \x01(\x0e\x32\x19.context.ServiceStateEnum\":\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\"\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\"G\n\x08\x45ndPoint\x12(\n\x0b\x65ndpoint_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x11\n\tport_type\x18\x02 \x01(\t\"a\n\nConfigRule\x12%\n\x06\x61\x63tion\x18\x01 \x01(\x0e\x32\x15.context.ConfigAction\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*\x9d\x01\n\x0c\x44\x65viceDriver\x12\x14\n\x10\x44RIVER_UNDEFINED\x10\x00\x12\x15\n\x11\x44RIVER_OPENCONFIG\x10\x01\x12\x18\n\x14\x44RIVER_TRANSPORT_API\x10\x02\x12\r\n\tDRIVER_P4\x10\x03\x12 \n\x1c\x44RIVER_IETF_NETWORK_TOPOLOGY\x10\x04\x12\x15\n\x11\x44RIVER_ONF_TR_352\x10\x05*N\n\x17\x44\x65viceOperationalStatus\x12\x0f\n\x0bKEEP_STATUS\x10\x00\x12\x15\n\x08\x44ISABLED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0b\n\x07\x45NABLED\x10\x01*}\n\x0bServiceType\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*j\n\x10ServiceStateEnum\x12\x19\n\x15SERVICESTATUS_PLANNED\x10\x00\x12\x18\n\x14SERVICESTATUS_ACTIVE\x10\x01\x12!\n\x1dSERVICESTATUS_PENDING_REMOVAL\x10\x02*Y\n\x0c\x43onfigAction\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\xe6\n\n\x0e\x43ontextService\x12\x39\n\rGetContextIds\x12\x0e.context.Empty\x1a\x16.context.ContextIdList\"\x00\x12\x35\n\x0bGetContexts\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\rDeleteContext\x12\x12.context.ContextId\x1a\x0e.context.Empty\"\x00\x12?\n\x0eGetTopologyIds\x12\x12.context.ContextId\x1a\x17.context.TopologyIdList\"\x00\x12<\n\rGetTopologies\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\x0e\x44\x65leteTopology\x12\x13.context.TopologyId\x1a\x0e.context.Empty\"\x00\x12\x37\n\x0cGetDeviceIds\x12\x0e.context.Empty\x1a\x15.context.DeviceIdList\"\x00\x12\x33\n\nGetDevices\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\x33\n\nGetLinkIds\x12\x0e.context.Empty\x1a\x13.context.LinkIdList\"\x00\x12/\n\x08GetLinks\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\nDeleteLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x12=\n\rGetServiceIds\x12\x12.context.ContextId\x1a\x16.context.ServiceIdList\"\x00\x12\x39\n\x0bGetServices\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\rDeleteService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x62\x06proto3' ) +_DEVICEDRIVER = _descriptor.EnumDescriptor( + name='DeviceDriver', + full_name='context.DeviceDriver', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DRIVER_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DRIVER_OPENCONFIG', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DRIVER_TRANSPORT_API', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DRIVER_P4', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DRIVER_IETF_NETWORK_TOPOLOGY', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DRIVER_ONF_TR_352', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=2855, + serialized_end=3012, +) +_sym_db.RegisterEnumDescriptor(_DEVICEDRIVER) + +DeviceDriver = enum_type_wrapper.EnumTypeWrapper(_DEVICEDRIVER) _DEVICEOPERATIONALSTATUS = _descriptor.EnumDescriptor( name='DeviceOperationalStatus', full_name='context.DeviceOperationalStatus', @@ -48,15 +94,129 @@ _DEVICEOPERATIONALSTATUS = _descriptor.EnumDescriptor( ], containing_type=None, serialized_options=None, - serialized_start=1271, - serialized_end=1349, + serialized_start=3014, + serialized_end=3092, ) _sym_db.RegisterEnumDescriptor(_DEVICEOPERATIONALSTATUS) DeviceOperationalStatus = enum_type_wrapper.EnumTypeWrapper(_DEVICEOPERATIONALSTATUS) +_SERVICETYPE = _descriptor.EnumDescriptor( + name='ServiceType', + full_name='context.ServiceType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L3NM', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L2NM', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_TAPI_CONNECTIVITY_SERVICE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3094, + serialized_end=3219, +) +_sym_db.RegisterEnumDescriptor(_SERVICETYPE) + +ServiceType = enum_type_wrapper.EnumTypeWrapper(_SERVICETYPE) +_SERVICESTATEENUM = _descriptor.EnumDescriptor( + name='ServiceStateEnum', + full_name='context.ServiceStateEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PLANNED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_ACTIVE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PENDING_REMOVAL', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3221, + serialized_end=3327, +) +_sym_db.RegisterEnumDescriptor(_SERVICESTATEENUM) + +ServiceStateEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICESTATEENUM) +_CONFIGACTION = _descriptor.EnumDescriptor( + name='ConfigAction', + full_name='context.ConfigAction', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_SET', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_DELETE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3329, + serialized_end=3418, +) +_sym_db.RegisterEnumDescriptor(_CONFIGACTION) + +ConfigAction = enum_type_wrapper.EnumTypeWrapper(_CONFIGACTION) +DRIVER_UNDEFINED = 0 +DRIVER_OPENCONFIG = 1 +DRIVER_TRANSPORT_API = 2 +DRIVER_P4 = 3 +DRIVER_IETF_NETWORK_TOPOLOGY = 4 +DRIVER_ONF_TR_352 = 5 KEEP_STATUS = 0 DISABLED = -1 ENABLED = 1 +SERVICETYPE_UNKNOWN = 0 +SERVICETYPE_L3NM = 1 +SERVICETYPE_L2NM = 2 +SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3 +SERVICESTATUS_PLANNED = 0 +SERVICESTATUS_ACTIVE = 1 +SERVICESTATUS_PENDING_REMOVAL = 2 +CONFIGACTION_UNDEFINED = 0 +CONFIGACTION_SET = 1 +CONFIGACTION_DELETE = 2 @@ -85,32 +245,18 @@ _EMPTY = _descriptor.Descriptor( ) -_CONTEXT = _descriptor.Descriptor( - name='Context', - full_name='context.Context', +_UUID = _descriptor.Descriptor( + name='Uuid', + full_name='context.Uuid', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contextId', full_name='context.Context.contextId', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='topo', full_name='context.Context.topo', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='ctl', full_name='context.Context.ctl', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='uuid', full_name='context.Uuid.uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), 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), @@ -127,7 +273,7 @@ _CONTEXT = _descriptor.Descriptor( oneofs=[ ], serialized_start=35, - serialized_end=158, + serialized_end=55, ) @@ -140,7 +286,7 @@ _CONTEXTID = _descriptor.Descriptor( create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contextUuid', full_name='context.ContextId.contextUuid', index=0, + name='context_uuid', full_name='context.ContextId.context_uuid', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -158,37 +304,37 @@ _CONTEXTID = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=160, - serialized_end=207, + serialized_start=57, + serialized_end=105, ) -_TOPOLOGY = _descriptor.Descriptor( - name='Topology', - full_name='context.Topology', +_CONTEXT = _descriptor.Descriptor( + name='Context', + full_name='context.Context', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='topoId', full_name='context.Topology.topoId', index=0, - number=2, type=11, cpp_type=10, label=1, + name='context_id', full_name='context.Context.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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='device', full_name='context.Topology.device', index=1, - number=3, type=11, cpp_type=10, label=3, + name='topology', full_name='context.Context.topology', index=1, + number=2, type=11, cpp_type=10, 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), _descriptor.FieldDescriptor( - name='link', full_name='context.Topology.link', index=2, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], + name='controller', full_name='context.Context.controller', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, 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), @@ -204,29 +350,22 @@ _TOPOLOGY = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=209, - serialized_end=318, + serialized_start=108, + serialized_end=243, ) -_LINK = _descriptor.Descriptor( - name='Link', - full_name='context.Link', +_CONTEXTIDLIST = _descriptor.Descriptor( + name='ContextIdList', + full_name='context.ContextIdList', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='link_id', full_name='context.Link.link_id', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='endpointList', full_name='context.Link.endpointList', index=1, - number=2, type=11, cpp_type=10, label=3, + name='context_ids', full_name='context.ContextIdList.context_ids', index=0, + number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -243,30 +382,23 @@ _LINK = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=320, - serialized_end=403, + serialized_start=245, + serialized_end=301, ) -_TOPOLOGYID = _descriptor.Descriptor( - name='TopologyId', - full_name='context.TopologyId', +_CONTEXTLIST = _descriptor.Descriptor( + name='ContextList', + full_name='context.ContextList', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='contextId', full_name='context.TopologyId.contextId', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='topoId', full_name='context.TopologyId.topoId', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, + name='contexts', full_name='context.ContextList.contexts', index=0, + number=1, type=11, cpp_type=10, 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), @@ -282,30 +414,30 @@ _TOPOLOGYID = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=405, - serialized_end=487, + serialized_start=303, + serialized_end=352, ) -_CONSTRAINT = _descriptor.Descriptor( - name='Constraint', - full_name='context.Constraint', +_TOPOLOGYID = _descriptor.Descriptor( + name='TopologyId', + full_name='context.TopologyId', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='constraint_type', full_name='context.Constraint.constraint_type', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='context_id', full_name='context.TopologyId.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, 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='constraint_value', full_name='context.Constraint.constraint_value', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='topology_uuid', full_name='context.TopologyId.topology_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, 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), @@ -321,50 +453,36 @@ _CONSTRAINT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=489, - serialized_end=552, + serialized_start=354, + serialized_end=444, ) -_DEVICE = _descriptor.Descriptor( - name='Device', - full_name='context.Device', +_TOPOLOGY = _descriptor.Descriptor( + name='Topology', + full_name='context.Topology', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='device_id', full_name='context.Device.device_id', index=0, + name='topology_id', full_name='context.Topology.topology_id', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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='device_type', full_name='context.Device.device_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - 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='device_config', full_name='context.Device.device_config', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='devOperationalStatus', full_name='context.Device.devOperationalStatus', index=3, - number=4, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, + name='devices', full_name='context.Topology.devices', index=1, + number=2, type=11, cpp_type=10, 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), _descriptor.FieldDescriptor( - name='endpointList', full_name='context.Device.endpointList', index=4, - number=5, type=11, cpp_type=10, label=3, + name='links', full_name='context.Topology.links', index=2, + number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -381,23 +499,23 @@ _DEVICE = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=555, - serialized_end=773, + serialized_start=446, + serialized_end=562, ) -_DEVICECONFIG = _descriptor.Descriptor( - name='DeviceConfig', - full_name='context.DeviceConfig', +_TOPOLOGYIDLIST = _descriptor.Descriptor( + name='TopologyIdList', + full_name='context.TopologyIdList', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='device_config', full_name='context.DeviceConfig.device_config', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='topology_ids', full_name='context.TopologyIdList.topology_ids', index=0, + number=1, type=11, cpp_type=10, 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), @@ -413,30 +531,23 @@ _DEVICECONFIG = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=775, - serialized_end=812, + serialized_start=564, + serialized_end=623, ) -_ENDPOINT = _descriptor.Descriptor( - name='EndPoint', - full_name='context.EndPoint', +_TOPOLOGYLIST = _descriptor.Descriptor( + name='TopologyList', + full_name='context.TopologyList', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='port_id', full_name='context.EndPoint.port_id', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='port_type', full_name='context.EndPoint.port_type', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='topologies', full_name='context.TopologyList.topologies', index=0, + number=1, type=11, cpp_type=10, 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), @@ -452,40 +563,26 @@ _ENDPOINT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=814, - serialized_end=881, + serialized_start=625, + serialized_end=678, ) -_ENDPOINTID = _descriptor.Descriptor( - name='EndPointId', - full_name='context.EndPointId', +_DEVICEID = _descriptor.Descriptor( + name='DeviceId', + full_name='context.DeviceId', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='topoId', full_name='context.EndPointId.topoId', index=0, + name='device_uuid', full_name='context.DeviceId.device_uuid', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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='dev_id', full_name='context.EndPointId.dev_id', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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='port_id', full_name='context.EndPointId.port_id', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - 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=[ ], @@ -498,40 +595,171 @@ _ENDPOINTID = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=883, - serialized_end=999, + serialized_start=680, + serialized_end=726, ) -_DEVICEID = _descriptor.Descriptor( - name='DeviceId', - full_name='context.DeviceId', +_DEVICE = _descriptor.Descriptor( + name='Device', + full_name='context.Device', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='device_id', full_name='context.DeviceId.device_id', index=0, + name='device_id', full_name='context.Device.device_id', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], + _descriptor.FieldDescriptor( + name='device_type', full_name='context.Device.device_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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='device_config', full_name='context.Device.device_config', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='devive_operational_status', full_name='context.Device.devive_operational_status', 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), + _descriptor.FieldDescriptor( + name='device_drivers', full_name='context.Device.device_drivers', index=4, + number=5, 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), + _descriptor.FieldDescriptor( + name='endpoints', full_name='context.Device.endpoints', index=5, + number=6, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=729, + serialized_end=996, +) + + +_DEVICECONFIG = _descriptor.Descriptor( + name='DeviceConfig', + full_name='context.DeviceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.DeviceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=998, + serialized_end=1055, +) + + +_DEVICEIDLIST = _descriptor.Descriptor( + name='DeviceIdList', + full_name='context.DeviceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_ids', full_name='context.DeviceIdList.device_ids', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1057, + serialized_end=1110, +) + + +_DEVICELIST = _descriptor.Descriptor( + name='DeviceList', + full_name='context.DeviceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='devices', full_name='context.DeviceList.devices', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], oneofs=[ ], - serialized_start=1001, - serialized_end=1045, + serialized_start=1112, + serialized_end=1158, ) @@ -544,7 +772,7 @@ _LINKID = _descriptor.Descriptor( create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='link_id', full_name='context.LinkId.link_id', index=0, + name='link_uuid', full_name='context.LinkId.link_uuid', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -562,23 +790,30 @@ _LINKID = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1047, - serialized_end=1087, + serialized_start=1160, + serialized_end=1202, ) -_UUID = _descriptor.Descriptor( - name='Uuid', - full_name='context.Uuid', +_LINK = _descriptor.Descriptor( + name='Link', + full_name='context.Link', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='uuid', full_name='context.Uuid.uuid', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='link_id', full_name='context.Link.link_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='endpoints', full_name='context.Link.endpoints', index=1, + number=2, type=11, cpp_type=10, 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), @@ -594,30 +829,94 @@ _UUID = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1089, - serialized_end=1109, + serialized_start=1204, + serialized_end=1284, ) -_TERAFLOWCONTROLLER = _descriptor.Descriptor( - name='TeraFlowController', - full_name='context.TeraFlowController', +_LINKIDLIST = _descriptor.Descriptor( + name='LinkIdList', + full_name='context.LinkIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_ids', full_name='context.LinkIdList.link_ids', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1286, + serialized_end=1333, +) + + +_LINKLIST = _descriptor.Descriptor( + name='LinkList', + full_name='context.LinkList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='links', full_name='context.LinkList.links', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1335, + serialized_end=1375, +) + + +_SERVICEID = _descriptor.Descriptor( + name='ServiceId', + full_name='context.ServiceId', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='ctl_id', full_name='context.TeraFlowController.ctl_id', index=0, + name='context_id', full_name='context.ServiceId.context_id', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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='ipaddress', full_name='context.TeraFlowController.ipaddress', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), + name='service_uuid', full_name='context.ServiceId.service_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, 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), @@ -633,30 +932,58 @@ _TERAFLOWCONTROLLER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1111, - serialized_end=1186, + serialized_start=1377, + serialized_end=1465, ) -_AUTHENTICATIONRESULT = _descriptor.Descriptor( - name='AuthenticationResult', - full_name='context.AuthenticationResult', +_SERVICE = _descriptor.Descriptor( + name='Service', + full_name='context.Service', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='ctl_id', full_name='context.AuthenticationResult.ctl_id', index=0, + name='service_id', full_name='context.Service.service_id', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, 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='authenticated', full_name='context.AuthenticationResult.authenticated', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, + name='service_type', full_name='context.Service.service_type', index=1, + number=2, 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), + _descriptor.FieldDescriptor( + name='endpoints', full_name='context.Service.endpoints', index=2, + number=3, type=11, cpp_type=10, 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), + _descriptor.FieldDescriptor( + name='constraints', full_name='context.Service.constraints', index=3, + number=4, type=11, cpp_type=10, 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), + _descriptor.FieldDescriptor( + name='service_state', full_name='context.Service.service_state', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='service_config', full_name='context.Service.service_config', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, 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), @@ -672,65 +999,642 @@ _AUTHENTICATIONRESULT = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1188, - serialized_end=1269, + serialized_start=1468, + serialized_end=1737, ) -_CONTEXT.fields_by_name['contextId'].message_type = _CONTEXTID -_CONTEXT.fields_by_name['topo'].message_type = _TOPOLOGY -_CONTEXT.fields_by_name['ctl'].message_type = _TERAFLOWCONTROLLER -_CONTEXTID.fields_by_name['contextUuid'].message_type = _UUID -_TOPOLOGY.fields_by_name['topoId'].message_type = _TOPOLOGYID -_TOPOLOGY.fields_by_name['device'].message_type = _DEVICE -_TOPOLOGY.fields_by_name['link'].message_type = _LINK -_LINK.fields_by_name['link_id'].message_type = _LINKID -_LINK.fields_by_name['endpointList'].message_type = _ENDPOINTID -_TOPOLOGYID.fields_by_name['contextId'].message_type = _CONTEXTID -_TOPOLOGYID.fields_by_name['topoId'].message_type = _UUID -_DEVICE.fields_by_name['device_id'].message_type = _DEVICEID -_DEVICE.fields_by_name['device_config'].message_type = _DEVICECONFIG -_DEVICE.fields_by_name['devOperationalStatus'].enum_type = _DEVICEOPERATIONALSTATUS -_DEVICE.fields_by_name['endpointList'].message_type = _ENDPOINT -_ENDPOINT.fields_by_name['port_id'].message_type = _ENDPOINTID -_ENDPOINTID.fields_by_name['topoId'].message_type = _TOPOLOGYID -_ENDPOINTID.fields_by_name['dev_id'].message_type = _DEVICEID -_ENDPOINTID.fields_by_name['port_id'].message_type = _UUID -_DEVICEID.fields_by_name['device_id'].message_type = _UUID -_LINKID.fields_by_name['link_id'].message_type = _UUID -_TERAFLOWCONTROLLER.fields_by_name['ctl_id'].message_type = _CONTEXTID -_AUTHENTICATIONRESULT.fields_by_name['ctl_id'].message_type = _CONTEXTID -DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY -DESCRIPTOR.message_types_by_name['Context'] = _CONTEXT -DESCRIPTOR.message_types_by_name['ContextId'] = _CONTEXTID -DESCRIPTOR.message_types_by_name['Topology'] = _TOPOLOGY -DESCRIPTOR.message_types_by_name['Link'] = _LINK -DESCRIPTOR.message_types_by_name['TopologyId'] = _TOPOLOGYID -DESCRIPTOR.message_types_by_name['Constraint'] = _CONSTRAINT -DESCRIPTOR.message_types_by_name['Device'] = _DEVICE -DESCRIPTOR.message_types_by_name['DeviceConfig'] = _DEVICECONFIG -DESCRIPTOR.message_types_by_name['EndPoint'] = _ENDPOINT -DESCRIPTOR.message_types_by_name['EndPointId'] = _ENDPOINTID -DESCRIPTOR.message_types_by_name['DeviceId'] = _DEVICEID -DESCRIPTOR.message_types_by_name['LinkId'] = _LINKID -DESCRIPTOR.message_types_by_name['Uuid'] = _UUID -DESCRIPTOR.message_types_by_name['TeraFlowController'] = _TERAFLOWCONTROLLER -DESCRIPTOR.message_types_by_name['AuthenticationResult'] = _AUTHENTICATIONRESULT -DESCRIPTOR.enum_types_by_name['DeviceOperationalStatus'] = _DEVICEOPERATIONALSTATUS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { - 'DESCRIPTOR' : _EMPTY, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Empty) - }) -_sym_db.RegisterMessage(Empty) -Context = _reflection.GeneratedProtocolMessageType('Context', (_message.Message,), { - 'DESCRIPTOR' : _CONTEXT, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Context) - }) -_sym_db.RegisterMessage(Context) +_SERVICESTATE = _descriptor.Descriptor( + name='ServiceState', + full_name='context.ServiceState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_state', full_name='context.ServiceState.service_state', index=0, + number=1, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1739, + serialized_end=1803, +) + + +_SERVICECONFIG = _descriptor.Descriptor( + name='ServiceConfig', + full_name='context.ServiceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.ServiceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1805, + serialized_end=1863, +) + + +_SERVICEIDLIST = _descriptor.Descriptor( + name='ServiceIdList', + full_name='context.ServiceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_ids', full_name='context.ServiceIdList.service_ids', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1865, + serialized_end=1921, +) + + +_SERVICELIST = _descriptor.Descriptor( + name='ServiceList', + full_name='context.ServiceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='services', full_name='context.ServiceList.services', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1923, + serialized_end=1972, +) + + +_ENDPOINTID = _descriptor.Descriptor( + name='EndPointId', + full_name='context.EndPointId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.EndPointId.topology_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='device_id', full_name='context.EndPointId.device_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='endpoint_uuid', full_name='context.EndPointId.endpoint_uuid', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1975, + serialized_end=2105, +) + + +_ENDPOINT = _descriptor.Descriptor( + name='EndPoint', + full_name='context.EndPoint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoint_id', full_name='context.EndPoint.endpoint_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='port_type', full_name='context.EndPoint.port_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2107, + serialized_end=2178, +) + + +_CONFIGRULE = _descriptor.Descriptor( + name='ConfigRule', + full_name='context.ConfigRule', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='action', full_name='context.ConfigRule.action', index=0, + number=1, 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), + _descriptor.FieldDescriptor( + name='resource_key', full_name='context.ConfigRule.resource_key', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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='resource_value', full_name='context.ConfigRule.resource_value', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2180, + serialized_end=2277, +) + + +_CONSTRAINT = _descriptor.Descriptor( + name='Constraint', + full_name='context.Constraint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='constraint_type', full_name='context.Constraint.constraint_type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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='constraint_value', full_name='context.Constraint.constraint_value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2279, + serialized_end=2342, +) + + +_CONNECTIONID = _descriptor.Descriptor( + name='ConnectionId', + full_name='context.ConnectionId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_uuid', full_name='context.ConnectionId.connection_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2344, + serialized_end=2398, +) + + +_CONNECTION = _descriptor.Descriptor( + name='Connection', + full_name='context.Connection', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='context.Connection.connection_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='related_service_id', full_name='context.Connection.related_service_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='path', full_name='context.Connection.path', index=2, + number=3, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2401, + serialized_end=2542, +) + + +_CONNECTIONIDLIST = _descriptor.Descriptor( + name='ConnectionIdList', + full_name='context.ConnectionIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_ids', full_name='context.ConnectionIdList.connection_ids', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2544, + serialized_end=2609, +) + + +_CONNECTIONLIST = _descriptor.Descriptor( + name='ConnectionList', + full_name='context.ConnectionList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connections', full_name='context.ConnectionList.connections', index=0, + number=1, type=11, cpp_type=10, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2611, + serialized_end=2669, +) + + +_TERAFLOWCONTROLLER = _descriptor.Descriptor( + name='TeraFlowController', + full_name='context.TeraFlowController', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.TeraFlowController.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='ip_address', full_name='context.TeraFlowController.ip_address', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + 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='port', full_name='context.TeraFlowController.port', index=2, + number=3, type=13, cpp_type=3, 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2671, + serialized_end=2765, +) + + +_AUTHENTICATIONRESULT = _descriptor.Descriptor( + name='AuthenticationResult', + full_name='context.AuthenticationResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.AuthenticationResult.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + 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='authenticated', full_name='context.AuthenticationResult.authenticated', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + 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=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2767, + serialized_end=2852, +) + +_CONTEXTID.fields_by_name['context_uuid'].message_type = _UUID +_CONTEXT.fields_by_name['context_id'].message_type = _CONTEXTID +_CONTEXT.fields_by_name['topology'].message_type = _TOPOLOGY +_CONTEXT.fields_by_name['controller'].message_type = _TERAFLOWCONTROLLER +_CONTEXTIDLIST.fields_by_name['context_ids'].message_type = _CONTEXTID +_CONTEXTLIST.fields_by_name['contexts'].message_type = _CONTEXT +_TOPOLOGYID.fields_by_name['context_id'].message_type = _CONTEXTID +_TOPOLOGYID.fields_by_name['topology_uuid'].message_type = _UUID +_TOPOLOGY.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_TOPOLOGY.fields_by_name['devices'].message_type = _DEVICE +_TOPOLOGY.fields_by_name['links'].message_type = _LINK +_TOPOLOGYIDLIST.fields_by_name['topology_ids'].message_type = _TOPOLOGYID +_TOPOLOGYLIST.fields_by_name['topologies'].message_type = _TOPOLOGY +_DEVICEID.fields_by_name['device_uuid'].message_type = _UUID +_DEVICE.fields_by_name['device_id'].message_type = _DEVICEID +_DEVICE.fields_by_name['device_config'].message_type = _DEVICECONFIG +_DEVICE.fields_by_name['devive_operational_status'].enum_type = _DEVICEOPERATIONALSTATUS +_DEVICE.fields_by_name['device_drivers'].enum_type = _DEVICEDRIVER +_DEVICE.fields_by_name['endpoints'].message_type = _ENDPOINT +_DEVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_DEVICEIDLIST.fields_by_name['device_ids'].message_type = _DEVICEID +_DEVICELIST.fields_by_name['devices'].message_type = _DEVICE +_LINKID.fields_by_name['link_uuid'].message_type = _UUID +_LINK.fields_by_name['link_id'].message_type = _LINKID +_LINK.fields_by_name['endpoints'].message_type = _ENDPOINTID +_LINKIDLIST.fields_by_name['link_ids'].message_type = _LINKID +_LINKLIST.fields_by_name['links'].message_type = _LINK +_SERVICEID.fields_by_name['context_id'].message_type = _CONTEXTID +_SERVICEID.fields_by_name['service_uuid'].message_type = _UUID +_SERVICE.fields_by_name['service_id'].message_type = _SERVICEID +_SERVICE.fields_by_name['service_type'].enum_type = _SERVICETYPE +_SERVICE.fields_by_name['endpoints'].message_type = _ENDPOINTID +_SERVICE.fields_by_name['constraints'].message_type = _CONSTRAINT +_SERVICE.fields_by_name['service_state'].message_type = _SERVICESTATE +_SERVICE.fields_by_name['service_config'].message_type = _SERVICECONFIG +_SERVICESTATE.fields_by_name['service_state'].enum_type = _SERVICESTATEENUM +_SERVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_SERVICEIDLIST.fields_by_name['service_ids'].message_type = _SERVICEID +_SERVICELIST.fields_by_name['services'].message_type = _SERVICE +_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 +_CONFIGRULE.fields_by_name['action'].enum_type = _CONFIGACTION +_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 +_CONNECTION.fields_by_name['path'].message_type = _ENDPOINTID +_CONNECTIONIDLIST.fields_by_name['connection_ids'].message_type = _CONNECTIONID +_CONNECTIONLIST.fields_by_name['connections'].message_type = _CONNECTION +_TERAFLOWCONTROLLER.fields_by_name['context_id'].message_type = _CONTEXTID +_AUTHENTICATIONRESULT.fields_by_name['context_id'].message_type = _CONTEXTID +DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY +DESCRIPTOR.message_types_by_name['Uuid'] = _UUID +DESCRIPTOR.message_types_by_name['ContextId'] = _CONTEXTID +DESCRIPTOR.message_types_by_name['Context'] = _CONTEXT +DESCRIPTOR.message_types_by_name['ContextIdList'] = _CONTEXTIDLIST +DESCRIPTOR.message_types_by_name['ContextList'] = _CONTEXTLIST +DESCRIPTOR.message_types_by_name['TopologyId'] = _TOPOLOGYID +DESCRIPTOR.message_types_by_name['Topology'] = _TOPOLOGY +DESCRIPTOR.message_types_by_name['TopologyIdList'] = _TOPOLOGYIDLIST +DESCRIPTOR.message_types_by_name['TopologyList'] = _TOPOLOGYLIST +DESCRIPTOR.message_types_by_name['DeviceId'] = _DEVICEID +DESCRIPTOR.message_types_by_name['Device'] = _DEVICE +DESCRIPTOR.message_types_by_name['DeviceConfig'] = _DEVICECONFIG +DESCRIPTOR.message_types_by_name['DeviceIdList'] = _DEVICEIDLIST +DESCRIPTOR.message_types_by_name['DeviceList'] = _DEVICELIST +DESCRIPTOR.message_types_by_name['LinkId'] = _LINKID +DESCRIPTOR.message_types_by_name['Link'] = _LINK +DESCRIPTOR.message_types_by_name['LinkIdList'] = _LINKIDLIST +DESCRIPTOR.message_types_by_name['LinkList'] = _LINKLIST +DESCRIPTOR.message_types_by_name['ServiceId'] = _SERVICEID +DESCRIPTOR.message_types_by_name['Service'] = _SERVICE +DESCRIPTOR.message_types_by_name['ServiceState'] = _SERVICESTATE +DESCRIPTOR.message_types_by_name['ServiceConfig'] = _SERVICECONFIG +DESCRIPTOR.message_types_by_name['ServiceIdList'] = _SERVICEIDLIST +DESCRIPTOR.message_types_by_name['ServiceList'] = _SERVICELIST +DESCRIPTOR.message_types_by_name['EndPointId'] = _ENDPOINTID +DESCRIPTOR.message_types_by_name['EndPoint'] = _ENDPOINT +DESCRIPTOR.message_types_by_name['ConfigRule'] = _CONFIGRULE +DESCRIPTOR.message_types_by_name['Constraint'] = _CONSTRAINT +DESCRIPTOR.message_types_by_name['ConnectionId'] = _CONNECTIONID +DESCRIPTOR.message_types_by_name['Connection'] = _CONNECTION +DESCRIPTOR.message_types_by_name['ConnectionIdList'] = _CONNECTIONIDLIST +DESCRIPTOR.message_types_by_name['ConnectionList'] = _CONNECTIONLIST +DESCRIPTOR.message_types_by_name['TeraFlowController'] = _TERAFLOWCONTROLLER +DESCRIPTOR.message_types_by_name['AuthenticationResult'] = _AUTHENTICATIONRESULT +DESCRIPTOR.enum_types_by_name['DeviceDriver'] = _DEVICEDRIVER +DESCRIPTOR.enum_types_by_name['DeviceOperationalStatus'] = _DEVICEOPERATIONALSTATUS +DESCRIPTOR.enum_types_by_name['ServiceType'] = _SERVICETYPE +DESCRIPTOR.enum_types_by_name['ServiceStateEnum'] = _SERVICESTATEENUM +DESCRIPTOR.enum_types_by_name['ConfigAction'] = _CONFIGACTION +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { + 'DESCRIPTOR' : _EMPTY, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Empty) + }) +_sym_db.RegisterMessage(Empty) + +Uuid = _reflection.GeneratedProtocolMessageType('Uuid', (_message.Message,), { + 'DESCRIPTOR' : _UUID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Uuid) + }) +_sym_db.RegisterMessage(Uuid) ContextId = _reflection.GeneratedProtocolMessageType('ContextId', (_message.Message,), { 'DESCRIPTOR' : _CONTEXTID, @@ -739,19 +1643,26 @@ ContextId = _reflection.GeneratedProtocolMessageType('ContextId', (_message.Mess }) _sym_db.RegisterMessage(ContextId) -Topology = _reflection.GeneratedProtocolMessageType('Topology', (_message.Message,), { - 'DESCRIPTOR' : _TOPOLOGY, +Context = _reflection.GeneratedProtocolMessageType('Context', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXT, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Topology) + # @@protoc_insertion_point(class_scope:context.Context) }) -_sym_db.RegisterMessage(Topology) +_sym_db.RegisterMessage(Context) -Link = _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), { - 'DESCRIPTOR' : _LINK, +ContextIdList = _reflection.GeneratedProtocolMessageType('ContextIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTIDLIST, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Link) + # @@protoc_insertion_point(class_scope:context.ContextIdList) }) -_sym_db.RegisterMessage(Link) +_sym_db.RegisterMessage(ContextIdList) + +ContextList = _reflection.GeneratedProtocolMessageType('ContextList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextList) + }) +_sym_db.RegisterMessage(ContextList) TopologyId = _reflection.GeneratedProtocolMessageType('TopologyId', (_message.Message,), { 'DESCRIPTOR' : _TOPOLOGYID, @@ -760,12 +1671,33 @@ TopologyId = _reflection.GeneratedProtocolMessageType('TopologyId', (_message.Me }) _sym_db.RegisterMessage(TopologyId) -Constraint = _reflection.GeneratedProtocolMessageType('Constraint', (_message.Message,), { - 'DESCRIPTOR' : _CONSTRAINT, +Topology = _reflection.GeneratedProtocolMessageType('Topology', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGY, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Constraint) + # @@protoc_insertion_point(class_scope:context.Topology) }) -_sym_db.RegisterMessage(Constraint) +_sym_db.RegisterMessage(Topology) + +TopologyIdList = _reflection.GeneratedProtocolMessageType('TopologyIdList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyIdList) + }) +_sym_db.RegisterMessage(TopologyIdList) + +TopologyList = _reflection.GeneratedProtocolMessageType('TopologyList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyList) + }) +_sym_db.RegisterMessage(TopologyList) + +DeviceId = _reflection.GeneratedProtocolMessageType('DeviceId', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceId) + }) +_sym_db.RegisterMessage(DeviceId) Device = _reflection.GeneratedProtocolMessageType('Device', (_message.Message,), { 'DESCRIPTOR' : _DEVICE, @@ -781,12 +1713,89 @@ DeviceConfig = _reflection.GeneratedProtocolMessageType('DeviceConfig', (_messag }) _sym_db.RegisterMessage(DeviceConfig) -EndPoint = _reflection.GeneratedProtocolMessageType('EndPoint', (_message.Message,), { - 'DESCRIPTOR' : _ENDPOINT, +DeviceIdList = _reflection.GeneratedProtocolMessageType('DeviceIdList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEIDLIST, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.EndPoint) + # @@protoc_insertion_point(class_scope:context.DeviceIdList) }) -_sym_db.RegisterMessage(EndPoint) +_sym_db.RegisterMessage(DeviceIdList) + +DeviceList = _reflection.GeneratedProtocolMessageType('DeviceList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceList) + }) +_sym_db.RegisterMessage(DeviceList) + +LinkId = _reflection.GeneratedProtocolMessageType('LinkId', (_message.Message,), { + 'DESCRIPTOR' : _LINKID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkId) + }) +_sym_db.RegisterMessage(LinkId) + +Link = _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), { + 'DESCRIPTOR' : _LINK, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Link) + }) +_sym_db.RegisterMessage(Link) + +LinkIdList = _reflection.GeneratedProtocolMessageType('LinkIdList', (_message.Message,), { + 'DESCRIPTOR' : _LINKIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkIdList) + }) +_sym_db.RegisterMessage(LinkIdList) + +LinkList = _reflection.GeneratedProtocolMessageType('LinkList', (_message.Message,), { + 'DESCRIPTOR' : _LINKLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkList) + }) +_sym_db.RegisterMessage(LinkList) + +ServiceId = _reflection.GeneratedProtocolMessageType('ServiceId', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceId) + }) +_sym_db.RegisterMessage(ServiceId) + +Service = _reflection.GeneratedProtocolMessageType('Service', (_message.Message,), { + 'DESCRIPTOR' : _SERVICE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Service) + }) +_sym_db.RegisterMessage(Service) + +ServiceState = _reflection.GeneratedProtocolMessageType('ServiceState', (_message.Message,), { + 'DESCRIPTOR' : _SERVICESTATE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceState) + }) +_sym_db.RegisterMessage(ServiceState) + +ServiceConfig = _reflection.GeneratedProtocolMessageType('ServiceConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVICECONFIG, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceConfig) + }) +_sym_db.RegisterMessage(ServiceConfig) + +ServiceIdList = _reflection.GeneratedProtocolMessageType('ServiceIdList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceIdList) + }) +_sym_db.RegisterMessage(ServiceIdList) + +ServiceList = _reflection.GeneratedProtocolMessageType('ServiceList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceList) + }) +_sym_db.RegisterMessage(ServiceList) EndPointId = _reflection.GeneratedProtocolMessageType('EndPointId', (_message.Message,), { 'DESCRIPTOR' : _ENDPOINTID, @@ -795,26 +1804,54 @@ EndPointId = _reflection.GeneratedProtocolMessageType('EndPointId', (_message.Me }) _sym_db.RegisterMessage(EndPointId) -DeviceId = _reflection.GeneratedProtocolMessageType('DeviceId', (_message.Message,), { - 'DESCRIPTOR' : _DEVICEID, +EndPoint = _reflection.GeneratedProtocolMessageType('EndPoint', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINT, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.DeviceId) + # @@protoc_insertion_point(class_scope:context.EndPoint) }) -_sym_db.RegisterMessage(DeviceId) +_sym_db.RegisterMessage(EndPoint) -LinkId = _reflection.GeneratedProtocolMessageType('LinkId', (_message.Message,), { - 'DESCRIPTOR' : _LINKID, +ConfigRule = _reflection.GeneratedProtocolMessageType('ConfigRule', (_message.Message,), { + 'DESCRIPTOR' : _CONFIGRULE, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.LinkId) + # @@protoc_insertion_point(class_scope:context.ConfigRule) }) -_sym_db.RegisterMessage(LinkId) +_sym_db.RegisterMessage(ConfigRule) -Uuid = _reflection.GeneratedProtocolMessageType('Uuid', (_message.Message,), { - 'DESCRIPTOR' : _UUID, +Constraint = _reflection.GeneratedProtocolMessageType('Constraint', (_message.Message,), { + 'DESCRIPTOR' : _CONSTRAINT, '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Uuid) + # @@protoc_insertion_point(class_scope:context.Constraint) }) -_sym_db.RegisterMessage(Uuid) +_sym_db.RegisterMessage(Constraint) + +ConnectionId = _reflection.GeneratedProtocolMessageType('ConnectionId', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionId) + }) +_sym_db.RegisterMessage(ConnectionId) + +Connection = _reflection.GeneratedProtocolMessageType('Connection', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTION, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Connection) + }) +_sym_db.RegisterMessage(Connection) + +ConnectionIdList = _reflection.GeneratedProtocolMessageType('ConnectionIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionIdList) + }) +_sym_db.RegisterMessage(ConnectionIdList) + +ConnectionList = _reflection.GeneratedProtocolMessageType('ConnectionList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionList) + }) +_sym_db.RegisterMessage(ConnectionList) TeraFlowController = _reflection.GeneratedProtocolMessageType('TeraFlowController', (_message.Message,), { 'DESCRIPTOR' : _TERAFLOWCONTROLLER, @@ -839,24 +1876,194 @@ _CONTEXTSERVICE = _descriptor.ServiceDescriptor( index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=1352, - serialized_end=1514, + serialized_start=3421, + serialized_end=4803, methods=[ _descriptor.MethodDescriptor( - name='GetTopology', - full_name='context.ContextService.GetTopology', + name='GetContextIds', + full_name='context.ContextService.GetContextIds', index=0, containing_service=None, input_type=_EMPTY, - output_type=_TOPOLOGY, + output_type=_CONTEXTIDLIST, serialized_options=None, create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( - name='AddLink', - full_name='context.ContextService.AddLink', + name='GetContexts', + full_name='context.ContextService.GetContexts', index=1, containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetContext', + full_name='context.ContextService.GetContext', + index=2, + containing_service=None, + input_type=_CONTEXTID, + output_type=_CONTEXT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetContext', + full_name='context.ContextService.SetContext', + index=3, + containing_service=None, + input_type=_CONTEXT, + output_type=_CONTEXTID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DeleteContext', + full_name='context.ContextService.DeleteContext', + index=4, + containing_service=None, + input_type=_CONTEXTID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopologyIds', + full_name='context.ContextService.GetTopologyIds', + index=5, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopologies', + full_name='context.ContextService.GetTopologies', + index=6, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopology', + full_name='context.ContextService.GetTopology', + index=7, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_TOPOLOGY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetTopology', + full_name='context.ContextService.SetTopology', + index=8, + containing_service=None, + input_type=_TOPOLOGY, + output_type=_TOPOLOGYID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DeleteTopology', + full_name='context.ContextService.DeleteTopology', + index=9, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDeviceIds', + full_name='context.ContextService.GetDeviceIds', + index=10, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDevices', + full_name='context.ContextService.GetDevices', + index=11, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDevice', + full_name='context.ContextService.GetDevice', + index=12, + containing_service=None, + input_type=_DEVICEID, + output_type=_DEVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetDevice', + full_name='context.ContextService.SetDevice', + index=13, + containing_service=None, + input_type=_DEVICE, + output_type=_DEVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveDevice', + full_name='context.ContextService.RemoveDevice', + index=14, + containing_service=None, + input_type=_DEVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLinkIds', + full_name='context.ContextService.GetLinkIds', + index=15, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLinks', + full_name='context.ContextService.GetLinks', + index=16, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLink', + full_name='context.ContextService.GetLink', + index=17, + containing_service=None, + input_type=_LINKID, + output_type=_LINK, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetLink', + full_name='context.ContextService.SetLink', + index=18, + containing_service=None, input_type=_LINK, output_type=_LINKID, serialized_options=None, @@ -865,13 +2072,63 @@ _CONTEXTSERVICE = _descriptor.ServiceDescriptor( _descriptor.MethodDescriptor( name='DeleteLink', full_name='context.ContextService.DeleteLink', - index=2, + index=19, containing_service=None, input_type=_LINKID, output_type=_EMPTY, serialized_options=None, create_key=_descriptor._internal_create_key, ), + _descriptor.MethodDescriptor( + name='GetServiceIds', + full_name='context.ContextService.GetServiceIds', + index=20, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetServices', + full_name='context.ContextService.GetServices', + index=21, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetService', + full_name='context.ContextService.GetService', + index=22, + containing_service=None, + input_type=_SERVICEID, + output_type=_SERVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetService', + full_name='context.ContextService.SetService', + index=23, + containing_service=None, + input_type=_SERVICE, + output_type=_SERVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DeleteService', + full_name='context.ContextService.DeleteService', + index=24, + containing_service=None, + input_type=_SERVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), ]) _sym_db.RegisterServiceDescriptor(_CONTEXTSERVICE) diff --git a/src/context/proto/context_pb2_grpc.py b/src/context/proto/context_pb2_grpc.py index bfae5108cc4bc9a2f5ad93d0cbf25dbcfc65fc47..2dd4f98d6cd76184c7aeadfa3e719806e5c883dd 100644 --- a/src/context/proto/context_pb2_grpc.py +++ b/src/context/proto/context_pb2_grpc.py @@ -14,13 +14,98 @@ class ContextServiceStub(object): Args: channel: A grpc.Channel. """ + self.GetContextIds = channel.unary_unary( + '/context.ContextService/GetContextIds', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.ContextIdList.FromString, + ) + self.GetContexts = channel.unary_unary( + '/context.ContextService/GetContexts', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.ContextList.FromString, + ) + self.GetContext = channel.unary_unary( + '/context.ContextService/GetContext', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.Context.FromString, + ) + self.SetContext = channel.unary_unary( + '/context.ContextService/SetContext', + request_serializer=context__pb2.Context.SerializeToString, + response_deserializer=context__pb2.ContextId.FromString, + ) + self.DeleteContext = channel.unary_unary( + '/context.ContextService/DeleteContext', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.GetTopologyIds = channel.unary_unary( + '/context.ContextService/GetTopologyIds', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.TopologyIdList.FromString, + ) + self.GetTopologies = channel.unary_unary( + '/context.ContextService/GetTopologies', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.TopologyList.FromString, + ) self.GetTopology = channel.unary_unary( '/context.ContextService/GetTopology', - request_serializer=context__pb2.Empty.SerializeToString, + request_serializer=context__pb2.TopologyId.SerializeToString, response_deserializer=context__pb2.Topology.FromString, ) - self.AddLink = channel.unary_unary( - '/context.ContextService/AddLink', + self.SetTopology = channel.unary_unary( + '/context.ContextService/SetTopology', + request_serializer=context__pb2.Topology.SerializeToString, + response_deserializer=context__pb2.TopologyId.FromString, + ) + self.DeleteTopology = channel.unary_unary( + '/context.ContextService/DeleteTopology', + request_serializer=context__pb2.TopologyId.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.GetDeviceIds = channel.unary_unary( + '/context.ContextService/GetDeviceIds', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.DeviceIdList.FromString, + ) + self.GetDevices = channel.unary_unary( + '/context.ContextService/GetDevices', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.DeviceList.FromString, + ) + self.GetDevice = channel.unary_unary( + '/context.ContextService/GetDevice', + request_serializer=context__pb2.DeviceId.SerializeToString, + response_deserializer=context__pb2.Device.FromString, + ) + self.SetDevice = channel.unary_unary( + '/context.ContextService/SetDevice', + request_serializer=context__pb2.Device.SerializeToString, + response_deserializer=context__pb2.DeviceId.FromString, + ) + self.RemoveDevice = channel.unary_unary( + '/context.ContextService/RemoveDevice', + request_serializer=context__pb2.DeviceId.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.GetLinkIds = channel.unary_unary( + '/context.ContextService/GetLinkIds', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.LinkIdList.FromString, + ) + self.GetLinks = channel.unary_unary( + '/context.ContextService/GetLinks', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.LinkList.FromString, + ) + self.GetLink = channel.unary_unary( + '/context.ContextService/GetLink', + request_serializer=context__pb2.LinkId.SerializeToString, + response_deserializer=context__pb2.Link.FromString, + ) + self.SetLink = channel.unary_unary( + '/context.ContextService/SetLink', request_serializer=context__pb2.Link.SerializeToString, response_deserializer=context__pb2.LinkId.FromString, ) @@ -29,18 +114,145 @@ class ContextServiceStub(object): request_serializer=context__pb2.LinkId.SerializeToString, response_deserializer=context__pb2.Empty.FromString, ) + self.GetServiceIds = channel.unary_unary( + '/context.ContextService/GetServiceIds', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.ServiceIdList.FromString, + ) + self.GetServices = channel.unary_unary( + '/context.ContextService/GetServices', + request_serializer=context__pb2.ContextId.SerializeToString, + response_deserializer=context__pb2.ServiceList.FromString, + ) + self.GetService = channel.unary_unary( + '/context.ContextService/GetService', + request_serializer=context__pb2.ServiceId.SerializeToString, + response_deserializer=context__pb2.Service.FromString, + ) + self.SetService = channel.unary_unary( + '/context.ContextService/SetService', + request_serializer=context__pb2.Service.SerializeToString, + response_deserializer=context__pb2.ServiceId.FromString, + ) + self.DeleteService = channel.unary_unary( + '/context.ContextService/DeleteService', + request_serializer=context__pb2.ServiceId.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) class ContextServiceServicer(object): """Missing associated documentation comment in .proto file.""" + def GetContextIds(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetContexts(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetContext(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetContext(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteContext(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetTopologyIds(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetTopologies(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def GetTopology(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') - def AddLink(self, request, context): + def SetTopology(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteTopology(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetDeviceIds(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetDevices(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetDevice(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetDevice(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RemoveDevice(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetLinkIds(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetLinks(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetLink(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetLink(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') @@ -52,16 +264,131 @@ class ContextServiceServicer(object): context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') + def GetServiceIds(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetServices(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetService(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetService(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DeleteService(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + def add_ContextServiceServicer_to_server(servicer, server): rpc_method_handlers = { + 'GetContextIds': grpc.unary_unary_rpc_method_handler( + servicer.GetContextIds, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.ContextIdList.SerializeToString, + ), + 'GetContexts': grpc.unary_unary_rpc_method_handler( + servicer.GetContexts, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.ContextList.SerializeToString, + ), + 'GetContext': grpc.unary_unary_rpc_method_handler( + servicer.GetContext, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.Context.SerializeToString, + ), + 'SetContext': grpc.unary_unary_rpc_method_handler( + servicer.SetContext, + request_deserializer=context__pb2.Context.FromString, + response_serializer=context__pb2.ContextId.SerializeToString, + ), + 'DeleteContext': grpc.unary_unary_rpc_method_handler( + servicer.DeleteContext, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'GetTopologyIds': grpc.unary_unary_rpc_method_handler( + servicer.GetTopologyIds, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.TopologyIdList.SerializeToString, + ), + 'GetTopologies': grpc.unary_unary_rpc_method_handler( + servicer.GetTopologies, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.TopologyList.SerializeToString, + ), 'GetTopology': grpc.unary_unary_rpc_method_handler( servicer.GetTopology, - request_deserializer=context__pb2.Empty.FromString, + request_deserializer=context__pb2.TopologyId.FromString, response_serializer=context__pb2.Topology.SerializeToString, ), - 'AddLink': grpc.unary_unary_rpc_method_handler( - servicer.AddLink, + 'SetTopology': grpc.unary_unary_rpc_method_handler( + servicer.SetTopology, + request_deserializer=context__pb2.Topology.FromString, + response_serializer=context__pb2.TopologyId.SerializeToString, + ), + 'DeleteTopology': grpc.unary_unary_rpc_method_handler( + servicer.DeleteTopology, + request_deserializer=context__pb2.TopologyId.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'GetDeviceIds': grpc.unary_unary_rpc_method_handler( + servicer.GetDeviceIds, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.DeviceIdList.SerializeToString, + ), + 'GetDevices': grpc.unary_unary_rpc_method_handler( + servicer.GetDevices, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.DeviceList.SerializeToString, + ), + 'GetDevice': grpc.unary_unary_rpc_method_handler( + servicer.GetDevice, + request_deserializer=context__pb2.DeviceId.FromString, + response_serializer=context__pb2.Device.SerializeToString, + ), + 'SetDevice': grpc.unary_unary_rpc_method_handler( + servicer.SetDevice, + request_deserializer=context__pb2.Device.FromString, + response_serializer=context__pb2.DeviceId.SerializeToString, + ), + 'RemoveDevice': grpc.unary_unary_rpc_method_handler( + servicer.RemoveDevice, + request_deserializer=context__pb2.DeviceId.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'GetLinkIds': grpc.unary_unary_rpc_method_handler( + servicer.GetLinkIds, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.LinkIdList.SerializeToString, + ), + 'GetLinks': grpc.unary_unary_rpc_method_handler( + servicer.GetLinks, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.LinkList.SerializeToString, + ), + 'GetLink': grpc.unary_unary_rpc_method_handler( + servicer.GetLink, + request_deserializer=context__pb2.LinkId.FromString, + response_serializer=context__pb2.Link.SerializeToString, + ), + 'SetLink': grpc.unary_unary_rpc_method_handler( + servicer.SetLink, request_deserializer=context__pb2.Link.FromString, response_serializer=context__pb2.LinkId.SerializeToString, ), @@ -70,6 +397,31 @@ def add_ContextServiceServicer_to_server(servicer, server): request_deserializer=context__pb2.LinkId.FromString, response_serializer=context__pb2.Empty.SerializeToString, ), + 'GetServiceIds': grpc.unary_unary_rpc_method_handler( + servicer.GetServiceIds, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.ServiceIdList.SerializeToString, + ), + 'GetServices': grpc.unary_unary_rpc_method_handler( + servicer.GetServices, + request_deserializer=context__pb2.ContextId.FromString, + response_serializer=context__pb2.ServiceList.SerializeToString, + ), + 'GetService': grpc.unary_unary_rpc_method_handler( + servicer.GetService, + request_deserializer=context__pb2.ServiceId.FromString, + response_serializer=context__pb2.Service.SerializeToString, + ), + 'SetService': grpc.unary_unary_rpc_method_handler( + servicer.SetService, + request_deserializer=context__pb2.Service.FromString, + response_serializer=context__pb2.ServiceId.SerializeToString, + ), + 'DeleteService': grpc.unary_unary_rpc_method_handler( + servicer.DeleteService, + request_deserializer=context__pb2.ServiceId.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( 'context.ContextService', rpc_method_handlers) @@ -80,6 +432,125 @@ def add_ContextServiceServicer_to_server(servicer, server): class ContextService(object): """Missing associated documentation comment in .proto file.""" + @staticmethod + def GetContextIds(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetContextIds', + context__pb2.Empty.SerializeToString, + context__pb2.ContextIdList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetContexts(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetContexts', + context__pb2.Empty.SerializeToString, + context__pb2.ContextList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetContext(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetContext', + context__pb2.ContextId.SerializeToString, + context__pb2.Context.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetContext(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/SetContext', + context__pb2.Context.SerializeToString, + context__pb2.ContextId.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteContext(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/DeleteContext', + context__pb2.ContextId.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetTopologyIds(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetTopologyIds', + context__pb2.ContextId.SerializeToString, + context__pb2.TopologyIdList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetTopologies(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetTopologies', + context__pb2.ContextId.SerializeToString, + context__pb2.TopologyList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + @staticmethod def GetTopology(request, target, @@ -92,13 +563,183 @@ class ContextService(object): timeout=None, metadata=None): return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetTopology', - context__pb2.Empty.SerializeToString, + context__pb2.TopologyId.SerializeToString, context__pb2.Topology.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def AddLink(request, + def SetTopology(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/SetTopology', + context__pb2.Topology.SerializeToString, + context__pb2.TopologyId.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteTopology(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/DeleteTopology', + context__pb2.TopologyId.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetDeviceIds(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetDeviceIds', + context__pb2.Empty.SerializeToString, + context__pb2.DeviceIdList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetDevices(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetDevices', + context__pb2.Empty.SerializeToString, + context__pb2.DeviceList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetDevice(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetDevice', + context__pb2.DeviceId.SerializeToString, + context__pb2.Device.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetDevice(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/SetDevice', + context__pb2.Device.SerializeToString, + context__pb2.DeviceId.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RemoveDevice(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/RemoveDevice', + context__pb2.DeviceId.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetLinkIds(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetLinkIds', + context__pb2.Empty.SerializeToString, + context__pb2.LinkIdList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetLinks(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetLinks', + context__pb2.Empty.SerializeToString, + context__pb2.LinkList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetLink(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetLink', + context__pb2.LinkId.SerializeToString, + context__pb2.Link.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetLink(request, target, options=(), channel_credentials=None, @@ -108,7 +749,7 @@ class ContextService(object): wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/context.ContextService/AddLink', + return grpc.experimental.unary_unary(request, target, '/context.ContextService/SetLink', context__pb2.Link.SerializeToString, context__pb2.LinkId.FromString, options, channel_credentials, @@ -130,3 +771,88 @@ class ContextService(object): context__pb2.Empty.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetServiceIds(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetServiceIds', + context__pb2.ContextId.SerializeToString, + context__pb2.ServiceIdList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetServices(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetServices', + context__pb2.ContextId.SerializeToString, + context__pb2.ServiceList.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetService(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/GetService', + context__pb2.ServiceId.SerializeToString, + context__pb2.Service.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SetService(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/SetService', + context__pb2.Service.SerializeToString, + context__pb2.ServiceId.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DeleteService(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/context.ContextService/DeleteService', + context__pb2.ServiceId.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/context/service/__main__.py b/src/context/service/__main__.py index 69d2788e2f0bf30bd855f7578474c93afa04fe49..ed7aaba650e55ee6dc0cf73ac5ec4362e9ad9245 100644 --- a/src/context/service/__main__.py +++ b/src/context/service/__main__.py @@ -1,10 +1,10 @@ import logging, signal, sys, threading from prometheus_client import start_http_server from common.Settings import get_setting -from common.database.Factory import get_database from context.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, RESTAPI_SERVICE_PORT, \ RESTAPI_BASE_URL, METRICS_PORT -from context.service.ContextService import ContextService +from context.service.database.Factory import get_database +from context.service.grpc_server.ContextService import ContextService from context.service.rest_server.Server import Server from context.service.rest_server.resources.Context import Context @@ -12,18 +12,17 @@ terminate = threading.Event() logger = None def signal_handler(signal, frame): - global terminate, logger logger.warning('Terminate signal received') terminate.set() def main(): - global terminate, logger + global logger grpc_service_port = get_setting('CONTEXTSERVICE_SERVICE_PORT_GRPC', default=GRPC_SERVICE_PORT ) max_workers = get_setting('MAX_WORKERS', default=GRPC_MAX_WORKERS ) grace_period = get_setting('GRACE_PERIOD', default=GRPC_GRACE_PERIOD ) log_level = get_setting('LOG_LEVEL', default=LOG_LEVEL ) - restapi_service_port = get_setting('RESTAPI_SERVICE_PORT', default=RESTAPI_SERVICE_PORT) + restapi_service_port = get_setting('CONTEXTSERVICE_SERVICE_PORT_HTTP', default=RESTAPI_SERVICE_PORT) restapi_base_url = get_setting('RESTAPI_BASE_URL', default=RESTAPI_BASE_URL ) metrics_port = get_setting('METRICS_PORT', default=METRICS_PORT ) @@ -46,8 +45,7 @@ def main(): grpc_service.start() rest_server = Server(port=restapi_service_port, base_url=restapi_base_url) - rest_server.add_resource( - Context, '/restconf/config/context', endpoint='api.context', resource_class_args=(database,)) + rest_server.add_resource(Context, '/context', endpoint='api.context', resource_class_args=(database,)) rest_server.start() # Wait for Ctrl+C or termination signal diff --git a/src/context/service/database/Database.py b/src/context/service/database/Database.py new file mode 100644 index 0000000000000000000000000000000000000000..eb0117d1a0bfae4217be3a76467ed6e44552ecb7 --- /dev/null +++ b/src/context/service/database/Database.py @@ -0,0 +1,23 @@ +import logging +from typing import Optional, Union +from ._engine._Database import _Database +from ._engine.Factory import BackendEnum, get_database_backend +from ._engine.object.Collection import Collection + +#from .context.Context import Context +#from .context.Keys import KEY_CONTEXTS + +LOGGER = logging.getLogger(__name__) + +class Database(_Database): + def __init__(self, backend : Optional[Union[str, BackendEnum]] = None, **settings): + super().__init__(get_database_backend(backend=backend, **settings)) + self._contexts = Collection(self, KEY_CONTEXTS) + + @property + def parent(self) -> 'Database': return self + + @property + def contexts(self) -> Collection: return self._contexts + + def context(self, context_uuid : str) -> Context: return Context(context_uuid, self) diff --git a/src/common/database/__init__.py b/src/context/service/database/__init__.py similarity index 100% rename from src/common/database/__init__.py rename to src/context/service/database/__init__.py diff --git a/src/context/service/database/_engine/Exceptions.py b/src/context/service/database/_engine/Exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..0d4cb33f91be9df3a9e237351312cb666c2a9654 --- /dev/null +++ b/src/context/service/database/_engine/Exceptions.py @@ -0,0 +1,2 @@ +class MutexException(Exception): + pass diff --git a/src/context/service/database/_engine/Factory.py b/src/context/service/database/_engine/Factory.py new file mode 100644 index 0000000000000000000000000000000000000000..ad208090df9d6dad04e379e0fcc1db337b928307 --- /dev/null +++ b/src/context/service/database/_engine/Factory.py @@ -0,0 +1,32 @@ +import logging, os +from typing import Optional, Union +from .backend._Backend import _Backend +from .backend.BackendEnum import BackendEnum +from .backend.inmemory.InMemoryBackend import InMemoryBackend +from .backend.redis.RedisBackend import RedisBackend + +LOGGER = logging.getLogger(__name__) + +BACKENDS = { + BackendEnum.INMEMORY.value: InMemoryBackend, + BackendEnum.REDIS.value: RedisBackend, + #BackendEnum.MONGO.value: MongoBackend, + #BackendEnum.RETHINK.value: RethinkBackend, + #BackendEnum.ETCD.value: EtcdBackend, +} + +DEFAULT_DB_BACKEND = BackendEnum.INMEMORY + +def get_database_backend(backend : Optional[Union[str, BackendEnum]] = None, **settings) -> _Backend: + # return an instance of Database initialized with selected backend. + # The backend is selected using following criteria (first that is not None is selected): + # 1. user selected by parameter (backend=...) + # 2. environment variable DB_BACKEND + # 3. default backend: INMEMORY + if backend is None: backend = os.environ.get('DB_BACKEND', DEFAULT_DB_BACKEND) + if backend is None: raise Exception('Database Backend not specified') + if isinstance(backend, BackendEnum): backend = backend.value + backend_class = BACKENDS.get(backend) + if backend_class is None: raise Exception('Unsupported DatabaseBackend({})'.format(backend)) + LOGGER.info('Selected Database Backend: {}'.format(backend)) + return backend_class(**settings) diff --git a/src/context/service/database/_engine/_Database.py b/src/context/service/database/_engine/_Database.py new file mode 100644 index 0000000000000000000000000000000000000000..357a06dff18d8ca2267669dbe413439675ceaf10 --- /dev/null +++ b/src/context/service/database/_engine/_Database.py @@ -0,0 +1,42 @@ +import logging +from typing import List, Set +from .backend._Backend import _Backend +from .object._Object import _Object +from .Exceptions import MutexException + +LOGGER = logging.getLogger(__name__) + +class _Database(_Object): + def __init__(self, backend : _Backend): + if not issubclass(backend, _Backend): + str_class_path = '{}.{}'.format(_Backend.__module__, _Backend.__name__) + raise AttributeError('backend must inherit from {}'.format(str_class_path)) + self._backend = backend + super().__init__(self, 'root') + self._acquired = False + self._owner_key = None + + @property + def parent(self) -> '_Database': return self + + @property + def backend(self) -> _Backend: return self._backend + + def __enter__(self) -> '_Database': + self._acquired, self._owner_key = self._backend.lock() + if not self._acquired: raise MutexException('Unable to acquire database lock') + return self + + def __exit__(self, exc_type, exc_val, exc_tb) -> None: + self._backend.unlock(self._owner_key) + + def clear_all(self, keep_keys : Set[str] = set()) -> None: + keys = self._backend.keys() + for key in keys: + if key in keep_keys: continue + self._backend.delete(key) + + def dump(self) -> List[str]: + entries = self._backend.dump() + entries.sort() + return ['[{:>4s}] {:100s} :: {}'.format(k_type, k_name, k_value) for k_name,k_type,k_value in entries] diff --git a/src/common/database/api/__init__.py b/src/context/service/database/_engine/__init__.py similarity index 100% rename from src/common/database/api/__init__.py rename to src/context/service/database/_engine/__init__.py diff --git a/src/context/service/database/_engine/backend/BackendEnum.py b/src/context/service/database/_engine/backend/BackendEnum.py new file mode 100644 index 0000000000000000000000000000000000000000..6b269419c0812b00ea961304c01bf816500bd015 --- /dev/null +++ b/src/context/service/database/_engine/backend/BackendEnum.py @@ -0,0 +1,8 @@ +from enum import Enum + +class BackendEnum(Enum): + INMEMORY = 'inmemory' + REDIS = 'redis' + #MONGO = 'mongo' + #RETHINK = 'rethink' + #ETCD = 'etcd' diff --git a/src/common/database/engines/_DatabaseEngine.py b/src/context/service/database/_engine/backend/_Backend.py similarity index 98% rename from src/common/database/engines/_DatabaseEngine.py rename to src/context/service/database/_engine/backend/_Backend.py index 962608826a679a9028c6061d8ab1b3afc9b11ded..6d6697bc4a7e2877367f9cfbd815cc4a2e7a18b1 100644 --- a/src/common/database/engines/_DatabaseEngine.py +++ b/src/context/service/database/_engine/backend/_Backend.py @@ -1,6 +1,6 @@ from typing import Dict, List, Set, Tuple -class _DatabaseEngine: +class _Backend: def __init__(self, **settings) -> None: raise NotImplementedError() diff --git a/src/common/database/api/context/__init__.py b/src/context/service/database/_engine/backend/__init__.py similarity index 100% rename from src/common/database/api/context/__init__.py rename to src/context/service/database/_engine/backend/__init__.py diff --git a/src/common/database/engines/inmemory/InMemoryDatabaseEngine.py b/src/context/service/database/_engine/backend/inmemory/InMemoryBackend.py similarity index 77% rename from src/common/database/engines/inmemory/InMemoryDatabaseEngine.py rename to src/context/service/database/_engine/backend/inmemory/InMemoryBackend.py index 80c1669c73f603ac1eb477d883196b144d1ea143..ee141600a508ee4e5ef4ea351e9c9d3541500133 100644 --- a/src/common/database/engines/inmemory/InMemoryDatabaseEngine.py +++ b/src/context/service/database/_engine/backend/inmemory/InMemoryBackend.py @@ -1,28 +1,11 @@ import copy, logging, threading, uuid -from typing import Dict, List, Set, Tuple, Union -from common.database.engines._DatabaseEngine import _DatabaseEngine +from typing import Dict, List, Set, Tuple +from .._Backend import _Backend +from .Tools import get_or_create_dict, get_or_create_list, get_or_create_set LOGGER = logging.getLogger(__name__) -def get_or_create_dict(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> Dict: - container = keys.get(key_name, None) - if container is None: container = keys.setdefault(key_name, dict()) - if not isinstance(container, dict): raise Exception('Key({}) is not a dict'.format(key_name)) - return container - -def get_or_create_list(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> List: - container = keys.get(key_name, None) - if container is None: container = keys.setdefault(key_name, list()) - if not isinstance(container, list): raise Exception('Key({}) is not a list'.format(key_name)) - return container - -def get_or_create_set(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> Set: - container = keys.get(key_name, None) - if container is None: container = keys.setdefault(key_name, set()) - if not isinstance(container, set): raise Exception('Key({}) is not a set'.format(key_name)) - return container - -class InMemoryDatabaseEngine(_DatabaseEngine): +class InMemoryBackend(_Backend): def __init__(self, **settings): self._internal_lock = threading.Lock() self._external_lock = threading.Lock() diff --git a/src/context/service/database/_engine/backend/inmemory/Tools.py b/src/context/service/database/_engine/backend/inmemory/Tools.py new file mode 100644 index 0000000000000000000000000000000000000000..7eb18c94732915bb35e5bdd4087f79647028c600 --- /dev/null +++ b/src/context/service/database/_engine/backend/inmemory/Tools.py @@ -0,0 +1,19 @@ +from typing import Dict, List, Set, Union + +def get_or_create_dict(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> Dict: + container = keys.get(key_name, None) + if container is None: container = keys.setdefault(key_name, dict()) + if not isinstance(container, dict): raise Exception('Key({}) is not a dict'.format(key_name)) + return container + +def get_or_create_list(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> List: + container = keys.get(key_name, None) + if container is None: container = keys.setdefault(key_name, list()) + if not isinstance(container, list): raise Exception('Key({}) is not a list'.format(key_name)) + return container + +def get_or_create_set(keys : Dict[str, Union[Dict, List, Set]], key_name : str) -> Set: + container = keys.get(key_name, None) + if container is None: container = keys.setdefault(key_name, set()) + if not isinstance(container, set): raise Exception('Key({}) is not a set'.format(key_name)) + return container diff --git a/src/common/database/api/context/service/__init__.py b/src/context/service/database/_engine/backend/inmemory/__init__.py similarity index 100% rename from src/common/database/api/context/service/__init__.py rename to src/context/service/database/_engine/backend/inmemory/__init__.py diff --git a/src/common/database/engines/redis/Mutex.py b/src/context/service/database/_engine/backend/redis/Mutex.py similarity index 98% rename from src/common/database/engines/redis/Mutex.py rename to src/context/service/database/_engine/backend/redis/Mutex.py index a83bed740a9abfe9bf4cea2b76c049662853bebf..55d52d8d5ff558b096958aefd85d926b46716db9 100644 --- a/src/common/database/engines/redis/Mutex.py +++ b/src/context/service/database/_engine/backend/redis/Mutex.py @@ -8,7 +8,8 @@ MIN_WAIT_TIME = 0.01 class Mutex: def __init__(self, client: Redis) -> None: if not isinstance(client, Redis): - raise AttributeError('client must be an instance of redis.client.Redis') + str_class_path = '{}.{}'.format(Redis.__module__, Redis.__name__) + raise AttributeError('client must be an instance of {}'.format(str_class_path)) self._client = client self._script_release = None self._script_refresh_expire = None diff --git a/src/common/database/engines/redis/RedisDatabaseEngine.py b/src/context/service/database/_engine/backend/redis/RedisBackend.py similarity index 84% rename from src/common/database/engines/redis/RedisDatabaseEngine.py rename to src/context/service/database/_engine/backend/redis/RedisBackend.py index a4b31aa13debd501112eb04b4353b4593dbc5b04..b18cd54b60aa1e1282a72587241733fe3f28e9cc 100644 --- a/src/common/database/engines/redis/RedisDatabaseEngine.py +++ b/src/context/service/database/_engine/backend/redis/RedisBackend.py @@ -1,17 +1,24 @@ -import uuid -from typing import Dict, List, Set, Tuple +import os, uuid +from typing import Any, Dict, List, Set, Tuple from redis.client import Redis -from common.Settings import get_setting -from common.database.engines._DatabaseEngine import _DatabaseEngine -from common.database.engines.redis.Mutex import Mutex +from .._Backend import _Backend +from .Mutex import Mutex + +DEFAULT_SERVICE_HOST = '127.0.0.1' +DEFAULT_SERVICE_PORT = 6379 +DEFAULT_DATABASE_ID = 0 KEY_ENTIRE_DATABASE_LOCK = 'everything' -class RedisDatabaseEngine(_DatabaseEngine): +def get_setting(settings : Dict[str, Any], name : str, default : Any) -> Any: + value = settings.get(name, os.environ.get(name)) + return default if value is None else value + +class RedisBackend(_Backend): def __init__(self, **settings) -> None: - host = get_setting('REDIS_SERVICE_HOST', settings=settings) - port = get_setting('REDIS_SERVICE_PORT', settings=settings) - dbid = get_setting('REDIS_DATABASE_ID', settings=settings) + host = get_setting(settings, 'REDIS_SERVICE_HOST', DEFAULT_SERVICE_HOST) + port = get_setting(settings, 'REDIS_SERVICE_PORT', DEFAULT_SERVICE_PORT) + dbid = get_setting(settings, 'REDIS_DATABASE_ID', DEFAULT_DATABASE_ID ) self._client = Redis.from_url('redis://{host}:{port}/{dbid}'.format(host=host, port=port, dbid=dbid)) self._mutex = Mutex(self._client) diff --git a/src/common/database/api/context/topology/__init__.py b/src/context/service/database/_engine/backend/redis/__init__.py similarity index 100% rename from src/common/database/api/context/topology/__init__.py rename to src/context/service/database/_engine/backend/redis/__init__.py diff --git a/src/context/service/database/_engine/object/Attributes.py b/src/context/service/database/_engine/object/Attributes.py new file mode 100644 index 0000000000000000000000000000000000000000..91e9e29923ec0e908fb4a470eb94578939b00479 --- /dev/null +++ b/src/context/service/database/_engine/object/Attributes.py @@ -0,0 +1,71 @@ +from __future__ import annotations +import copy +from typing import Any, Callable, Dict, List, Set +from ..backend._Backend import _Backend +from ._Object import _Object +from .Tools import format_key + +class Attributes: + def __init__( + self, parent : _Object, key_pattern : str, validators : Dict[str, Callable[[Any], bool]], + transcoders : Dict[str, Dict[Any, Callable[[Any], Any]]] = {}): + + if not issubclass(parent, _Object): + str_class_path = '{}.{}'.format(_Object.__module__, _Object.__name__) + raise AttributeError('parent must inherit from {}'.format(str_class_path)) + if (not isinstance(key_pattern, str)) or (len(key_pattern) == 0): + raise AttributeError('key_pattern must be a non-empty instance of str') + if not isinstance(validators, dict): + raise AttributeError('validators must be an instance of dict') + # TODO: implement validation of entries in validators + if not isinstance(transcoders, dict): + raise AttributeError('transcoders must be an instance of dict') + # TODO: implement validation of entries in transcoders + + self._parent = parent + self._backend : _Backend = self._parent.backend + self._key = format_key(key_pattern, self._parent) + self._validators = validators + self._transcoders = transcoders + + def validate(self, update_attributes : Dict[str, Any], remove_attributes : Set[str], attribute_name : str) -> None: + remove_attributes.discard(attribute_name) + value = update_attributes.pop(attribute_name, None) + if value is None: return + validator = self._validators.get(attribute_name) + if validator is None: return + if not validator(value): raise AttributeError('{} is invalid'.format(attribute_name)) + + def transcode(self, attribute_name : str, attribute_value : Any) -> Any: + transcoder_set = self._transcoders.get(attribute_name, {}) + transcoder = transcoder_set.get(type(attribute_value)) + return attribute_value if transcoder is None else transcoder(attribute_value) + + def get(self, attributes : List[str] = []) -> Dict[str, Any]: + return { + k:self.transcode(k, v) + for k,v in self._backend.dict_get(self._key, fields=attributes).items() + } + + def update(self, update_attributes : Dict[str, Any] = {}, remove_attributes : List[str] = []) -> 'Attributes': + remove_attributes = set(remove_attributes) + copy_update_attributes = copy.deepcopy(update_attributes) + copy_remove_attributes = copy.deepcopy(remove_attributes) + + for attribute_name in self._validators.keys(): + self.validate(copy_update_attributes, copy_remove_attributes, attribute_name) + attribute_value = update_attributes.get(attribute_name) + if attribute_value is None: continue + update_attributes[attribute_name] = self.transcode(attribute_name, attribute_value) + + if len(copy_update_attributes) > 0: + raise AttributeError('Unexpected update_attributes: {}'.format(str(copy_update_attributes))) + + if len(copy_remove_attributes) > 0: + raise AttributeError('Unexpected remove_attributes: {}'.format(str(copy_remove_attributes))) + + self._backend.dict_update(self._key, update_attributes, remove_attributes) + return self + + def delete(self, attributes : List[str] = []) -> None: + self._backend.dict_delete(self._key, attributes) diff --git a/src/context/service/database/_engine/object/Collection.py b/src/context/service/database/_engine/object/Collection.py new file mode 100644 index 0000000000000000000000000000000000000000..7f8e22382ec8de3841916d7a2130fe5c51233766 --- /dev/null +++ b/src/context/service/database/_engine/object/Collection.py @@ -0,0 +1,34 @@ +from __future__ import annotations +from typing import List +from ..backend._Backend import _Backend +from ._Object import _Object +from .Tools import format_key + +class Collection: + def __init__(self, parent : _Object, key_pattern : str): + if not issubclass(parent, _Object): + str_class_path = '{}.{}'.format(_Object.__module__, _Object.__name__) + raise AttributeError('parent must inherit from {}'.format(str_class_path)) + if (not isinstance(key_pattern, str)) or (len(key_pattern) == 0): + raise AttributeError('key_pattern must be a non-empty instance of str') + + self._parent = parent + self._backend : _Backend = self._parent.backend + self._key_list = format_key(key_pattern, self._parent, container_name='_list') + self._key_set = format_key(key_pattern, self._parent, container_name='_set') + + def add(self, object_uuid : str) -> None: + if self._backend.set_has(self._key_set, object_uuid): return + self._backend.set_add(self._key_set, object_uuid) + self._backend.list_push_last(self._key_list, object_uuid) + + def get(self) -> List[str]: + return self._backend.list_get_all(self._key_list) + + def contains(self, object_uuid : str) -> bool: + return self._backend.set_has(self._key_set, object_uuid) + + def delete(self, object_uuid : str) -> None: + if not self._backend.set_has(self._key_set, object_uuid): return + self._backend.set_remove(self._key_set, object_uuid) + self._backend.list_remove_first_occurrence(self._key_list, object_uuid) diff --git a/src/common/database/api/entity/Tools.py b/src/context/service/database/_engine/object/Tools.py similarity index 100% rename from src/common/database/api/entity/Tools.py rename to src/context/service/database/_engine/object/Tools.py diff --git a/src/context/service/database/_engine/object/_Object.py b/src/context/service/database/_engine/object/_Object.py new file mode 100644 index 0000000000000000000000000000000000000000..667f149a290a656f0d1f6b9851b8b04799ed321e --- /dev/null +++ b/src/context/service/database/_engine/object/_Object.py @@ -0,0 +1,30 @@ +from typing import Dict +from ..backend._Backend import _Backend + +class _Object: + def __init__(self, parent, object_uuid : str): + if not issubclass(parent, _Object): + str_class_path = '{}.{}'.format(_Object.__module__, _Object.__name__) + raise AttributeError('parent must inherit from {}'.format(str_class_path)) + if (not isinstance(object_uuid, str)) or (len(object_uuid) == 0): + raise AttributeError('object_uuid must be a non-empty instance of str') + self._object_uuid = object_uuid + self._parent = parent + + @property + def parent(self) -> '_Object': return self._parent + + @property + def backend(self) -> _Backend: return self._parent.backend + + def create(self) -> None: + raise NotImplementedError() + + def delete(self) -> None: + raise NotImplementedError() + + def dump_id(self) -> Dict: + raise NotImplementedError() + + def dump(self) -> Dict: + raise NotImplementedError() diff --git a/src/context/service/database/_engine/object/_ObjectWithAttributes.py b/src/context/service/database/_engine/object/_ObjectWithAttributes.py new file mode 100644 index 0000000000000000000000000000000000000000..4eb851ff036f2c9193475e4577927042b4e0bd83 --- /dev/null +++ b/src/context/service/database/_engine/object/_ObjectWithAttributes.py @@ -0,0 +1,14 @@ +from typing import Any, Callable, Dict +from ._Object import _Object +from .Attributes import Attributes + +class _ObjectWithAttributes(_Object): + def __init__( + self, parent, object_uuid: str, key_pattern : str, validators : Dict[str, Callable[[Any], bool]], + transcoders : Dict[str, Dict[Any, Callable[[Any], Any]]] = {}) -> None: + + super().__init__(parent, object_uuid) + self._attributes = Attributes(parent, key_pattern, validators, transcoders=transcoders) + + @property + def attributes(self) -> Attributes: return self._attributes diff --git a/src/common/database/api/context/topology/device/__init__.py b/src/context/service/database/_engine/object/__init__.py similarity index 100% rename from src/common/database/api/context/topology/device/__init__.py rename to src/context/service/database/_engine/object/__init__.py diff --git a/src/common/tools/service/DeviceCheckers.py b/src/context/service/database/checkers/DeviceCheckers.py similarity index 94% rename from src/common/tools/service/DeviceCheckers.py rename to src/context/service/database/checkers/DeviceCheckers.py index 9233b683e91ef26c112990dee139e21b3cc4a0c2..b8f49170301d457cf0ac0230fd04bf589daed3fe 100644 --- a/src/common/tools/service/DeviceCheckers.py +++ b/src/context/service/database/checkers/DeviceCheckers.py @@ -1,7 +1,7 @@ import grpc -from common.database.api.Database import Database -from common.database.api.context.topology.device.Endpoint import Endpoint from common.exceptions.ServiceException import ServiceException +from context.service.database.api.Database import Database +from context.service.database.api.context.topology.device.Endpoint import Endpoint def check_device_exists(database : Database, context_id : str, topology_id : str, device_id : str): db_context = database.context(context_id).create() diff --git a/src/common/tools/service/EndpointIdCheckers.py b/src/context/service/database/checkers/EndpointIdCheckers.py similarity index 93% rename from src/common/tools/service/EndpointIdCheckers.py rename to src/context/service/database/checkers/EndpointIdCheckers.py index 5ac0fe92dd458f38778d9a62011c4279b42ed918..4794dd0fbae95dc59b184007a35d7f9c2bf3fa6f 100644 --- a/src/common/tools/service/EndpointIdCheckers.py +++ b/src/context/service/database/checkers/EndpointIdCheckers.py @@ -1,14 +1,16 @@ import grpc, logging from typing import Dict, Set, Tuple, Union from common.Checkers import chk_string +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.exceptions.ServiceException import ServiceException -from common.database.api.context.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID def check_endpoint_id( logger : logging.Logger, endpoint_number : int, parent_name : str, endpoint_id : 'EndpointId', add_topology_devices_endpoints : Dict[str, Dict[str, Set[str]]], - predefined_context_id : str = DEFAULT_CONTEXT_ID, acceptable_context_ids : Set[str] = set([DEFAULT_CONTEXT_ID]), - predefined_topology_id : str = DEFAULT_TOPOLOGY_ID, acceptable_topology_ids : Set[str] = set([DEFAULT_TOPOLOGY_ID]), + predefined_context_id : str = DEFAULT_CONTEXT_UUID, + acceptable_context_ids : Set[str] = set([DEFAULT_CONTEXT_UUID]), + predefined_topology_id : str = DEFAULT_TOPOLOGY_UUID, + acceptable_topology_ids : Set[str] = set([DEFAULT_TOPOLOGY_UUID]), predefined_device_id : Union[str, None] = None, acceptable_device_ids : Set[str] = set(), prevent_same_device_multiple_times : bool = True) -> Tuple[str, str, str]: diff --git a/src/common/tools/service/EnumCheckers.py b/src/context/service/database/checkers/EnumCheckers.py similarity index 100% rename from src/common/tools/service/EnumCheckers.py rename to src/context/service/database/checkers/EnumCheckers.py diff --git a/src/common/tools/service/LinkCheckers.py b/src/context/service/database/checkers/LinkCheckers.py similarity index 94% rename from src/common/tools/service/LinkCheckers.py rename to src/context/service/database/checkers/LinkCheckers.py index a65046dbf065286547b1885239ad7578fa69a562..c9a0d2425bccb77427c0b065e94c153fb7952c3f 100644 --- a/src/common/tools/service/LinkCheckers.py +++ b/src/context/service/database/checkers/LinkCheckers.py @@ -1,6 +1,6 @@ import grpc -from common.database.api.Database import Database from common.exceptions.ServiceException import ServiceException +from context.service.database.api.Database import Database def check_link_exists(database : Database, context_id : str, topology_id : str, link_id : str): db_context = database.context(context_id).create() diff --git a/src/common/tools/service/ServiceCheckers.py b/src/context/service/database/checkers/ServiceCheckers.py similarity index 95% rename from src/common/tools/service/ServiceCheckers.py rename to src/context/service/database/checkers/ServiceCheckers.py index d8bafd1c03db0b1b330633062456752da7cd93c9..1b972f6502f7af3b98894eaacf211f90be71219e 100644 --- a/src/common/tools/service/ServiceCheckers.py +++ b/src/context/service/database/checkers/ServiceCheckers.py @@ -1,6 +1,6 @@ import grpc -from common.database.api.Database import Database from common.exceptions.ServiceException import ServiceException +from context.service.database.api.Database import Database def check_service_exists(database : Database, context_id : str, service_id : str): if not database.contexts.contains(context_id): diff --git a/src/common/database/api/context/topology/link/__init__.py b/src/context/service/database/checkers/__init__.py similarity index 100% rename from src/common/database/api/context/topology/link/__init__.py rename to src/context/service/database/checkers/__init__.py diff --git a/src/common/database/api/context/service/Constraint.py b/src/context/service/database/objects/Constraint.py similarity index 87% rename from src/common/database/api/context/service/Constraint.py rename to src/context/service/database/objects/Constraint.py index 866f98c1761ba399a3d27fc440524515626a019d..b66f16d27a5c5f333de0f21741dd40a022bbfca8 100644 --- a/src/common/database/api/context/service/Constraint.py +++ b/src/context/service/database/objects/Constraint.py @@ -1,11 +1,11 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.Keys import KEY_SERVICE_CONSTRAINT -from common.database.api.entity._Entity import _Entity +from ...entity._Entity import _Entity +from ..Keys import KEY_SERVICE_CONSTRAINT if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.service.Service import Service + from ..Context import Context + from .Service import Service VALIDATORS = { 'constraint_value': lambda v: v is not None and isinstance(v, str) and (len(v) > 0), diff --git a/src/common/database/api/context/Context.py b/src/context/service/database/objects/Context.py similarity index 83% rename from src/common/database/api/context/Context.py rename to src/context/service/database/objects/Context.py index f4b530dd2e4519568f9f27c97b0f78d8efbaa53d..54bef2a45071ea2661b43f81bd875dc1aa99ec2a 100644 --- a/src/common/database/api/context/Context.py +++ b/src/context/service/database/objects/Context.py @@ -1,12 +1,12 @@ from typing import TYPE_CHECKING, Dict, List -from common.database.api.context.service.Service import Service -from common.database.api.context.topology.Topology import Topology -from common.database.api.context.Keys import KEY_CONTEXT, KEY_SERVICES, KEY_TOPOLOGIES -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection +from ..entity._Entity import _Entity +from ..entity.EntityCollection import EntityCollection +from .service.Service import Service +from .topology.Topology import Topology +from .Keys import KEY_CONTEXT, KEY_SERVICES, KEY_TOPOLOGIES if TYPE_CHECKING: - from common.database.api.Database import Database + from ..Database import Database VALIDATORS = {} # no attributes accepted TRANSCODERS = {} # no transcoding applied to attributes diff --git a/src/common/database/api/context/topology/device/Device.py b/src/context/service/database/objects/Device.py similarity index 85% rename from src/common/database/api/context/topology/device/Device.py rename to src/context/service/database/objects/Device.py index 06c560051e1b3d7d930efb6ddca16d9096a2509e..1b68e271935467a81e8f577b82f2d7c26dca69b2 100644 --- a/src/common/database/api/context/topology/device/Device.py +++ b/src/context/service/database/objects/Device.py @@ -1,14 +1,14 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.Keys import KEY_DEVICE, KEY_DEVICE_ENDPOINTS -from common.database.api.context.topology.device.Endpoint import Endpoint -from common.database.api.context.topology.device.OperationalStatus import OperationalStatus, to_operationalstatus_enum -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection +from ....entity._Entity import _Entity +from ....entity.EntityCollection import EntityCollection +from ...Keys import KEY_DEVICE, KEY_DEVICE_ENDPOINTS +from .Endpoint import Endpoint +from .OperationalStatus import OperationalStatus, to_operationalstatus_enum if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.topology.Topology import Topology + from ...Context import Context + from ..Topology import Topology VALIDATORS = { 'device_type': lambda v: v is not None and isinstance(v, str) and (len(v) > 0), diff --git a/src/common/database/api/context/topology/device/Endpoint.py b/src/context/service/database/objects/Endpoint.py similarity index 85% rename from src/common/database/api/context/topology/device/Endpoint.py rename to src/context/service/database/objects/Endpoint.py index 8ea516f3e50ad14fd133048570555abf4d872372..bc36a93f2d24bdbc967b4bb3171a6de10a4989df 100644 --- a/src/common/database/api/context/topology/device/Endpoint.py +++ b/src/context/service/database/objects/Endpoint.py @@ -1,12 +1,12 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.entity._Entity import _Entity -from common.database.api.context.Keys import KEY_DEVICE_ENDPOINT +from ....entity._Entity import _Entity +from ...Keys import KEY_DEVICE_ENDPOINT if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.topology.Topology import Topology - from common.database.api.context.topology.device.Device import Device + from ...Context import Context + from ..Topology import Topology + from .Device import Device VALIDATORS = { 'port_type': lambda v: v is not None and isinstance(v, str) and (len(v) > 0), diff --git a/src/common/database/api/context/Keys.py b/src/context/service/database/objects/Keys.py similarity index 100% rename from src/common/database/api/context/Keys.py rename to src/context/service/database/objects/Keys.py diff --git a/src/common/database/api/context/topology/link/Link.py b/src/context/service/database/objects/Link.py similarity index 80% rename from src/common/database/api/context/topology/link/Link.py rename to src/context/service/database/objects/Link.py index 41d72e0d2284b6569a550216e0539ce950fcdc14..3c7976d5985cad8e058d415e1019de29a3850f58 100644 --- a/src/common/database/api/context/topology/link/Link.py +++ b/src/context/service/database/objects/Link.py @@ -1,13 +1,13 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection -from common.database.api.context.topology.link.Endpoint import Endpoint -from common.database.api.context.Keys import KEY_LINK, KEY_LINK_ENDPOINTS +from ....entity._Entity import _Entity +from ....entity.EntityCollection import EntityCollection +from ...Keys import KEY_LINK, KEY_LINK_ENDPOINTS +from .Endpoint import Endpoint if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.topology.Topology import Topology + from ...Context import Context + from ..Topology import Topology VALIDATORS = {} # no attributes accepted TRANSCODERS = {} # no transcoding applied to attributes diff --git a/src/common/database/api/context/topology/link/Endpoint.py b/src/context/service/database/objects/LinkEndpoint.py similarity index 83% rename from src/common/database/api/context/topology/link/Endpoint.py rename to src/context/service/database/objects/LinkEndpoint.py index 0fbdd26cbc222f7591ccfc8fbfdc6aa9062ead58..0814fdbe99f804eaf27f25ff8894c7e7f1fc2664 100644 --- a/src/common/database/api/context/topology/link/Endpoint.py +++ b/src/context/service/database/objects/LinkEndpoint.py @@ -1,13 +1,13 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.topology.device.Endpoint import Endpoint as DeviceEndpoint -from common.database.api.context.Keys import KEY_LINK_ENDPOINT -from common.database.api.entity._Entity import _Entity +from ....entity._Entity import _Entity +from ...Keys import KEY_LINK_ENDPOINT +from ..device.Endpoint import Endpoint as DeviceEndpoint if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.topology.Topology import Topology - from common.database.api.context.topology.link.Link import Link + from ...Context import Context + from ..Topology import Topology + from .Link import Link VALIDATORS = { 'device_uuid': lambda v: v is not None and isinstance(v, str) and (len(v) > 0), diff --git a/src/common/database/api/context/topology/device/OperationalStatus.py b/src/context/service/database/objects/OperationalStatus.py similarity index 100% rename from src/common/database/api/context/topology/device/OperationalStatus.py rename to src/context/service/database/objects/OperationalStatus.py diff --git a/src/common/database/api/context/service/Service.py b/src/context/service/database/objects/Service.py similarity index 85% rename from src/common/database/api/context/service/Service.py rename to src/context/service/database/objects/Service.py index 71fe3488db8691259e02d2c0ba76e7565adeaf15..0b5e69fce53992a392aa626856a1cb6b0ae33575 100644 --- a/src/common/database/api/context/service/Service.py +++ b/src/context/service/database/objects/Service.py @@ -1,15 +1,15 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.Keys import KEY_SERVICE, KEY_SERVICE_CONSTRAINTS, KEY_SERVICE_ENDPOINTS -from common.database.api.context.service.Constraint import Constraint -from common.database.api.context.service.Endpoint import Endpoint -from common.database.api.context.service.ServiceState import ServiceState, to_servicestate_enum -from common.database.api.context.service.ServiceType import ServiceType, to_servicetype_enum -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection +from ...entity._Entity import _Entity +from ...entity.EntityCollection import EntityCollection +from ..Keys import KEY_SERVICE, KEY_SERVICE_CONSTRAINTS, KEY_SERVICE_ENDPOINTS +from .Constraint import Constraint +from .Endpoint import Endpoint +from .ServiceState import ServiceState, to_servicestate_enum +from .ServiceType import ServiceType, to_servicetype_enum if TYPE_CHECKING: - from common.database.api.context.Context import Context + from ..Context import Context VALIDATORS = { 'service_type': lambda v: v is not None and isinstance(v, ServiceType), diff --git a/src/common/database/api/context/service/Endpoint.py b/src/context/service/database/objects/ServiceEndpoint.py similarity index 86% rename from src/common/database/api/context/service/Endpoint.py rename to src/context/service/database/objects/ServiceEndpoint.py index 5f86002371f7c2288b75332061ba928c120ca621..6a684e056ac5c034958c346ebb3d197f417d7f2b 100644 --- a/src/common/database/api/context/service/Endpoint.py +++ b/src/context/service/database/objects/ServiceEndpoint.py @@ -1,12 +1,12 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.topology.device.Endpoint import Endpoint as DeviceEndpoint -from common.database.api.context.Keys import KEY_SERVICE_ENDPOINT -from common.database.api.entity._Entity import _Entity +from ...entity._Entity import _Entity +from ..topology.device.Endpoint import Endpoint as DeviceEndpoint +from ..Keys import KEY_SERVICE_ENDPOINT if TYPE_CHECKING: - from common.database.api.context.Context import Context - from common.database.api.context.service.Service import Service + from ..Context import Context + from .Service import Service VALIDATORS = { 'topology_uuid': lambda v: v is not None and isinstance(v, str) and (len(v) > 0), diff --git a/src/common/database/api/context/service/ServiceState.py b/src/context/service/database/objects/ServiceState.py similarity index 100% rename from src/common/database/api/context/service/ServiceState.py rename to src/context/service/database/objects/ServiceState.py diff --git a/src/common/database/api/context/service/ServiceType.py b/src/context/service/database/objects/ServiceType.py similarity index 100% rename from src/common/database/api/context/service/ServiceType.py rename to src/context/service/database/objects/ServiceType.py diff --git a/src/common/database/api/context/topology/Topology.py b/src/context/service/database/objects/Topology.py similarity index 82% rename from src/common/database/api/context/topology/Topology.py rename to src/context/service/database/objects/Topology.py index de9cd67a41b822800f78f07208b090adf91b7bd8..ef8e802d7fef3bf2367ac4bfd90c57386a2a7d51 100644 --- a/src/common/database/api/context/topology/Topology.py +++ b/src/context/service/database/objects/Topology.py @@ -1,13 +1,13 @@ from __future__ import annotations from typing import TYPE_CHECKING, Dict -from common.database.api.context.Keys import KEY_TOPOLOGY, KEY_DEVICES, KEY_LINKS -from common.database.api.context.topology.device.Device import Device -from common.database.api.context.topology.link.Link import Link -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityCollection import EntityCollection +from ...entity._Entity import _Entity +from ...entity.EntityCollection import EntityCollection +from ..Keys import KEY_TOPOLOGY, KEY_DEVICES, KEY_LINKS +from .device.Device import Device +from .link.Link import Link if TYPE_CHECKING: - from common.database.api.context.Context import Context + from ..Context import Context VALIDATORS = {} # no attributes accepted TRANSCODERS = {} # no transcoding applied to attributes diff --git a/src/common/database/api/entity/__init__.py b/src/context/service/database/objects/__init__.py similarity index 100% rename from src/common/database/api/entity/__init__.py rename to src/context/service/database/objects/__init__.py diff --git a/src/common/database/api/context/_structure.txt b/src/context/service/database/objects/_structure.txt similarity index 100% rename from src/common/database/api/context/_structure.txt rename to src/context/service/database/objects/_structure.txt diff --git a/src/context/service/ContextService.py b/src/context/service/grpc_server/ContextService.py similarity index 96% rename from src/context/service/ContextService.py rename to src/context/service/grpc_server/ContextService.py index 54f90a64116a4385908fb025735998b9fd4dad55..f34a465bf72b33f7a16468922435d6a12f2abeca 100644 --- a/src/context/service/ContextService.py +++ b/src/context/service/grpc_server/ContextService.py @@ -4,9 +4,9 @@ from concurrent import futures from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH from grpc_health.v1.health_pb2 import HealthCheckResponse from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server -from context.proto.context_pb2_grpc import add_ContextServiceServicer_to_server -from context.service.ContextServiceServicerImpl import ContextServiceServicerImpl from context.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD +from context.proto.context_pb2_grpc import add_ContextServiceServicer_to_server +from .ContextServiceServicerImpl import ContextServiceServicerImpl BIND_ADDRESS = '0.0.0.0' LOGGER = logging.getLogger(__name__) diff --git a/src/context/service/ContextServiceServicerImpl.py b/src/context/service/grpc_server/ContextServiceServicerImpl.py similarity index 91% rename from src/context/service/ContextServiceServicerImpl.py rename to src/context/service/grpc_server/ContextServiceServicerImpl.py index f067d144652314ad58d5eaf3c3fdfefb3c900bbf..b2c87eba2a6a78f9b511bdd5cb52d5495b531697 100644 --- a/src/context/service/ContextServiceServicerImpl.py +++ b/src/context/service/grpc_server/ContextServiceServicerImpl.py @@ -1,11 +1,11 @@ import grpc, logging from prometheus_client import Counter, Histogram -from common.database.api.context.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID -from common.database.api.Database import Database +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.exceptions.ServiceException import ServiceException from context.proto.context_pb2 import Empty, Link, LinkId, Topology from context.proto.context_pb2_grpc import ContextServiceServicer -from context.service.Tools import check_link_id_request, check_link_request +from context.service.database.api.Database import Database +from .Tools import check_link_id_request, check_link_request LOGGER = logging.getLogger(__name__) @@ -49,8 +49,8 @@ class ContextServiceServicerImpl(ContextServiceServicer): LOGGER.debug('GetTopology request: {}'.format(str(request))) # ----- Validate request data and pre-conditions ----------------------------------------------------------- - db_context = self.database.context(DEFAULT_CONTEXT_ID).create() - db_topology = db_context.topology(DEFAULT_TOPOLOGY_ID).create() + db_context = self.database.context(DEFAULT_CONTEXT_UUID).create() + db_topology = db_context.topology(DEFAULT_TOPOLOGY_UUID).create() # ----- Retrieve data from the database -------------------------------------------------------------------- json_topology = db_topology.dump() @@ -79,8 +79,8 @@ class ContextServiceServicerImpl(ContextServiceServicer): link_id, db_endpoints = check_link_request('AddLink', request, self.database, LOGGER) # ----- Implement changes in the database ------------------------------------------------------------------ - db_context = self.database.context(DEFAULT_CONTEXT_ID).create() - db_topology = db_context.topology(DEFAULT_TOPOLOGY_ID).create() + db_context = self.database.context(DEFAULT_CONTEXT_UUID).create() + db_topology = db_context.topology(DEFAULT_TOPOLOGY_UUID).create() db_link = db_topology.link(link_id).create() for db_endpoint in db_endpoints: link_endpoint_id = '{}/{}'.format( @@ -111,8 +111,8 @@ class ContextServiceServicerImpl(ContextServiceServicer): link_id = check_link_id_request('DeleteLink', request, self.database, LOGGER) # ----- Implement changes in the database ------------------------------------------------------------------ - db_context = self.database.context(DEFAULT_CONTEXT_ID).create() - db_topology = db_context.topology(DEFAULT_TOPOLOGY_ID).create() + db_context = self.database.context(DEFAULT_CONTEXT_UUID).create() + db_topology = db_context.topology(DEFAULT_TOPOLOGY_UUID).create() db_topology.link(link_id).delete() # ----- Compose reply -------------------------------------------------------------------------------------- diff --git a/src/context/service/Tools.py b/src/context/service/grpc_server/Tools.py similarity index 77% rename from src/context/service/Tools.py rename to src/context/service/grpc_server/Tools.py index 9856d616bb335f0a1be64c09de5174eb3523fefc..3ad29057da32aaf2b3bde1f08b0ce1e18581a8d7 100644 --- a/src/context/service/Tools.py +++ b/src/context/service/grpc_server/Tools.py @@ -1,20 +1,20 @@ import grpc, logging from typing import Dict, List, Set, Tuple from common.Checkers import 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.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.exceptions.ServiceException import ServiceException -from common.tools.service.EndpointIdCheckers import check_endpoint_id -from common.tools.service.DeviceCheckers import check_device_endpoint_exists -from common.tools.service.LinkCheckers import check_link_exists, check_link_not_exists from context.proto.context_pb2 import Link, LinkId +from context.service.database.api.Database import Database +from context.service.database.api.context.topology.device.Endpoint import Endpoint +from context.service.database.checkers.EndpointIdCheckers import check_endpoint_id +from context.service.database.checkers.DeviceCheckers import check_device_endpoint_exists +from context.service.database.checkers.LinkCheckers import check_link_exists, check_link_not_exists def _check_link_exists(method_name : str, database : Database, link_id : str): if method_name in ['AddLink']: - check_link_not_exists(database, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, link_id) + check_link_not_exists(database, DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID, link_id) elif method_name in ['DeleteLink']: - check_link_exists(database, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, link_id) + check_link_exists(database, DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID, link_id) else: # pragma: no cover (test requires malforming the code) msg = 'Unexpected condition [_check_link_exists(method_name={}, link_id={})]' msg = msg.format(str(method_name), str(link_id)) @@ -41,13 +41,13 @@ def check_link_request( db_endpoints : List[Endpoint] = [] for endpoint_number,endpoint_id in enumerate(request.endpointList): parent_name = 'Endpoint(#{}) of Context({})/Topology({})/Link({})' - parent_name = parent_name.format(endpoint_number, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, link_id) + parent_name = parent_name.format(endpoint_number, DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID, link_id) _, ep_device_id, ep_port_id = check_endpoint_id( logger, endpoint_number, parent_name, endpoint_id, add_topology_devices_endpoints) db_endpoint = check_device_endpoint_exists( - database, parent_name, DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID, ep_device_id, ep_port_id) + database, parent_name, DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID, ep_device_id, ep_port_id) db_endpoints.append(db_endpoint) return link_id, db_endpoints diff --git a/src/common/database/engines/__init__.py b/src/context/service/grpc_server/__init__.py similarity index 100% rename from src/common/database/engines/__init__.py rename to src/context/service/grpc_server/__init__.py diff --git a/src/context/service/rest_server/resources/Context.py b/src/context/service/rest_server/resources/Context.py index 293ff24edebab8a1ded55e6ff5120409a534a332..188bff891e96221f1874b348e49fbc636302531b 100644 --- a/src/context/service/rest_server/resources/Context.py +++ b/src/context/service/rest_server/resources/Context.py @@ -1,7 +1,7 @@ from flask.json import jsonify from flask_restful import Resource -from common.database.api.Database import Database -from common.database.api.context.Constants import DEFAULT_CONTEXT_ID +from common.Constants import DEFAULT_CONTEXT_UUID +from context.service.database.api.Database import Database class Context(Resource): def __init__(self, database : Database) -> None: @@ -10,4 +10,4 @@ class Context(Resource): def get(self): with self.database: - return jsonify(self.database.context(DEFAULT_CONTEXT_ID).dump()) + return jsonify(self.database.context(DEFAULT_CONTEXT_UUID).dump()) diff --git a/src/common/database/tests/script.py b/src/context/tests/populate_database.py similarity index 91% rename from src/common/database/tests/script.py rename to src/context/tests/populate_database.py index 78efa9d6aaaf7c5288faf112b70d200b917b82f1..ead4e628937ba13973ccf2f87a7210b39f077f53 100644 --- a/src/common/database/tests/script.py +++ b/src/context/tests/populate_database.py @@ -1,14 +1,14 @@ import json, logging, time -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.service.ServiceState import ServiceState -from common.database.api.context.service.ServiceType import ServiceType -from common.database.api.context.topology.device.OperationalStatus import OperationalStatus +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID +from context.service.database.api.Database import Database +from context.service.database.api.context.service.ServiceState import ServiceState +from context.service.database.api.context.service.ServiceType import ServiceType +from context.service.database.api.context.topology.device.OperationalStatus import OperationalStatus LOGGER = logging.getLogger(__name__) def populate_example( - database : Database, context_uuid : str = DEFAULT_CONTEXT_ID, topology_uuid : str = DEFAULT_TOPOLOGY_ID, + database : Database, context_uuid : str = DEFAULT_CONTEXT_UUID, topology_uuid : str = DEFAULT_TOPOLOGY_UUID, add_devices : bool = True, add_links : bool = True, add_services : bool = True): if add_links: @@ -139,14 +139,14 @@ def sequence(database : Database): with database: t0 = time.time() - context = database.context(DEFAULT_CONTEXT_ID).create() + context = database.context(DEFAULT_CONTEXT_UUID).create() json_context = context.dump() t1 = time.time() LOGGER.info(json.dumps(json_context)) LOGGER.info('Dump elapsed: {}'.format(1000.0 * (t1-t0))) with database: - database.context(DEFAULT_CONTEXT_ID).delete() + database.context(DEFAULT_CONTEXT_UUID).delete() LOGGER.info('Dump:') for entry in database.dump(): LOGGER.info(' {}'.format(entry)) diff --git a/src/common/database/tests/test_engine_inmemory.py b/src/context/tests/test_database_engine_inmemory.py similarity index 59% rename from src/common/database/tests/test_engine_inmemory.py rename to src/context/tests/test_database_engine_inmemory.py index e3afd995573b04926bbec080e2dd5797eac6ce00..c3d894f1788f7e0e1ddb03efcb7c0b26c2ec098a 100644 --- a/src/common/database/tests/test_engine_inmemory.py +++ b/src/context/tests/test_database_engine_inmemory.py @@ -1,6 +1,6 @@ import logging -from common.database.Factory import get_database, DatabaseEngineEnum -from common.database.tests.script import sequence +from context.service.database.Factory import get_database, DatabaseEngineEnum +from .populate_database import sequence logging.basicConfig(level=logging.INFO) diff --git a/src/common/database/tests/test_engine_redis.py b/src/context/tests/test_database_engine_redis.py similarity index 68% rename from src/common/database/tests/test_engine_redis.py rename to src/context/tests/test_database_engine_redis.py index e68600db6a8e196890526c97d79b132c03dd4b32..f14afe30b0138581e97c1e09f2bbb2ec2223e399 100644 --- a/src/common/database/tests/test_engine_redis.py +++ b/src/context/tests/test_database_engine_redis.py @@ -1,6 +1,6 @@ import logging -from common.database.Factory import get_database, DatabaseEngineEnum -from common.database.tests.script import sequence +from context.service.database.Factory import get_database, DatabaseEngineEnum +from .populate_database import sequence logging.basicConfig(level=logging.INFO) diff --git a/src/common/database/tests/test_unitary.py b/src/context/tests/test_database_unitary.py similarity index 87% rename from src/common/database/tests/test_unitary.py rename to src/context/tests/test_database_unitary.py index 8589c7cfacb04505c75108f510b5f7bcca4005a2..72539d2a728e171394f14cf00bf73df4bd36875c 100644 --- a/src/common/database/tests/test_unitary.py +++ b/src/context/tests/test_database_unitary.py @@ -1,10 +1,10 @@ import logging, pytest -from common.database.api.Database import Database -from common.database.api.entity._Entity import _Entity -from common.database.api.entity.EntityAttributes import EntityAttributes -from common.database.api.Exceptions import WrongDatabaseEngine -from common.database.engines._DatabaseEngine import _DatabaseEngine -from common.database.engines.inmemory.InMemoryDatabaseEngine import InMemoryDatabaseEngine +from context.service.database.api.Database import Database +from context.service.database.api.entity._Entity import _Entity +from context.service.database.api.entity.EntityAttributes import EntityAttributes +from context.service.database.api.Exceptions import WrongDatabaseEngine +from context.service.database.engines._DatabaseEngine import _DatabaseEngine +from context.service.database.engines.inmemory.InMemoryDatabaseEngine import InMemoryDatabaseEngine logging.basicConfig(level=logging.INFO) diff --git a/src/context/tests/test_unitary.py b/src/context/tests/test_unitary.py index bba2a346adc2554e81b9048394fb964c4144a982..f7f81fdde989a8d58b17bd93e93aa1225cd7cabc 100644 --- a/src/context/tests/test_unitary.py +++ b/src/context/tests/test_unitary.py @@ -1,18 +1,18 @@ import copy, grpc, logging, pytest, requests, time from google.protobuf.json_format import MessageToDict -from common.database.Factory import get_database, DatabaseEngineEnum -from common.database.api.Database import Database -from common.database.api.context.Constants import DEFAULT_CONTEXT_ID, DEFAULT_TOPOLOGY_ID -from common.database.tests.script import populate_example +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.tests.Assertions import validate_empty, validate_link_id, validate_topology, validate_topology_has_devices,\ validate_topology_has_links, validate_topology_is_empty from context.client.ContextClient import ContextClient from context.proto.context_pb2 import Empty, Link, LinkId, Topology -from context.service.ContextService import ContextService +from context.service.database.Factory import get_database, DatabaseEngineEnum +from context.service.database.api.Database import Database +from context.service.grpc_server.ContextService import ContextService from context.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, RESTAPI_SERVICE_PORT, \ RESTAPI_BASE_URL from context.service.rest_server.Server import Server from context.service.rest_server.resources.Context import Context +from .populate_database import populate_example grpc_port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports restapi_port = 10000 + RESTAPI_SERVICE_PORT # avoid privileged ports @@ -21,8 +21,8 @@ LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) # use "copy.deepcopy" to prevent propagating forced changes during tests -CONTEXT_ID = {'contextUuid': {'uuid': DEFAULT_CONTEXT_ID}} -TOPOLOGY_ID = {'contextId': copy.deepcopy(CONTEXT_ID), 'topoId': {'uuid': DEFAULT_TOPOLOGY_ID}} +CONTEXT_ID = {'contextUuid': {'uuid': DEFAULT_CONTEXT_UUID}} +TOPOLOGY_ID = {'contextId': copy.deepcopy(CONTEXT_ID), 'topoId': {'uuid': DEFAULT_TOPOLOGY_UUID}} LINK_ID = {'link_id': {'uuid': 'DEV1/EP2 ==> DEV2/EP1'}} LINK = { 'link_id': {'link_id': {'uuid': 'DEV1/EP2 ==> DEV2/EP1'}}, @@ -48,8 +48,7 @@ def context_service(context_database : Database): @pytest.fixture(scope='session') def context_service_rest(context_database : Database): _rest_server = Server(port=restapi_port, base_url=RESTAPI_BASE_URL) - _rest_server.add_resource( - Context, '/restconf/config/context', endpoint='api.context', resource_class_args=(context_database,)) + _rest_server.add_resource(Context, '/context', endpoint='api.context', resource_class_args=(context_database,)) _rest_server.start() time.sleep(1) # bring time for the server to start yield _rest_server @@ -235,8 +234,11 @@ def test_get_topology_completed_2(context_client : ContextClient): def test_get_topology_completed_rest_api(context_service_rest : Server): # should work - request_url = 'http://127.0.0.1:{}{}/restconf/config/context'.format(restapi_port, RESTAPI_BASE_URL) + request_url = 'http://127.0.0.1:{}{}/context'.format(restapi_port, RESTAPI_BASE_URL) + LOGGER.warning('Request: GET {}'.format(str(request_url))) reply = requests.get(request_url) + LOGGER.warning('Reply: {}'.format(str(reply.text))) + assert reply.status_code == 200, 'Reply failed with code {}'.format(reply.status_code) json_reply = reply.json() topology = MessageToDict( Topology(**json_reply['topologies'][0]),