Search in sources :

Example 1 with ConnectionEndPoint

use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint in project onos by opennetworkinglab.

the class TapiCepRefHandler method setCep.

public TapiCepRefHandler setCep(ConnectionEndPoint cep) {
    obj.connectionEndPointUuid(cep.uuid());
    ParentNodeEdgePoint parentNep = cep.parentNodeEdgePoint();
    obj.topologyUuid(parentNep.topologyUuid());
    obj.nodeUuid(parentNep.nodeUuid());
    obj.nodeEdgePointUuid(parentNep.nodeEdgePointUuid());
    return this;
}
Also used : ParentNodeEdgePoint(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectionendpoint.ParentNodeEdgePoint)

Example 2 with ConnectionEndPoint

use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint in project onos by opennetworkinglab.

the class DcsBasedTapiConnectionManager method deleteConnection.

@Override
public void deleteConnection(TapiConnectionHandler connectionHandler) {
    // Retrieve the target to be deleted (right now we have the uuid)
    connectionHandler.read();
    // Remove Intent if exists
    if (connectionHandler.getLowerConnections().isEmpty()) {
        // Connection object
        DefaultConnection connection = connectionHandler.getModelObject();
        // These are two connection.ConnectionEndpoint (Actually Refs, mainly UUID)
        ConnectionEndPoint cepLeft = connection.connectionEndPoint().get(0);
        ConnectionEndPoint cepRight = connection.connectionEndPoint().get(1);
        TapiNepRef left = TapiNepRef.create(cepLeft.topologyUuid().toString(), cepLeft.nodeUuid().toString(), cepLeft.nodeEdgePointUuid().toString());
        TapiNepRef right = TapiNepRef.create(cepRight.topologyUuid().toString(), cepRight.nodeUuid().toString(), cepRight.nodeEdgePointUuid().toString());
        // update with latest data in DCS
        left = resolver.getNepRef(left);
        right = resolver.getNepRef(right);
        log.debug("Removing intent connection: {}", connection);
        notifyTapiConnectivityChange(connectionHandler.getId().toString(), left.getConnectPoint(), right.getConnectPoint(), false);
    }
    deleteConnectionRecursively(connectionHandler);
}
Also used : ConnectionEndPoint(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint) DefaultConnection(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivitycontext.DefaultConnection) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef)

Example 3 with ConnectionEndPoint

use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint in project onos by opennetworkinglab.

the class DcsBasedTapiDataProducer method getNeps.

/**
 * Extract Tapi Neps from context modelObject and convert them to NepRefs.
 *
 * @param context
 * @return List of TapiNepRef
 */
