Commit b4292d18 authored by Andrea Sgambelluri's avatar Andrea Sgambelluri
Browse files

solving libyang problem and integration with optical link model extensions

parent 3b345732
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ MANIFEST
*.manifest
.manifest/
*.spec

scripts/aa
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
+1 −1
Original line number Diff line number Diff line
@@ -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 opticalcontroller service slice  webui nbi"
export TFS_COMPONENTS="context device pathcomp opticalcontroller service webui nbi"

# Uncomment to activate Monitoring (old)
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ from sqlalchemy.engine import Engine
from sqlalchemy.orm import Session, selectinload, sessionmaker
from sqlalchemy_cockroachdb import run_transaction
from typing import Dict, List, Optional, Set, Tuple
from common.proto.context_pb2 import Empty, EventTypeEnum, Link, LinkId, LinkIdList, LinkList, TopologyId
from common.proto.context_pb2 import (
    Empty, EventTypeEnum, Link, LinkId, LinkIdList, LinkList, TopologyId
)
from common.message_broker.MessageBroker import MessageBroker
from common.method_wrappers.ServiceExceptions import NotFoundException
from common.tools.object_factory.Link import json_link_id
+5 −5
Original line number Diff line number Diff line
@@ -66,9 +66,10 @@ def optical_link_set(db_engine : Engine, messagebroker : MessageBroker, request

    now = datetime.datetime.utcnow()

    # By default, always add link to default Context/Topology
    topology_uuids : Set[str] = set()
    related_topologies : List[Dict] = list()
    
    # By default, always add link to default Context/Topology
    _,topology_uuid = topology_get_uuid(TopologyId(), allow_random=False, allow_default=True)
    related_topologies.append({
        'topology_uuid': topology_uuid,
@@ -77,15 +78,14 @@ def optical_link_set(db_engine : Engine, messagebroker : MessageBroker, request
    topology_uuids.add(topology_uuid)

    link_endpoints_data : List[Dict] = list()

    for i,endpoint_id in enumerate(request.link_endpoint_ids):
        endpoint_topology_uuid, endpoint_device_uuid, endpoint_uuid = endpoint_get_uuid(
              endpoint_id, endpoint_name="", allow_random=True)
        endpoint_topology_uuid, _, endpoint_uuid = endpoint_get_uuid(
            endpoint_id, allow_random=False)

        link_endpoints_data.append({
            'link_uuid'    : link_uuid,
            'endpoint_uuid': endpoint_uuid,
           
            'position'     : i,
        })

        if endpoint_topology_uuid not in topology_uuids:
+12 −5
Original line number Diff line number Diff line
@@ -12,8 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.


from sqlalchemy import Column, DateTime, ForeignKey, Integer, String ,Boolean
import operator
from sqlalchemy import (
    Boolean, CheckConstraint, Column, DateTime, ForeignKey, Integer, String
)
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship
from typing import Dict
@@ -59,7 +61,7 @@ class OpticalLinkModel(_Base):
            },
            'link_endpoint_ids' : [
                optical_endpoint.endpoint.dump_id()
                for optical_endpoint in self.opticallink_endpoints
                for optical_endpoint in sorted(self.opticallink_endpoints, key=operator.attrgetter('position'))
            ],
        }
        return result
@@ -69,6 +71,11 @@ class OpticalLinkEndPointModel(_Base):

    link_uuid     = Column(ForeignKey('opticallink.opticallink_uuid', ondelete='CASCADE' ), primary_key=True)
    endpoint_uuid = Column(ForeignKey('endpoint.endpoint_uuid',       ondelete='RESTRICT'), primary_key=True, index=True)
    position      = Column(Integer, nullable=False)
    
    optical_link  = relationship('OpticalLinkModel', back_populates='opticallink_endpoints')
    endpoint      = relationship('EndPointModel',    lazy='selectin')

    __table_args__ = (
        CheckConstraint(position >= 0, name='check_position_value'),
    )
 No newline at end of file
Loading