.build();
}
- private static ServiceAEnd getServiceAEnd(GenericServiceEndpoint sepA, GenericServiceEndpoint sepZ) {
- if (sepA.getType().equals(ServiceEndpointType.SERVICEAEND)) {
- return new ServiceAEndBuilder(sepA.getValue()).build();
- } else if (sepZ.getType().equals(ServiceEndpointType.SERVICEAEND)) {
- return new ServiceAEndBuilder(sepZ.getValue()).build();
- } else {
- return null;
- }
- }
-
- private static ServiceZEnd getServiceZEnd(GenericServiceEndpoint sepA, GenericServiceEndpoint sepZ) {
- if (sepA.getType().equals(ServiceEndpointType.SERVICEZEND)) {
- return new ServiceZEndBuilder(sepA.getValue()).build();
- } else if (sepZ.getType().equals(ServiceEndpointType.SERVICEZEND)) {
- return new ServiceZEndBuilder(sepZ.getValue()).build();
- } else {
- return null;
- }
- }
-
public void setSipMap(Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips) {
this.sipMap = sips;
}
.build();
// Connection creation
Map<ConnectionKey, Connection> connMap =
- createConnectionsFromService(serviceAEnd, serviceZEnd, pathDescription);
+ createConnectionsFromService(pathDescription, mapServiceLayerToAend(serviceAEnd));
LOG.debug("connectionMap for service {} = {} ", name.toString(), connMap.toString());
ConnectivityConstraint conConstr =
new ConnectivityConstraintBuilder().setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build();
.build();
}
- private LayerProtocolName mapServiceLayer(ServiceFormat serviceFormat, EndPoint endPoint1, EndPoint endPoint2) {
- switch (serviceFormat) {
- case OC:
- case OTU:
- return LayerProtocolName.PHOTONICMEDIA;
- case ODU:
- return LayerProtocolName.ODU;
- case Ethernet:
- String node1 = endPoint1.getLocalId();
- String node2 = endPoint2.getLocalId();
- if (getOpenroadmType(node1).equals(OpenroadmNodeType.TPDR)
- && getOpenroadmType(node2).equals(OpenroadmNodeType.TPDR)) {
- return LayerProtocolName.ETH;
- }
- return LayerProtocolName.DSR;
- default:
- LOG.info("Service layer mapping not supported for {}", serviceFormat.getName());
- }
- return null;
- }
-
- private OpenroadmNodeType getOpenroadmType(String nodeName) {
- LOG.info("Node name = {}", nodeName);
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+",nodeName, TapiStringConstants.XPDR))
- .getBytes(StandardCharsets.UTF_8)).toString());
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node tapiNode
- = this.tapiContext.getTapiNode(this.tapiTopoUuid, nodeUuid);
- if (tapiNode != null) {
- return OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type"))
- .getValue());
- }
- return null;
- }
-
- private Map<ConnectionKey, Connection> createConnectionsFromService(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEnd
- serviceAEnd,
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceZEnd
- serviceZEnd,
- PathDescription pathDescription) {
+ public Map<ConnectionKey, Connection> createConnectionsFromService(PathDescription pathDescription,
+ LayerProtocolName lpn) {
Map<ConnectionKey, Connection> connectionServMap = new HashMap<>();
// build lists with ROADM nodes, XPDR/MUX/SWITCH nodes, ROADM DEG TTPs, ROADM SRG TTPs, XPDR CLIENT TTPs
// and XPDR NETWORK TTPs (if any). From the path description. This will help to build the uuid of the CEPs
}
// create corresponding CEPs and Connections. Connections should be added to the corresponding context
// CEPs must be included in the topology context as an augmentation for each ONEP!!
- ServiceFormat serviceFormat = serviceAEnd.getServiceFormat(); // should be equal to serviceZEnd
// TODO -> Maybe we dont need to create the connections and ceps if the previous service doesnt exist??
// As mentioned above, for 100GbE service creation there are ROADMs in the path description.
// What are the configurations needed here? No OTU, ODU... what kind of cross connections is needed?
// this needs to be changed
// TODO: OpenROADM getNodeType from the NamesList to verify what needs to be created
OpenroadmNodeType openroadmNodeType = getOpenRoadmNodeType(xpdrNodelist);
- switch (serviceFormat) {
- case OC:
+ switch (lpn) {
+ case PHOTONICMEDIA:
// Identify number of ROADMs
// - XC Connection between MC CEPs mapped from MC NEPs (within a roadm)
// - XC Connection between OTSiMC CEPs mapped from OTSiMC NEPs (within a roadm)
// - Top Connection OTSiMC betwwen OTSiMC CEPs of extreme roadms
connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
edgeRoadm1, edgeRoadm2));
- break;
- case OTU:
- // Identify number of ROADMs between XPDRs and check if OC is created
- // - XC Connection between MC CEPs mapped from MC NEPs (within a roadm)
- // - Top Connection MC betwwen MC CEPs of different roadms
- // - XC Connection between OTSiMC CEPs mapped from OTSiMC NEPs (within a roadm)
- // - Top Connection OTSiMC betwwen OTSiMC CEPs of different roadms
- connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
- edgeRoadm1, edgeRoadm2));
- // - XC Connection OTSi betwwen iOTSi y eOTSi of xpdr
- // - Top connection OTSi between network ports of xpdrs in the Photonic media layer -> i_OTSi
- connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
+ if (!pathDescription.getAToZDirection().getAToZ().values().stream().findFirst().orElseThrow().getId()
+ .contains("ROADM")) {
+ // - XC Connection OTSi betwwen iOTSi y eOTSi of xpdr
+ // - Top connection OTSi between network ports of xpdrs in the Photonic media layer -> i_OTSi
+ connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
+ }
this.topConnRdmRdm = null;
break;
case ODU:
this.topConnXpdrXpdrPhtn = null;
}
break;
- case Ethernet:
+ case ETH:
// Check if OC, OTU and ODU are created
if (openroadmNodeType.equals(OpenroadmNodeType.TPDR)) {
LOG.info("WDM ETH service");
connectionServMap));
this.topConnXpdrXpdrPhtn = null;
}
+ break;
+ case DSR:
+ LOG.info("OTN XGE/ODUe service");
+ // - XC connection between iODU and eODU
+ // - Top connection between eODU ports
+ // - Top connection between DSR ports
if (openroadmNodeType.equals(OpenroadmNodeType.SWITCH)) {
// TODO: We create both ODU and DSR because there is no ODU service creation for the switch
// - XC Connection OTSi between iODU and eODU of xpdr
return connectionServMap;
}
+ public void updateTopologyWithNep(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, OwnedNodeEdgePoint onep) {
+ // TODO: verify this is correct. Should we identify the context IID with the context UUID??
+ InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
+ .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class)
+ .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class)
+ .child(Topology.class, new TopologyKey(topoUuid))
+ .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
+ new NodeKey(nodeUuid))
+ .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
+ .build();
+ try {
+ Optional<OwnedNodeEdgePoint> optionalOnep = this.networkTransactionService.read(
+ LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ if (optionalOnep.isPresent()) {
+ LOG.error("ONEP is already present in datastore");
+ return;
+ }
+ // merge in datastore
+ this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID,
+ onep);
+ this.networkTransactionService.commit().get();
+ LOG.info("NEP {} added successfully.", onep.getName().toString());
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Couldnt put NEP {} in topology, error = ", onep.getName().toString(), e);
+ }
+ }
+
+ public Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.ConnectionKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection> getConnectionFullMap() {
+ return this.connectionFullMap;
+ }
+
+ public ServiceCreateInput createORServiceInput(CreateConnectivityServiceInput input, Uuid serviceUuid) {
+ // TODO: not taking into account all the constraints. Only using EndPoints and Connectivity Constraint.
+ Map<org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPointKey,
+ org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint>
+ endPointMap = input.getEndPoint();
+ ConnectionType connType = null;
+ ServiceFormat serviceFormat = null;
+ String nodeAid = String.join("+", endPointMap.values().stream().findFirst().orElseThrow().getLocalId(),
+ TapiStringConstants.XPDR);
+ String nodeZid = String.join("+", endPointMap.values().stream().skip(1).findFirst().orElseThrow().getLocalId(),
+ TapiStringConstants.XPDR);
+ LOG.info("NodeAid = {}", nodeAid);
+ LOG.info("NodeZid = {}", nodeZid);
+ //switch (constraint.getServiceLayer().getIntValue()) {
+ switch (input.getLayerProtocolName().getIntValue()) {
+ case 0:
+ LOG.info("ODU");
+ connType = ConnectionType.Infrastructure;
+ serviceFormat = ServiceFormat.ODU;
+ break;
+ case 1:
+ LOG.info("ETH, no need to create OTU and ODU");
+ connType = ConnectionType.Service;
+ serviceFormat = ServiceFormat.Ethernet;
+ break;
+ case 2:
+ LOG.info("DSR, need to create OTU and ODU");
+ connType = ConnectionType.Service;
+ serviceFormat = ServiceFormat.Ethernet;
+ break;
+ case 3:
+ LOG.info("PHOTONIC");
+ connType = getConnectionTypePhtnc(endPointMap.values());
+ serviceFormat = getServiceFormatPhtnc(endPointMap.values());
+ LOG.debug("Node a photonic = {}", nodeAid);
+ LOG.debug("Node z photonic = {}", nodeZid);
+ break;
+ default:
+ LOG.info("Service type {} not supported", input.getLayerProtocolName().getName());
+ }
+ // Requested Capacity for connectivity service
+ Uint64 capacity = Uint64.valueOf(Math.abs(
+ input.getConnectivityConstraint().getRequestedCapacity().getTotalSize().getValue().intValue()));
+ // map endpoints into service end points. Map the type of service from TAPI to OR
+ ServiceAEnd serviceAEnd = tapiEndPointToServiceAPoint(endPointMap.values().stream().findFirst().orElseThrow(),
+ serviceFormat, nodeAid, capacity, input.getLayerProtocolName());
+ ServiceZEnd serviceZEnd = tapiEndPointToServiceZPoint(endPointMap.values().stream().skip(1).findFirst()
+ .orElseThrow(), serviceFormat, nodeZid, capacity, input.getLayerProtocolName());
+ if (serviceAEnd == null || serviceZEnd == null) {
+ LOG.error("Couldnt map endpoints to service end");
+ return null;
+ }
+ LOG.info("Service a end = {}", serviceAEnd);
+ LOG.info("Service z end = {}", serviceZEnd);
+ return new ServiceCreateInputBuilder()
+ .setServiceAEnd(serviceAEnd)
+ .setServiceZEnd(serviceZEnd)
+ .setConnectionType(connType)
+ .setServiceName(serviceUuid.getValue())
+ .setCommonId("common id")
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request-1")
+ .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url")
+ .setRequestSystemId("appname")
+ .build())
+ .setCustomer("customer")
+ .setDueDate(DateAndTime.getDefaultInstance("2018-06-15T00:00:01Z"))
+ .setOperatorContact("pw1234")
+ .build();
+ }
+
+ private static ServiceAEnd getServiceAEnd(GenericServiceEndpoint sepA, GenericServiceEndpoint sepZ) {
+ if (sepA.getType().equals(ServiceEndpointType.SERVICEAEND)) {
+ return new ServiceAEndBuilder(sepA.getValue()).build();
+ }
+ if (sepZ.getType().equals(ServiceEndpointType.SERVICEAEND)) {
+ return new ServiceAEndBuilder(sepZ.getValue()).build();
+ }
+ return null;
+ }
+
+ private static ServiceZEnd getServiceZEnd(GenericServiceEndpoint sepA, GenericServiceEndpoint sepZ) {
+ if (sepA.getType().equals(ServiceEndpointType.SERVICEZEND)) {
+ return new ServiceZEndBuilder(sepA.getValue()).build();
+ }
+ if (sepZ.getType().equals(ServiceEndpointType.SERVICEZEND)) {
+ return new ServiceZEndBuilder(sepZ.getValue()).build();
+ }
+ return null;
+ }
+
+ private LayerProtocolName mapServiceLayerToAend(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEnd
+ serviceAEnd) {
+ ServiceFormat serviceFormat = serviceAEnd.getServiceFormat();
+ switch (serviceFormat) {
+ case OC:
+ case OTU:
+ return LayerProtocolName.PHOTONICMEDIA;
+ case ODU:
+ return LayerProtocolName.ODU;
+ case Ethernet:
+ if (getOpenroadmType(serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort()
+ .getPortDeviceName()).equals(OpenroadmNodeType.TPDR)) {
+ return LayerProtocolName.ETH;
+ }
+ return LayerProtocolName.DSR;
+ default:
+ LOG.info("Service layer mapping not supported for {}", serviceFormat.getName());
+ }
+ return null;
+ }
+
+ private LayerProtocolName mapServiceLayer(ServiceFormat serviceFormat, EndPoint endPoint1, EndPoint endPoint2) {
+ switch (serviceFormat) {
+ case OC:
+ case OTU:
+ return LayerProtocolName.PHOTONICMEDIA;
+ case ODU:
+ return LayerProtocolName.ODU;
+ case Ethernet:
+ String node1 = endPoint1.getLocalId();
+ String node2 = endPoint2.getLocalId();
+ if (getOpenroadmType(node1).equals(OpenroadmNodeType.TPDR)
+ && getOpenroadmType(node2).equals(OpenroadmNodeType.TPDR)) {
+ return LayerProtocolName.ETH;
+ }
+ return LayerProtocolName.DSR;
+ default:
+ LOG.info("Service layer mapping not supported for {}", serviceFormat.getName());
+ }
+ return null;
+ }
+
+ private OpenroadmNodeType getOpenroadmType(String nodeName) {
+ LOG.info("Node name = {}", nodeName);
+ Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+",nodeName, TapiStringConstants.XPDR))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node tapiNode
+ = this.tapiContext.getTapiNode(this.tapiTopoUuid, nodeUuid);
+ if (tapiNode != null) {
+ return OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type"))
+ .getValue());
+ }
+ return null;
+ }
+
private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsEth(List<String> xpdrClientTplist,
List<String> xpdrNodelist,
Map<ConnectionKey, Connection> lowerConn) {
updateTopologyWithNep(topoUuid, nodeUuid, nepUuid, onep);
}
- public void updateTopologyWithNep(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, OwnedNodeEdgePoint onep) {
- // TODO: verify this is correct. Should we identify the context IID with the context UUID??
- InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
- .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class)
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class)
- .child(Topology.class, new TopologyKey(topoUuid))
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
- new NodeKey(nodeUuid))
- .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
- .build();
- try {
- Optional<OwnedNodeEdgePoint> optionalOnep = this.networkTransactionService.read(
- LogicalDatastoreType.OPERATIONAL, onepIID).get();
- if (optionalOnep.isPresent()) {
- LOG.error("ONEP is already present in datastore");
- return;
- }
- // merge in datastore
- this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID,
- onep);
- this.networkTransactionService.commit().get();
- LOG.info("NEP {} added successfully.", onep.getName().toString());
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt put NEP {} in topology, error = ", onep.getName().toString(), e);
- }
- }
-
- public Map<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection>
- getConnectionFullMap() {
- return this.connectionFullMap;
- }
-
private String getIdBasedOnModelVersion(String nodeid) {
return nodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*") ? String.join("-", nodeid.split("-")[0],
nodeid.split("-")[1]) : nodeid.split("-")[0];
}
- public ServiceCreateInput createORServiceInput(CreateConnectivityServiceInput input, Uuid serviceUuid) {
- // TODO: not taking into account all the constraints. Only using EndPoints and Connectivity Constraint.
- Map<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPointKey,
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint>
- endPointMap = input.getEndPoint();
- ConnectionType connType = null;
- ServiceFormat serviceFormat = null;
- String nodeAid = String.join("+", endPointMap.values().stream().findFirst().orElseThrow().getLocalId(),
- TapiStringConstants.XPDR);
- String nodeZid = String.join("+", endPointMap.values().stream().skip(1).findFirst().orElseThrow().getLocalId(),
- TapiStringConstants.XPDR);
- LOG.info("NodeAid = {}", nodeAid);
- LOG.info("NodeZid = {}", nodeZid);
- //switch (constraint.getServiceLayer().getIntValue()) {
- switch (input.getLayerProtocolName().getIntValue()) {
- case 0:
- LOG.info("ODU");
- connType = ConnectionType.Infrastructure;
- serviceFormat = ServiceFormat.ODU;
- break;
- case 1:
- LOG.info("ETH, no need to create OTU and ODU");
- connType = ConnectionType.Service;
- serviceFormat = ServiceFormat.Ethernet;
- break;
- case 2:
- LOG.info("DSR, need to create OTU and ODU");
- connType = ConnectionType.Service;
- serviceFormat = ServiceFormat.Ethernet;
- break;
- case 3:
- LOG.info("PHOTONIC");
- connType = getConnectionTypePhtnc(endPointMap.values());
- serviceFormat = getServiceFormatPhtnc(endPointMap.values());
- LOG.debug("Node a photonic = {}", nodeAid);
- LOG.debug("Node z photonic = {}", nodeZid);
- break;
- default:
- LOG.info("Service type {} not supported", input.getLayerProtocolName().getName());
- }
- // Requested Capacity for connectivity service
- Uint64 capacity = Uint64.valueOf(Math.abs(
- input.getConnectivityConstraint().getRequestedCapacity().getTotalSize().getValue().intValue()));
- // map endpoints into service end points. Map the type of service from TAPI to OR
- ServiceAEnd serviceAEnd = tapiEndPointToServiceAPoint(endPointMap.values().stream().findFirst().orElseThrow(),
- serviceFormat, nodeAid, capacity, input.getLayerProtocolName());
- ServiceZEnd serviceZEnd = tapiEndPointToServiceZPoint(endPointMap.values().stream().skip(1).findFirst()
- .orElseThrow(), serviceFormat, nodeZid, capacity, input.getLayerProtocolName());
- if (serviceAEnd == null || serviceZEnd == null) {
- LOG.error("Couldnt map endpoints to service end");
- return null;
- }
- LOG.info("Service a end = {}", serviceAEnd);
- LOG.info("Service z end = {}", serviceZEnd);
- return new ServiceCreateInputBuilder()
- .setServiceAEnd(serviceAEnd)
- .setServiceZEnd(serviceZEnd)
- .setConnectionType(connType)
- .setServiceName(serviceUuid.getValue())
- .setCommonId("common id")
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request-1")
- .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url")
- .setRequestSystemId("appname")
- .build())
- .setCustomer("customer")
- .setDueDate(DateAndTime.getDefaultInstance("2018-06-15T00:00:01Z"))
- .setOperatorContact("pw1234")
- .build();
- }
-
private ServiceZEnd tapiEndPointToServiceZPoint(
org.opendaylight.yang.gen.v1.urn
.onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint endPoint,
tapiContext, this.serviceDataStoreOperations);
tapiInitialORMapping.performTopoInitialMapping();
tapiInitialORMapping.performServInitialMapping();
- TapiPceNotificationHandler pceListenerImpl = new TapiPceNotificationHandler(dataBroker);
+ TapiPceNotificationHandler pceListenerImpl = new TapiPceNotificationHandler(dataBroker, connectivityUtils);
TapiRendererNotificationHandler rendererListenerImpl = new TapiRendererNotificationHandler(dataBroker,
notificationPublishService);
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Comparator;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
-import java.util.stream.Collectors;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
-import org.opendaylight.transportpce.tapi.TapiStringConstants;
+import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResult;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.Network;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.MappingKey;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.network.Nodes;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.network.NodesKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZ;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.Node;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.TerminationPoint;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Context;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ForwardingDirection;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LifecycleState;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.CreateConnectivityServiceInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.OwnedNodeEdgePoint1;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.OwnedNodeEdgePoint1Builder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnection;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnectionBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnectionKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.end.point.ClientNodeEdgePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.end.point.ClientNodeEdgePointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.end.point.ParentNodeEdgePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.end.point.ParentNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityService;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityServiceBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityServiceKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.Connection;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.ConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.ConnectionKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContextBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepList;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIERMC;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(TapiPceNotificationHandler.class);
- private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
private ServicePathRpcResult servicePathRpcResult;
private CreateConnectivityServiceInput input;
private Uuid serviceUuid;
private final DataBroker dataBroker;
private final NetworkTransactionService networkTransactionService;
+ private final ConnectivityUtils connectivityUtils;
private final Map<org.opendaylight.yang.gen.v1.urn
.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection>
connectionFullMap; // this variable is for complete connection objects
- private Connection topConnRdmRdm;
- private Connection topConnXpdrXpdrPhtn;
- private Connection topConnXpdrXpdrOdu;
- public TapiPceNotificationHandler(DataBroker dataBroker) {
+ public TapiPceNotificationHandler(DataBroker dataBroker, ConnectivityUtils connecUtil) {
this.connectionFullMap = new HashMap<>();
this.dataBroker = dataBroker;
this.networkTransactionService = new NetworkTransactionImpl(this.dataBroker);
- this.topConnRdmRdm = null;
- this.topConnXpdrXpdrPhtn = null;
- this.topConnXpdrXpdrOdu = null;
+ this.connectivityUtils = connecUtil;
}
public CompositeListener getCompositeListener() {
// verify the type of XPDR and the capacity and determine if it is an OTN service or pure WDM service
// Create connections and ceps for the connectivity service.
// Connections must be with a locked stated. As the renderer hasnt implemented yet the oc's
- Map<ConnectionKey, Connection> connectionMap = createConnectionsAndCepsForService(pathDescription,
- input.getLayerProtocolName());
+ Map<ConnectionKey, Connection> connectionMap = connectivityUtils.createConnectionsFromService(
+ pathDescription, input.getLayerProtocolName());
+ this.connectionFullMap.putAll(connectivityUtils.getConnectionFullMap());
LOG.debug("Connection Map from createConnectionsAndCepsForService is {}, LAYERPROTOCOL of service is {} ",
connectionMap.toString(), input.getLayerProtocolName());
// add connections to connection context and to connectivity context
updateConnectionContextWithConn(this.connectionFullMap, connectionMap, serviceUuid);
}
- private Map<ConnectionKey, Connection> createConnectionsAndCepsForService(PathDescription pathDescription,
- LayerProtocolName serviceProtName) {
- Map<ConnectionKey, Connection> connectionServMap = new HashMap<>();
- // build lists with ROADM nodes, XPDR/MUX/SWITCH nodes, ROADM DEG TTPs, ROADM SRG TTPs, XPDR CLIENT TTPs
- // and XPDR NETWORK TTPs (if any). From the path description. This will help to build the uuid of the CEPs
- // and the connections
- String resourceType;
- List<String> xpdrClientTplist = new ArrayList<>();
- List<String> xpdrNetworkTplist = new ArrayList<>();
- List<String> rdmAddDropTplist = new ArrayList<>();
- List<String> rdmDegTplist = new ArrayList<>();
- List<String> rdmNodelist = new ArrayList<>();
- List<String> xpdrNodelist = new ArrayList<>();
- for (AToZ elem:pathDescription.getAToZDirection().getAToZ().values().stream()
- .sorted((Comparator.comparing(atoz -> Integer.valueOf(atoz.getId())))).collect(Collectors.toList())) {
- resourceType = elem.getResource().getResource().implementedInterface().getSimpleName();
- switch (resourceType) {
- case TapiStringConstants.TP:
- TerminationPoint tp = (TerminationPoint) elem.getResource().getResource();
- String tpID = tp.getTpId();
- String tpNode;
- if (tpID.contains("CLIENT")) {
- tpNode = tp.getTpNodeId();
- if (!xpdrClientTplist.contains(String.join("+", tpNode, tpID))) {
- xpdrClientTplist.add(String.join("+", tpNode, tpID));
- }
- }
- if (tpID.contains("NETWORK")) {
- tpNode = tp.getTpNodeId();
- if (!xpdrNetworkTplist.contains(String.join("+", tpNode, tpID))) {
- xpdrNetworkTplist.add(String.join("+", tpNode, tpID));
- }
- }
- if (tpID.contains("PP")) {
- tpNode = getIdBasedOnModelVersion(tp.getTpNodeId());
- LOG.info("ROADM Node of tp = {}", tpNode);
- if (!rdmAddDropTplist.contains(String.join("+", tpNode, tpID))) {
- rdmAddDropTplist.add(String.join("+", tpNode, tpID));
- }
- }
- if (tpID.contains("TTP")) {
- tpNode = getIdBasedOnModelVersion(tp.getTpNodeId());
- LOG.info("ROADM Node of tp = {}", tpNode);
- if (!rdmDegTplist.contains(String.join("+", tpNode, tpID))) {
- rdmDegTplist.add(String.join("+", tpNode, tpID));
- }
- }
- break;
- case TapiStringConstants.NODE:
- Node node = (Node) elem.getResource().getResource();
- String nodeId = node.getNodeId();
- if (nodeId.contains("XPDR") || nodeId.contains("SPDR") || nodeId.contains("MXPDR")) {
- LOG.info("Node id = {}", nodeId);
- if (!xpdrNodelist.contains(nodeId)) {
- xpdrNodelist.add(nodeId); // should contain only 2
- }
- }
- if (nodeId.contains("ROADM")) {
- nodeId = getIdBasedOnModelVersion(nodeId);
- LOG.info("Node id = {}", nodeId);
- if (!rdmNodelist.contains(nodeId)) {
- rdmNodelist.add(nodeId);
- }
- }
- break;
- default:
- LOG.warn("Resource is a {}", resourceType);
- }
- }
- LOG.info("ROADM node list = {}", rdmNodelist.toString());
- LOG.info("ROADM degree list = {}", rdmDegTplist.toString());
- LOG.info("ROADM addrop list = {}", rdmAddDropTplist.toString());
- LOG.info("XPDR node list = {}", xpdrNodelist.toString());
- LOG.info("XPDR network list = {}", xpdrNetworkTplist.toString());
- LOG.info("XPDR client list = {}", xpdrClientTplist.toString());
- // TODO -> for 10GB eth and ODU services there are no ROADMs in path description as they use the OTU link,
- // but for 100GB eth all is created at once. Check if the roadm list is empty to determine whether we need
- // to trigger all the steps or not
- String edgeRoadm1 = "";
- String edgeRoadm2 = "";
- if (!rdmNodelist.isEmpty()) {
- edgeRoadm1 = rdmNodelist.get(0);
- edgeRoadm2 = rdmNodelist.get(rdmNodelist.size() - 1);
- LOG.info("edgeRoadm1 = {}", edgeRoadm1);
- LOG.info("edgeRoadm2 = {}", edgeRoadm2);
- }
- // create corresponding CEPs and Connections. Connections should be added to the corresponding context
- // CEPs must be included in the topology context as an augmentation for each ONEP!!
- // TODO -> Maybe we dont need to create the connections and ceps if the previous service doesnt exist??
- // As mentioned above, for 100GbE service creation there are ROADMs in the path description.
- // What are the configurations needed here? No OTU, ODU... what kind of cross connections is needed?
- // this needs to be changed
-
- // TODO: OpenROADM getNodeType from the NamesList to verify what needs to be created
- OpenroadmNodeType openroadmNodeType = getOpenRoadmNodeType(xpdrNodelist);
- switch (serviceProtName) {
- case PHOTONICMEDIA:
- // Identify number of ROADMs
- // - XC Connection between MC CEPs mapped from MC NEPs (within a roadm)
- // - XC Connection between OTSiMC CEPs mapped from OTSiMC NEPs (within a roadm)
- // - Top Connection MC betwwen MC CEPs of different roadms
- // - Top Connection OTSiMC betwwen OTSiMC CEPs of extreme roadms
- connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
- edgeRoadm1, edgeRoadm2));
- if (!pathDescription.getAToZDirection().getAToZ().values().stream().findFirst().orElseThrow().getId()
- .contains("ROADM")) {
- // - XC Connection OTSi betwwen iOTSi y eOTSi of xpdr
- // - Top connection OTSi between network ports of xpdrs in the Photonic media layer -> i_OTSi
- connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
- this.topConnRdmRdm = null;
- }
- break;
- case ODU:
- // TODO: verify if this is correct
- LOG.info("OTN ODU service");
- // - XC Connection OTSi between iODU and eODU of xpdr
- // - Top connection in the ODU layer, between xpdr iODU ports
- if (openroadmNodeType.equals(OpenroadmNodeType.MUXPDR)) {
- connectionServMap.putAll(createXpdrCepsAndConnectionsOdu(xpdrNetworkTplist, xpdrNodelist));
- this.topConnXpdrXpdrPhtn = null;
- }
- break;
- case ETH:
- LOG.info("WDM service");
- if (openroadmNodeType.equals(OpenroadmNodeType.TPDR)) {
- // TODO: WDM service. Only och/otu4 needed and then directly DSR top connection.
- // Need to find the associated client ports of the network port
- // - Same as for PHOTONIC MEDIA service
- // - Do we nedd cross connection in the ODU layer??
- // - Top connection DSR between client ports of the transponder
- connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
- edgeRoadm1, edgeRoadm2));
- connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
- this.topConnRdmRdm = null;
- xpdrClientTplist = getAssociatedClientsPort(xpdrNetworkTplist);
- LOG.info("Associated client ports = {}", xpdrClientTplist);
- connectionServMap.putAll(createXpdrCepsAndConnectionsEth(xpdrClientTplist, xpdrNodelist,
- connectionServMap));
- this.topConnXpdrXpdrPhtn = null;
- }
- break;
- case DSR:
- LOG.info("OTN XGE/ODUe service");
- // - XC connection between iODU and eODU
- // - Top connection between eODU ports
- // - Top connection between DSR ports
- if (openroadmNodeType.equals(OpenroadmNodeType.SWITCH)) {
- // TODO: We create both ODU and DSR because there is no ODU service creation for the switch
- // - XC Connection OTSi betwwen iODU and eODU of xpdr
- // - Top connection in the ODU layer, between xpdr eODU ports (?)
- connectionServMap.putAll(createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist,
- xpdrNodelist));
- this.topConnXpdrXpdrPhtn = null;
- }
- if (openroadmNodeType.equals(OpenroadmNodeType.MUXPDR)) {
- // TODO: OTN service but mux has 3 steps at rendering. Verify that things exist
- connectionServMap.putAll(createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist,
- xpdrNodelist));
- this.topConnXpdrXpdrOdu = null;
- }
- break;
- default:
- LOG.error("Service type format {} not supported", serviceProtName.getName());
- }
- LOG.info("CONNSERVERMAP PceListener= {}", connectionServMap.toString());
- return connectionServMap;
- }
-
/**
* Process cancel resource result.
* @param serviceName Service name to build uuid.
return true;
}
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsEth(List<String> xpdrClientTplist,
- List<String> xpdrNodelist,
- Map<ConnectionKey, Connection> lowerConn) {
- // TODO: do we need to create cross connection between iODU and eODU??
- // add the lower connections of the previous steps for this kind of service
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
- for (Connection lowConn: lowerConn.values()) {
- LowerConnection conn = new LowerConnectionBuilder().setConnectionUuid(lowConn.getConnectionUuid()).build();
- xcMap.put(conn.key(), conn);
- }
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapDsr = new HashMap<>();
- // Create 1 cep per Xpdr in the CLIENT
- // 1 top connection DSR between the CLIENT xpdrs
- for (String xpdr:xpdrNodelist) {
- LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrClient = xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR,
- LayerProtocolName.DSR);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR,
- netCep1);
-
- cepMapDsr.put(netCep1.key(), netCep1);
- }
- String spcXpdr1 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
-
- // DSR top connection between edge xpdr CLIENT DSR
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionDsr = createTopConnection(spcXpdr1, spcXpdr2, cepMapDsr, TapiStringConstants.DSR,
- LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
- this.connectionFullMap.put(connectionDsr.key(), connectionDsr);
-
- // DSR top connection that will be added to the service object
- Connection conn1 = new ConnectionBuilder().setConnectionUuid(connectionDsr.getUuid()).build();
- connServMap.put(conn1.key(), conn1);
-
- return connServMap;
- }
-
- private Map<ConnectionKey,Connection> createXpdrCepsAndConnectionsDsr(List<String> xpdrClientTplist,
- List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapDsr = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapOdu = new HashMap<>();
- // TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
- // be added to the lower connection of a top connection
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
-
- // Create 1 cep per Xpdr in the CLIENT, 1 cep per Xpdr eODU, 1 XC between eODU and iODE,
- // 1 top connection between eODU and a top connection DSR between the CLIENT xpdrs
- for (String xpdr:xpdrNodelist) {
- LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrClient = xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint clientCep1 = createCepXpdr(spcXpdrClient, TapiStringConstants.DSR,
- TapiStringConstants.XPDR, LayerProtocolName.DSR);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR,
- clientCep1);
-
- ConnectionEndPoint clientCep2 = createCepXpdr(spcXpdrClient, TapiStringConstants.E_ODU,
- TapiStringConstants.XPDR, LayerProtocolName.ODU);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.E_ODU, TapiStringConstants.XPDR,
- clientCep2);
-
- String spcXpdrNetwork = getAssociatedNetworkPort(spcXpdrClient, xpdrNetworkTplist);
- ConnectionEndPoint netCep3 = getAssociatediODUCep(spcXpdrNetwork);
-
- cepMapDsr.put(clientCep1.key(), clientCep1);
- cepMapOdu.put(clientCep2.key(), clientCep2);
- // Create x connection between I_ODU and E_ODU within xpdr
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createXCBetweenCeps(clientCep2, netCep3, spcXpdrClient, spcXpdrNetwork,
- TapiStringConstants.ODU, LayerProtocolName.ODU);
- this.connectionFullMap.put(connection.key(), connection);
-
- // Create X connection that will be added to the service object
- LowerConnection conn = new LowerConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- xcMap.put(conn.key(), conn);
- }
-
- String spcXpdr1 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
-
- // eODU top connection between edge xpdr CLIENT eODU
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionOdu = createTopConnection(spcXpdr1, spcXpdr2, cepMapOdu, TapiStringConstants.E_ODU,
- LayerProtocolName.ODU, xcMap, this.topConnXpdrXpdrOdu);
- this.connectionFullMap.put(connectionOdu.key(), connectionOdu);
-
- // ODU top connection that will be added to the service object and also lower connection
- Connection conn = new ConnectionBuilder().setConnectionUuid(connectionOdu.getUuid()).build();
- connServMap.put(conn.key(), conn);
- LowerConnection lowerConn = new LowerConnectionBuilder().setConnectionUuid(connectionOdu.getUuid()).build();
- xcMap.put(lowerConn.key(), lowerConn);
-
- // DSR top connection between edge xpdr CLIENT DSR
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionDsr = createTopConnection(spcXpdr1, spcXpdr2, cepMapDsr, TapiStringConstants.DSR,
- LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
- this.connectionFullMap.put(connectionDsr.key(), connectionDsr);
-
- // DSR top connection that will be added to the service object
- Connection conn1 = new ConnectionBuilder().setConnectionUuid(connectionDsr.getUuid()).build();
- connServMap.put(conn1.key(), conn1);
-
- return connServMap;
- }
-
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsOdu(List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap = new HashMap<>();
- // TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
- // be added to the lower connection of a top connection
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
- // Create 1 cep per Xpdr in the I_ODU and a top
- // connection iODU between the xpdrs
- for (String xpdr:xpdrNodelist) {
- LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrNetwork = xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.I_ODU,
- TapiStringConstants.XPDR, LayerProtocolName.ODU);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.I_ODU, TapiStringConstants.XPDR,
- netCep1);
-
- cepMap.put(netCep1.key(), netCep1);
- }
-
- // ODU top connection between edge xpdr i_ODU
- String spcXpdr1 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcXpdr1, spcXpdr2, cepMap, TapiStringConstants.I_ODU,
- LayerProtocolName.ODU, xcMap, this.topConnXpdrXpdrPhtn);
- this.connectionFullMap.put(connection.key(), connection);
-
- // ODU top connection that will be added to the service object
- Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- connServMap.put(conn.key(), conn);
- this.topConnXpdrXpdrOdu = conn;
-
- return connServMap;
- }
-
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsPht(List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap = new HashMap<>();
- // TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
- // be added to the lower connection of a top connection
-// Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
-
- // create ceps and xc connections within xpdr
- for (String xpdr:xpdrNodelist) {
- LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrNetwork = xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- // There should be 1 network tp per xpdr
- // Just create 2 different CEPs (1 OTS + 1 OTSI_MC)
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS,
- TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS,
- TapiStringConstants.XPDR, netCep1);
- ConnectionEndPoint netCep2 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.OTSI_MC,
- TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.OTSI_MC, TapiStringConstants.XPDR,
- netCep2);
-// ConnectionEndPoint netCep3 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.I_OTSI,
-// TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
-// putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.I_OTSI, TapiStringConstants.OTSI,
-// netCep3);
-// cepMap.put(netCep3.key(), netCep3);
- cepMap.put(netCep1.key(), netCep1);
- cepMap.put(netCep2.key(), netCep2);
-
-
- }
-
- // OTSi top connection between edge OTSI_MC Xpdr
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
- String spcXpdr1 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcXpdr1, spcXpdr2, cepMap, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA, xcMap, this.topConnRdmRdm);
- this.connectionFullMap.put(connection.key(), connection);
-
- // OTSi top connection that will be added to the service object
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- connServMap.put(conn.key(), conn);
- this.topConnXpdrXpdrPhtn = conn;
- return connServMap;
- }
-
- private Map<ConnectionKey, Connection> createRoadmCepsAndConnections(List<String> rdmAddDropTplist,
- List<String> rdmDegTplist,
- List<String> rdmNodelist,
- String edgeRoadm1, String edgeRoadm2) {
- // TODO: will need to check if things exist already or not
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap = new HashMap<>();
- // create ceps and x connections within roadm
- Map<LowerConnectionKey, LowerConnection> xcLowerMap = new HashMap<>();
- for (String roadm : rdmNodelist) {
- LOG.info("Creating ceps and xc for roadm {}", roadm);
- if (roadm.equals(edgeRoadm1) || roadm.equals(edgeRoadm2)) {
- LOG.info("EDGE ROADM, cross connections needed between SRG and DEG");
- String spcRdmAD = rdmAddDropTplist.stream().filter(adp -> adp.contains(roadm)).findFirst()
- .orElseThrow();
- LOG.info("AD port of ROADm {} = {}", roadm, spcRdmAD);
- // There should be only 1 AD and 1 DEG per roadm
- // TODO photonic media model should be updated to have the corresponding CEPs. I will just create
- // 3 different MC CEPs giving different IDs to show that they are different
- // Create 3 CEPs for each AD and DEG and the corresponding cross connections, matching the NEPs
- // created in the topology creation
- // add CEPs to the topology to the corresponding ONEP
- ConnectionEndPoint adCep1 = createCepRoadm(spcRdmAD, TapiStringConstants.PHTNC_MEDIA_OTS);
- putRdmCepInTopologyContext(roadm, spcRdmAD, TapiStringConstants.PHTNC_MEDIA_OTS, adCep1);
- ConnectionEndPoint adCep2 = createCepRoadm(spcRdmAD, TapiStringConstants.MC);
- putRdmCepInTopologyContext(roadm, spcRdmAD, TapiStringConstants.MC, adCep2);
- ConnectionEndPoint adCep3 = createCepRoadm(spcRdmAD, TapiStringConstants.OTSI_MC);
- putRdmCepInTopologyContext(roadm, spcRdmAD, TapiStringConstants.OTSI_MC, adCep3);
- cepMap.put(adCep1.key(), adCep1);
- cepMap.put(adCep2.key(), adCep2);
- cepMap.put(adCep3.key(), adCep3);
-
- String spcRdmDEG = rdmDegTplist.stream().filter(adp -> adp.contains(roadm)).findFirst().orElseThrow();
- LOG.info("Degree port of ROADm {} = {}", roadm, spcRdmDEG);
-
- ConnectionEndPoint degCep0 = createCepRoadm(spcRdmDEG, TapiStringConstants.PHTNC_MEDIA_OTS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG, TapiStringConstants.PHTNC_MEDIA_OTS, degCep0);
- ConnectionEndPoint degCep1 = createCepRoadm(spcRdmDEG, TapiStringConstants.PHTNC_MEDIA_OMS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG, TapiStringConstants.PHTNC_MEDIA_OMS, degCep1);
- ConnectionEndPoint degCep2 = createCepRoadm(spcRdmDEG, TapiStringConstants.MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG, TapiStringConstants.MC, degCep2);
- ConnectionEndPoint degCep3 = createCepRoadm(spcRdmDEG, TapiStringConstants.OTSI_MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG, TapiStringConstants.OTSI_MC, degCep3);
- cepMap.put(degCep0.key(), degCep0);
- cepMap.put(degCep1.key(), degCep1);
- cepMap.put(degCep2.key(), degCep2);
- cepMap.put(degCep3.key(), degCep3);
-
- LOG.info("Going to create cross connections for ROADM {}", roadm);
- // Create X connections between MC and OTSi_MC for full map
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection1
- = createXCBetweenCeps(adCep2, degCep2, spcRdmAD, spcRdmDEG, TapiStringConstants.MC,
- LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 1 created = {}", connection1.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection2
- = createXCBetweenCeps(adCep3, degCep3, spcRdmAD, spcRdmDEG, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 2 created = {}", connection2.toString());
- this.connectionFullMap.put(connection1.key(), connection1);
- this.connectionFullMap.put(connection2.key(), connection2);
-
- // Create X connections that will be added to the service object
- LowerConnection conn1 = new LowerConnectionBuilder().setConnectionUuid(connection1.getUuid()).build();
- LowerConnection conn2 = new LowerConnectionBuilder().setConnectionUuid(connection2.getUuid()).build();
-
- xcLowerMap.put(conn1.key(), conn1);
- xcLowerMap.put(conn2.key(), conn2);
- } else {
- LOG.info("MIDDLE ROADM, cross connections needed between DEG and DEG");
- String spcRdmDEG1 = rdmDegTplist.stream().filter(adp -> adp.contains(roadm)).findFirst().orElseThrow();
- LOG.info("Degree 1 port of ROADm {} = {}", roadm, spcRdmDEG1);
-
- ConnectionEndPoint deg1Cep0 = createCepRoadm(spcRdmDEG1, TapiStringConstants.PHTNC_MEDIA_OTS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG1, TapiStringConstants.PHTNC_MEDIA_OTS, deg1Cep0);
- ConnectionEndPoint deg1Cep1 = createCepRoadm(spcRdmDEG1, TapiStringConstants.PHTNC_MEDIA_OMS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG1, TapiStringConstants.PHTNC_MEDIA_OMS, deg1Cep1);
- ConnectionEndPoint deg1Cep2 = createCepRoadm(spcRdmDEG1, TapiStringConstants.MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG1, TapiStringConstants.MC, deg1Cep2);
- ConnectionEndPoint deg1Cep3 = createCepRoadm(spcRdmDEG1, TapiStringConstants.OTSI_MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG1, TapiStringConstants.OTSI_MC, deg1Cep3);
- cepMap.put(deg1Cep0.key(), deg1Cep0);
- cepMap.put(deg1Cep1.key(), deg1Cep1);
- cepMap.put(deg1Cep2.key(), deg1Cep2);
- cepMap.put(deg1Cep3.key(), deg1Cep3);
-
- String spcRdmDEG2 = rdmDegTplist.stream().filter(adp -> adp.contains(roadm)).skip(1).findFirst()
- .orElseThrow();
- LOG.info("Degree 2 port of ROADm {} = {}", roadm, spcRdmDEG2);
-
- ConnectionEndPoint deg2Cep0 = createCepRoadm(spcRdmDEG2, TapiStringConstants.PHTNC_MEDIA_OTS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG2, TapiStringConstants.PHTNC_MEDIA_OTS, deg2Cep0);
- ConnectionEndPoint deg2Cep1 = createCepRoadm(spcRdmDEG2, TapiStringConstants.PHTNC_MEDIA_OMS);
- putRdmCepInTopologyContext(roadm, spcRdmDEG2, TapiStringConstants.PHTNC_MEDIA_OMS, deg2Cep1);
- ConnectionEndPoint deg2Cep2 = createCepRoadm(spcRdmDEG2, TapiStringConstants.MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG2, TapiStringConstants.MC, deg2Cep2);
- ConnectionEndPoint deg2Cep3 = createCepRoadm(spcRdmDEG2, TapiStringConstants.OTSI_MC);
- putRdmCepInTopologyContext(roadm, spcRdmDEG2, TapiStringConstants.OTSI_MC, deg2Cep3);
- cepMap.put(deg2Cep0.key(), deg2Cep0);
- cepMap.put(deg2Cep1.key(), deg2Cep1);
- cepMap.put(deg2Cep2.key(), deg2Cep2);
- cepMap.put(deg2Cep3.key(), deg2Cep3);
-
- LOG.info("Going to create cross connections for ROADM {}", roadm);
- // Create X connections between MC and OTSi_MC for full map
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection1
- = createXCBetweenCeps(deg1Cep2, deg2Cep2, spcRdmDEG1, spcRdmDEG2,
- TapiStringConstants.MC, LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 1 created = {}", connection1.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection2
- = createXCBetweenCeps(deg1Cep3, deg2Cep3, spcRdmDEG1, spcRdmDEG2,
- TapiStringConstants.OTSI_MC, LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 2 created = {}", connection2.toString());
- this.connectionFullMap.put(connection1.key(), connection1);
- this.connectionFullMap.put(connection2.key(), connection2);
-
- // Create X connections that will be added to the service object
- LowerConnection conn1 = new LowerConnectionBuilder().setConnectionUuid(connection1.getUuid()).build();
- LowerConnection conn2 = new LowerConnectionBuilder().setConnectionUuid(connection2.getUuid()).build();
-
- xcLowerMap.put(conn1.key(), conn1);
- xcLowerMap.put(conn2.key(), conn2);
- }
- }
- LOG.info("Going to create top connections between roadms");
- String spcRdmAD1 = rdmAddDropTplist.stream().filter(adp -> adp.contains(edgeRoadm1)).findFirst().orElseThrow();
- String spcRdmAD2 = rdmAddDropTplist.stream().filter(adp -> adp.contains(edgeRoadm2)).findFirst().orElseThrow();
- // MC top connection between edge roadms
- LOG.info("Going to created top connection between MC");
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.MC,
- LayerProtocolName.PHOTONICMEDIA, xcLowerMap, null);
- this.connectionFullMap.put(connection.key(), connection);
- LOG.info("Top connection created = {}", connection.toString());
-
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- // OTSiMC top connections that will be added to the service object
- Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- connServMap.put(conn.key(), conn);
- LowerConnection conn1 = new LowerConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- Map<LowerConnectionKey, LowerConnection> topLowerMap = new HashMap<>();
- topLowerMap.put(conn1.key(), conn1);
-
- // OTSiMC top connection between edge roadms
- LOG.info("Going to created top connection between OTSiMC");
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection1 = createTopConnection(spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA, topLowerMap, null);
- this.connectionFullMap.put(connection1.key(), connection1);
- LOG.info("Top connection created = {}", connection1.toString());
-
- // OTSiMC top connections that will be added to the service object
- Connection conn2 = new ConnectionBuilder().setConnectionUuid(connection1.getUuid()).build();
- connServMap.put(conn2.key(), conn2);
- this.topConnRdmRdm = conn2;
- return connServMap;
- }
-
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- createTopConnection(String tp1, String tp2,
- Map<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap, String qual, LayerProtocolName topPortocol,
- Map<LowerConnectionKey, LowerConnection> xcMap, Connection additionalLowerConn) {
- // find cep for each AD MC of roadm 1 and 2
- LOG.info("Top connection name = {}", String.join("+", "TOP", tp1, tp2, qual));
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.ConnectionEndPoint adCep1 =
- cepMap.get(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey(
- new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", tp1.split("\\+")[0],
- qual, tp1.split("\\+")[1])).getBytes(Charset.forName("UTF-8")))
- .toString())));
- LOG.info("ADCEP1 = {}", adCep1.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cep1 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(adCep1.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(adCep1.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(adCep1.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(adCep1.getUuid())
- .build();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.ConnectionEndPoint adCep2 =
- cepMap.get(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey(
- new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", tp2.split("\\+")[0],
- qual, tp2.split("\\+")[1])).getBytes(Charset.forName("UTF-8")))
- .toString())));
- LOG.info("ADCEP2 = {}", adCep2.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cep2 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(adCep2.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(adCep2.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(adCep2.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(adCep1.getUuid())
- .build();
- Map<ConnectionEndPointKey, org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint> ceps = new HashMap<>();
- ceps.put(cep1.key(), cep1);
- ceps.put(cep2.key(), cep2);
- Name connName = new NameBuilder()
- .setValueName("Connection name")
- .setValue(String.join("+", "TOP", tp1, tp2, qual))
- .build();
- // TODO: lower connection, supported link.......
- if (additionalLowerConn != null) {
- xcMap.putIfAbsent(new LowerConnectionKey(additionalLowerConn.getConnectionUuid()),
- new LowerConnectionBuilder().setConnectionUuid(additionalLowerConn.getConnectionUuid()).build());
- }
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "TOP", tp1, tp2, qual))
- .getBytes(Charset.forName("UTF-8"))).toString()))
- .setName(Map.of(connName.key(), connName))
- .setConnectionEndPoint(ceps)
- .setOperationalState(OperationalState.DISABLED)
- .setLayerProtocolName(topPortocol)
- .setLifecycleState(LifecycleState.POTENTIALAVAILABLE)
- .setDirection(ForwardingDirection.BIDIRECTIONAL)
- .setLowerConnection(xcMap)
- .build();
- }
-
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- createXCBetweenCeps(ConnectionEndPoint cep1, ConnectionEndPoint cep2, String tp1, String tp2, String qual,
- LayerProtocolName xcProtocol) {
- LOG.info("Creation cross connection between: {} and {}", tp1, tp2);
- LOG.info("Cross connection name = {}", String.join("+", "XC", tp1, tp2, qual));
- LOG.debug("Parent NEP of CEP1 = {}", cep1.getParentNodeEdgePoint().toString());
- LOG.debug("Parent NEP CEP2 = {}", cep2.getParentNodeEdgePoint().toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cepServ1 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(cep1.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(cep1.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(cep1.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(cep1.getUuid())
- .build();
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cepServ2 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(cep2.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(cep2.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(cep2.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(cep2.getUuid())
- .build();
- Map<ConnectionEndPointKey, org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint> ceps = new HashMap<>();
- ceps.put(cepServ1.key(), cepServ1);
- ceps.put(cepServ2.key(), cepServ2);
- Name connName = new NameBuilder()
- .setValueName("Connection name")
- .setValue(String.join("+", "XC", tp1, tp2, qual))
- .build();
- // TODO: lower connection, supported link.......
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "XC", tp1, tp2, qual))
- .getBytes(Charset.forName("UTF-8"))).toString()))
- .setName(Map.of(connName.key(), connName))
- .setConnectionEndPoint(ceps)
- .setOperationalState(OperationalState.ENABLED)
- .setLayerProtocolName(xcProtocol)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setDirection(ForwardingDirection.BIDIRECTIONAL)
- .build();
- }
-
- private ConnectionEndPoint createCepRoadm(String id, String qualifier) {
- LOG.info("NEP = {}", String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
- Name cepName = new NameBuilder()
- .setValueName("ConnectionEndPoint name")
- .setValue(String.join("+", id.split("\\+")[0], qualifier,
- id.split("\\+")[1]))
- .build();
- ParentNodeEdgePoint pnep = new ParentNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
- .build();
- String clientQualifier = "";
- switch (qualifier) {
- case TapiStringConstants.PHTNC_MEDIA_OTS:
- clientQualifier = TapiStringConstants.PHTNC_MEDIA_OMS;
- break;
- case TapiStringConstants.PHTNC_MEDIA_OMS:
- clientQualifier = TapiStringConstants.MC;
- OwnedNodeEdgePoint onepMC = createRoadmNep(id.split("\\+")[0], id.split("\\+")[1],
- false, OperationalState.ENABLED, AdministrativeState.UNLOCKED, clientQualifier);
- putRdmNepInTopologyContext(id.split("\\+")[0], id.split("\\+")[1], TapiStringConstants.MC, onepMC);
- break;
- case TapiStringConstants.MC:
- clientQualifier = TapiStringConstants.OTSI_MC;
- OwnedNodeEdgePoint onepOTSiMC = createRoadmNep(id.split("\\+")[0], id.split("\\+")[1],
- false, OperationalState.ENABLED, AdministrativeState.UNLOCKED, clientQualifier);
- putRdmNepInTopologyContext(id.split("\\+")[0], id.split("\\+")[1],
- TapiStringConstants.OTSI_MC, onepOTSiMC);
- break;
- default:
- LOG.debug("not currently handling client NEP for OTSiMC CEP {}",
- String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
- break;
- }
- ClientNodeEdgePoint cnep = new ClientNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- clientQualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
- .build();
- // TODO: add augmentation with the corresponding cep-spec (i.e. MC, OTSiMC...)
- // TODO: add parent ONEP??
- ConnectionEndPointBuilder cepBldr = new ConnectionEndPointBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setParentNodeEdgePoint(pnep)
- .setName(Map.of(cepName.key(), cepName))
- .setConnectionPortRole(PortRole.SYMMETRIC)
- .setDirection(Direction.BIDIRECTIONAL)
- .setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA);
- if (!(TapiStringConstants.OTSI_MC.equals(qualifier))) {
- cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep));
- }
- return cepBldr.build();
- }
-
- private ConnectionEndPoint createCepXpdr(String id, String qualifier, String nodeLayer,
- LayerProtocolName cepProtocol) {
- Name cepName = new NameBuilder()
- .setValueName("ConnectionEndPoint name")
- .setValue(String.join("+", id.split("\\+")[0], qualifier,
- id.split("\\+")[1]))
- .build();
- ParentNodeEdgePoint pnep = new ParentNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.XPDR)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
- .build();
- String clientQualifier = "";
- String clientNodeLayer = TapiStringConstants.PHTNC_MEDIA;
- switch (qualifier) {
- case TapiStringConstants.PHTNC_MEDIA_OTS:
- clientQualifier = TapiStringConstants.OTSI_MC;
- break;
- case TapiStringConstants.OTSI_MC:
- clientQualifier = TapiStringConstants.E_ODU;
- clientNodeLayer = TapiStringConstants.ODU;
- break;
- case TapiStringConstants.E_ODU:
- clientQualifier = TapiStringConstants.DSR;
- clientNodeLayer = TapiStringConstants.DSR;
- break;
- default :
- LOG.debug("no client CEP for DSR NEP {}",
- String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
- break;
- }
- ClientNodeEdgePoint cnep = new ClientNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- clientQualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.XPDR)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
- .build();
- // TODO: add augmentation with the corresponding cep-spec (i.e. MC, OTSiMC...)
- // TODO: add parent ONEP??
- ConnectionEndPointBuilder cepBldr = new ConnectionEndPointBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setParentNodeEdgePoint(pnep)
- .setName(Map.of(cepName.key(), cepName))
- .setConnectionPortRole(PortRole.SYMMETRIC)
- .setDirection(Direction.BIDIRECTIONAL)
- .setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setLayerProtocolName(cepProtocol);
- if (!(TapiStringConstants.DSR.equals(qualifier))) {
- cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep));
- }
- return cepBldr.build();
- }
-
- private void putRdmCepInTopologyContext(String node, String spcRdmAD, String qual, ConnectionEndPoint cep) {
- LOG.info("NEP id before Merge = {}", String.join("+", node, qual, spcRdmAD.split("\\+")[1]));
- LOG.info("Node of NEP id before Merge = {}", String.join("+", node, TapiStringConstants.PHTNC_MEDIA));
- // Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, TapiStringConstants.PHTNC_MEDIA)
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, qual, spcRdmAD.split("\\+")[1])
- .getBytes(Charset.forName("UTF-8"))).toString());
- updateTopologyWithCep(topoUuid, nodeUuid, nepUuid, cep);
- }
-
- private void putXpdrCepInTopologyContext(String node, String spcXpdrNet, String qual, String nodeLayer,
- ConnectionEndPoint cep) {
- // Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, nodeLayer)
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, qual, spcXpdrNet.split("\\+")[1])
- .getBytes(Charset.forName("UTF-8"))).toString());
- updateTopologyWithCep(topoUuid, nodeUuid, nepUuid, cep);
- }
public void updateTopologyWithCep(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, ConnectionEndPoint cep) {
// TODO: verify this is correct. Should we identify the context IID with the context UUID??
}
}
- private void putRdmNepInTopologyContext(String orNodeId, String orTpId, String qual, OwnedNodeEdgePoint onep) {
- LOG.info("NEP id before Merge = {}", String.join("+", orNodeId, qual, orTpId));
- LOG.info("Node of NEP id before Merge = {}", String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA));
- // Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", orNodeId, qual, orTpId)
- .getBytes(Charset.forName("UTF-8"))).toString());
- updateTopologyWithNep(topoUuid, nodeUuid, nepUuid, onep);
- }
-
public void updateTopologyWithNep(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, OwnedNodeEdgePoint onep) {
// TODO: verify this is correct. Should we identify the context IID with the context UUID??
InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
}
}
- private String getIdBasedOnModelVersion(String nodeid) {
- return nodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*")
- ? String.join("-", nodeid.split("-")[0], nodeid.split("-")[1]) : nodeid.split("-")[0];
- }
-
- private ConnectionEndPoint getAssociatediODUCep(String spcXpdrNetwork) {
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", spcXpdrNetwork.split("\\+")[0],
- TapiStringConstants.XPDR).getBytes(Charset.forName("UTF-8")))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", spcXpdrNetwork.split("\\+")[0],
- TapiStringConstants.I_ODU, spcXpdrNetwork.split("\\+")[1]).getBytes(Charset.forName("UTF-8"))))
- .toString());
- Uuid cepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP",
- spcXpdrNetwork.split("\\+")[0], TapiStringConstants.I_ODU, spcXpdrNetwork.split("\\+")[1]))
- .getBytes(Charset.forName("UTF-8"))).toString());
- InstanceIdentifier<OwnedNodeEdgePoint> nepIID = InstanceIdentifier.builder(Context.class)
- .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class)
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class)
- .child(Topology.class, new TopologyKey(topoUuid))
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
- new NodeKey(nodeUuid)).child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid)).build();
- try {
- Optional<OwnedNodeEdgePoint> optNode = this.networkTransactionService
- .read(LogicalDatastoreType.OPERATIONAL, nepIID).get();
- if (!optNode.isPresent()) {
- LOG.error("Node is not present in datastore");
- return null;
- }
- if (optNode.orElseThrow().augmentation(OwnedNodeEdgePoint1.class) == null) {
- LOG.error("Node doesnt have ceps");
- return null;
- }
- return optNode.orElseThrow().augmentation(OwnedNodeEdgePoint1.class).getCepList().getConnectionEndPoint()
- .get(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey(cepUuid));
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt read node in topology", e);
- return null;
- }
- }
-
- private String getAssociatedNetworkPort(String spcXpdrClient, List<String> xpdrNetworkTplist) {
- for (String networkPort:xpdrNetworkTplist) {
- if (networkPort.split("\\+")[0].equals(spcXpdrClient.split("\\+")[0])) {
- return networkPort;
- }
- }
- return null;
- }
-
- private OpenroadmNodeType getOpenRoadmNodeType(List<String> xpdrNodelist) {
- List<OpenroadmNodeType> openroadmNodeTypeList = new ArrayList<>();
- for (String xpdrNode:xpdrNodelist) {
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+",xpdrNode, TapiStringConstants.XPDR))
- .getBytes(Charset.forName("UTF-8"))).toString());
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeIID
- = InstanceIdentifier.builder(Context.class).augmentation(org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.Context1.class).child(TopologyContext.class)
- .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
- new NodeKey(nodeUuid)).build();
- try {
- Optional<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> optNode
- = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, nodeIID).get();
- if (!optNode.isPresent()) {
- return null;
- }
- OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.orElseThrow().getName().get(
- new NameKey("Node Type")).getValue());
- if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
- openroadmNodeTypeList.add(openroadmNodeType);
- }
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt read node in topology", e);
- return null;
- }
- }
- // TODO for now check that there is only one type, otherwise error
- if (openroadmNodeTypeList.size() != 1) {
- LOG.error("More than one xpdr type. List = {}", openroadmNodeTypeList);
- return null;
- }
- return openroadmNodeTypeList.get(0);
- }
-
- private List<String> getAssociatedClientsPort(List<String> xpdrNetworkTplist) {
- List<String> clientPortList = new ArrayList<>();
- for (String networkPort:xpdrNetworkTplist) {
- String nodeId = String.join("-", networkPort.split("\\+")[0].split("-")[0],
- networkPort.split("\\+")[0].split("-")[1]);
- String tpId = networkPort.split("\\+")[1];
- InstanceIdentifier<Mapping> mapIID = InstanceIdentifier.builder(Network.class)
- .child(Nodes.class, new NodesKey(nodeId))
- .child(Mapping.class, new MappingKey(tpId)).build();
- try {
- Optional<Mapping> optMapping = this.networkTransactionService.read(LogicalDatastoreType.CONFIGURATION,
- mapIID).get();
- if (!optMapping.isPresent()) {
- LOG.error("Couldnt find mapping for port {} of node {}", tpId, nodeId);
- }
- Mapping mapping = optMapping.orElseThrow();
- LOG.info("Mapping for node+port {}+{} = {}", nodeId, tpId, mapping);
- String key = String.join("+", String.join("-", nodeId, tpId.split("\\-")[0]),
- mapping.getConnectionMapLcp());
- LOG.info("Key to be added to list = {}", key);
- if (!clientPortList.contains(key)) {
- clientPortList.add(key);
- }
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt read mapping from datastore", e);
- return null;
- }
-
- }
- return clientPortList;
- }
-
- private OwnedNodeEdgePoint createRoadmNep(String orNodeId, String tpId,
- boolean withSip, OperationalState operState, AdministrativeState adminState, String nepPhotonicSublayer) {
-
- //TODO : complete implementation with SIP
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, nepPhotonicSublayer,
- tpId)).getBytes(StandardCharsets.UTF_8)).toString());
- Name nepName = new NameBuilder()
- .setValueName(TapiStringConstants.PHTNC_MEDIA + "NodeEdgePoint")
- .setValue(String.join("+", orNodeId, nepPhotonicSublayer, tpId))
- .build();
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- if (TapiStringConstants.MC.equals(nepPhotonicSublayer)) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIERMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- } else {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- }
- OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
- .setDirection(Direction.BIDIRECTIONAL)
- .setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState).setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED)
- .build();
-
- return onep;
- }
-
public void setInput(CreateConnectivityServiceInput input) {
this.input = input;
}
--- /dev/null
+/*
+ * Copyright © 2023 Orange, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.tapi.topology;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.opendaylight.transportpce.tapi.TapiStringConstants;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmTpType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.Node1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LifecycleState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.AvailableCapacityBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.TotalPotentialCapacityBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPEGigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristic;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristicBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.LinkKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.cost.pac.CostCharacteristic;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.cost.pac.CostCharacteristicBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristic;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristicBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class ConvertORToTapiTopology {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ConvertORToTapiTopology.class);
+ private String ietfNodeId;
+ private OpenroadmNodeType ietfNodeType;
+ private AdminStates ietfNodeAdminState;
+ private State ietfNodeOperState;
+ private List<TerminationPoint> oorClientPortList;
+ private List<TerminationPoint> oorNetworkPortList;
+ private OduSwitchingPools oorOduSwitchingPool;
+ private Uuid tapiTopoUuid;
+ private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
+ tapiNodes;
+ private Map<LinkKey, Link> tapiLinks;
+ private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
+ private Map<String, Uuid> uuidMap;
+
+
+ public ConvertORToTapiTopology(Uuid tapiTopoUuid) {
+ this.tapiTopoUuid = tapiTopoUuid;
+ this.tapiNodes = new HashMap<>();
+ this.tapiLinks = new HashMap<>();
+ this.uuidMap = new HashMap<>();
+ this.tapiSips = new HashMap<>();
+ }
+
+ public void convertNode(Node ietfNode, List<String> networkPorts) {
+ this.ietfNodeId = ietfNode.getNodeId().getValue();
+ if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
+ == null) {
+ return;
+ }
+ this.ietfNodeType = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class).getNodeType();
+ this.ietfNodeAdminState = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
+ .getAdministrativeState();
+ this.ietfNodeOperState = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
+ .getOperationalState();
+ this.oorNetworkPortList = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
+ .getTerminationPoint().values().stream()
+ .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+ == OpenroadmTpType.XPONDERNETWORK.getIntValue()
+ && networkPorts.contains(tp.getTpId().getValue()))
+ .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+ .collect(Collectors.toList());
+ if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
+ this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
+ .values().stream().findFirst().orElseThrow();
+ this.oorClientPortList = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
+ .getTerminationPoint().values().stream()
+ .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+ == OpenroadmTpType.XPONDERCLIENT.getIntValue())
+ .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+ .collect(Collectors.toList());
+ } else {
+ this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
+ List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
+ .flatMap(nbl -> nbl.getTpList().stream())
+ .collect(Collectors.toList());
+ this.oorClientPortList = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
+ .getTerminationPoint().values().stream()
+ .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+ == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
+ .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+ .collect(Collectors.toList());
+ this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
+ }
+
+ // node creation [DSR/ODU] ([DSR/ODU] and OTSI merged in R 2.4.X)
+ LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
+ Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
+ TapiStringConstants.XPDR)).getBytes(Charset.forName("UTF-8"))).toString());
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR), nodeUuid);
+ Name nameDsr = new NameBuilder().setValueName("dsr/odu node name")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
+ Name namePhot = new NameBuilder().setValueName("otsi node name")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
+ Name nameNodeType = new NameBuilder().setValueName("Node Type")
+ .setValue(this.ietfNodeType.getName()).build();
+ Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
+ LayerProtocolName.DIGITALOTN,LayerProtocolName.PHOTONICMEDIA);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology
+ .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot,nameNodeType.key(),
+ nameNodeType), dsrLayerProtocols);
+ LOG.debug("XPDR Node {} should have {} NEPs and SIPs", this.ietfNodeId,
+ this.oorClientPortList.size() + this.oorNetworkPortList.size());
+ LOG.info("XPDR Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
+ dsrNode.getOwnedNodeEdgePoint().values().size(), dsrNode.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
+ tapiNodes.put(dsrNode.key(), dsrNode);
+ }
+
+ public Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String topoType, Uuid nodeUuid,
+ String orNodeId, Collection<OwnedNodeEdgePoint> onepl) {
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
+ nepMap = new HashMap<>();
+ for (OwnedNodeEdgePoint onep : onepl) {
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
+ nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group
+ .NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(nodeUuid)
+ .setNodeEdgePointUuid(onep.key().getUuid())
+ .build();
+ nepMap.put(nep.key(), nep);
+ }
+ String rdmName =
+ topoType.equals("Abstracted")
+ ? "rdm infra node rule group"
+ : orNodeId + " node rule group";
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
+ Set<RuleType> ruleTypes = new HashSet<>();
+ ruleTypes.add(RuleType.FORWARDING);
+ Map<RuleKey, Rule> ruleList = new HashMap<>();
+ Rule rule = new RuleBuilder()
+ .setLocalId("forward")
+ .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
+ .setRuleType(ruleTypes)
+ .build();
+ ruleList.put(rule.key(), rule);
+ NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((rdmName)
+ .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setRule(ruleList)
+ .setNodeEdgePoint(nepMap)
+ .build();
+ nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
+ return nodeRuleGroupMap;
+ }
+
+ public Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
+ LayerProtocolName layerProtocol, String tpId, String nodeid,
+ Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
+ OperationalState operState, AdministrativeState adminState) {
+ // add them to SIP context
+ Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
+ for (int i = 0; i < nb; i++) {
+ String sipName =
+ nb == 1
+ ? String.join("+", "SIP", nodeid, tpId)
+ : String.join("+", "SIP", nodeid, tpId,"Nber", String.valueOf(i));
+ LOG.info("SIP = {}", sipName);
+ Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes(sipName.getBytes(Charset.forName("UTF-8"))).toString());
+ MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
+ .setServiceInterfacePointUuid(sipUuid).build();
+ ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tpId, nodeid, supportedInterfaceCapability,
+ operState, adminState);
+ this.tapiSips.put(sip.key(), sip);
+ msipl.put(msip.key(), msip);
+ LOG.debug("SIP created {}", sip.getUuid());
+ LOG.debug("This SIP corresponds to SIP+nodeId {} + TpId {}", nodeid, tpId);
+ }
+ return msipl;
+ }
+
+ public List<SupportedCepLayerProtocolQualifierInstances> createSupportedCepLayerProtocolQualifier(
+ Collection<SupportedInterfaceCapability> sicList, LayerProtocolName lpn) {
+ List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
+ if (sicList == null) {
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build());
+ return sclpqiList;
+ }
+ LOG.debug("SIC list = {}", sicList);
+ for (SupportedInterfaceCapability sic : sicList) {
+ String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
+ switch (lpn.getName()) {
+ case "ETH":
+ case "DSR":
+ switch (ifCapType) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2e":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GE":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GEODU4":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GE":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "IfOCHOTU4ODU4":
+ case "IfOCH":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ default:
+ LOG.error("IfCapability type not managed");
+ break;
+ }
+ break;
+ case "ODU":
+ switch (ifCapType) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2e":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2":
+ case "If10GE":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GEODU4":
+ case "If100GE":
+ case "IfOCHOTU4ODU4":
+ case "IfOCH":
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ default:
+ LOG.error("IfCapability type not managed");
+ break;
+ }
+ break;
+ case "PHOTONIC_MEDIA":
+ if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ }
+ break;
+ default:
+ LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
+ break;
+ }
+ }
+ return sclpqiList.stream().distinct().toList();
+ }
+
+ private OduSwitchingPools createOduSwitchingPoolForTp100G() {
+ Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
+ int count = 1;
+ for (TerminationPoint tp : this.oorNetworkPortList) {
+ TpId tpid1 = tp.getTpId();
+ TpId tpid2 = tp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1.class)
+ .getAssociatedConnectionMapTp().iterator().next();
+ Set<TpId> tpList = new HashSet<>();
+ tpList.add(tpid1);
+ tpList.add(tpid2);
+ NonBlockingList nbl = new NonBlockingListBuilder()
+ .setNblNumber(Uint16.valueOf(count))
+ .setTpList(tpList)
+ .build();
+ nblMap.put(nbl.key(), nbl);
+ count++;
+ }
+ return new OduSwitchingPoolsBuilder()
+ .setNonBlockingList(nblMap)
+ .setSwitchingPoolNumber(Uint16.valueOf(1))
+ .build();
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
+ createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
+ Uuid nodeUuid = null;
+ Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
+ Map<RuleKey, Rule> ruleList = new HashMap<>();
+ Set<RuleType> ruleTypes = new HashSet<>();
+ ruleTypes.add(RuleType.FORWARDING);
+ Rule rule = new RuleBuilder()
+ .setLocalId("forward")
+ .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
+ .setRuleType(ruleTypes)
+ .build();
+ ruleList.put(rule.key(), rule);
+ if (layerProtocols.contains(LayerProtocolName.DSR)
+ || layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
+ nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
+ } else {
+ LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
+ .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
+ }
+ // Empty random creation of mandatory fields for avoiding errors....
+ CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
+ .setCostAlgorithm("Restricted Shortest Path - RSP")
+ .setCostName("HOP_COUNT")
+ .setCostValue(TapiStringConstants.COST_HOP_VALUE)
+ .build();
+ LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
+ .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE)
+ .setQueuingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE)
+ .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE)
+ .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE)
+ .setTrafficPropertyName("FIXED_LATENCY")
+ .build();
+ RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
+ .setRiskCharacteristicName("risk characteristic")
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
+ .build();
+ RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .build();
+ return new NodeBuilder()
+ .setUuid(nodeUuid)
+ .setName(nodeNames)
+ .setLayerProtocolName(layerProtocols)
+ .setAdministrativeState(transformAsToTapiAdminState(this.ietfNodeAdminState.getName()))
+ .setOperationalState(transformOsToTapiOperationalState(this.ietfNodeOperState.getName()))
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .setOwnedNodeEdgePoint(onepl)
+ .setNodeRuleGroup(nodeRuleGroupList)
+ .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
+ .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
+ .setRiskParameterPac(riskParamPac)
+ .setErrorCharacteristic("error")
+ .setLossCharacteristic("loss")
+ .setRepeatDeliveryCharacteristic("repeat delivery")
+ .setDeliveryOrderCharacteristic("delivery order")
+ .setUnavailableTimeCharacteristic("unavailable time")
+ .setServerIntegrityProcessCharacteristic("server integrity process")
+ .build();
+ }
+
+ private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
+ Uuid nodeUuid;
+ nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR));
+ // client NEP DSR creation on DSR/ODU node
+ for (int i = 0; i < oorClientPortList.size(); i++) {
+ Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+ oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+ oorClientPortList.get(i).getTpId().getValue()), nepUuid);
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+ oorClientPortList.get(i).getTpId().getValue()), nepUuid);
+ NameBuilder nameBldr = new NameBuilder().setValue(
+ String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+ oorClientPortList.get(i).getTpId().getValue()));
+ Name name;
+ if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
+ name = nameBldr.setValueName("100G-tpdr").build();
+ } else {
+ name = nameBldr.setValueName("NodeEdgePoint_C").build();
+ }
+
+ OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
+ LayerProtocolName.DSR, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
+ TapiStringConstants.DSR));
+ onepl.put(onep.key(), onep);
+ }
+ // CLIENT NEP E_ODU creation on DSR/ODU node
+ for (int i = 0; i < oorClientPortList.size(); i++) {
+ Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
+ oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
+ oorClientPortList.get(i).getTpId().getValue()), nepUuid1);
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
+ oorClientPortList.get(i).getTpId().getValue()), nepUuid1);
+ Name onedName = new NameBuilder()
+ .setValueName("eNodeEdgePoint_N")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
+ oorClientPortList.get(i).getTpId().getValue()))
+ .build();
+
+ OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, false, String.join("+", this.ietfNodeId,
+ TapiStringConstants.E_ODU));
+ onepl.put(onep.key(), onep);
+ }
+ // NETWORK NEPs I_ODU creation on DSR/ODU node
+ for (int i = 0; i < oorNetworkPortList.size(); i++) {
+ Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
+ oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
+ Name onedName = new NameBuilder()
+ .setValueName("iNodeEdgePoint_N")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
+ oorNetworkPortList.get(i).getTpId().getValue()))
+ .build();
+
+ OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
+ TapiStringConstants.I_ODU));
+ onepl.put(onep.key(), onep);
+ }
+ // NETWORK NEP OTS network on DSR/ODU node
+ for (int i = 0; i < oorNetworkPortList.size(); i++) {
+ Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
+ oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
+ .toString());
+ LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
+ Name onedName = new NameBuilder()
+ .setValueName("eNodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
+ oorNetworkPortList.get(i).getTpId().getValue()))
+ .build();
+
+ OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
+ LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
+ String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS));
+ onepl.put(onep.key(), onep);
+ }
+ // NETWORK NEP OTSI_MC network nep creation
+ //TODO: add test to see if wavelength is provionned and condition this creation to this!
+ for (int i = 0; i < oorNetworkPortList.size(); i++) {
+ Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
+ oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
+ .toString());
+ LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
+ this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
+ oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
+ Name onedName = new NameBuilder()
+ .setValueName("PhotMedNodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
+ oorNetworkPortList.get(i).getTpId().getValue()))
+ .build();
+
+ OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
+ LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
+ String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC));
+ onepl.put(onep.key(), onep);
+ }
+ // create NodeRuleGroup
+ int count = 1;
+ LOG.debug("ODU switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
+ for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
+ nepList = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
+ oduNepList = new HashMap<>();
+ LOG.debug("UUidMap={}", this.uuidMap.keySet());
+ LOG.debug("TP list = {}", nbl.getTpList());
+ for (TpId tp : nbl.getTpList()) {
+ LOG.debug("TP={}", tp.getValue());
+ LOG.debug("UuidKey={}", String.join("+", this.ietfNodeId,
+ TapiStringConstants.E_ODU, tp.getValue()));
+ if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+ tp.getValue())) || this.uuidMap.containsKey(String.join(
+ "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue()))) {
+ String qual = tp.getValue().contains("CLIENT") ? TapiStringConstants.DSR
+ : TapiStringConstants.I_ODU;
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
+ nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+ TapiStringConstants.XPDR)))
+ .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+ qual, tp.getValue())))
+ .build();
+ nepList.put(nep.key(), nep);
+ }
+ if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
+ TapiStringConstants.E_ODU, tp.getValue()))) {
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
+ nep1 = new org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+ TapiStringConstants.XPDR)))
+ .setNodeEdgePointUuid(this.uuidMap.get(String.join(
+ "+", this.ietfNodeId, TapiStringConstants.E_ODU, tp.getValue())))
+ .build();
+ oduNepList.put(nep1.key(), nep1);
+ }
+ if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
+ TapiStringConstants.I_ODU, tp.getValue()))) {
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
+ nep2 = new org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+ TapiStringConstants.XPDR)))
+ .setNodeEdgePointUuid(this.uuidMap.get(String.join(
+ "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue())))
+ .build();
+ oduNepList.put(nep2.key(), nep2);
+ }
+ }
+ LOG.debug("NEPLIST (DSR/I_ODU) of [dsr node rule group] is {}", nepList.toString());
+ LOG.debug("NEPLIST (E_ODU/I_ODU) of [odu node rule group] is {}", nepList.toString());
+ // Empty random creation of mandatory fields for avoiding errors....
+ CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
+ .setCostAlgorithm("Restricted Shortest Path - RSP")
+ .setCostName("HOP_COUNT")
+ .setCostValue(TapiStringConstants.COST_HOP_VALUE)
+ .build();
+ LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
+ .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE)
+ .setQueuingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE)
+ .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE)
+ .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE)
+ .setTrafficPropertyName("FIXED_LATENCY")
+ .build();
+ RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
+ .setRiskCharacteristicName("risk characteristic")
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
+ .build();
+ NodeRuleGroup nodeRuleGroup1 = new NodeRuleGroupBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
+ .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setRule(ruleList)
+ .setNodeEdgePoint(nepList)
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
+ .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
+ .build();
+ nodeRuleGroupList.put(nodeRuleGroup1.key(), nodeRuleGroup1);
+ NodeRuleGroup nodeRuleGroup2 = new NodeRuleGroupBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(("odu node rule group " + count)
+ .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setRule(ruleList)
+ .setNodeEdgePoint(oduNepList)
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
+ .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
+ .build();
+ nodeRuleGroupList.put(nodeRuleGroup2.key(), nodeRuleGroup2);
+ count++;
+ }
+ return nodeUuid;
+ }
+
+ private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
+ LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
+ String key = String.join("+", keyword, oorTp.getTpId().getValue());
+ AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null)
+ ? transformAsToTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()
+ .getName())
+ : null;
+ OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null)
+ ? transformOsToTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState()
+ .getName())
+ : null;
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1 tp1 =
+ oorTp.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
+ if (tp1.getTpSupportedInterfaces() == null) {
+ LOG.warn("Tp supported interface doesnt exist on TP {}", oorTp.getTpId().getValue());
+ return null;
+ }
+// Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
+ Collection<SupportedInterfaceCapability> sicColl = tp1.getTpSupportedInterfaces()
+ .getSupportedInterfaceCapability().values();
+ OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
+ .setUuid(this.uuidMap.get(key))
+ .setLayerProtocolName(nepProtocol)
+ .setName(nepNames);
+ onepBldr.setSupportedCepLayerProtocolQualifierInstances(createSupportedCepLayerProtocolQualifier(sicColl,
+ nepProtocol))
+ .setDirection(Direction.BIDIRECTIONAL)
+ .setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(adminState)
+ .setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED);
+ if (withSip) {
+ onepBldr.setMappedServiceInterfacePoint(
+ createMSIP(1, nepProtocol, oorTp.getTpId().getValue(), keyword, sicColl, operState, adminState));
+ }
+ return onepBldr.build();
+ }
+
+ private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpId,
+ String nodeid, Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
+ OperationalState operState, AdministrativeState adminState) {
+ // TODO: what value should be set in total capacity and available capacity??
+ // LOG.info("SIP name = {}", String.join("+", nodeid, tp.getTpId().getValue()));
+ Name sipName = new NameBuilder()
+ .setValueName("SIP name")
+ .setValue(String.join("+", nodeid, tpId))
+ .build();
+
+ return new ServiceInterfacePointBuilder()
+ .setUuid(sipUuid)
+ .setName(Map.of(sipName.key(), sipName))
+ .setLayerProtocolName(layerProtocol)
+ .setAdministrativeState(adminState)
+ .setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .setAvailableCapacity(new AvailableCapacityBuilder().build())
+ .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
+ .setSupportedCepLayerProtocolQualifierInstances(createSipSupportedLayerProtocolQualifier(
+ supportedInterfaceCapability, layerProtocol))
+ .build();
+ }
+
+ private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
+ createSipSupportedLayerProtocolQualifier(
+ Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
+ LayerProtocolName lpn) {
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
+ if (supportedInterfaceCapability == null) {
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build());
+ return sclpqiList;
+ }
+ for (SupportedInterfaceCapability sic : supportedInterfaceCapability) {
+ String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
+ switch (lpn.getName()) {
+ case "ETH":
+ case "DSR":
+ switch (ifCapType) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2e":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GE":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GEODU4":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GE":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "IfOCHOTU4ODU4":
+ case "IfOCH":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ default:
+ LOG.error("IfCapability type not managed");
+ break;
+ }
+ break;
+ case "ODU":
+ switch (ifCapType) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2e":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If10GEODU2":
+ case "If10GE":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ case "If100GEODU4":
+ case "If100GE":
+ case "IfOCHOTU4ODU4":
+ case "IfOCH":
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ break;
+ default:
+ LOG.error("IfCapability type not managed");
+ break;
+ }
+ break;
+ case "PHOTONIC_MEDIA":
+ if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(0))
+ .build());
+ }
+ break;
+ default:
+ LOG.error("Layer Protocol Name is unknown");
+ break;
+ }
+ }
+ return sclpqiList.stream().distinct().toList();
+ }
+
+ public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
+ getTapiNodes() {
+ return tapiNodes;
+ }
+
+ public Map<LinkKey, Link> getTapiLinks() {
+ return tapiLinks;
+ }
+
+ public AdministrativeState transformAsToTapiAdminState(String adminState) {
+ if (adminState == null) {
+ return null;
+ }
+ return adminState.equals(AdminStates.InService.getName())
+ || adminState.equals(AdministrativeState.UNLOCKED.getName()) ? AdministrativeState.UNLOCKED
+ : AdministrativeState.LOCKED;
+ }
+
+ public OperationalState transformOsToTapiOperationalState(String operState) {
+ if (operState == null) {
+ return null;
+ }
+ return operState.equals("inService") || operState.equals(OperationalState.ENABLED.getName())
+ ? OperationalState.ENABLED : OperationalState.DISABLED;
+ }
+
+ public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {
+ return tapiSips;
+ }
+
+ public void setTapiSips(Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSip) {
+ this.tapiSips.putAll(tapiSip);
+ }
+
+}
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmTpType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.Node1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.AvailableCapacityBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.TotalPotentialCapacityBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPEGigE;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROMS;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.cost.pac.CostCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristicBuilder;
-import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiFullTopo.class);
private String ietfNodeId;
private OpenroadmNodeType ietfNodeType;
- private AdminStates ietfNodeAdminState;
- private State ietfNodeOperState;
- private List<TerminationPoint> oorClientPortList;
- private List<TerminationPoint> oorNetworkPortList;
- private OduSwitchingPools oorOduSwitchingPool;
private Uuid tapiTopoUuid;
private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
tapiNodes;
private Map<LinkKey, Link> tapiLinks;
private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
- private Map<String, Uuid> uuidMap;
private final TapiLink tapiLink;
this.tapiTopoUuid = tapiTopoUuid;
this.tapiNodes = new HashMap<>();
this.tapiLinks = new HashMap<>();
- this.uuidMap = new HashMap<>();
this.tapiSips = new HashMap<>();
this.tapiLink = tapiLink;
}
- public void convertNode(Node ietfNode, List<String> networkPorts) {
- this.ietfNodeId = ietfNode.getNodeId().getValue();
- if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- == null) {
- return;
- }
- this.ietfNodeType = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class).getNodeType();
- this.ietfNodeAdminState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getAdministrativeState();
- this.ietfNodeOperState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getOperationalState();
- this.oorNetworkPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERNETWORK.getIntValue()
- && networkPorts.contains(tp.getTpId().getValue()))
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
- .values().stream().findFirst().orElseThrow();
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue())
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- } else {
- this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
- List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
- .flatMap(nbl -> nbl.getTpList().stream())
- .collect(Collectors.toList());
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
- }
-
- // node creation XPDR ([DSR/ODU] and OTSI merged in R 2.4.X
- LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR), nodeUuid);
- Name nameDsrNode = new NameBuilder().setValueName("dsr/odu node name").setValue(
- String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name nameOtsiNode = new NameBuilder().setValueName("otsi node name").setValue(
- String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name nameNodeType = new NameBuilder().setValueName("Node Type")
- .setValue(this.ietfNodeType.getName()).build();
- Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
- LayerProtocolName.DIGITALOTN, LayerProtocolName.PHOTONICMEDIA);
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology
- .Node dsrNode = createTapiNode(Map.of(nameDsrNode.key(), nameDsrNode, nameOtsiNode.key(), nameOtsiNode,
- nameNodeType.key(), nameNodeType), dsrLayerProtocols);
- LOG.info("XPDR Node {} should have {} NEPs and {} SIPs", this.ietfNodeId,
- this.oorClientPortList.size() + this.oorNetworkPortList.size(),
- this.oorClientPortList.size() + this.oorNetworkPortList.size());
- LOG.info("XPDR Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
- dsrNode.getOwnedNodeEdgePoint().values().size(), dsrNode.getOwnedNodeEdgePoint().values().stream()
- .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
- tapiNodes.put(dsrNode.key(), dsrNode);
- }
-
public void convertRdmToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.networks.network.Link> rdmTordmLinkList) {
List<String> linksToNotConvert = new ArrayList<>();
tapiNodes.put(roadmNode.key(), roadmNode);
}
- private OduSwitchingPools createOduSwitchingPoolForTp100G() {
- Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
- int count = 1;
- for (TerminationPoint tp : this.oorNetworkPortList) {
- TpId tpid1 = tp.getTpId();
- TpId tpid2 = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1.class)
- .getAssociatedConnectionMapTp().iterator().next();
- Set<TpId> tpList = new HashSet<>();
- tpList.add(tpid1);
- tpList.add(tpid2);
- NonBlockingList nbl = new NonBlockingListBuilder()
- .setNblNumber(Uint16.valueOf(count))
- .setTpList(tpList)
- .build();
- nblMap.put(nbl.key(), nbl);
- count++;
- }
- return new OduSwitchingPoolsBuilder()
- .setNonBlockingList(nblMap)
- .setSwitchingPoolNumber(Uint16.valueOf(1))
- .build();
- }
-
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
- Uuid nodeUuid = null;
- Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
- if (layerProtocols.contains(LayerProtocolName.DSR)
- || layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
- nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
- } else {
- LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
- .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
- }
- // Empty random creation of mandatory fields for avoiding errors....
- CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
- .setCostAlgorithm("Restricted Shortest Path - RSP")
- .setCostName("HOP_COUNT")
- .setCostValue(TapiStringConstants.COST_HOP_VALUE)
- .build();
- LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
- .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE)
- .setQueuingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE)
- .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE)
- .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE)
- .setTrafficPropertyName("FIXED_LATENCY")
- .build();
- RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
- .setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
- .build();
- RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .build();
- return new NodeBuilder()
- .setUuid(nodeUuid)
- .setName(nodeNames)
- .setLayerProtocolName(layerProtocols)
- .setAdministrativeState(this.tapiLink.setTapiAdminState(this.ietfNodeAdminState.getName()))
- .setOperationalState(this.tapiLink.setTapiOperationalState(this.ietfNodeOperState.getName()))
- .setLifecycleState(LifecycleState.INSTALLED)
- .setOwnedNodeEdgePoint(onepl)
- .setNodeRuleGroup(nodeRuleGroupList)
- .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
- .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .setRiskParameterPac(riskParamPac)
- .setErrorCharacteristic("error")
- .setLossCharacteristic("loss")
- .setRepeatDeliveryCharacteristic("repeat delivery")
- .setDeliveryOrderCharacteristic("delivery order")
- .setUnavailableTimeCharacteristic("unavailable time")
- .setServerIntegrityProcessCharacteristic("server integrity process")
- .build();
- }
-
private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
createRoadmTapiNode(Uuid nodeUuid, Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setOwnedNodeEdgePoint(oneplist)
- .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
+ .setNodeRuleGroup(new ConvertORToTapiTopology(this.tapiTopoUuid)
+ .createNodeRuleGroupForRdmNode("Full",nodeUuid, this.ietfNodeId, oneplist.values()))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setRiskParameterPac(riskParamPac)
.build();
}
- private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
- Uuid nodeUuid;
- nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR));
- // client nep creation on DSR node
- for (int i = 0; i < oorClientPortList.size(); i++) {
- LOG.info("NEP = {}", String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid);
- NameBuilder nameBldr = new NameBuilder().setValue(
- String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()));
- Name name;
- if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- name = nameBldr.setValueName("100G-tpdr").build();
- } else {
- name = nameBldr.setValueName("NodeEdgePoint_C").build();
- }
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
- LayerProtocolName.DSR, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.DSR));
- onepl.put(onep.key(), onep);
- }
- // network nep creation on I_ODU node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- LOG.info("NEP = {}", String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()));
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
- Name onedName = new NameBuilder()
- .setValueName("iNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.I_ODU));
- onepl.put(onep.key(), onep);
- }
- // network nep creation on E_ODU node
- for (int i = 0; i < oorClientPortList.size(); i++) {
- LOG.info("NEP = {}", String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()));
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid1);
- Name onedName = new NameBuilder()
- .setValueName("eNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, false, String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU));
- onepl.put(onep.key(), onep);
- }
- // OTS network nep creation
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- LOG.info("NEP = {}", String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()));
- Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
- Name onedName = new NameBuilder()
- .setValueName("eNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
- String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS));
- onepl.put(onep.key(), onep);
- }
- // OTSI_MC network nep creation
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- LOG.info("NEP = {}", String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()));
- Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
- Name onedName = new NameBuilder()
- .setValueName("PhotMedNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
- String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC));
- onepl.put(onep.key(), onep);
- }
- // create NodeRuleGroup
- int count = 1;
- LOG.info("ODU switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
- for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepList = new HashMap<>();
- LOG.info("UUidMap={}", this.uuidMap.keySet());
- LOG.info("TP list = {}", nbl.getTpList());
- for (TpId tp : nbl.getTpList()) {
- LOG.info("TP={}", tp.getValue());
- LOG.info("UuidKey={}", String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU, tp.getValue()));
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU, tp.getValue()))
- && this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
- TapiStringConstants.DSR, tp.getValue()))) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep1 = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join(
- "+", this.ietfNodeId, TapiStringConstants.DSR, tp.getValue())))
- .build();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep2 = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join(
- "+", this.ietfNodeId, TapiStringConstants.E_ODU, tp.getValue())))
- .build();
- nepList.put(nep1.key(), nep1);
- nepList.put(nep2.key(), nep2);
- }
- }
- //LOG.info("NEPLIST is {}", nepList.toString());
- // Empty random creation of mandatory fields for avoiding errors....
- CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
- .setCostAlgorithm("Restricted Shortest Path - RSP")
- .setCostName("HOP_COUNT")
- .setCostValue(TapiStringConstants.COST_HOP_VALUE)
- .build();
- LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
- .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE)
- .setQueuingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE)
- .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE)
- .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE)
- .setTrafficPropertyName("FIXED_LATENCY")
- .build();
- RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
- .setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
- .build();
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
- .getBytes(Charset.forName("UTF-8"))).toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepList)
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
- .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .build();
- nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
- count++;
- }
- return nodeUuid;
- }
-
- private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
- LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
- String keyword) {
- String key = String.join("+", keyword, oorTp.getTpId().getValue());
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(key))
- .setLayerProtocolName(nepProtocol)
- .setName(nepNames);
- if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, oorTp, keyword));
- }
- AdministrativeState adminState = null;
- OperationalState operState = null;
- if (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null) {
- adminState = this.tapiLink.setTapiAdminState(oorTp.augmentation(TerminationPoint1.class)
- .getAdministrativeState().getName());
- }
- if (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null) {
- operState = this.tapiLink.setTapiOperationalState(oorTp.augmentation(TerminationPoint1.class)
- .getOperationalState().getName());
- }
- onepBldr.setSupportedCepLayerProtocolQualifierInstances(createSupportedLayerProtocolQualifier(oorTp,
- nepProtocol))
- .setDirection(Direction.BIDIRECTIONAL)
- .setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState)
- .setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED);
- return onepBldr.build();
- }
-
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
boolean withSip, String nepPhotonicSublayer) {
// create neps for MC and OTSiMC and Photonic Media
return onepMap;
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
- Collection<OwnedNodeEdgePoint> onepl) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepMap = new HashMap<>();
- for (OwnedNodeEdgePoint onep : onepl) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group
- .NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(nodeUuid)
- .setNodeEdgePointUuid(onep.key().getUuid())
- .build();
- nepMap.put(nep.key(), nep);
- }
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((this.ietfNodeId + " node rule group")
- .getBytes(Charset.forName("UTF-8"))).toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepMap)
- .build();
- nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
- return nodeRuleGroupMap;
- }
-
- private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
- LayerProtocolName layerProtocol,
- TerminationPoint tp,
- String nodeid) {
- // add them to SIP context
- Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
- for (int i = 0; i < nb; i++) {
- LOG.info("SIP = {}", String.join("+", "SIP", nodeid, tp.getTpId().getValue()));
- Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
- tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(sipUuid).build();
- ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tp, nodeid);
- this.tapiSips.put(sip.key(), sip);
- msipl.put(msip.key(), msip);
- }
- return msipl;
- }
-
- private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, TerminationPoint tp,
- String nodeid) {
- // TODO: what value should be set in total capacity and available capacity??
- // LOG.info("SIP name = {}", String.join("+", nodeid, tp.getTpId().getValue()));
- Name sipName = new NameBuilder()
- .setValueName("SIP name")
- .setValue(String.join("+", nodeid, tp.getTpId().getValue()))
- .build();
- AdministrativeState adminState = null;
- OperationalState operState = null;
- if (tp.augmentation(TerminationPoint1.class).getAdministrativeState() != null) {
- adminState = this.tapiLink.setTapiAdminState(tp.augmentation(TerminationPoint1.class)
- .getAdministrativeState().getName());
- }
- if (tp.augmentation(TerminationPoint1.class).getOperationalState() != null) {
- operState = this.tapiLink.setTapiOperationalState(tp.augmentation(TerminationPoint1.class)
- .getOperationalState().getName());
- }
- return new ServiceInterfacePointBuilder()
- .setUuid(sipUuid)
- .setName(Map.of(sipName.key(), sipName))
- .setLayerProtocolName(layerProtocol)
- .setAdministrativeState(adminState)
- .setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setAvailableCapacity(new AvailableCapacityBuilder().build())
- .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
- .setSupportedCepLayerProtocolQualifierInstances(createSipSupportedLayerProtocolQualifier(
- tp, layerProtocol))
- .build();
- }
-
- private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
- createSipSupportedLayerProtocolQualifier(TerminationPoint tp,
- LayerProtocolName lpn) {
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1 tp1 =
- tp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
- if (tp1 == null) {
- return new ArrayList<>(sclpqiList);
- }
- if (tp1.getTpSupportedInterfaces() == null) {
- LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
- return new ArrayList<>(sclpqiList);
- }
- Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values();
- for (SupportedInterfaceCapability sic : sicList) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "DSR":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown");
- break;
- }
- }
- return sclpqiList.stream().distinct().toList();
- }
-
- private List<SupportedCepLayerProtocolQualifierInstances> createSupportedLayerProtocolQualifier(TerminationPoint tp,
- LayerProtocolName lpn) {
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1 tp1 =
- tp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
- if (tp1 == null) {
- return new ArrayList<>(sclpqiList);
- }
- if (tp1.getTpSupportedInterfaces() == null) {
- LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
- return new ArrayList<>(sclpqiList);
- }
- Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values();
- for (SupportedInterfaceCapability sic : sicList) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "DSR":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown");
- break;
- }
- }
- return sclpqiList.stream().distinct().toList();
- }
-
public void convertXpdrToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.networks.network.Link> xpdrRdmLinkList) {
List<String> linksToNotConvert = new ArrayList<>();
}
}
+
+ public void setTapiNodes(Map<NodeKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap) {
+ this.tapiNodes.putAll(nodeMap);
+ }
+
public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
getTapiNodes() {
return tapiNodes;
return tapiLinks;
}
+ public void setTapiSips(Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSip) {
+ this.tapiSips.putAll(tapiSip);
+ }
+
public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {
return tapiSips;
}
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.opendaylight.transportpce.tapi.TapiStringConstants;
import org.opendaylight.transportpce.tapi.utils.TapiLink;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Link1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmTpType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.Node1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ForwardingDirection;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPEGigE;
-//import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROMS;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.link.NodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.Rule;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.RuleKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.cost.pac.CostCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristicBuilder;
-import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConvertORTopoToTapiTopo {
private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopo.class);
- private String ietfNodeId;
- private OpenroadmNodeType ietfNodeType;
- private AdminStates ietfNodeAdminState = null;
- private State ietfNodeOperState = null;
- private List<TerminationPoint> oorClientPortList = null;
- private List<TerminationPoint> oorNetworkPortList = null;
- private OduSwitchingPools oorOduSwitchingPool = null;
private Uuid tapiTopoUuid;
private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
tapiNodes;
private Map<LinkKey, Link> tapiLinks;
- private Map<String, Uuid> uuidMap;
+ private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
private final TapiLink tapiLink;
this.tapiTopoUuid = tapiTopoUuid;
this.tapiNodes = new HashMap<>();
this.tapiLinks = new HashMap<>();
- this.uuidMap = new HashMap<>();
+ this.tapiSips = new HashMap<>();
this.tapiLink = tapiLink;
}
- public void convertNode(Node ietfNode, List<String> networkPorts) {
- this.ietfNodeId = ietfNode.getNodeId().getValue();
- if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- == null) {
- return;
- }
- this.ietfNodeType = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class).getNodeType();
- this.ietfNodeAdminState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getAdministrativeState();
- this.ietfNodeOperState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getOperationalState();
- this.oorNetworkPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERNETWORK.getIntValue()
- && networkPorts.contains(tp.getTpId().getValue()))
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
- .values().stream().findFirst().orElseThrow();
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue())
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- } else {
- this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
- List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
- .flatMap(nbl -> nbl.getTpList().stream())
- .collect(Collectors.toList());
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
- }
-
- // node creation [DSR/ODU]
- LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR), nodeUuid);
- Name nameDsr = new NameBuilder().setValueName("dsr/odu node name")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name namePhot = new NameBuilder().setValueName("otsi node name")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name nameNodeType = new NameBuilder().setValueName("Node Type")
- .setValue(this.ietfNodeType.getName()).build();
- Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
- LayerProtocolName.DIGITALOTN,LayerProtocolName.PHOTONICMEDIA);
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology
- .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot,nameNodeType.key(),
- nameNodeType),
- dsrLayerProtocols);
- tapiNodes.put(dsrNode.key(), dsrNode);
- }
-
public void convertLinks(Map<
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
.LinkKey,
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = createNepForRdmNode(photonicNepUuisMap.size());
// node rule group creation
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList
- = createNodeRuleGroupForRdmNode(nodeUuid, onepMap.values());
- // Empty random creation of mandatory fields for avoiding errors....
+ = new ConvertORToTapiTopology(this.tapiTopoUuid)
+ .createNodeRuleGroupForRdmNode("Abstracted", nodeUuid, null, onepMap.values());
+ // Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setCostAlgorithm("Restricted Shortest Path - RSP")
.setCostName("HOP_COUNT")
}
}
- private OduSwitchingPools createOduSwitchingPoolForTp100G() {
- Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
- int count = 1;
- for (TerminationPoint tp : this.oorNetworkPortList) {
- TpId tpid1 = tp.getTpId();
- TpId tpid2 = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1.class)
- .getAssociatedConnectionMapTp().iterator().next();
- Set<TpId> tpList = new HashSet<>();
- tpList.add(tpid1);
- tpList.add(tpid2);
- NonBlockingList nbl = new NonBlockingListBuilder()
- .setNblNumber(Uint16.valueOf(count))
- .setTpList(tpList)
- .build();
- nblMap.put(nbl.key(), nbl);
- count++;
- }
- return new OduSwitchingPoolsBuilder()
- .setNonBlockingList(nblMap)
- .setSwitchingPoolNumber(Uint16.valueOf(1))
- .build();
- }
-
private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
pruneTapiPhotonicNodes() {
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepM = new HashMap<>();
for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry : node.getOwnedNodeEdgePoint().entrySet()) {
if (entry.getValue().getName().values().stream()
- .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")).count() > 0) {
+ .filter(name -> name.getValueName().equals("eNodeEdgePoint")).count() > 0) {
onepM.put(entry.getKey(), entry.getValue());
}
}
return uuidNameMap;
}
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
- Uuid nodeUuid = null;
- Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
- if (layerProtocols.contains(LayerProtocolName.DSR)
- || layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
- nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
- } else {
- LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
- .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
- }
- // Empty random creation of mandatory fields for avoiding errors....
- CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
- .setCostAlgorithm("Restricted Shortest Path - RSP")
- .setCostName("HOP_COUNT")
- .setCostValue(TapiStringConstants.COST_HOP_VALUE)
- .build();
- LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
- .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE)
- .setQueuingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE)
- .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE)
- .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE)
- .setTrafficPropertyName("FIXED_LATENCY")
- .build();
- RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
- .setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
- .build();
- RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .build();
- return new NodeBuilder()
- .setUuid(nodeUuid)
- .setName(nodeNames)
- .setLayerProtocolName(layerProtocols)
- .setAdministrativeState(this.tapiLink.setTapiAdminState(this.ietfNodeAdminState.getName()))
- .setOperationalState(this.tapiLink.setTapiOperationalState(this.ietfNodeOperState.getName()))
- .setLifecycleState(LifecycleState.INSTALLED)
- .setOwnedNodeEdgePoint(onepl)
- .setNodeRuleGroup(nodeRuleGroupList)
- .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
- .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .setRiskParameterPac(riskParamPac)
- .build();
- }
-
- private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
- Uuid nodeUuid;
- nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR));
- // client nep creation on DSR/ODU node
- for (int i = 0; i < oorClientPortList.size(); i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid);
- NameBuilder nameBldr = new NameBuilder().setValue(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()));
- Name name;
- if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- name = nameBldr.setValueName("100G-tpdr").build();
- } else {
- name = nameBldr.setValueName("NodeEdgePoint_C").build();
- }
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
- LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.DSR));
- onepl.put(onep.key(), onep);
- }
- // network nep creation on DSR/ODU node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid);
- Name onedName = new NameBuilder()
- .setValueName("iNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.I_ODU));
- onepl.put(onep.key(), onep);
- }
- // eNep creation on otsi node
- for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
- Name onedName = new NameBuilder()
- .setValueName("eNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()))
- .build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
- String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS));
- onepl.put(onep.key(), onep);
- }
- // create NodeRuleGroup
- int count = 1;
- for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepList = new HashMap<>();
- for (TpId tp : nbl.getTpList()) {
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- tp.getValue())) || this.uuidMap.containsKey(String.join(
- "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue()))) {
- String qual = tp.getValue().contains("CLIENT") ? TapiStringConstants.DSR
- : TapiStringConstants.I_ODU;
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group
- .NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- qual, tp.getValue())))
- .build();
- nepList.put(nep.key(), nep);
- }
- }
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
- .toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepList)
- .build();
- nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
- count++;
- }
- return nodeUuid;
- }
-
- private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
- LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol,
- boolean withSip, String keyword) {
- String key = String.join("+", keyword, oorTp.getTpId().getValue());
- AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null)
- ? this.tapiLink.setTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()
- .getName())
- : null;
- OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null)
- ? this.tapiLink.setTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState()
- .getName())
- : null;
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(key))
- .setLayerProtocolName(nepProtocol)
- .setName(nepNames)
- .setSupportedCepLayerProtocolQualifierInstances(createSupportedCepLayerProtocolQualifier(oorTp,
- nodeProtocol))
- .setDirection(Direction.BIDIRECTIONAL)
- .setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState)
- .setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED);
- if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createSIP(1, oorTp, keyword));
- }
- return onepBldr.build();
- }
-
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createNepForRdmNode(int nbNep) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
for (int i = 1; i <= nbNep; i++) {
return onepMap;
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
- Collection<OwnedNodeEdgePoint> onepl) {
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepMap = new HashMap<>();
- for (OwnedNodeEdgePoint onep : onepl) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group
- .NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(nodeUuid)
- .setNodeEdgePointUuid(onep.key().getUuid())
- .build();
- nepMap.put(nep.key(), nep);
- }
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group").getBytes(Charset.forName("UTF-8")))
- .toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepMap)
- .build();
- nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
- return nodeRuleGroupMap;
- }
-
- private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(int nb, TerminationPoint tp,
- String nodeId) {
- Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
- for (int i = 0; i < nb; i++) {
- //TODO : verify why i is not included to proceed Uuid
- MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId,
- tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
- .build();
- msipl.put(msip.key(), msip);
- }
- return msipl;
- }
-
- private List<SupportedCepLayerProtocolQualifierInstances> createSupportedCepLayerProtocolQualifier(
- TerminationPoint tp, LayerProtocolName lpn) {
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1 tp1 =
- tp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
- if (tp1 == null) {
- return new ArrayList<>(sclpqiList);
- }
- if (tp1.getTpSupportedInterfaces() == null) {
- LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
- return new ArrayList<>(sclpqiList);
- }
- Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values();
- for (SupportedInterfaceCapability sic : sicList) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "DSR":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- //TODO: verify that in the new scope it makes sense to include ODU in the abstracted topology
- case "ODU":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown");
- break;
- }
- }
- return sclpqiList.stream().distinct().toList();
- }
-
private void createTapiOtsLinks(Map<String, String> photonicNepUuisMap, Map<String, String> rdmInfraNepUuisMap) {
Iterator<Entry<String, String>> it1 = photonicNepUuisMap.entrySet().iterator();
Iterator<Entry<String, String>> it2 = rdmInfraNepUuisMap.entrySet().iterator();
}
}
+ public void setTapiNodes(Map<NodeKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap) {
+ this.tapiNodes.putAll(nodeMap);
+ }
+
public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node>
getTapiNodes() {
return tapiNodes;
public Map<LinkKey, Link> getTapiLinks() {
return tapiLinks;
}
-}
\ No newline at end of file
+
+ public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {
+ return tapiSips;
+ }
+
+ public void setTapiSips(Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSip) {
+ this.tapiSips.putAll(tapiSip);
+ }
+}
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.AvailableCapacityBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.TotalPotentialCapacityBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepList;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPEGigE;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.NOTIFICATIONTYPEATTRIBUTEVALUECHANGE;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.NotificationBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.notification.ChangedAttributes;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.notification.ChangedAttributesKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROMS;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.NodeEdgePointRef;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
.getBytes(StandardCharsets.UTF_8)).toString());
private final NetworkTransactionService networkTransactionService;
private final R2RTapiLinkDiscovery linkDiscovery;
- private final TapiLink tapiLink;
+// private final TapiLink tapiLink;
+ private final ConvertORToTapiTopology tapiFactory;
private final NotificationPublishService notificationPublishService;
private Map<ServiceInterfacePointKey, ServiceInterfacePoint> sipMap = new HashMap<>();
@Reference final NotificationPublishService notificationPublishService) {
this.networkTransactionService = networkTransactionService;
this.linkDiscovery = new R2RTapiLinkDiscovery(networkTransactionService, deviceTransactionManager, tapiLink);
- this.tapiLink = tapiLink;
this.notificationPublishService = notificationPublishService;
+ this.tapiFactory = new ConvertORToTapiTopology(tapiTopoUuid);
}
@Override
private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
String keyword,
- List<SupportedIfCapability> supportedInterfaceCapability,
+ List<SupportedIfCapability> sicList,
OperationalState operState, AdministrativeState adminState) {
+ List<SupportedInterfaceCapability> sicListTemp = new ArrayList<>();
+ for (SupportedIfCapability supInterCapa : sicList) {
+ SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
+ .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
+ .setIfCapType(supInterCapa)
+ .build();
+ sicListTemp.add(supIfCapa);
+ }
+ Collection<SupportedInterfaceCapability> sicColl = sicListTemp;
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
.setUuid(nepUuid)
.setLayerProtocolName(nepProtocol)
.setName(nepNames);
if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, tpid, keyword,
- supportedInterfaceCapability, operState, adminState));
+ onepBldr.setMappedServiceInterfacePoint(this.tapiFactory.createMSIP(1, nepProtocol, tpid, keyword,
+ sicColl, operState, adminState));
+ this.sipMap.putAll(tapiFactory.getTapiSips());
}
LOG.debug("Node layer {}", nodeProtocol.getName());
- onepBldr.setSupportedCepLayerProtocolQualifierInstances(createSupportedLayerProtocolQualifier(
- supportedInterfaceCapability, nepProtocol));
+ onepBldr.setSupportedCepLayerProtocolQualifierInstances(
+ this.tapiFactory.createSupportedCepLayerProtocolQualifier(sicColl, nepProtocol));
onepBldr.setDirection(Direction.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED);
return onepMap;
}
- private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
- createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<SupportedIfCapability> supportedInterfaceCapability,
- OperationalState operState, AdministrativeState adminState) {
- Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
- for (int i = 0; i < nb; i++) {
- Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
- tpid)).getBytes(StandardCharsets.UTF_8)).toString());
- MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(sipUuid).build();
- ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability,
- operState, adminState);
- this.sipMap.put(sip.key(), sip);
- // this.tapiSips.put(sip.key(), sip);
- msipl.put(msip.key(), msip);
- LOG.info("SIP created {}", sip.getUuid());
- LOG.info("This SIP corresponds to SIP+nodeId {} + TpId {}", nodeid, tpid);
- }
- return msipl;
- }
-
- private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<SupportedIfCapability> supportedInterfaceCapability,
- OperationalState operState, AdministrativeState adminState) {
- // TODO: what value should be set in total capacity and available capacity
- LOG.info("SIP name = {}", String.join("+", nodeid, tpid));
- Name sipName = new NameBuilder()
- .setValueName("SIP name")
- .setValue(String.join("+", nodeid, tpid))
- .build();
- return new ServiceInterfacePointBuilder()
- .setUuid(sipUuid)
- .setName(Map.of(sipName.key(), sipName))
- .setLayerProtocolName(layerProtocol)
- .setAdministrativeState(adminState)
- .setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setAvailableCapacity(new AvailableCapacityBuilder().build())
- .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
- .setSupportedCepLayerProtocolQualifierInstances(createSipSupportedLayerProtocolQualifier(
- supportedInterfaceCapability, layerProtocol))
- .build();
- }
-
private Node createRoadmTapiNode(String orNodeId, Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
// UUID
Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId,
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setOwnedNodeEdgePoint(oneplist)
- .setNodeRuleGroup(createNodeRuleGroupForRdmNode(orNodeId, nodeUuid, oneplist.values()))
+ .setNodeRuleGroup(this.tapiFactory
+ .createNodeRuleGroupForRdmNode("Full", nodeUuid, orNodeId, oneplist.values()))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setErrorCharacteristic("error")
.build();
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String orNodeId, Uuid nodeUuid,
- Collection<OwnedNodeEdgePoint> onepl) {
- Map<NodeEdgePointKey, NodeEdgePoint>
- nepMap = new HashMap<>();
- for (OwnedNodeEdgePoint onep : onepl) {
- NodeEdgePoint nep = new NodeEdgePointBuilder()
- .setTopologyUuid(this.tapiTopoUuid)
- .setNodeUuid(nodeUuid)
- .setNodeEdgePointUuid(onep.key().getUuid())
- .build();
- nepMap.put(nep.key(), nep);
- }
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
- NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group")
- .getBytes(StandardCharsets.UTF_8)).toString()))
- .setRule(ruleList)
- .setNodeEdgePoint(nepMap)
- .build();
- nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
- return nodeRuleGroupMap;
- }
-
private OduSwitchingPools createTpdrSwitchPool(List<Mapping> xpdrNetMaps) {
Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
int count = 1;
}
private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForDsrNode(String nodeId,
- OduSwitchingPools oorOduSwitchingPool,
- Map<RuleKey, Rule> ruleList,
- Map<OwnedNodeEdgePointKey,
- OwnedNodeEdgePoint> onepl) {
+ OduSwitchingPools oorOduSwitchingPool, Map<RuleKey, Rule> ruleList,
+ Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl) {
// create NodeRuleGroup
if (oorOduSwitchingPool == null) {
LOG.info("No switching pool created for node = {}", nodeId);
return nodeRuleGroupMap;
}
- private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
- createSipSupportedLayerProtocolQualifier(List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- if (sicList == null) {
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- return sclpqiList;
- }
- Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
- LOG.info("SIC list = {}", sicList);
- for (SupportedIfCapability supInterCapa : sicList) {
- SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
- .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
- .setIfCapType(supInterCapa)
- .build();
- supIfMap.put(supIfCapa.key(), supIfCapa);
- }
- for (SupportedInterfaceCapability sic : supIfMap.values()) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "DSR":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
- break;
- }
- }
- return sclpqiList;
- }
-
- private List<SupportedCepLayerProtocolQualifierInstances> createSupportedLayerProtocolQualifier(
- List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- if (sicList == null) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- return sclpqiList;
- }
- Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
- LOG.info("SIC list = {}", sicList);
- for (SupportedIfCapability supInterCapa : sicList) {
- SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
- .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
- .setIfCapType(supInterCapa)
- .build();
- supIfMap.put(supIfCapa.key(), supIfCapa);
- }
- for (SupportedInterfaceCapability sic : supIfMap.values()) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "DSR":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- // TODO: it may be needed to add more cases clauses if the interface capabilities of a
- // port are extended in the config file
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
- break;
- }
- }
- return sclpqiList;
- }
-
private String getNodeType(XpdrNodeTypes xponderType) {
switch (xponderType.getIntValue()) {
case 1:
tapiLinkList = new HashMap<>();
Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_MULTILAYER
.getBytes(Charset.forName("UTF-8"))).toString());
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topoUuid, this.tapiLink);
+ ConvertORTopoToTapiTopo tapiAbstractFactory = new ConvertORTopoToTapiTopo(topoUuid, this.tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topoUuid);
Iterator<Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
while (it.hasNext()) {
String nodeId = it.next().getKey();
tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiAbstractFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbstractFactory.setTapiSips(tapiFactory.getTapiSips());
+ tapiNodeList.putAll(tapiAbstractFactory.getTapiNodes());
+ tapiLinkList.putAll(tapiAbstractFactory.getTapiLinks());
}
if (openroadmTopo.nonnullNode().values().stream()
.filter(nt -> nt
.getNodeType()
.equals(OpenroadmNodeType.SRG))
.count() > 0) {
- tapiFactory.convertRoadmInfrastructure();
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiAbstractFactory.convertRoadmInfrastructure();
+ tapiNodeList.putAll(tapiAbstractFactory.getTapiNodes());
+ tapiLinkList.putAll(tapiAbstractFactory.getTapiLinks());
} else {
LOG.warn("Unable to abstract an ROADM infrasctructure from openroadm-topology");
}
Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.networks.network.LinkKey, Link> otnLinkMap =
otnTopo.augmentation(Network1.class).getLink();
- tapiFactory.convertLinks(otnLinkMap);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiAbstractFactory.convertLinks(otnLinkMap);
+ tapiLinkList.putAll(tapiAbstractFactory.getTapiLinks());
}
Name name = new NameBuilder()
.setValue(TapiStringConstants.T0_MULTILAYER)
tapiNodeList = new HashMap<>();
Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link>
tapiLinkList = new HashMap<>();
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topoUuid, this.tapiLink);
+ ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topoUuid, this.tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topoUuid);
Iterator<Map.Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
while (it.hasNext()) {
String nodeId = it.next().getKey();
tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
+ this.tapiSips.putAll(tapiFactory.getTapiSips());
+ tapiFullFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiFullFactory.setTapiSips(tapiFactory.getTapiSips());
tapiNodeList.putAll(tapiFactory.getTapiNodes());
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiLinkList.putAll(tapiFullFactory.getTapiLinks());
}
// roadm infrastructure not abstracted
// read openroadm-network
.getNodeType()
.equals(OpenroadmNodeType.ROADM))
.collect(Collectors.toList())) {
- tapiFactory.convertRoadmNode(roadm, openroadmTopo);
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ tapiFullFactory.convertRoadmNode(roadm, openroadmTopo);
+ this.tapiSips.putAll(tapiFullFactory.getTapiSips());
+ tapiNodeList.putAll(tapiFullFactory.getTapiNodes());
+ tapiLinkList.putAll(tapiFullFactory.getTapiLinks());
}
} else {
LOG.warn("No roadm nodes exist in the network");
List<Link> rdmTordmLinkList = linkList.stream()
.filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
.collect(Collectors.toList());
- tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiFullFactory.convertRdmToRdmLinks(rdmTordmLinkList);
+ tapiLinkList.putAll(tapiFullFactory.getTapiLinks());
// map xpdr_input to roadm and xpdr_output to roadm links.
xponderInLinkList.addAll(xponderOutLinkList);
- tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiFullFactory.convertXpdrToRdmLinks(xponderInLinkList);
+ tapiLinkList.putAll(tapiFullFactory.getTapiLinks());
// Retrieve created sips map in TapiFactory when mapping all the nodes
- this.tapiSips = tapiFactory.getTapiSips();
+ this.tapiSips.putAll(tapiFullFactory.getTapiSips());
return new TopologyBuilder()
.setName(Map.of(name.key(), name))
.setUuid(topoUuid)
}
LOG.info("Mapping found = {}", mapping);
String networkPortDirection = mapping.getPortDirection();
- // long count = 0;
switch (networkPortDirection) {
// TODO -> remove the part of counting only if the Network LCP is part of a Link.
// We want to have all OTN nodes in the TAPI topology
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
@Test
void convertNodeForTransponder100G() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
@Test
void convertNodeForOtnMuxponder() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
@Test
void convertNodeForOtnSwitch() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
@Test
void convertNodeForRoadmWhenNoOtnMuxAttached() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
- tapiFactory.convertRoadmNode(roadmA, openroadmNet);
+ ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
- assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1");
- assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be empty");
+ assertEquals(1, tapiFullFactory.getTapiNodes().size(), "Node list size should be 1");
+ assertEquals(0, tapiFullFactory.getTapiLinks().size(), "Link list size should be empty");
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
- = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
+ = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
.getBytes(Charset.forName("UTF-8"))).toString());
checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmNodeUuid, "roadm", "ROADM-A1");
@Test
void convertNodeForRoadmWhenRoadmNeighborAttached() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
- tapiFactory.convertRoadmNode(roadmA, openroadmNet);
- tapiFactory.convertRoadmNode(roadmC, openroadmNet);
+ ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
+ tapiFullFactory.convertRoadmNode(roadmC, openroadmNet);
List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
.filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
.collect(Collectors.toList());
- tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
+ tapiFullFactory.convertRdmToRdmLinks(rdmTordmLinkList);
- assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
- assertEquals(1, tapiFactory.getTapiLinks().size(), "Link list size should be 1");
+ assertEquals(2, tapiFullFactory.getTapiNodes().size(), "Node list size should be 2");
+ assertEquals(1, tapiFullFactory.getTapiLinks().size(), "Link list size should be 1");
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
- = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
+ = tapiFullFactory.getTapiNodes().values().stream().collect(Collectors.toList());
int myInt = 0;
for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node : tapiNodes) {
if (node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA)
checkOtsiNode(tapiNodes.get(getNodeRank("ROADM-A1", tapiNodes)), roadmaNodeUuid, "roadm", "ROADM-A1");
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
- = tapiFactory.getTapiLinks().values().stream()
+ = tapiFullFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
@Test
void convertNodeForRoadmWhenOtnMuxAttached() {
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORTopoToTapiFullTopo tapiFullFactory = new ConvertORTopoToTapiFullTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxA, networkPortListA);
- tapiFactory.convertRoadmNode(roadmA, openroadmNet);
+ tapiFullFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiFullFactory.convertRoadmNode(roadmA, openroadmNet);
List<Link> xponderOutLinkList = ortopoLinks.values().stream()
.filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
.filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
|| lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
.collect(Collectors.toList());
xponderInLinkList.addAll(xponderOutLinkList);
- tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
- assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2 (XPDR, DSR-ODU merged; ROADM)");
- assertEquals(1, tapiFactory.getTapiLinks().size(), "Link list size should be 1 : no more transitional link");
+ tapiFullFactory.convertXpdrToRdmLinks(xponderInLinkList);
+ assertEquals(2, tapiFullFactory.getTapiNodes().size(),
+ "Node list size should be 2 (XPDR, DSR-ODU merged; ROADM)");
+ assertEquals(1, tapiFullFactory.getTapiLinks().size(),
+ "Link list size should be 1 : no more transitional link");
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap =
+ tapiFactory.getTapiNodes();
+ nodeMap.putAll(tapiFullFactory.getTapiNodes());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
- = tapiFactory.getTapiNodes().values().stream()
+ = nodeMap.values().stream()
.sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
.collect(Collectors.toList());
Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
"ROADM-A1+PHOTONIC_MEDIA_OTS+SRG1-PP2-TXRXtoSPDR-SA1-XPDR1+PHOTONIC_MEDIA_OTS+XPDR1-NETWORK1"
.getBytes(Charset.forName("UTF-8"))).toString());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link> links
- = tapiFactory.getTapiLinks().values().stream()
+ = tapiFullFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
checkXpdrRdmLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
.sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
.collect(Collectors.toList());
- checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, node9Uuid);
+// keep trace of the previous test performed before the structure of the NRG was modified
+// checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, node9Uuid);
+ checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, inetworkNepUuid, node9Uuid);
break;
case "mux":
nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
OwnedNodeEdgePoint enep4 = enepsN.get(3);
OwnedNodeEdgePoint inep4 = inepsN.get(0);
- Uuid enetworkNepUuid2 = new Uuid(
+ Uuid eclientNepUuid2 = new Uuid(
UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
.toString());
Uuid inetworkNepUuid2 = new Uuid(
UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
.toString());
- checkNepeODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
+ checkNepeODU4(enep4, eclientNepUuid2, nodeId + "+eODU+XPDR1-CLIENT3", "eNodeEdgePoint_N", false);
checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
true);
List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
.sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
.collect(Collectors.toList());
- checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, node9Uuid);
+// keep trace of the previous test performed before the structure of the NRG was modified
+// checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, eclientNepUuid2, node9Uuid);
+ checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, inetworkNepUuid2, node9Uuid);
break;
case "tpdr":
nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
.sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
.collect(Collectors.toList());
- checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, node9Uuid);
+// keep trace of the previous test performed before the structure of the NRG was modified
+// checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, node9Uuid);
+ checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, inetworkNepUuid3, node9Uuid);
break;
default:
fail();
checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
break;
case "roadm":
+// Keep trace of MC NEP test to be restored after the new policy for creating NEP is applied
// assertEquals(0, nepsMc.size(), "MC NEP no more configured, Roadm node should have 0 MC NEPs");
// assertEquals(0, nepsOtsimc.size(), "Roadm node should have 10 OTSiMC NEPs");
assertEquals(12, nepsPhot.size(), "Roadm node should have 12 PHOT_MEDIA NEPs (2x4 OTS +2x(OTS+OMS)");
private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(2, nrgList.size(), "transponder DSR should contain 2 node rule group");
+ assertEquals(4, nrgList.size(), "transponder DSR should contain 4 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
for (NodeRuleGroup nodeRuleGroup : nrgList) {
assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
"each node-rule-group should contain 2 NEP for transponder DSR");
}
- List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
+ Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
+ assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(4, nrgList.size(), "muxponder DSR should contain 4 node rule group");
- for (NodeRuleGroup nodeRuleGroup : nrgList) {
- assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
- "each node-rule-group should contain 2 NEP for muxponder DSR");
- }
- List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(1).nonnullNodeEdgePoint().values());
+ assertEquals(8, nrgList.size(), "muxponder DSR should contain 8 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
+ Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
+ assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(indNrg).nonnullNodeEdgePoint().values());
assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(1, nrgList.size(), "Switch-DSR should contain a single node rule group");
- assertEquals(8, nrgList.get(0).getNodeEdgePoint().size(), "Switch-DSR node-rule-group should contain 8 NEP");
+ assertEquals(2, nrgList.size(), "Switch-DSR should contain 2 node rule group (DSR-I_ODU/I-ODU-E_ODU)");
+ Integer indNrg = nrgContainsClientAndNetwork(nrgList, clientNepUuid, networkNepUuid);
+ assertNotNull("One node-rule-group shall contains client and network Neps", indNrg);
+ assertEquals(8, nrgList.get(indNrg).getNodeEdgePoint().size(), "Switch-DSR nrg should contain 8 NEP");
List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
.sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
.compareTo(nrg2.getNodeEdgePointUuid().getValue()))
.collect(Collectors.toList());
+ Integer xxxxx = 0;
+ for (NodeEdgePoint nep : nrg) {
+ LOG.info("nep number {} UUID is {} ", xxxxx, nep.getNodeEdgePointUuid());
+ xxxxx++;
+ }
+ LOG.info("nep SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK1 UUID is {} ", UUID.nameUUIDFromBytes(
+ ("SPDR-SA1-XPDR2" + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("nep SPDR-SA1-XPDR2+DSR+XPDR2-CLIENT4 UUID is {} ", UUID.nameUUIDFromBytes(
+ ("SPDR-SA1-XPDR2" + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8"))).toString());
assertEquals(networkNepUuid, nrg.get(6).getNodeEdgePointUuid(),
"in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1");
- assertEquals(clientNepUuid, nrg.get(3).getNodeEdgePointUuid(),
+ assertEquals(clientNepUuid, nrg.get(5).getNodeEdgePointUuid(),
"in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4");
assertEquals(nodeUuid, nrg.get(4).getNodeUuid(),
"any item of the node-rule-group should have the same nodeUuid");
LOG.info("searched Char {} found at rank {}", searchedChar, foundAtRank);
return foundAtRank;
}
+
+ private Integer nrgContainsClientAndNetwork(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid) {
+ // 1 NRG should at least contain the NEP of interest in the NEP List
+ Boolean foundClient = false;
+ Boolean foundNetwork = false;
+ Integer indexNrg = 0;
+ for (NodeRuleGroup nrg : nrgList) {
+ for (NodeEdgePoint nep : nrg.nonnullNodeEdgePoint().values()) {
+ if (nep.getNodeEdgePointUuid().equals(clientNepUuid)) {
+ foundClient = true;
+ } else if (nep.getNodeEdgePointUuid().equals(networkNepUuid)) {
+ foundNetwork = true;
+ }
+ }
+ if (foundClient && foundNetwork) {
+ break;
+ } else {
+ foundClient = false;
+ foundNetwork = false;
+ }
+ indexNrg++;
+ }
+ if (foundClient && foundNetwork) {
+ return indexNrg;
+ }
+ return null;
+ }
+
}
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
networkPortList.add(tp.getTpId().getValue());
}
}
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
tapiFactory.convertNode(tpdr, networkPortList);
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
otnLinksAlt.replace(link.key(), link);
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinksAlt);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertLinks(otnLinksAlt);
- List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
+ List<Link> tapiLinks = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
assertNull(tapiLinks.get(1).getAdministrativeState(), "Administrative State should not be present");
new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
otnLinksAlt.replace(link.key(), link);
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinksAlt);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertLinks(otnLinksAlt);
- List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
+ List<Link> tapiLinks = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
assertNull(tapiLinks.get(1).getAdministrativeState(), "Administrative State should not be present");
new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
AdminStates.OutOfService, State.OutOfService);
otnLinksAlt.replace(link.key(), link);
-
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinksAlt);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertLinks(otnLinksAlt);
- List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
+ List<Link> tapiLinks = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
LOG.info("TapiLinks are as follow : {}", tapiLinks.toString());
new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
AdminStates.Maintenance, State.Degraded);
otnLinksAlt.replace(link.key(), link);
-
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinksAlt);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertLinks(otnLinksAlt);
- List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
+ List<Link> tapiLinks = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
assertEquals(AdministrativeState.LOCKED, tapiLinks.get(1).getAdministrativeState(),
new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
AdminStates.OutOfService, State.OutOfService);
otnLinksAlt.replace(link.key(), link);
-
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinksAlt);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertLinks(otnLinksAlt);
- List<Link> tapiLinks = tapiFactory.getTapiLinks().values().stream()
+ List<Link> tapiLinks = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
assertEquals(AdministrativeState.LOCKED, tapiLinks.get(1).getAdministrativeState(),
@Test
void convertNodeForTransponder100G() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
@Test
void convertNodeForOtnMuxponder() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
@Test
void convertNodeForOtnSwitch() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortList = new ArrayList<>();
for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+XPONDER".getBytes(Charset.forName("UTF-8")))
.toString());
- //get(0)
checkDsrNode(tapiNodes.get(getNodeRank("SPDR-SA1", tapiNodes)), dsrNodeUuid, "switch",
"SPDR-SA1-XPDR2+XPONDER");
}
@Test
void convertOtnLink() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
networkPortListA.add(tp.getTpId().getValue());
}
}
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
List<String> networkPortListC = new ArrayList<>();
for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxC, networkPortListC);
- tapiFactory.convertLinks(otnLinks);
- assertEquals(2, tapiFactory.getTapiLinks().size(), "Link list size should be 2 : no transitional link");
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+
+ tapiAbsFactory.convertLinks(otnLinks);
+ assertEquals(2, tapiAbsFactory.getTapiLinks().size(), "Link list size should be 2 : no transitional link");
Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
.toString());
new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1toSPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
.getBytes(Charset.forName("UTF-8"))).toString());
- List<Link> links = tapiFactory.getTapiLinks().values().stream()
+ List<Link> links = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
LOG.info("Node3 {}, Node4 = {},", node3Uuid.toString(), node4Uuid.toString());
@Test
void convertRoadmInfrastructureWhenNoXponderAttached() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
- tapiFactory.convertRoadmInfrastructure();
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ tapiAbsFactory.convertRoadmInfrastructure();
- assertEquals(1, tapiFactory.getTapiNodes().size(), "Node list size should be 1");
- assertEquals(0, tapiFactory.getTapiLinks().size(), "Link list size should be empty");
+ assertEquals(1, tapiAbsFactory.getTapiNodes().size(), "Node list size should be 1");
+ assertEquals(0, tapiAbsFactory.getTapiLinks().size(), "Link list size should be empty");
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
- = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
+ = tapiAbsFactory.getTapiNodes().values().stream().collect(Collectors.toList());
Uuid photNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
.toString());
checkOtsiNode(tapiNodes.get(0), photNodeUuid, "infra", "ROADM-infra");
@Test
void convertRoadmInfrastructureWhenOtnMuxAttached() {
- ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORTopoToTapiTopo tapiAbsFactory = new ConvertORTopoToTapiTopo(topologyUuid, tapiLink);
+ ConvertORToTapiTopology tapiFactory = new ConvertORToTapiTopology(topologyUuid);
List<String> networkPortListA = new ArrayList<>();
for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
}
}
tapiFactory.convertNode(otnMuxA, networkPortListA);
- tapiFactory.convertRoadmInfrastructure();
-
- assertEquals(2, tapiFactory.getTapiNodes().size(), "Node list size should be 2");
- assertEquals(1, tapiFactory.getTapiLinks().size(), "Link list size should be 1 : no more transitional links");
+ tapiAbsFactory.setTapiNodes(tapiFactory.getTapiNodes());
+ tapiAbsFactory.convertRoadmInfrastructure();
+ LOG.info("ERRORLINK List of link = {}", tapiAbsFactory.getTapiLinks().toString());
+ assertEquals(2, tapiAbsFactory.getTapiNodes().size(),
+ "Node list size should be 2");
+ assertEquals(1, tapiAbsFactory.getTapiLinks().size(), "Link list size should be 1");
+
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap =
+ tapiFactory.getTapiNodes();
+ nodeMap.putAll(tapiAbsFactory.getTapiNodes());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> tapiNodes
- = tapiFactory.getTapiNodes().values().stream()
+ = nodeMap.values().stream()
.sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
.collect(Collectors.toList());
+
Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-infra".getBytes(Charset.forName("UTF-8")))
.toString());
- //get (2)
checkOtsiNode(tapiNodes.get(getNodeRank("ROADM", tapiNodes)), otsiNodeUuid, "infra", "ROADM-infra");
- List<Link> links = tapiFactory.getTapiLinks().values().stream()
+ List<Link> links = tapiAbsFactory.getTapiLinks().values().stream()
.sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
.collect(Collectors.toList());
Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+XPONDER".getBytes(Charset.forName("UTF-8")))
assertEquals(3, lpql.size(), "Client nep should support 3 kind of cep");
assertThat("client nep should support 3 kind of cep", lpql,
hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
- assertEquals(LayerProtocolName.ETH, nep.getLayerProtocolName(), "client nep should be of ETH protocol type");
+ assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR(ETH) protocol ");
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
}
private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(2, nrgList.size(), "transponder DSR should contain 2 node rule group");
+ assertEquals(4, nrgList.size(), "transponder DSR should contain 4 node rule group (2*DSR/I_ODU+2*E_ODU/I_ODU)");
for (NodeRuleGroup nodeRuleGroup : nrgList) {
assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
"each node-rule-group should contain 2 NEP for transponder DSR");
private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(4, nrgList.size(), "muxponder DSR should contain 4 node rule group");
+ assertEquals(8, nrgList.size(), "muxponder DSR should contain 8 node rule group (4*DSR/I_ODU + 4*E_ODU/I_ODU)");
for (NodeRuleGroup nodeRuleGroup : nrgList) {
assertEquals(2, nodeRuleGroup.getNodeEdgePoint().size(),
"each node-rule-group should contain 2 NEP for muxponder DSR");
private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
Uuid nodeUuid) {
- assertEquals(1, nrgList.size(), "Switch-DSR should contain a single node rule group");
+ assertEquals(2, nrgList.size(), "Switch-DSR should contain 2 node rule groups (DSR/I_ODU + E_ODU/I_ODU)");
assertEquals(8, nrgList.get(0).getNodeEdgePoint().size(), "Switch-DSR node-rule-group should contain 8 NEP");
List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
.sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
assertEquals(2, lpql.size(), "Client nep should support 2 kind of cep");
assertThat("client nep should support 2 kind of cep", lpql,
hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
- assertEquals(LayerProtocolName.ETH, nep.getLayerProtocolName(), "client nep should be of ETH protocol type");
+ assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR(ETH) protocol");
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
}
}
assertEquals(1, lpql.size(), "Client nep should support 1 kind of cep");
assertThat("client nep should support 2 kind of cep", lpql, hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
- assertEquals(LayerProtocolName.ETH, nep.getLayerProtocolName(), "client nep should be of ETH protocol type");
+ assertEquals(LayerProtocolName.DSR, nep.getLayerProtocolName(), "client nep should be of DSR(ETH) protocol");
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
}