Loading my_deploy.sh +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device pathcomp service slice nbi webui" export TFS_COMPONENTS="context device pathcomp service nbi webui" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" Loading proto/context.proto +51 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package context; import "google/protobuf/any.proto"; import "acl.proto"; import "ip_link.proto"; import "kpi_sample_types.proto"; service ContextService { Loading Loading @@ -93,6 +94,10 @@ service ContextService { rpc DeleteOpticalLink (LinkId ) returns (Empty ) {} rpc GetOpticalLinkList (Empty ) returns (OpticalLinkList ) {} rpc GetOpticalBand (Empty ) returns (OpticalBandList) {} rpc SelectOpticalBand (OpticalBandId ) returns (OpticalBand) {} rpc DeleteServiceConfigRule(ServiceConfigRule) returns (Empty ) {} } Loading Loading @@ -347,6 +352,7 @@ enum ServiceTypeEnum { SERVICETYPE_L1NM = 8; SERVICETYPE_INT = 9; SERVICETYPE_ACL = 10; SERVICETYPE_IP_LINK = 11; } enum ServiceStatusEnum { Loading Loading @@ -560,11 +566,17 @@ message ConfigRule_ACL { acl.AclRuleSet rule_set = 2; } message ConfigRule_IP_LINK { EndPointId endpoint_id = 1; ip_link.IpLinkRuleSet rule_set = 2; } message ConfigRule { ConfigActionEnum action = 1; oneof config_rule { ConfigRule_Custom custom = 2; ConfigRule_ACL acl = 3; ConfigRule_IP_LINK ip_link = 4; } } Loading Loading @@ -687,6 +699,8 @@ message AuthenticationResult { bool authenticated = 2; } // ---------------- Experimental ------------------------ message OpticalConfigId { string opticalconfig_uuid = 1; Loading @@ -707,6 +721,8 @@ message OpticalConfigEvent { } // ---- Optical Link ---- message OpticalEndPointId { Loading @@ -722,6 +738,7 @@ message OpticalLinkList { message OpticalLinkDetails { float length = 1; string src_port = 2; string dst_port = 3; Loading @@ -731,6 +748,7 @@ message OpticalLinkDetails { map<string, int32> c_slots = 7; map<string, int32> l_slots = 8; map<string, int32> s_slots = 9; } message OpticalLink { Loading @@ -741,6 +759,34 @@ message OpticalLink { } message ChannelId { Uuid channel_uuid = 1; } message OpticalBandId { Uuid opticalband_uuid = 1; } message OpticalBand { OpticalBandId opticalband_id = 1 ; ConnectionId connection_id =2 ; ChannelId channel_id = 3; ServiceId service_id =4; oneof field { Service service =5 ; Connection connection =6 ; string channel = 7; } } message OpticalBandList { repeated OpticalBand opticalbands =1 ; } ////////////////// Config Rule Delete //////////// Loading proto/ip_link.proto 0 → 100644 +22 −0 Original line number 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 ip_link; message IpLinkRuleSet { string ip = 1; string mask = 3; string vlan = 4; } src/common/tools/context_queries/OpticalConfig.py +34 −1 Original line number Diff line number Diff line Loading @@ -14,9 +14,11 @@ from common.method_wrappers.ServiceExceptions import InvalidArgumentsException from context.client.ContextClient import ContextClient import logging from typing import Optional, Union from uuid import UUID, uuid4, uuid5 from common.proto.context_pb2 import OpticalBand, OpticalBandId, Empty # Generate a UUIDv5-like from the SHA-1 of "TFS" and no namespace to be used as the NAMESPACE for all # the context UUIDs generated. For efficiency purposes, the UUID is hardcoded; however, it is produced # using the following code: Loading Loading @@ -64,3 +66,34 @@ def opticalconfig_get_uuid( raise InvalidArgumentsException([ ('name', device_name), ], extra_details=['At least one is required to produce a OpticalConfig UUID']) def ob_get_uuid( ob_name:str , allow_random : bool = False ) -> str: if ( ob_name is not None): result = get_uuid_from_string(f'ob_{ob_name}') return result if allow_random: return get_uuid_random() raise InvalidArgumentsException([ ('ob_name ', ob_name), ], extra_details=['ob_name is required to produce a Optical band UUID']) def find_optical_band (ob_index)->OpticalBand: op_uuid = ob_get_uuid(ob_index) op_id=OpticalBandId() op_id.opticalband_uuid.uuid =op_uuid try: ctxt = ContextClient() target_ob= ctxt.SelectOpticalBand(op_id) return target_ob except Exception as e : logging.debug(f"error in finding optical band {e}") src/common/tools/object_factory/OpticalLink.py +41 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,44 @@ def correct_slot(dic: dict) -> dict: _dict[key]=1 #print(f"result {_dict}") return _dict ## To be deleted , needed now for development purpose ## def order_list (lst:list[tuple])->list: if (len(lst)<=1): return lst else : pivot,bit_val =lst[0] lst_smaller = [] lst_greater = [] for element in lst[1:]: key,val=element if (key <= pivot): lst_smaller.append(element) else : lst_greater.append(element) return order_list(lst_smaller) + [(pivot,bit_val)] + order_list(lst_greater) def list_to_dict (lst:list[tuple[int,int]])->dict: dct = dict() for ele in lst : key,value = ele dct[str(key)]=value return dct def order_dict (dct:dict)->dict: lst = list() for key,value in sorted(dct.items()): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def order_dict_v1 (dct:dict)->dict: lst = list() for key,value in dct.items(): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst) Loading
my_deploy.sh +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device pathcomp service slice nbi webui" export TFS_COMPONENTS="context device pathcomp service nbi webui" # Uncomment to activate Monitoring (old) #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" Loading
proto/context.proto +51 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package context; import "google/protobuf/any.proto"; import "acl.proto"; import "ip_link.proto"; import "kpi_sample_types.proto"; service ContextService { Loading Loading @@ -93,6 +94,10 @@ service ContextService { rpc DeleteOpticalLink (LinkId ) returns (Empty ) {} rpc GetOpticalLinkList (Empty ) returns (OpticalLinkList ) {} rpc GetOpticalBand (Empty ) returns (OpticalBandList) {} rpc SelectOpticalBand (OpticalBandId ) returns (OpticalBand) {} rpc DeleteServiceConfigRule(ServiceConfigRule) returns (Empty ) {} } Loading Loading @@ -347,6 +352,7 @@ enum ServiceTypeEnum { SERVICETYPE_L1NM = 8; SERVICETYPE_INT = 9; SERVICETYPE_ACL = 10; SERVICETYPE_IP_LINK = 11; } enum ServiceStatusEnum { Loading Loading @@ -560,11 +566,17 @@ message ConfigRule_ACL { acl.AclRuleSet rule_set = 2; } message ConfigRule_IP_LINK { EndPointId endpoint_id = 1; ip_link.IpLinkRuleSet rule_set = 2; } message ConfigRule { ConfigActionEnum action = 1; oneof config_rule { ConfigRule_Custom custom = 2; ConfigRule_ACL acl = 3; ConfigRule_IP_LINK ip_link = 4; } } Loading Loading @@ -687,6 +699,8 @@ message AuthenticationResult { bool authenticated = 2; } // ---------------- Experimental ------------------------ message OpticalConfigId { string opticalconfig_uuid = 1; Loading @@ -707,6 +721,8 @@ message OpticalConfigEvent { } // ---- Optical Link ---- message OpticalEndPointId { Loading @@ -722,6 +738,7 @@ message OpticalLinkList { message OpticalLinkDetails { float length = 1; string src_port = 2; string dst_port = 3; Loading @@ -731,6 +748,7 @@ message OpticalLinkDetails { map<string, int32> c_slots = 7; map<string, int32> l_slots = 8; map<string, int32> s_slots = 9; } message OpticalLink { Loading @@ -741,6 +759,34 @@ message OpticalLink { } message ChannelId { Uuid channel_uuid = 1; } message OpticalBandId { Uuid opticalband_uuid = 1; } message OpticalBand { OpticalBandId opticalband_id = 1 ; ConnectionId connection_id =2 ; ChannelId channel_id = 3; ServiceId service_id =4; oneof field { Service service =5 ; Connection connection =6 ; string channel = 7; } } message OpticalBandList { repeated OpticalBand opticalbands =1 ; } ////////////////// Config Rule Delete //////////// Loading
proto/ip_link.proto 0 → 100644 +22 −0 Original line number 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 ip_link; message IpLinkRuleSet { string ip = 1; string mask = 3; string vlan = 4; }
src/common/tools/context_queries/OpticalConfig.py +34 −1 Original line number Diff line number Diff line Loading @@ -14,9 +14,11 @@ from common.method_wrappers.ServiceExceptions import InvalidArgumentsException from context.client.ContextClient import ContextClient import logging from typing import Optional, Union from uuid import UUID, uuid4, uuid5 from common.proto.context_pb2 import OpticalBand, OpticalBandId, Empty # Generate a UUIDv5-like from the SHA-1 of "TFS" and no namespace to be used as the NAMESPACE for all # the context UUIDs generated. For efficiency purposes, the UUID is hardcoded; however, it is produced # using the following code: Loading Loading @@ -64,3 +66,34 @@ def opticalconfig_get_uuid( raise InvalidArgumentsException([ ('name', device_name), ], extra_details=['At least one is required to produce a OpticalConfig UUID']) def ob_get_uuid( ob_name:str , allow_random : bool = False ) -> str: if ( ob_name is not None): result = get_uuid_from_string(f'ob_{ob_name}') return result if allow_random: return get_uuid_random() raise InvalidArgumentsException([ ('ob_name ', ob_name), ], extra_details=['ob_name is required to produce a Optical band UUID']) def find_optical_band (ob_index)->OpticalBand: op_uuid = ob_get_uuid(ob_index) op_id=OpticalBandId() op_id.opticalband_uuid.uuid =op_uuid try: ctxt = ContextClient() target_ob= ctxt.SelectOpticalBand(op_id) return target_ob except Exception as e : logging.debug(f"error in finding optical band {e}")
src/common/tools/object_factory/OpticalLink.py +41 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,44 @@ def correct_slot(dic: dict) -> dict: _dict[key]=1 #print(f"result {_dict}") return _dict ## To be deleted , needed now for development purpose ## def order_list (lst:list[tuple])->list: if (len(lst)<=1): return lst else : pivot,bit_val =lst[0] lst_smaller = [] lst_greater = [] for element in lst[1:]: key,val=element if (key <= pivot): lst_smaller.append(element) else : lst_greater.append(element) return order_list(lst_smaller) + [(pivot,bit_val)] + order_list(lst_greater) def list_to_dict (lst:list[tuple[int,int]])->dict: dct = dict() for ele in lst : key,value = ele dct[str(key)]=value return dct def order_dict (dct:dict)->dict: lst = list() for key,value in sorted(dct.items()): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst) def order_dict_v1 (dct:dict)->dict: lst = list() for key,value in dct.items(): lst.append((int(key),value)) ordered_lst= order_list(lst) if (len(ordered_lst)>0): return list_to_dict (ordered_lst)