Skip to content
Snippets Groups Projects
Commit 8eac01b3 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Minor code cleanup before merging
parent a30709e3
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!89First implementation of location-aware services
......@@ -20,7 +20,7 @@ from sqlalchemy_cockroachdb import run_transaction
from typing import Dict, List, Optional, Set, Tuple
from common.method_wrappers.ServiceExceptions import InvalidArgumentException, NotFoundException
from common.proto.context_pb2 import Device, DeviceFilter, DeviceId, TopologyId
#from common.tools.grpc.Tools import grpc_message_to_json_string
from common.tools.grpc.Tools import grpc_message_to_json_string
from common.tools.object_factory.Device import json_device_id
from context.service.database.uuids.Topology import topology_get_uuid
from .models.DeviceModel import DeviceModel
......@@ -32,8 +32,6 @@ from .models.enums.KpiSampleType import grpc_to_enum__kpi_sample_type
from .uuids.Device import device_get_uuid
from .uuids.EndPoint import endpoint_get_uuid
from .ConfigRule import compose_config_rules_data, upsert_config_rules
from common.tools.grpc.Tools import grpc_message_to_json
import json
LOGGER = logging.getLogger(__name__)
......@@ -118,7 +116,7 @@ def device_set(db_engine : Engine, request : Device) -> Tuple[Dict, bool]:
'name' : endpoint_name,
'endpoint_type' : endpoint.endpoint_type,
'kpi_sample_types' : kpi_sample_types,
'endpoint_location': json.dumps(grpc_message_to_json(endpoint.endpoint_location)),
'endpoint_location': grpc_message_to_json_string(endpoint.endpoint_location),
'created_at' : now,
'updated_at' : now,
})
......
......@@ -32,7 +32,7 @@ class ServiceModel(_Base):
created_at = Column(DateTime, nullable=False)
updated_at = Column(DateTime, nullable=False)
context = relationship('ContextModel', back_populates='services', lazy='selectin',)
context = relationship('ContextModel', back_populates='services', lazy='selectin')
service_endpoints = relationship('ServiceEndPointModel') # lazy='selectin', back_populates='service'
constraints = relationship('ServiceConstraintModel', passive_deletes=True) # lazy='selectin', back_populates='service'
config_rules = relationship('ServiceConfigRuleModel', passive_deletes=True) # lazy='selectin', back_populates='service'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment