Commit d6e88844 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

First version of TAPI LSP service

1) New service
2) New Handler
3) Optical TFS driver
parent c0eb5377
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import "google/protobuf/any.proto";


import "acl.proto";
import "acl.proto";
import "kpi_sample_types.proto";
import "kpi_sample_types.proto";
import "tapi_lsp.proto";


service ContextService {
service ContextService {
  rpc ListContextIds     (Empty         ) returns (       ContextIdList   ) {}
  rpc ListContextIds     (Empty         ) returns (       ContextIdList   ) {}
@@ -78,7 +79,6 @@ service ContextService {
  rpc RemoveConnection   (ConnectionId  ) returns (       Empty           ) {}
  rpc RemoveConnection   (ConnectionId  ) returns (       Empty           ) {}
  rpc GetConnectionEvents(Empty         ) returns (stream ConnectionEvent ) {}
  rpc GetConnectionEvents(Empty         ) returns (stream ConnectionEvent ) {}


 
  // ------------------------------ Experimental -----------------------------
  // ------------------------------ Experimental -----------------------------
  rpc GetOpticalConfig       (Empty            ) returns (OpticalConfigList) {}
  rpc GetOpticalConfig       (Empty            ) returns (OpticalConfigList) {}
  rpc SetOpticalConfig       (OpticalConfig    ) returns (OpticalConfigId  ) {}
  rpc SetOpticalConfig       (OpticalConfig    ) returns (OpticalConfigId  ) {}
@@ -203,7 +203,6 @@ message Component { // Defined previously in this sectio
  Uuid component_uuid = 1;
  Uuid component_uuid = 1;
  string name         = 2;
  string name         = 2;
  string type         = 3;
  string type         = 3;
  
  map<string, string> attributes = 4; // dict[attr.name => json.dumps(attr.value)]
  map<string, string> attributes = 4; // dict[attr.name => json.dumps(attr.value)]
  string parent       = 5;
  string parent       = 5;
}
}
@@ -331,6 +330,7 @@ enum ServiceTypeEnum {
  SERVICETYPE_L1NM = 8;
  SERVICETYPE_L1NM = 8;
  SERVICETYPE_INT = 9;
  SERVICETYPE_INT = 9;
  SERVICETYPE_ACL = 10;
  SERVICETYPE_ACL = 10;
  SERVICETYPE_TAPI_LSP = 11;
}
}


enum ServiceStatusEnum {
enum ServiceStatusEnum {
@@ -544,11 +544,17 @@ message ConfigRule_ACL {
  acl.AclRuleSet rule_set = 2;
  acl.AclRuleSet rule_set = 2;
}
}


message ConfigRule_TAPI_LSP {
  EndPointId endpoint_id           = 1;
  tapi_lsp.TapiLspRuleSet rule_set = 2;
}

message ConfigRule {
message ConfigRule {
  ConfigActionEnum action = 1;
  ConfigActionEnum action = 1;
  oneof config_rule {
  oneof config_rule {
    ConfigRule_Custom custom = 2;
    ConfigRule_Custom custom = 2;
    ConfigRule_ACL acl = 3;
    ConfigRule_ACL acl = 3;
    ConfigRule_TAPI_LSP tapi_lsp = 4;
  }
  }
}
}


@@ -579,7 +585,6 @@ message Location {
  oneof location {
  oneof location {
    string region = 1;
    string region = 1;
    GPS_Position gps_position = 2;
    GPS_Position gps_position = 2;
    
    string interface=3;
    string interface=3;
    string circuit_pack=4;
    string circuit_pack=4;
  }
  }

proto/tapi_lsp.proto

0 → 100644
+24 −0
Original line number Original line Diff line number Diff line
// Copyright 2022-2025 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package tapi_lsp;

message TapiLspRuleSet {
  string  src  = 1;
  string  dst  = 2;
  string  uuid = 3;
  string  bw   = 4;
  string  unit = 5;
}
 No newline at end of file
+11 −1
Original line number Original line Diff line number Diff line
@@ -93,3 +93,13 @@ def json_service_p4_planned(
        service_uuid, ServiceTypeEnum.SERVICETYPE_L1NM, context_id=json_context_id(context_uuid),
        service_uuid, ServiceTypeEnum.SERVICETYPE_L1NM, context_id=json_context_id(context_uuid),
        status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints,
        status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints,
        config_rules=config_rules)
        config_rules=config_rules)

def json_service_tapi_lsp_planned(
        service_uuid : str, endpoint_ids : List[Dict] = [], constraints : List[Dict] = [],
        config_rules : List[Dict] = [], context_uuid : str = DEFAULT_CONTEXT_NAME
    ):

    return json_service(
        service_uuid, ServiceTypeEnum.SERVICETYPE_TAPI_LSP, context_id=json_context_id(context_uuid),
        status=ServiceStatusEnum.SERVICESTATUS_PLANNED, endpoint_ids=endpoint_ids, constraints=constraints,
        config_rules=config_rules)
+2 −0
Original line number Original line Diff line number Diff line
@@ -109,6 +109,7 @@ def validate_service_type_enum(message):
        'SERVICETYPE_E2E',
        'SERVICETYPE_E2E',
        'SERVICETYPE_OPTICAL_CONNECTIVITY',
        'SERVICETYPE_OPTICAL_CONNECTIVITY',
        'SERVICETYPE_QKD',
        'SERVICETYPE_QKD',
        'SERVICETYPE_TAPI_LSP',
    ]
    ]


def validate_service_state_enum(message):
def validate_service_state_enum(message):
@@ -146,6 +147,7 @@ def validate_uuid(message, allow_empty=False):
CONFIG_RULE_TYPES = {
CONFIG_RULE_TYPES = {
    'custom',
    'custom',
    'acl',
    'acl',
    'tapi_lsp'
}
}
def validate_config_rule(message):
def validate_config_rule(message):
    assert isinstance(message, dict)
    assert isinstance(message, dict)
+3 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,9 @@ def compose_config_rules_data(
            _, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False)
            _, _, endpoint_uuid = endpoint_get_uuid(config_rule.acl.endpoint_id, allow_random=False)
            rule_set_name = config_rule.acl.rule_set.name
            rule_set_name = config_rule.acl.rule_set.name
            configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name)
            configrule_name = '{:s}:{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid, rule_set_name)
        elif kind == ConfigRuleKindEnum.TAPI_LSP:
            _, _, endpoint_uuid = endpoint_get_uuid(config_rule.tapi_lsp.endpoint_id, allow_random=False)
            configrule_name = '{:s}:{:s}:{:s}'.format(parent_kind, kind.value, endpoint_uuid)
        else:
        else:
            MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\
            MSG = 'Name for ConfigRule({:s}) cannot be inferred '+\
                  '(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})'
                  '(device_uuid={:s}, service_uuid={:s}, slice_uuid={:s})'
Loading