Commit 817f5f08 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Proto:

- added field name in context
- added field name in topology
- added field name in device
- added field name in link
- added field name in service
- added field name in slice
parent 16ad5d96
Loading
Loading
Loading
Loading
+40 −33
Original line number Diff line number Diff line
@@ -101,9 +101,11 @@ message ContextId {

message Context {
  ContextId context_id = 1;
  repeated TopologyId topology_ids = 2;
  repeated ServiceId service_ids = 3;
  TeraFlowController controller = 4;
  string name = 2;
  repeated TopologyId topology_ids = 3;
  repeated ServiceId service_ids = 4;
  repeated SliceId slice_ids = 5;
  TeraFlowController controller = 6;
}

message ContextIdList {
@@ -128,8 +130,9 @@ message TopologyId {

message Topology {
  TopologyId topology_id = 1;
  repeated DeviceId device_ids = 2;
  repeated LinkId link_ids = 3;
  string name = 2;
  repeated DeviceId device_ids = 3;
  repeated LinkId link_ids = 4;
}

message TopologyIdList {
@@ -153,12 +156,13 @@ message DeviceId {

message Device {
  DeviceId device_id = 1;
  string device_type = 2;
  DeviceConfig device_config = 3;
  DeviceOperationalStatusEnum device_operational_status = 4;
  repeated DeviceDriverEnum device_drivers = 5;
  repeated EndPoint device_endpoints = 6;
  repeated Component component = 7; // Used for inventory
  string name = 2;
  string device_type = 3;
  DeviceConfig device_config = 4;
  DeviceOperationalStatusEnum device_operational_status = 5;
  repeated DeviceDriverEnum device_drivers = 6;
  repeated EndPoint device_endpoints = 7;
  repeated Component component = 8; // Used for inventory
}

message Component {
@@ -207,7 +211,8 @@ message LinkId {

message Link {
  LinkId link_id = 1;
  repeated EndPointId link_endpoint_ids = 2;
  string name = 2;
  repeated EndPointId link_endpoint_ids = 3;
}

message LinkIdList {
@@ -232,12 +237,13 @@ message ServiceId {

message Service {
  ServiceId service_id = 1;
  ServiceTypeEnum service_type = 2;
  repeated EndPointId service_endpoint_ids = 3;
  repeated Constraint service_constraints = 4;
  ServiceStatus service_status = 5;
  ServiceConfig service_config = 6;
  Timestamp timestamp = 7;
  string name = 2;
  ServiceTypeEnum service_type = 3;
  repeated EndPointId service_endpoint_ids = 4;
  repeated Constraint service_constraints = 5;
  ServiceStatus service_status = 6;
  ServiceConfig service_config = 7;
  Timestamp timestamp = 8;
}

enum ServiceTypeEnum {
@@ -284,14 +290,15 @@ message SliceId {

message Slice {
  SliceId slice_id = 1;
  repeated EndPointId slice_endpoint_ids = 2;
  repeated Constraint slice_constraints = 3;
  repeated ServiceId slice_service_ids = 4;
  repeated SliceId slice_subslice_ids = 5;
  SliceStatus slice_status = 6;
  SliceConfig slice_config = 7;
  SliceOwner slice_owner = 8;
  Timestamp timestamp = 9;
  string name = 2;
  repeated EndPointId slice_endpoint_ids = 3;
  repeated Constraint slice_constraints = 4;
  repeated ServiceId slice_service_ids = 5;
  repeated SliceId slice_subslice_ids = 6;
  SliceStatus slice_status = 7;
  SliceConfig slice_config = 8;
  SliceOwner slice_owner = 9;
  Timestamp timestamp = 10;
}

message SliceOwner {
+7 −6
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import logging, uuid
from enum import Enum

# Default logging level
@@ -30,11 +30,12 @@ DEFAULT_HTTP_BIND_ADDRESS = '0.0.0.0'
DEFAULT_METRICS_PORT = 9192

# Default context and topology UUIDs
#DEFAULT_CONTEXT_UUID      = '85f78267-4c5e-4f80-ad2f-7fbaca7c62a0'
#DEFAULT_TOPOLOGY_UUID     = '85f78267-4c5e-4f80-ad2f-7fbaca7c62a0'
DEFAULT_CONTEXT_UUID      = 'admin'
DEFAULT_TOPOLOGY_UUID     = 'admin'     # contains the detailed local topology
INTERDOMAIN_TOPOLOGY_UUID = 'inter'     # contains the abstract inter-domain topology
DEFAULT_CONTEXT_NAME      = 'admin'
DEFAULT_TOPOLOGY_NAME     = 'admin'     # contains the detailed local topology
INTERDOMAIN_TOPOLOGY_NAME = 'inter'     # contains the abstract inter-domain topology
DEFAULT_CONTEXT_UUID      = str(uuid.uuid5(uuid.NAMESPACE_OID, DEFAULT_CONTEXT_NAME     ))
DEFAULT_TOPOLOGY_UUID     = str(uuid.uuid5(uuid.NAMESPACE_OID, DEFAULT_TOPOLOGY_NAME    ))
INTERDOMAIN_TOPOLOGY_UUID = str(uuid.uuid5(uuid.NAMESPACE_OID, INTERDOMAIN_TOPOLOGY_NAME))

# Default service names
class ServiceNameEnum(Enum):
+7 −2
Original line number Diff line number Diff line
@@ -12,12 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Optional

def json_context_id(context_uuid : str):
    return {'context_uuid': {'uuid': context_uuid}}

def json_context(context_uuid : str):
    return {
def json_context(context_uuid : str, name : Optional[str] = None):
    result = {
        'context_id'  : json_context_id(context_uuid),
        'topology_ids': [],
        'service_ids' : [],
        'slice_ids'   : [],
    }
    if name is not None: result['name'] = name
    return result
+4 −2
Original line number Diff line number Diff line
@@ -20,9 +20,11 @@ def json_topology_id(topology_uuid : str, context_id : Optional[Dict] = None):
    if context_id is not None: result['context_id'] = copy.deepcopy(context_id)
    return result

def json_topology(topology_uuid : str, context_id : Optional[Dict] = None):
    return {
def json_topology(topology_uuid : str, name : Optional[str] = None, context_id : Optional[Dict] = None):
    result = {
        'topology_id': json_topology_id(topology_uuid, context_id=context_id),
        'device_ids' : [],
        'link_ids'   : [],
    }
    if name is not None: result['name'] = name
    return result