Loading proto/context.proto +9 −7 Original line number Diff line number Diff line Loading @@ -274,11 +274,13 @@ enum LinkTypeEnum { LINKTYPE_RADIO = 3; LINKTYPE_VIRTUAL = 4; LINKTYPE_MANAGEMENT = 5; LINKTYPE_REMOTE = 6; // imported from remote topology } message LinkAttributes { float total_capacity_gbps = 1; float used_capacity_gbps = 2; bool is_bidirectional = 1; float total_capacity_gbps = 2; float used_capacity_gbps = 3; } message Link { Loading src/context/service/database/Link.py +6 −0 Original line number Diff line number Diff line Loading @@ -105,12 +105,16 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) topology_uuids.add(endpoint_topology_uuid) total_capacity_gbps, used_capacity_gbps = None, None is_bidirectional = False if request.HasField('attributes'): attributes = request.attributes # In proto3, HasField() does not work for scalar fields, using ListFields() instead. attribute_names = set([field.name for field,_ in attributes.ListFields()]) if 'is_bidirectional' in attribute_names: is_bidirectional = attributes.is_bidirectional if 'total_capacity_gbps' in attribute_names: total_capacity_gbps = attributes.total_capacity_gbps Loading @@ -125,6 +129,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) 'link_type' : link_type, 'total_capacity_gbps' : total_capacity_gbps, 'used_capacity_gbps' : used_capacity_gbps, 'is_bidirectional' : is_bidirectional, 'created_at' : now, 'updated_at' : now, }] Loading @@ -138,6 +143,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) link_type = stmt.excluded.link_type, total_capacity_gbps = stmt.excluded.total_capacity_gbps, used_capacity_gbps = stmt.excluded.used_capacity_gbps, is_bidirectional = stmt.excluded.is_bidirectional, updated_at = stmt.excluded.updated_at, ) ) Loading src/context/service/database/models/LinkModel.py +5 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ import operator from sqlalchemy import ( CheckConstraint, Column, DateTime, Enum, Float, ForeignKey, Integer, String CheckConstraint, Boolean, Column, DateTime, Enum, Float, ForeignKey, Integer, String ) from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship Loading @@ -31,6 +32,7 @@ class LinkModel(_Base): link_type = Column(Enum(ORM_LinkTypeEnum), nullable=False) total_capacity_gbps = Column(Float, nullable=True) used_capacity_gbps = Column(Float, nullable=True) is_bidirectional = Column(Boolean, default=False) created_at = Column(DateTime, nullable=False) updated_at = Column(DateTime, nullable=False) Loading @@ -57,11 +59,11 @@ class LinkModel(_Base): } if self.link_type is None: self.link_type = LinkTypeEnum.LINKTYPE_UNKNOWN if self.total_capacity_gbps is not None: attributes : Dict = result.setdefault('attributes', dict()) attributes.setdefault('is_bidirectional', self.is_bidirectional) if self.total_capacity_gbps is not None: attributes.setdefault('total_capacity_gbps', self.total_capacity_gbps) if self.used_capacity_gbps is not None: attributes : Dict = result.setdefault('attributes', dict()) attributes.setdefault('used_capacity_gbps', self.used_capacity_gbps) return result Loading src/context/service/database/models/enums/LinkType.py +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class ORM_LinkTypeEnum(enum.Enum): RADIO = LinkTypeEnum.LINKTYPE_RADIO VIRTUAL = LinkTypeEnum.LINKTYPE_VIRTUAL MANAGEMENT = LinkTypeEnum.LINKTYPE_MANAGEMENT REMOTE = LinkTypeEnum.LINKTYPE_REMOTE grpc_to_enum__link_type_enum = functools.partial( grpc_to_enum, LinkTypeEnum, ORM_LinkTypeEnum Loading src/webui/service/templates/link/home.html +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ <th scope="col">Name</th> <th scope="col">Type</th> <th scope="col">Endpoints</th> <th scope="col">Attributes</th> <th scope="col"></th> </tr> </thead> Loading Loading @@ -79,6 +80,15 @@ {% endfor %} </ul> </td> <td> <ul> {% for field_descriptor, field_value in link.attributes.ListFields() %} <li> {{ field_descriptor.name }} = {{ field_value }} </li> {% endfor %} </ul> </td> <td> <a href="{{ url_for('link.detail', link_uuid=link.link_id.link_uuid.uuid) }}"> Loading Loading
proto/context.proto +9 −7 Original line number Diff line number Diff line Loading @@ -274,11 +274,13 @@ enum LinkTypeEnum { LINKTYPE_RADIO = 3; LINKTYPE_VIRTUAL = 4; LINKTYPE_MANAGEMENT = 5; LINKTYPE_REMOTE = 6; // imported from remote topology } message LinkAttributes { float total_capacity_gbps = 1; float used_capacity_gbps = 2; bool is_bidirectional = 1; float total_capacity_gbps = 2; float used_capacity_gbps = 3; } message Link { Loading
src/context/service/database/Link.py +6 −0 Original line number Diff line number Diff line Loading @@ -105,12 +105,16 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) topology_uuids.add(endpoint_topology_uuid) total_capacity_gbps, used_capacity_gbps = None, None is_bidirectional = False if request.HasField('attributes'): attributes = request.attributes # In proto3, HasField() does not work for scalar fields, using ListFields() instead. attribute_names = set([field.name for field,_ in attributes.ListFields()]) if 'is_bidirectional' in attribute_names: is_bidirectional = attributes.is_bidirectional if 'total_capacity_gbps' in attribute_names: total_capacity_gbps = attributes.total_capacity_gbps Loading @@ -125,6 +129,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) 'link_type' : link_type, 'total_capacity_gbps' : total_capacity_gbps, 'used_capacity_gbps' : used_capacity_gbps, 'is_bidirectional' : is_bidirectional, 'created_at' : now, 'updated_at' : now, }] Loading @@ -138,6 +143,7 @@ def link_set(db_engine : Engine, messagebroker : MessageBroker, request : Link) link_type = stmt.excluded.link_type, total_capacity_gbps = stmt.excluded.total_capacity_gbps, used_capacity_gbps = stmt.excluded.used_capacity_gbps, is_bidirectional = stmt.excluded.is_bidirectional, updated_at = stmt.excluded.updated_at, ) ) Loading
src/context/service/database/models/LinkModel.py +5 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ import operator from sqlalchemy import ( CheckConstraint, Column, DateTime, Enum, Float, ForeignKey, Integer, String CheckConstraint, Boolean, Column, DateTime, Enum, Float, ForeignKey, Integer, String ) from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship Loading @@ -31,6 +32,7 @@ class LinkModel(_Base): link_type = Column(Enum(ORM_LinkTypeEnum), nullable=False) total_capacity_gbps = Column(Float, nullable=True) used_capacity_gbps = Column(Float, nullable=True) is_bidirectional = Column(Boolean, default=False) created_at = Column(DateTime, nullable=False) updated_at = Column(DateTime, nullable=False) Loading @@ -57,11 +59,11 @@ class LinkModel(_Base): } if self.link_type is None: self.link_type = LinkTypeEnum.LINKTYPE_UNKNOWN if self.total_capacity_gbps is not None: attributes : Dict = result.setdefault('attributes', dict()) attributes.setdefault('is_bidirectional', self.is_bidirectional) if self.total_capacity_gbps is not None: attributes.setdefault('total_capacity_gbps', self.total_capacity_gbps) if self.used_capacity_gbps is not None: attributes : Dict = result.setdefault('attributes', dict()) attributes.setdefault('used_capacity_gbps', self.used_capacity_gbps) return result Loading
src/context/service/database/models/enums/LinkType.py +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class ORM_LinkTypeEnum(enum.Enum): RADIO = LinkTypeEnum.LINKTYPE_RADIO VIRTUAL = LinkTypeEnum.LINKTYPE_VIRTUAL MANAGEMENT = LinkTypeEnum.LINKTYPE_MANAGEMENT REMOTE = LinkTypeEnum.LINKTYPE_REMOTE grpc_to_enum__link_type_enum = functools.partial( grpc_to_enum, LinkTypeEnum, ORM_LinkTypeEnum Loading
src/webui/service/templates/link/home.html +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ <th scope="col">Name</th> <th scope="col">Type</th> <th scope="col">Endpoints</th> <th scope="col">Attributes</th> <th scope="col"></th> </tr> </thead> Loading Loading @@ -79,6 +80,15 @@ {% endfor %} </ul> </td> <td> <ul> {% for field_descriptor, field_value in link.attributes.ListFields() %} <li> {{ field_descriptor.name }} = {{ field_value }} </li> {% endfor %} </ul> </td> <td> <a href="{{ url_for('link.detail', link_uuid=link.link_id.link_uuid.uuid) }}"> Loading