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

Common - Object Factory tools:

- Added field name to json_link()
parent a377af3d
No related branches found
No related tags found
2 merge requests!328Resolve "(CTTC) Update recommendations to use SocketIO on NBI and E2E Orch components",!286Resolve "(CTTC) Implement integration test between E2E-IP-Optical SDN Controllers"
......@@ -15,6 +15,8 @@
import copy
from typing import Dict, List, Optional, Tuple
from common.proto.context_pb2 import LinkTypeEnum
def get_link_uuid(a_endpoint_id : Dict, z_endpoint_id : Dict) -> str:
return '{:s}/{:s}=={:s}/{:s}'.format(
a_endpoint_id['device_id']['device_uuid']['uuid'], a_endpoint_id['endpoint_uuid']['uuid'],
......@@ -25,9 +27,13 @@ def json_link_id(link_uuid : str) -> Dict:
def json_link(
link_uuid : str, endpoint_ids : List[Dict], name : Optional[str] = None,
link_type : LinkTypeEnum = LinkTypeEnum.LINKTYPE_UNKNOWN,
total_capacity_gbps : Optional[float] = None, used_capacity_gbps : Optional[float] = None
) -> Dict:
result = {'link_id': json_link_id(link_uuid), 'link_endpoint_ids': copy.deepcopy(endpoint_ids)}
result = {
'link_id': json_link_id(link_uuid), 'link_type': link_type,
'link_endpoint_ids': copy.deepcopy(endpoint_ids),
}
if name is not None: result['name'] = name
if total_capacity_gbps is not None:
attributes : Dict = result.setdefault('attributes', dict())
......
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