import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.TotalPotentialCapacityBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ProtectionType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RestorationPolicy;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.ResilienceTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.Topology;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.TopologyKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristicBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristic;
ifName.getRemotePortId(), tapiTopoUuid);
if (omsLink != null) {
linkMap.put(omsLink.key(), omsLink);
+ } else {
+ LOG.error("Link was not created");
}
}
return linkMap;
ifName.getRemotePortId(), tapiTopoUuid);
if (omsLink != null) {
linkMap.put(omsLink.key(), omsLink);
+ } else {
+ LOG.error("Link was not created");
}
}
return linkMap;
}
// Todo -> only handling for the bidirectional case. I assume all tps are of the type bidirectional
LOG.debug("Tapi R2R Link DstTPTx {}, DstTPRx {}", destTpTx, srcTpRx);
+
// Create OMS Tapi Link
LOG.info("Tapi R2R Link Found a neighbor SrcNodeId: {} , SrcDegId: {} , SrcTPId: {}, DestNodeId:{} , "
+ "DestDegId: {}, DestTPId: {}", nodeId.getValue(), srcDegId, srcTpTx, destNodeId, destDegId, destTpRx);
.setNodeEdgePointUuid(destUuidTp)
.build();
nepList.put(destNep.key(), destNep);
+ OperationalState sourceOperState = getOperState(tapiTopoUuid, sourceUuidTp, sourceUuidNode);
+ OperationalState destOperState = getOperState(tapiTopoUuid, destUuidTp, destUuidNode);
+ if (sourceOperState == null || destOperState == null) {
+ LOG.error("No link can be created, as the operational state was not found in the TAPI topology");
+ return null;
+ }
+ AdministrativeState sourceAdminState = getAdminState(tapiTopoUuid, sourceUuidTp, sourceUuidNode);
+ AdministrativeState destAdminState = getAdminState(tapiTopoUuid, destUuidTp, destUuidNode);
+ if (sourceAdminState == null || destAdminState == null) {
+ LOG.error("No link can be created, as the administrative state was not found in the TAPI topology");
+ return null;
+ }
+ OperationalState operState = (OperationalState.ENABLED.equals(sourceOperState)
+ && OperationalState.ENABLED.equals(destOperState))
+ ? OperationalState.ENABLED : OperationalState.DISABLED;
+ AdministrativeState adminState = (AdministrativeState.UNLOCKED.equals(sourceAdminState)
+ && AdministrativeState.UNLOCKED.equals(destAdminState))
+ ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
String linkNameValue = String.join("-", sourceNode, sourceTp.split("-")[0], sourceTp)
+ "to" + String.join("-", destNode, destTp.split("-")[0], destTp);
Name linkName = new NameBuilder().setValueName("OMS link name")
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState)
+ .setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
}
return Direction.NotApplicable;
}
+
+ private OperationalState getOperState(Uuid tapiTopoUuid, Uuid nepUuid, Uuid nodeUuid) {
+ InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
+ .augmentation(Context1.class).child(TopologyContext.class)
+ .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid))
+ .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
+ .build();
+ try (ReadTransaction readTx = this.dataBroker.newReadOnlyTransaction()) {
+ Optional<OwnedNodeEdgePoint> optionalOnep = readTx.read(LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ if (optionalOnep.isPresent()) {
+ return optionalOnep.get().getOperationalState();
+ }
+ return null;
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Failed getting Mapping data from portMapping",e);
+ return null;
+ }
+ }
+
+ private AdministrativeState getAdminState(Uuid tapiTopoUuid, Uuid nepUuid, Uuid nodeUuid) {
+ InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
+ .augmentation(Context1.class).child(TopologyContext.class)
+ .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid))
+ .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
+ .build();
+ try (ReadTransaction readTx = this.dataBroker.newReadOnlyTransaction()) {
+ Optional<OwnedNodeEdgePoint> optionalOnep = readTx.read(LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ if (optionalOnep.isPresent()) {
+ return optionalOnep.get().getAdministrativeState();
+ }
+ return null;
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Failed getting Mapping data from portMapping",e);
+ return null;
+ }
+ }
}
import org.opendaylight.transportpce.tapi.R2RTapiLinkDiscovery;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.network.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.NodeTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes;
+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.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
// create tapi Node
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node roadmNode =
createRoadmTapiNode(orNodeId, onepMap);
+ mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
+ mergeSipsinContext(this.sipMap);
// TODO add states corresponding to device config -> based on mapping.
// This should be possible after Gilles work is merged
LOG.info("checking if neighbor roadm exists");
Map<LinkKey, Link> rdm2rdmLinks = this.linkDiscovery.readLLDP(new NodeId(orNodeId), orNodeVersion,
this.tapiTopoUuid);
- mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
- mergeSipsinContext(this.sipMap);
if (!rdm2rdmLinks.isEmpty()) {
mergeLinkinTopology(rdm2rdmLinks);
}
continue;
}
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> srgNeps =
- createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), true);
+ createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), true,
+ transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()));
onepMap.putAll(srgNeps);
}
}
continue;
}
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> degNeps =
- createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false);
+ createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false,
+ transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()));
onepMap.putAll(degNeps);
}
}
OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- true, String.join("+", nodeId, I_OTSI), supportedInterfaceCapability);
+ true, String.join("+", nodeId, I_OTSI), supportedInterfaceCapability,
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// eNep creation on otsi node
OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- false, String.join("+", nodeId, E_OTSI), supportedInterfaceCapability);
+ false, String.join("+", nodeId, E_OTSI), supportedInterfaceCapability,
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// Photonic Media Nep creation on otsi node
OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- false, String.join("+", nodeId, PHTNC_MEDIA), supportedInterfaceCapability);
+ false, String.join("+", nodeId, PHTNC_MEDIA), supportedInterfaceCapability,
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
return onepl;
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
- String.join("+", nodeId, DSR), supportedInterfaceCapability);
+ String.join("+", nodeId, DSR), supportedInterfaceCapability,
+ transformOperState(xpdrClMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// network nep creation on I_ODU node
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName),
LayerProtocolName.ODU, LayerProtocolName.DSR, false,
- String.join("+", nodeId, I_ODU), supportedInterfaceCapability);
+ String.join("+", nodeId, I_ODU), supportedInterfaceCapability,
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// network nep creation on E_ODU node
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName),
LayerProtocolName.ODU, LayerProtocolName.DSR, true,
- String.join("+", nodeId, E_ODU), supportedInterfaceCapability);
+ String.join("+", nodeId, E_ODU), supportedInterfaceCapability,
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
return onepl;
}
+ private OperationalState transformOperState(String operString) {
+ State operState = org.opendaylight.transportpce.networkmodel.util.TopologyUtils.setNetworkOperState(operString);
+ return operState.equals(State.InService) ? OperationalState.ENABLED : OperationalState.DISABLED;
+ }
+
+ private AdministrativeState transformAdminState(String adminString) {
+ AdminStates adminState = org.opendaylight.transportpce.networkmodel.util.TopologyUtils
+ .setNetworkAdminState(adminString);
+ return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
+ }
+
private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
String keyword,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+ OperationalState operState, AdministrativeState adminState) {
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
.setUuid(nepUuid)
.setLayerProtocolName(nepProtocol)
.setName(nepNames);
if (withSip) {
onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, tpid, keyword,
- supportedInterfaceCapability));
+ supportedInterfaceCapability, operState, adminState));
}
LOG.debug("Node layer {}", nodeProtocol.getName());
onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedLayerProtocolQualifier(
supportedInterfaceCapability, nodeProtocol));
onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
return onepBldr.build();
}
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createRoadmNeps(String orNodeId, String tpId,
- boolean withSip) {
+ boolean withSip, OperationalState operState,
+ AdministrativeState adminState) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
// PHOTONIC MEDIA nep
Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, PHTNC_MEDIA, tpId))
.setName(Map.of(nepName.key(), nepName))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
OwnedNodeEdgePoint onep = onepBldr.build();
.setName(Map.of(nepName1.key(), nepName1))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
if (withSip) {
onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
- tpId, String.join("+", orNodeId, MC), null));
+ tpId, String.join("+", orNodeId, MC), null, operState, adminState));
}
OwnedNodeEdgePoint onep1 = onepBldr1.build();
onepMap.put(onep1.key(), onep1);
.setName(Map.of(nepName2.key(), nepName2))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
OwnedNodeEdgePoint onep2 = onepBldr2.build();
return onepMap;
}
- private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
- LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
+ createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
+ List<Class<? extends 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,
MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
.setServiceInterfacePointUuid(sipUuid).build();
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePoint sip
- = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability);
+ = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability,
+ operState, adminState);
this.sipMap.put(sip.key(), sip);
LOG.info("SIP created {}", sip.getUuid());
// this.tapiSips.put(sip.key(), sip);
}
private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ List<Class<? extends 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()
.setUuid(sipUuid)
.setName(Map.of(sipName.key(), sipName))
.setLayerProtocolName(layerProtocol)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState)
+ .setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED)
.setAvailableCapacity(new AvailableCapacityBuilder().build())
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(transformAdminState(mapping.getPortAdminState()))
+ .setOperationalState(transformOperState(mapping.getPortOperState()))
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
+ "as either the node or the tp doesnt exist in the TAPI topology");
return null;
}
+
NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
.setTopologyUuid(this.tapiTopoUuid)
.setNodeUuid(sourceUuidNode)
.setNodeEdgePointUuid(destUuidTp)
.build();
nepList.put(destNep.key(), destNep);
+ OperationalState sourceOperState = getOperState(sourceUuidTp, sourceUuidNode);
+ OperationalState destOperState = getOperState(destUuidTp, destUuidNode);
+ if (sourceOperState == null || destOperState == null) {
+ LOG.error("No link can be created, as the operational state was not found in the TAPI topology");
+ return null;
+ }
+ AdministrativeState sourceAdminState = getAdminState(sourceUuidTp, sourceUuidNode);
+ AdministrativeState destAdminState = getAdminState(destUuidTp, destUuidNode);
+ if (sourceAdminState == null || destAdminState == null) {
+ LOG.error("No link can be created, as the administrative state was not found in the TAPI topology");
+ return null;
+ }
+ OperationalState operState = (OperationalState.ENABLED.equals(sourceOperState)
+ && OperationalState.ENABLED.equals(destOperState))
+ ? OperationalState.ENABLED : OperationalState.DISABLED;
+ AdministrativeState adminState = (AdministrativeState.UNLOCKED.equals(sourceAdminState)
+ && AdministrativeState.UNLOCKED.equals(destAdminState))
+ ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
Name linkName = new NameBuilder().setValueName(valueName)
.setValue(linkId)
.build();
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(adminState)
+ .setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
}
}
+ private OperationalState getOperState(Uuid nepUuid, Uuid nodeUuid) {
+ try {
+ InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
+ .augmentation(Context1.class).child(TopologyContext.class)
+ .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid))
+ .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
+ .build();
+ Optional<OwnedNodeEdgePoint> optionalOnep = this.networkTransactionService.read(
+ LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ if (optionalOnep.isPresent()) {
+ return optionalOnep.get().getOperationalState();
+ }
+ return null;
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Couldnt retrieve nep from datastore");
+ return null;
+ }
+ }
+
+ private AdministrativeState getAdminState(Uuid nepUuid, Uuid nodeUuid) {
+ try {
+ InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
+ .augmentation(Context1.class).child(TopologyContext.class)
+ .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid))
+ .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
+ .build();
+ Optional<OwnedNodeEdgePoint> optionalOnep = this.networkTransactionService.read(
+ LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ if (optionalOnep.isPresent()) {
+ return optionalOnep.get().getAdministrativeState();
+ }
+ return null;
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Couldnt retrieve nep from datastore");
+ return null;
+ }
+ }
+
private boolean putLinkInTopology(Link tapiLink) {
// TODO is this merge correct? Should we just merge topology by changing the nodes map??
// TODO: verify this is correct. Should we identify the context IID with the context UUID??