Commit 8eac01b3 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Minor code cleanup before merging
parent a30709e3
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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,
        })
+1 −1
Original line number Diff line number Diff line
@@ -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'