private List<TapiNepRef> getNeps(DefaultContext context) {
    DefaultAugmentedTapiCommonContext topologyContext = context.augmentation(DefaultAugmentedTapiCommonContext.class);
    Topology topology = topologyContext.topologyContext().topology().get(0);
    if (topology.node() == null) {
        return Collections.emptyList();
    }
    List<TapiNepRef> ret = topology.node().stream().flatMap(node -> {
        if (node.ownedNodeEdgePoint() == null) {
            return null;
        }
        return node.ownedNodeEdgePoint().stream().map(nep -> {
            TapiNepRef nepRef = DcsBasedTapiObjectRefFactory.create(topology, node, nep);
            if (nep.name() != null) {
                Map<String, String> kvs = new HashMap<>();
                nep.name().forEach(kv -> kvs.put(kv.valueName(), kv.value()));
                String onosConnectPoint = kvs.getOrDefault(ONOS_CP, null);
                String portType = kvs.getOrDefault(ODTN_PORT_TYPE, null);
                String connectionId = kvs.getOrDefault(CONNECTION_ID, null);
                nepRef.setConnectPoint(ConnectPoint.fromString(onosConnectPoint)).setPortType(portType).setConnectionId(connectionId);
            }
            if (nep.mappedServiceInterfacePoint() != null) {
                nep.mappedServiceInterfacePoint().stream().forEach(sip -> {
                    nepRef.setSipId(sip.serviceInterfacePointUuid().toString());
                });
            }
            DefaultAugmentedTapiTopologyOwnedNodeEdgePoint augmentNep = nep.augmentation(DefaultAugmentedTapiTopologyOwnedNodeEdgePoint.class);
            try {
                if (augmentNep.cepList().connectionEndPoint() != null) {
                    List<String> cepIds = augmentNep.cepList().connectionEndPoint().stream().map(cep -> cep.uuid().toString()).collect(Collectors.toList());
                    nepRef.setCepIds(cepIds);
                }
            } catch (NullPointerException e) {
                log.warn("Augmented ownedNodeEdgePoint is not found.");
            }
            return nepRef;
        });
    }).collect(Collectors.toList());
    return ret;
}
Also used : DcsBasedTapiObjectRefFactory(org.onosproject.odtn.utils.tapi.DcsBasedTapiObjectRefFactory) HashMap(java.util.HashMap) DefaultModelObjectData(org.onosproject.yang.model.DefaultModelObjectData) TapiNodeRef(org.onosproject.odtn.utils.tapi.TapiNodeRef) ResourceData(org.onosproject.yang.model.ResourceData) ConnectPoint(org.onosproject.net.ConnectPoint) DataNode(org.onosproject.yang.model.DataNode) Map(java.util.Map) DynamicConfigService(org.onosproject.config.DynamicConfigService) Name(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.globalclass.Name) DefaultServiceDirectory.getService(org.onlab.osgi.DefaultServiceDirectory.getService) Logger(org.slf4j.Logger) DefaultResourceData(org.onosproject.yang.model.DefaultResourceData) ModelConverter(org.onosproject.yang.model.ModelConverter) ModelObjectId(org.onosproject.yang.model.ModelObjectId) DefaultContext(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.DefaultContext) Collectors(java.util.stream.Collectors) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) ResourceId(org.onosproject.yang.model.ResourceId) DefaultAugmentedTapiTopologyOwnedNodeEdgePoint(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.context.topologycontext.topology.node.ownednodeedgepoint.DefaultAugmentedTapiTopologyOwnedNodeEdgePoint) List(java.util.List) CONNECTION_ID(org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery.CONNECTION_ID) ModelObjectData(org.onosproject.yang.model.ModelObjectData) Topology(org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.topologycontext.Topology) ODTN_PORT_TYPE(org.onosproject.odtn.utils.tapi.TapiObjectHandler.ODTN_PORT_TYPE) DEVICE_ID(org.onosproject.odtn.utils.tapi.TapiObjectHandler.DEVICE_ID) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Filter(org.onosproject.config.Filter) DeviceId(org.onosproject.net.DeviceId) Collections(java.util.Collections) DefaultAugmentedTapiCommonContext(org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.context.DefaultAugmentedTapiCommonContext) ONOS_CP(org.onosproject.odtn.utils.tapi.TapiObjectHandler.ONOS_CP) DefaultAugmentedTapiTopologyOwnedNodeEdgePoint(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.context.topologycontext.topology.node.ownednodeedgepoint.DefaultAugmentedTapiTopologyOwnedNodeEdgePoint) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) List(java.util.List) DefaultAugmentedTapiCommonContext(org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.context.DefaultAugmentedTapiCommonContext) Topology(org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.topologycontext.Topology) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

TapiNepRef (org.onosproject.odtn.utils.tapi.TapiNepRef)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 DefaultServiceDirectory.getService (org.onlab.osgi.DefaultServiceDirectory.getService)1 DynamicConfigService (org.onosproject.config.DynamicConfigService)1 Filter (org.onosproject.config.Filter)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 DeviceId (org.onosproject.net.DeviceId)1 CONNECTION_ID (org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery.CONNECTION_ID)1 DcsBasedTapiObjectRefFactory (org.onosproject.odtn.utils.tapi.DcsBasedTapiObjectRefFactory)1 TapiNodeRef (org.onosproject.odtn.utils.tapi.TapiNodeRef)1 DEVICE_ID (org.onosproject.odtn.utils.tapi.TapiObjectHandler.DEVICE_ID)1 ODTN_PORT_TYPE (org.onosproject.odtn.utils.tapi.TapiObjectHandler.ODTN_PORT_TYPE)1 ONOS_CP (org.onosproject.odtn.utils.tapi.TapiObjectHandler.ONOS_CP)1 DefaultContext (org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.DefaultContext)1 Name (org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.globalclass.Name)1