Commit 16d9b2f3 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI - ETSI BWM connector:

- Added missing imports
- Fixed pull-from-develop leftovers
parent 8b987b8e
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -16,11 +16,14 @@ import json, logging, re, time
from decimal import ROUND_HALF_EVEN, Decimal
from flask.json import jsonify
from common.proto.context_pb2 import (
    ContextId, Empty, EndPointId, ServiceId, ServiceTypeEnum, Service, Constraint, Constraint_SLA_Capacity,
    ConfigRule, ConfigRule_Custom, ConfigActionEnum)
    ContextId, Empty, EndPointId, ServiceId, ServiceStatusEnum, ServiceTypeEnum,
    Service, Constraint, Constraint_SLA_Capacity, ConfigRule, ConfigRule_Custom,
    ConfigActionEnum
)
from common.tools.grpc.Tools import grpc_message_to_json
from common.tools.object_factory.Context import json_context_id
from common.tools.object_factory.Service import json_service_id
from common.tools.grpc.ConfigRules import update_config_rule_custom

LOGGER = logging.getLogger(__name__)

@@ -172,14 +175,14 @@ def bwInfo_2_service(client, bw_info: dict) -> Service:
    service.service_status.service_status = ServiceStatusEnum.SERVICESTATUS_PLANNED
    service.service_type = ServiceTypeEnum.SERVICETYPE_L3NM

    if 'appInsId' in bwInfo:
        service.service_id.service_uuid.uuid = bwInfo['appInsId']
    if 'appInsId' in bw_info:
        service.service_id.service_uuid.uuid = bw_info['appInsId']
        service.service_id.context_id.context_uuid.uuid = 'admin'
        service.name = bwInfo['appInsId']
        service.name = bw_info['appInsId']

    if 'fixedAllocation' in bwInfo:
    if 'fixedAllocation' in bw_info:
        capacity = Constraint_SLA_Capacity()
        capacity.capacity_gbps = float(bwInfo['fixedAllocation']) / 1.e9
        capacity.capacity_gbps = float(bw_info['fixedAllocation']) / 1.e9
        constraint = Constraint()
        constraint.sla_capacity.CopyFrom(capacity)
        service.service_constraints.append(constraint)