private static final Logger LOG = LoggerFactory.getLogger(CrossConnectImpl.class);
- private final DeviceTransactionManager deviceTransactionManager;
protected CrossConnect crossConnect;
private final MappingUtils mappingUtils;
private CrossConnectImpl121 crossConnectImpl121;
public CrossConnectImpl(DeviceTransactionManager deviceTransactionManager, MappingUtils mappingUtils,
CrossConnectImpl121 crossConnectImpl121,
CrossConnectImpl221 crossConnectImpl221) {
- this.deviceTransactionManager = deviceTransactionManager;
this.mappingUtils = mappingUtils;
this.crossConnectImpl121 = crossConnectImpl121;
this.crossConnectImpl221 = crossConnectImpl221;
package org.opendaylight.transportpce.common.fixedflex;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public final class FixedFlexImpl implements FixedFlexInterface {
- private static final Logger LOG = LoggerFactory.getLogger(FixedFlexImpl.class);
private long index;
private double centerFrequency;
private double start;
private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterfacesImpl.class);
- private final DeviceTransactionManager deviceTransactionManager;
OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121;
OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221;
MappingUtils mappingUtils;
public OpenRoadmInterfacesImpl(DeviceTransactionManager deviceTransactionManager, MappingUtils mappingUtils,
OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121,
OpenRoadmInterfacesImpl221 openRoadmInterfacesImpl221) {
- this.deviceTransactionManager = deviceTransactionManager;
this.mappingUtils = mappingUtils;
this.openRoadmInterfacesImpl121 = openRoadmInterfacesImpl121;
this.openRoadmInterfacesImpl221 = openRoadmInterfacesImpl221;
public boolean getDeviceInfo(String nodeId, DeviceTransactionManager deviceTransactionManager) {
switch (this.openRoadmVersion) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return getDeviceInfo1_2_1(nodeId, deviceTransactionManager);
+ return getDeviceInfo121(nodeId, deviceTransactionManager);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return getDeviceInfo2_2_1(nodeId, deviceTransactionManager);
+ return getDeviceInfo221(nodeId, deviceTransactionManager);
default:
LOG.info("Device version {} not supported",this.openRoadmVersion);
return false;
}
- private boolean getDeviceInfo1_2_1(String nodeId, DeviceTransactionManager deviceTransactionManager) {
+ private boolean getDeviceInfo121(String nodeId, DeviceTransactionManager deviceTransactionManager) {
//Read clli from the device
InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
}
- private boolean getDeviceInfo2_2_1(String nodeId, DeviceTransactionManager deviceTransactionManager) {
+ private boolean getDeviceInfo221(String nodeId, DeviceTransactionManager deviceTransactionManager) {
//TODO : change back to operational when testing on real device
//Read clli from the device
for (CircuitPacks cp : deviceObject.get().getCircuitPacks()) {
if (cp.getPorts() != null) {
for (Ports port : cp.getPorts()) {
- if (port.getPortQual() != null) {
- if (port.getPortQual().getIntValue() == 4) {
- client++;
- }
+ if ((port.getPortQual() != null) && (port.getPortQual().getIntValue() == 4)) {
+ client++;
}
}
}
for (CircuitPacks cp : deviceObject.get().getCircuitPacks()) {
if (cp.getPorts() != null) {
for (Ports port : cp.getPorts()) {
- if (port.getPortQual() != null) {
- if (port.getPortQual().getIntValue() == 4) {
- client++;
- }
+ if ((port.getPortQual() != null) && (port.getPortQual().getIntValue() == 4)) {
+ client++;
}
}
}
LOG.info("SRG Power Range not found");
}
} else {
- LOG.info("Tranponder range not available seting to default "
- + "power for nodeId: {}", nodeId);
+ LOG.info("Tranponder range not available setting to default power for nodeId: {}", nodeId);
String interfaceName = destTpId + "-" + input.getWaveNumber();
if (callSetTransponderPower(nodeId, interfaceName, new BigDecimal(-5),openroadmVersion)) {
LOG.info("Transponder OCH connection: {} power updated ", interfaceName);
return false;
}
if (interfaceOpt.isPresent()) {
- spanLossTx = interfaceOpt.get().augmentation(Interface1.class).getOts()
- .getSpanLossTransmit().getValue();
+ if (interfaceOpt.get().augmentation(Interface1.class).getOts()
+ .getSpanLossTransmit() != null) {
+ spanLossTx = interfaceOpt.get().augmentation(Interface1.class).getOts()
+ .getSpanLossTransmit().getValue();
+ LOG.info("Spanloss TX is {}", spanLossTx);
+ } else {
+ LOG.error("interface {} has no spanloss value", interfaceOpt.get().getName());
+ }
} else {
LOG.error("Interface {} on node {} is not present!", portMapping.getSupportingOts(),
nodeId);
return false;
}
if (interfaceOpt.isPresent()) {
- spanLossTx = interfaceOpt.get().augmentation(org.opendaylight.yang.gen.v1.http.org
- .openroadm.optical.transport.interfaces.rev181019.Interface1.class).getOts()
- .getSpanLossTransmit().getValue();
+ if (interfaceOpt.get().augmentation(org.opendaylight.yang.gen.v1.http.org
+ .openroadm.optical.transport.interfaces.rev181019.Interface1.class).getOts()
+ .getSpanLossTransmit() != null) {
+ spanLossTx = interfaceOpt.get().augmentation(org.opendaylight.yang.gen.v1.http.org
+ .openroadm.optical.transport.interfaces.rev181019.Interface1.class).getOts()
+ .getSpanLossTransmit().getValue();
+ LOG.info("Spanloss TX is {}", spanLossTx);
+ } else {
+ LOG.error("interface {} has no spanloss value", interfaceOpt.get().getName());
+ }
} else {
LOG.error("Interface {} on node {} is not present!", portMapping.getSupportingOts(),
nodeId);
return false;
}
}
- LOG.info("Spanloss TX is {}", spanLossTx);
- BigDecimal powerValue = BigDecimal.valueOf(Math.min(spanLossTx.doubleValue() - 9, 2));
- LOG.info("Power Value is {}", powerValue);
+
+ BigDecimal powerValue = null;
+ if (spanLossTx != null && spanLossTx.intValue() <= 28 && spanLossTx.intValue() > 0) {
+ powerValue = BigDecimal.valueOf(Math.min(spanLossTx.doubleValue() - 9, 2));
+ LOG.info("Power Value is {}", powerValue);
+ } else if (spanLossTx.intValue() > 28) {
+ LOG.error(
+ "Power Value is null - spanLossTx > 28dB not compliant with openROADM specifications");
+ return false;
+ } else if (spanLossTx.intValue() <= 0) {
+ LOG.error(
+ "Power Value is null - spanLossTx <= 0 dB not compliant with openROADM specifications");
+ return false;
+ } else {
+ LOG.error("Power Value is null - spanLossTx is null");
+ return false;
+ }
try {
Boolean setXconnPowerSuccessVal = crossConnect.setPowerLevel(nodeId,
OpticalControlMode.Power, powerValue, connectionNumber);
}
LOG.info("Transponder power range is fine");
if (!txPowerRangeMap.isEmpty()) {
- LOG.info("Transponder power range is not null {}, {}",
- nextNodeId,srgId);
+ LOG.info("Transponder power range is not null {}, {}", nextNodeId,srgId);
//Transponder range is not empty then check SRG Range
Optional<Mapping> mappingObjectSRG = OlmUtils.getNode(nextNodeId, db)
return false;
}
} else {
- LOG.info("Tranponder range not available seting to default "
- + "power for nodeId: {}", nodeId);
+ LOG.info("Tranponder range not available seting to default power for nodeId: {}", nodeId);
String interfaceName = destTpId + "-" + waveLength;
if (callSetTransponderPower(nodeId,interfaceName,new BigDecimal(-5),
openroadmVersion)) {
OpticalControlMode.GainLoss, powerValue,connectionNumber);
return true;
} else {
- LOG.info("Set Power failed for Roadm-connection: {} on Node: {}", connectionNumber,
- nodeId);
+ LOG.info("Set Power failed for Roadm-connection: {} on Node: {}", connectionNumber, nodeId);
return false;
}
} else {
- LOG.error("Interface {} on node {} is not present!", interfaceName,
- nodeId);
+ LOG.error("Interface {} on node {} is not present!", interfaceName, nodeId);
return false;
}
} else if (openroadmVersion.equals(Nodes.OpenroadmVersion._221)) {
OpticalControlMode.GainLoss, powerValue,connectionNumber);
return true;
} else {
- LOG.info("Set Power failed for Roadm-connection: {} on Node: {}", connectionNumber,
- nodeId);
+ LOG.info("Set Power failed for Roadm-connection: {} on Node: {}", connectionNumber, nodeId);
return false;
}
}
}
} catch (OpenRoadmInterfaceException | InterruptedException ex) {
- LOG.error("Error during power setup on Roadm nodeId: {} for connection: {}",
- nodeId, connectionNumber, ex);
+ LOG.error("Error during power setup on Roadm nodeId: {} for connection: {}", nodeId, connectionNumber, ex);
return false;
}
return false;
public final class PowerMgmtVersion121 {
private static final Logger LOG = LoggerFactory.getLogger(PowerMgmtVersion121.class);
- private static final long DATA_STORE_READ_TIMEOUT = 120;
private PowerMgmtVersion121() {
}
public final class PowerMgmtVersion221 {
private static final Logger LOG = LoggerFactory.getLogger(PowerMgmtVersion221.class);
- private static final long DATA_STORE_READ_TIMEOUT = 120;
private PowerMgmtVersion221() {
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RatioDB;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.Link1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmLinkType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.Interface1;
public GetPmOutput getPm(GetPmInput pmInput) {
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping
.rev170228.network.Nodes.OpenroadmVersion openroadmVersion;
- //LOG.info("Version returbed by mapping util is "+ mappingUtils.getOpenROADMVersion(pmInput.getNodeId()));
if (mappingUtils.getOpenRoadmVersion(pmInput.getNodeId())
.equals(StringConstants.OPENROADM_DEVICE_VERSION_1_2_1)) {
LOG.info("Device version is 1.2.1");
public ServicePowerSetupOutput servicePowerSetup(ServicePowerSetupInput powerSetupInput) {
ServicePowerSetupOutputBuilder powerSetupOutput = new ServicePowerSetupOutputBuilder();
boolean successValPowerCalculation = powerMgmt.setPower(powerSetupInput);
-
if (successValPowerCalculation) {
powerSetupOutput.setResult(ResponseCodes.SUCCESS_RESULT);
} else {
*/
private boolean setSpanLoss(String nodeId, String interfaceName, BigDecimal spanLoss, String direction) {
String realNodeId = getRealNodeId(nodeId);
- BigDecimal initialSpanloss = new BigDecimal(0);
try {
LOG.info("Setting Spanloss in device for {}, InterfaceName: {}", realNodeId, interfaceName);
if (mappingUtils.getOpenRoadmVersion(realNodeId)
Optional<Interface> interfaceObject;
interfaceObject = openRoadmInterfaces.getInterface(realNodeId, interfaceName);
if (interfaceObject.isPresent()) {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
InterfaceBuilder interfaceBuilder = new InterfaceBuilder(interfaceObject.get());
OtsBuilder otsBuilder = new OtsBuilder();
Interface intf = interfaceObject.get();
LOG.info("Spanloss Value update completed successfully");
return true;
} else {
- LOG.error("Interface not found for nodeId: {} and interfaceName: {}",
- nodeId,interfaceName);
+ LOG.error("Interface not found for nodeId: {} and interfaceName: {}", nodeId, interfaceName);
return false;
}
} else if (mappingUtils.getOpenRoadmVersion(realNodeId)
.interfaces.grp.Interface> interfaceObject =
openRoadmInterfaces.getInterface(realNodeId, interfaceName);
if (interfaceObject.isPresent()) {
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
- .interfaces.grp.Interface> interfacesIID =
- InstanceIdentifier.create(org.opendaylight.yang.gen.v1.http.org.openroadm
- .device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm
- .device.rev181019.interfaces.grp.Interface.class, new org.opendaylight.yang.gen
- .v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceKey(interfaceName));
org.opendaylight.yang.gen.v1.http.org.openroadm.device
.rev181019.interfaces.grp.InterfaceBuilder interfaceBuilder =
new org.opendaylight.yang.gen.v1.http.org.openroadm.device
LOG.info("Spanloss Value update completed successfully");
return true;
} else {
- LOG.error("Interface not found for nodeId: {} and interfaceName: {}",
- nodeId,interfaceName);
+ LOG.error("Interface not found for nodeId: {} and interfaceName: {}", nodeId,interfaceName);
return false;
}
}
OtsPmHolder destOtsPmHoler = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInput");
spanLoss = new BigDecimal(srcOtsPmHoler.getOtsParameterVal() - destOtsPmHoler.getOtsParameterVal())
.setScale(0, RoundingMode.HALF_UP);
- LOG.info("Spanloss Calculated as :" + spanLoss + "=" + srcOtsPmHoler.getOtsParameterVal() + "-"
- + destOtsPmHoler.getOtsParameterVal());
- if ((spanLoss.doubleValue() < 28) && (spanLoss.doubleValue() > 0)) {
- if (!setSpanLoss(sourceNodeId, srcOtsPmHoler.getOtsInterfaceName(), spanLoss, "TX")) {
- LOG.info("Setting spanLoss failed for " + sourceNodeId);
- return null;
- }
- if (!setSpanLoss(destNodeId, destOtsPmHoler.getOtsInterfaceName(), spanLoss, "RX")) {
- LOG.info("Setting spanLoss failed for " + destNodeId);
- return null;
- }
- map.put(link.getLinkId(), spanLoss);
+ LOG.info("Spanloss Calculated as :{}={}-{}",
+ spanLoss, srcOtsPmHoler.getOtsParameterVal(), destOtsPmHoler.getOtsParameterVal());
+ if (spanLoss.doubleValue() > 28) {
+ LOG.warn("Span Loss is out of range of OpenROADM specifications");
+ }
+ if (!setSpanLoss(sourceNodeId, srcOtsPmHoler.getOtsInterfaceName(), spanLoss, "TX")) {
+ LOG.info("Setting spanLoss failed for {}", sourceNodeId);
+ return null;
+ }
+ if (!setSpanLoss(destNodeId, destOtsPmHoler.getOtsInterfaceName(), spanLoss, "RX")) {
+ LOG.info("Setting spanLoss failed for {}", destNodeId);
+ return null;
}
+ map.put(link.getLinkId(), spanLoss);
}
return map;
}
NONE, HARD_EXCLUDE, HARD_INCLUDE, HARD_DIVERSITY, SOFT_EXCLUDE, SOFT_INCLUDE, SOFT_DIVERSITY;
}
- // private static final String NETWORK_ID = "Transport Overlay";
public PceCalculation(PathComputationRequestInput input, DataBroker dataBroker, PceConstraints pceHardConstraints,
PceConstraints pceSoftConstraints, PceResult rc) {
this.input = input;
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
-//import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
}
Diversity diversity = tmpGeneral.getDiversity();
- if (diversity != null) {
- if (diversity.getExistingServiceApplicability().isNode()) {
- LOG.info("in readGeneralContrains {}", diversity.toString());
- readDiversityNodes(diversity.getExistingService(), constraints);
- }
+ if ((diversity != null) && (diversity.getExistingServiceApplicability().isNode())) {
+ LOG.info("in readGeneralContrains {}", diversity.toString());
+ readDiversityNodes(diversity.getExistingService(), constraints);
}
}
result = Optional.of(path);
}
}
-// return pathDescReadTx.read(LogicalDatastoreType.CONFIGURATION, pathDescriptionIID)
-// .get(Timeouts.DATASTORE_READ, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
LOG.warn(
"PCE diversity constraints: Exception while getting path description from datastore {} for service {}!",
Long latencyConstraint = this.pceHardConstraints.getMaxLatency();
- if (latencyConstraint > 0) {
- if (this.tmpAtozLatency > latencyConstraint) {
- this.foundButTooHighLatency = true;
- this.pceResult.setLocalCause(LocalCause.TOO_HIGH_LATENCY);
- LOG.info("In validateLatency: AtoZ path has too high LATENCY {} > {}", this.tmpAtozLatency,
- latencyConstraint);
- return false;
- }
+ if ((latencyConstraint > 0) && (this.tmpAtozLatency > latencyConstraint)) {
+ this.foundButTooHighLatency = true;
+ this.pceResult.setLocalCause(LocalCause.TOO_HIGH_LATENCY);
+ LOG.info("In validateLatency: AtoZ path has too high LATENCY {} > {}", this.tmpAtozLatency,
+ latencyConstraint);
+ return false;
}
LOG.info("In validateLatency: AtoZ path is {}", this.pathAtoZ.toString());
return true;
/*
* extension of Link to include constraints and Graph weight
*/
- // double capacity = 1;
double weight = 0;
spanOsnrLu = Math.pow(10, (spanOsnrDb / 10.0));
sum = PceConstraints.CONST_OSNR / spanOsnrLu;
linkOsnrLu = sum;
- //link_OSNR_dB = 10 * Math.log10(1 / sum);
LOG.debug("In retrieveOSNR: link OSNR is {} dB", linkOsnrLu);
return linkOsnrLu;
}
}
public boolean checkTP(String tp) {
- if (this.usedXpndrNWTps.contains(tp)) {
- return false;
- }
- return true;
+ return !(this.usedXpndrNWTps.contains(tp));
}
public boolean checkWL(long index) {
- if (this.availableWLindex.contains(index)) {
- return true;
- }
- return false;
+ return (this.availableWLindex.contains(index));
}
public boolean isValid() {
public String toString() {
return "PceNode type=" + this.nodeType + " ID=" + this.nodeId.getValue();
}
-}
\ No newline at end of file
+}
.build();
// Resource
- AToZKey srcTPKey = new AToZKey(index.toString());// tpName);
+ AToZKey srcTPKey = new AToZKey(index.toString());
+ // tpName);
Resource tpResource1 = new ResourceBuilder().setResource(stp).build();
AToZ stpResource = new AToZBuilder().setId(tpName).withKey(srcTPKey).setResource(tpResource1).build();
index++;
ConnectToGnpyServer connect = new ConnectToGnpyServer();
String gnpyJsonModified = gnpyJson.replace("gnpy-eqpt-config:", "")
.replace("gnpy-path-computation-simplified:", "").replace("gnpy-network-topology:", "");
- //sd.writeStringFile(gnpyJsonModified);
String gnpyResponse = connect.gnpyCnx(gnpyJsonModified);
return gnpyResponse;
}
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.transportpce.common.NetworkUtils;
-//import org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.EdfaVariety;
-//import org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.FiberVariety;
import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Coordinate;
import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Km;
import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.edfa.params.Operational;
public class ExtractTopoDataStoreImpl {
private static final Logger LOG = LoggerFactory.getLogger(ExtractTopoDataStoreImpl.class);
private final DataBroker dataBroker;
- // private final OpenRoadmTopology openRoadmTopology;
- // private final OpenRoadmInterfaces openRoadmInterfaces;
private List<Elements> elements = new ArrayList<>();
private List<Connections> connections = new ArrayList<>();
private List<PathRequest> pathRequest = new ArrayList<>();
// Create the list of connections
Network1 nw1 = openRoadmTopo.get().augmentation(Network1.class);
List<Link> linksList = nw1.getLink();
- // 1:EXPRESS-LINK ; 2:ADD-LINK ; 3:DROP-LINK ;
- // 4:ROADM-To-ROADM ; 5:XPONDER-INPUT ; 6:XPONDER-OUTPUT
+ // 1:EXPRESS-LINK 2:ADD-LINK 3:DROP-LINK
+ // 4:ROADM-To-ROADM 5:XPONDER-INPUT 6:XPONDER-OUTPUT
int[] externalLink = {4,5,6};
int idFiber = 0;
int nbEDFA = 0;
nbEDFA++;
mapDisgNodeRefNode.put(nodeId, nodeId);
mapNodeRefIp.put(nodeId, ipEdfa);
- // class std_medium_gain
- // implements EdfaVariety {}
element1 = addElementsEdfa(2, 0, "RLD", "Lannion_CAS",
ila.getGain().getValue(), ila.getTilt().getValue(),
ila.getOutVoaAtt().getValue(), "std_medium_gain",
mapLinkFiber.put(link.getLinkId().getValue(), clfi);
mapFiberIp.put(clfi, ipFiber);
idFiber++;
- // class SSMF implements
- // FiberVariety {}
element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0,
"SSMF");
mapFiberIp.put(clfi, ipFiber);
idFiber++;
// Create a new element
- // class SSMF implements FiberVariety {}
Elements element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0, "SSMF");
topoElements.add(element1);
// List of A to Z
List<AToZ> listAtoZ = atoz.getAToZ();
int atozSize = listAtoZ.size();
- // String modulationFormat = atoz.getModulationFormat();
// Create the path request
List<PathRequest> pathRequestList = new ArrayList<>();
- // Define the instance identifier
- // InstanceIdentifier<Network> nwInstanceIdentifier = InstanceIdentifier
- // .builder(Network.class, new NetworkKey(new
- // NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
-
- // read the configuration part of the data broker that concerns the
- // nodes ID and get all the nodes
- // java.util.Optional<Network> networkObject = readOnlyTransaction
- // .read(LogicalDatastoreType.CONFIGURATION,
- // nwInstanceIdentifier).get().toJavaUtil();
+
// 1.1 Create explicitRouteObjects
// 1.1.1. create RouteObjectIncludeExclude list
List<RouteObjectIncludeExclude> routeObjectIncludeExcludes = new ArrayList<>();
IpAddress ipAddressCurrent = null;
Long index = (long) 0;
- //ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
for (int i = 0; i < atozSize; i++) {
- // String idAtoZ = listAtoZ.get(i).getId();
String nodeId = null;
if (listAtoZ.get(i).getResource()
.getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
for (Elements element : elements) {
if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
- String type = element.getType().getName();
if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
ipAddressCurrent = ipAddress;
// Fill in routeObjectIncludeExcludes
} else {
LOG.warn("node ID is null");
}
- } else if (listAtoZ.get(i).getResource()
- .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
- .pathdescription.rev171017.pce.resource.resource.resource.TerminationPoint) {
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
- .resource.resource.resource.TerminationPoint tp = (org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.pathdescription.rev171017.pce.resource.resource.resource
- .TerminationPoint) listAtoZ.get(i).getResource().getResource();
- // Not used in this version
+ //TODO else if termination point not implemented in this version
} else if (listAtoZ.get(i).getResource()
.getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
.pathdescription.rev171017.pce.resource.resource.resource.Link) {
// 1. Create the path request element 1
// Find parameters
- // String serviceName = input.getServiceName();
String sourceNode = input.getServiceAEnd().getNodeId();
String destNode = input.getServiceZEnd().getNodeId();
// 1.2 Create a path constraints
Long rate = atoz.getRate();
- // Long wavelengthNumber = atoz.getAToZWavelengthNumber();
// Create EffectiveFreqSlot
List<EffectiveFreqSlot> effectiveFreqSlot = new ArrayList<>();
EffectiveFreqSlot effectiveFreqSlot1 = new EffectiveFreqSlotBuilder().setM(5).setN(8).build();
TeBandwidth teBandwidth = new TeBandwidthBuilder().setPathBandwidth(new BigDecimal(rate))
.setTechnology("flexi-grid").setTrxType("openroadm-beta1").setTrxMode("W100G")
.setEffectiveFreqSlot(effectiveFreqSlot).setSpacing(new BigDecimal(50000000000.0)).build();
- // .setMaxNbOfChannel(new Long(80)).setOutputPower(new
- // BigDecimal(0.0012589254117941673))
PathConstraints pathConstraints = new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
- // PathRequest pathRequest1 = new
- // PathRequestBuilder().setRequestId(new
- // Long(0)).setSource(mapNodeRefIp.get(sourceNode))
- // .setDestination(mapNodeRefIp.get(destNode)).setSrcTpId(input.getServiceAEnd().getTxDirection()
- // .getPort().getPortName().getBytes())
- // .setDstTpId(input.getServiceAEnd().getRxDirection().getPort().getPortName().getBytes())
- // .setPathConstraints(pathConstraints)
- // .setExplicitRouteObjects(explicitRouteObjects).build();
PathRequest pathRequest1 = new PathRequestBuilder().setRequestId(requestId)
.setSource(mapNodeRefIp.get(sourceNode)).setDestination(mapNodeRefIp.get(destNode))
.setSrcTpId("srcTpId".getBytes()).setDstTpId("dstTpId".getBytes()).setPathConstraints(pathConstraints)
.setExplicitRouteObjects(explicitRouteObjects).build();
pathRequestList.add(pathRequest1);
- //readOnlyTransaction.close();
return pathRequestList;
}
// List of A to Z
List<ZToA> listZToA = ztoa.getZToA();
int ztoaSize = listZToA.size();
- // String modulationFormat = ztoa.getModulationFormat();
// Create the path request
List<PathRequest> servicePathRequest = new ArrayList<>();
- // Define the instance identifier
- InstanceIdentifier<Network> nwInstanceIdentifier = InstanceIdentifier
- .builder(Networks.class)
- .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
- //ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
- // read the configuration part of the data broker that concerns the
- // nodes ID and get all the nodes
- // java.util.Optional<Network> networkObject = readOnlyTransaction
- // .read(LogicalDatastoreType.CONFIGURATION,
- // nwInstanceIdentifier).get().toJavaUtil();
// 1.1 Create explicitRouteObjects
// 1.1.1. create RouteObjectIncludeExclude list
List<RouteObjectIncludeExclude> routeObjectIncludeExcludes = new ArrayList<>();
IpAddress ipAddressCurrent = null;
Long index = (long) 0;
for (int i = 0; i < ztoaSize; i++) {
- // String idZtoA = listZToA.get(i).getId();
String nodeId = null;
if (listZToA.get(i).getResource()
.getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
for (Elements element : elements) {
if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
- // String type = element.getType().getName();
if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
ipAddressCurrent = ipAddress;
// Fill in routeObjectIncludeExcludes
} else {
LOG.warn("node ID is null");
}
- } else if (listZToA.get(i).getResource()
- .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
- .pathdescription.rev171017.pce.resource.resource.resource.TerminationPoint) {
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
- .resource.resource.resource.TerminationPoint tp = (org.opendaylight.yang.gen.v1.http.org
- .transportpce.b.c._interface.pathdescription.rev171017.pce.resource.resource.resource
- .TerminationPoint) listZToA.get(i).getResource().getResource();
- // Not used in this version
+ //TODO else if termination point not implemented in this version
} else if (listZToA.get(i).getResource()
.getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
.pathdescription.rev171017.pce.resource.resource.resource.Link) {
// 1. Create the path request element 1
// Find parameters
- // String serviceName = input.getServiceName();
String sourceNode = input.getServiceZEnd().getNodeId();
String destNode = input.getServiceAEnd().getNodeId();
// 1.2 Create a path constraints
Long rate = ztoa.getRate();
- // Long wavelengthNumber = ztoa.getZToAWavelengthNumber();
// Create EffectiveFreqSlot
List<EffectiveFreqSlot> effectiveFreqSlot = new ArrayList<>();
EffectiveFreqSlot effectiveFreqSlot1 = new EffectiveFreqSlotBuilder().setM(5).setN(8).build();
TeBandwidth teBandwidth = new TeBandwidthBuilder().setPathBandwidth(new BigDecimal(rate))
.setTechnology("flexi-grid").setTrxType("openroadm-beta1").setTrxMode("W100G")
.setEffectiveFreqSlot(effectiveFreqSlot).setSpacing(new BigDecimal(50000000000.0)).build();
- // .setMaxNbOfChannel(new Long(80)).setOutputPower(new
- // BigDecimal(0.0012589254117941673))
PathConstraints pathConstraints = new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
- // PathRequest pathRequest1 = new
- // PathRequestBuilder().setRequestId(new
- // Long(0)).setSource(mapNodeRefIp.get(sourceNode))
- // .setDestination(mapNodeRefIp.get(destNode)).setSrcTpId(input.getServiceAEnd().getTxDirection()
- // .getPort().getPortName().getBytes())
- // .setDstTpId(input.getServiceAEnd().getRxDirection().getPort().getPortName().getBytes())
- // .setPathConstraints(pathConstraints)
- // .setExplicitRouteObjects(explicitRouteObjects).build();
PathRequest pathRequest1 = new PathRequestBuilder().setRequestId(requestId)
.setSource(mapNodeRefIp.get(sourceNode)).setDestination(mapNodeRefIp.get(destNode))
.setSrcTpId("srcTpId".getBytes()).setDstTpId("dstTpId".getBytes()).setPathConstraints(pathConstraints)
.setExplicitRouteObjects(explicitRouteObjects).build();
servicePathRequest.add(pathRequest1);
- //readOnlyTransaction.close();
return servicePathRequest;
}
.setAttIn(new BigDecimal(attIn)).setLossCoef(new BigDecimal(lossCoef)).setConIn(new BigDecimal(connIn))
.setConOut(new BigDecimal(connOut)).build();
Params params1 = new ParamsBuilder().setFiberroadm(fiber).build();
- // TypeElement Fiber = ; //new TypeElement(Fiber);
Elements element1 = new ElementsBuilder().setUid(clfi)
.setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Fiber.class)
.setTypeVariety(typeVariety).setMetadata(metadata1)
Operational operational = new OperationalBuilder().setGainTarget(gainTarget).setTiltTarget(tiltTarget)
.setOutVoa(outVoa).build();
Edfa edfa = new EdfaBuilder()
- // .setTypeVariety(typeVariety)
.setOperational(operational).build();
Elements element1 = new ElementsBuilder().setUid(uidEdfa)
// Choose an ip address
return routeObjectIncludeExclude1;
}
- private String fromToNodeForConnection(String id, IpAddress ip) {
- String fromToNode = id;
- if (ip != null) {
- fromToNode = ip.getIpv4Address().getValue().toString();
- }
- return (fromToNode);
- }
-
private Connections createNewConnection(String srcId, IpAddress srcIp, String destId, IpAddress destIp) {
String fromNode = srcId;
String toNode = destId;
}
public List<PathRequest> createEmptyPathRequest(PathComputationRequestInput input, AToZDirection atoz) {
- // List of A to Z
- // List<AToZ> listAtoZ = atoz.getAToZ();
- // int atozSize = listAtoZ.size();
-
// Create the path request
List<PathRequest> pathRequestList = new ArrayList<>();
// 1. Create the path request element 1
// Find parameters
- // String serviceName = input.getServiceName();
String sourceNode = input.getServiceAEnd().getNodeId();
String destNode = input.getServiceZEnd().getNodeId();
import com.google.common.base.Preconditions;
import com.google.gson.stream.JsonReader;
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public GnpyResult(String gnpyResponseString) throws Exception {
- // try {
- // Optional<DataObject> dataObject;
// Create the schema context
final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
Iterable<? extends YangModuleInfo> moduleInfos;
return schemaContext;
}
- private String readResultFromFile(String fileName) {
- BufferedReader br = null;
- FileReader fr = null;
- StringBuilder sb = new StringBuilder();
- String gnpyResponse;
-
- try {
- fr = new FileReader(fileName);
- br = new BufferedReader(fr);
- String currentLine;
- while ((currentLine = br.readLine()) != null) {
- LOG.info(currentLine);
- sb.append(currentLine);
- }
- fr.close();
- } catch (IOException e) {
- LOG.warn("GNPy: exception {} occured during the reading of results", e.getMessage());
- }
- gnpyResponse = sb.toString();
- return gnpyResponse;
- }
-
/**
* Transforms the given input {@link NormalizedNode} into the given
* {@link DataObject}.
public class ServiceDataStoreOperationsImpl implements ServiceDataStoreOperations {
private static final Logger LOG = LoggerFactory.getLogger(ServiceDataStoreOperationsImpl.class);
- private final DataBroker dataBroker;
public ServiceDataStoreOperationsImpl(DataBroker dataBroker) {
- this.dataBroker = dataBroker;
}
public void createXMLFromDevice(DataStoreContext dataStoreContextUtil, OrgOpenroadmDevice device, String output) {
// Prepare the variables
final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
Iterable<? extends YangModuleInfo> moduleInfos = Collections
- .singleton(BindingReflections.getModuleInfo(object.getClass()));// TransportpceGnpyData.class));
+ .singleton(BindingReflections.getModuleInfo(object.getClass()));
moduleContext.addModuleInfos(moduleInfos);
SchemaContext schemaContext = moduleContext.tryToCreateSchemaContext().get();
BindingRuntimeContext bindingContext;
// The write part
final BindingStreamEventWriter bindingWriter = codecRegistry.newWriter(id, domWriter);
codecRegistry.getSerializer(id.getTargetType()).serialize(object, bindingWriter);
- // file.write(writer.toString());
- // file.close();
writer.close();
} catch (IOException e) {
LOG.error("GNPy: writer error ");
LOG.warn("GNPy: exception {} occured during json file creation", e.getMessage(), e);
} catch (ReactorException e) {
LOG.warn("GNPy: exception {} occured during json file creation", e.getMessage(), e);
-// } catch (Exception e) {
-// LOG.warn("An error {} occured during json file creation", e.getMessage(), e);
}
return writer.toString();
}
PathDescriptionBuilder path = null;
path = sendingPCE.getPathDescription();
LOG.info("PCE response: {} {}", message, responseCode);
- if ((sendingPCE.getSuccess() == false) || (path == null)) {
+ if (!(sendingPCE.getSuccess()) || (path == null)) {
configurationResponseCommon.setAckFinalIndicator("Yes")
.setRequestId(input.getServiceHandlerHeader().getRequestId()).setResponseCode(responseCode)
.setResponseMessage(message);
.build());
break;
case XPONDERCLIENT:
-// XpdrClientAttributes xpdrClientAttributes = tp.getXpdrClientAttributes();
-// XpdrClientAttributesBuilder xpdrClientAttributesBuilder;
-// if (xpdrClientAttributes == null) {
-// xpdrClientAttributesBuilder = new XpdrClientAttributesBuilder();
-// } else {
-// xpdrClientAttributesBuilder = new XpdrClientAttributesBuilder(xpdrClientAttributes);
-// }
-// Wavelength usedXpdrClientWl = new WavelengthBuilder().setWidth(frequencyGHz)
-// .setFrequency(frequencyTHz).build();
-// tp1Builder.setXpdrClientAttributes(xpdrClientAttributesBuilder
-// .setWavelength(usedXpdrClientWl)
-// .build());
break;
case XPONDERPORT:
XpdrPortAttributes xpdrPortAttributes = tp.getXpdrPortAttributes();
OchBuilder ocIfBuilder = new OchBuilder();
ocIfBuilder.setFrequency(FrequencyTHz.getDefaultInstance(String.valueOf(fixedFlex.getCenterFrequency())));
- // ocIfBuilder.setWidth(FrequencyGHz.getDefaultInstance(String.valueOf(fixedFlex.getWavelength())));
- // ocIfBuilder.setModulationFormat(ModulationFormat.DpQpsk);
ocIfBuilder.setRate(R100G.class);
ocIfBuilder.setTransmitPower(new PowerDBm(new BigDecimal("-5")));
this.crossConnect.postCrossConnect(nodeId, waveNumber, srcTp, destTp);
if (connectionNameOpt.isPresent()) {
nodesProvisioned.add(nodeId);
-// List<Ports> ports =
-// this.crossConnect.getConnectionPortTrail(nodeId, waveNumber, srcTp, destTp);
-// if (ServicePathDirection.A_TO_Z.equals(direction)) {
-// topology.updateAtoZTopologyList(ports, nodeId);
-// }
-// if (ServicePathDirection.Z_TO_A.equals(direction)) {
-// topology.updateZtoATopologyList(ports, nodeId);
-// }
createdConnections.add(connectionNameOpt.get());
} else {
processErrorMessage("Unable to post Roadm-connection for node " + nodeId, forkJoinPool,
writeTx.submit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
} else {
LOG.warn("Service {} does not exist - topology can not be updated", name);
-// servicesBuilder = new ServicesBuilder();
-// servicesBuilder.withKey(serviceKey);
}
}
}
}
-/* @Override
- public ServiceImplementationRequestOutput serviceImplementation(ServiceImplementationRequestInput input) {
- LOG.info("Calling service impl request {} {}", input.getServiceName());
- RollbackProcessor rollbackProcessor = new RollbackProcessor();
-
- ServicePathInputData servicePathInputDataAtoZ
- = ModelMappingUtils.rendererCreateServiceInputAToZ(input.getServiceName(),
- input.getPathDescription());
- ServicePathInputData servicePathInputDataZtoA
- = ModelMappingUtils.rendererCreateServiceInputZToA(input.getServiceName(),
- input.getPathDescription());
- List<DeviceRenderingResult> renderingResults = deviceRendering(rollbackProcessor, servicePathInputDataAtoZ,
- servicePathInputDataZtoA);
- if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
- return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED, OPERATION_FAILED);
- }
-
- ServicePowerSetupInput olmPowerSetupInputAtoZ = ModelMappingUtils.createServicePowerSetupInput(
- renderingResults.get(0).getOlmList(), input);
- ServicePowerSetupInput olmPowerSetupInputZtoA = ModelMappingUtils.createServicePowerSetupInput(
- renderingResults.get(1).getOlmList(), input);
- olmPowerSetup(rollbackProcessor, olmPowerSetupInputAtoZ, olmPowerSetupInputZtoA);
- if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
- return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED, OPERATION_FAILED);
- }
-
- // run service activation test twice - once on source node and once on destination node
- List<Nodes> nodes = servicePathInputDataAtoZ.getServicePathInput().getNodes();
- Nodes sourceNode = nodes.get(0);
- Nodes destNode = nodes.get(nodes.size() - 1);
-
- String srcNetworkTp;
- String dstNetowrkTp;
-
- if (sourceNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
- srcNetworkTp = sourceNode.getDestTp();
- } else {
- srcNetworkTp = sourceNode.getSrcTp();
- }
- if (destNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
- dstNetowrkTp = destNode.getDestTp();
- } else {
- dstNetowrkTp = destNode.getSrcTp();
- }
-
- if (!isServiceActivated(sourceNode.getNodeId(), srcNetworkTp)
- || !isServiceActivated(destNode.getNodeId(), dstNetowrkTp)) {
- rollbackProcessor.rollbackAll();
- return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED, OPERATION_FAILED);
- }
- } */
-
@Override
public ListenableFuture<ServiceImplementationRequestOutput>
serviceImplementation(ServiceImplementationRequestInput input) {
Nodes destNode = nodes.get(nodes.size() - 1);
String srcNetworkTp;
String dstNetowrkTp;
- //if (sourceNode.getDestTp().contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) {
if (sourceNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
srcNetworkTp = sourceNode.getDestTp();
} else {
srcNetworkTp = sourceNode.getSrcTp();
}
- //if (destNode.getDestTp().contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) {
if (destNode.getDestTp().contains(StringConstants.NETWORK_TOKEN)) {
dstNetowrkTp = destNode.getDestTp();
} else {
servicePathDataAtoZ.getServicePathInput().getServiceName(), RpcStatusEx.Pending,
"Device rendering was not successful! Rendering will be rolled back.");
//FIXME we can't do rollback here, because we don't have rendering results.
- //rollbackProcessor.addTask(new DeviceRenderingRollbackTask("AtoZDeviceTask", true));
- //rollbackProcessor.addTask(new DeviceRenderingRollbackTask("ZtoADeviceTask", true));
return renderingResults;
}
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
+
+import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.renderer.provisiondevice.OLMRenderingResult;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.ServicePowerSetupOutput;
}
LOG.debug("Result: {}", result.getResult());
- if (result.isSuccessful()) {
+ if (ResponseCodes.SUCCESS_RESULT.equals(result.getResult().getResult())) {
LOG.info("OLM power setup finished successfully");
return OLMRenderingResult.ok();
} else {
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
+
+import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossBaseOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev170418.CalculateSpanlossCurrentInput;
@Override public ListenableFuture<RpcResult<ServicePowerSetupOutput>> servicePowerSetup(
ServicePowerSetupInput input) {
- return RpcResultBuilder.success(new ServicePowerSetupOutputBuilder().build()).buildFuture();
+ return RpcResultBuilder.success(new ServicePowerSetupOutputBuilder()
+ .setResult(ResponseCodes.SUCCESS_RESULT).build()).buildFuture();
}
}
return result.build();
}
- private static Exclude updateExclude(Exclude hard, Exclude soft) throws NullPointerException {
+ private static Exclude updateExclude(Exclude hard, Exclude soft) {
ExcludeBuilder result = new ExcludeBuilder(soft);
if (hard != null) {
result.getFiberBundle().addAll(hard.getFiberBundle());
return result.build();
}
- private static Diversity updateDiveristy(Diversity hard, Diversity soft) throws NullPointerException {
+ private static Diversity updateDiveristy(Diversity hard, Diversity soft) {
DiversityBuilder result = new DiversityBuilder(soft);
if (hard != null) {
result.getExistingService().addAll(hard.getExistingService());
.or.general.co.routing.CoRouting updateCoCoRouting(org.opendaylight.yang.gen.v1.http.org.openroadm.routing
.constrains.rev161014.constraints.co.routing.or.general.co.routing.CoRouting hard, org.opendaylight
.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014.constraints.co.routing.or.general.co
- .routing.CoRouting soft) throws NullPointerException {
+ .routing.CoRouting soft) {
org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014.constraints.co.routing.or.general
.co.routing.CoRoutingBuilder result = new org.opendaylight.yang.gen.v1.http.org.openroadm.routing
.constrains.rev161014.constraints.co.routing.or.general.co.routing.CoRoutingBuilder(soft);
*/
public void serviceToServicePathConstarints() {
LOG.info("Mapping Service Constraints to ServicePath Constraints");
- //CoRoutingOrGeneral coRoutingOrGeneral = null;
if (serviceHardConstraints != null) {
- /*HardConstraintsBuilder tempHard = new HardConstraintsBuilder();
- coRoutingOrGeneral = serviceHardConstraints.getCoRoutingOrGeneral();
- General tmpGeneral = null;
- CoRouting tmpCoRouting = null;
- if (coRoutingOrGeneral != null) {
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.GeneralBuilder finalGeneral =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.GeneralBuilder();
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.CoRoutingBuilder finalCoRouting =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.CoRoutingBuilder();
- if (coRoutingOrGeneral instanceof General) {
- tmpGeneral = (General) coRoutingOrGeneral;
- if (tmpGeneral != null) {
- Diversity tmpDiversity = tmpGeneral.getDiversity();
- if (tmpDiversity != null) {
- finalGeneral.setDiversity(
- new DiversityBuilder()
- .setExistingService(tmpDiversity.getExistingService())
- .setExistingServiceApplicability(
- new ExistingServiceApplicabilityBuilder()
- .setClli(tmpDiversity.getExistingServiceApplicability().isSite())
- .setNode(tmpDiversity.getExistingServiceApplicability().isNode())
- .setSrlg(tmpDiversity.getExistingServiceApplicability().isSrlg())
- .build())
- .build());
- }
- Exclude tmpExclude = tmpGeneral.getExclude();
- if (tmpExclude != null) {
- finalGeneral.setExclude(
- new ExcludeBuilder()
- .setSupportingServiceName(tmpExclude.getSupportingServiceName())
- .setClli(tmpExclude.getSite())
- .setNodeId(tmpExclude.getNodeId())
- //.setAffinity(value)
- //.setSRLG(value)
- .build());
- }
- Include tmpInclude = tmpGeneral.getInclude();
- if (tmpInclude != null) {
- finalGeneral.setInclude(
- new IncludeBuilder()
- //.setOrderedHops()
- .build());
- }
- Latency tmpLatency = tmpGeneral.getLatency();
- if (tmpLatency != null) {
- finalGeneral.setLatency(
- new LatencyBuilder()
- .setMaxLatency(tmpLatency.getMaxLatency())
- .build());
- }
- }
- tempHard
- .setCoRoutingOrGeneral(finalGeneral.build())
- .setCustomerCode(serviceHardConstraints.getCustomerCode());
- } else if (coRoutingOrGeneral instanceof CoRouting) {
- tmpCoRouting = (CoRouting)coRoutingOrGeneral;
- if (tmpCoRouting != null) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014
- .constraints.co.routing.or.general.co.routing.CoRouting tmpCoRoutingCoRouting =
- tmpCoRouting.getCoRouting();
- if (tmpCoRoutingCoRouting != null) {
- finalCoRouting.setCoRouting(
- new CoRoutingBuilder()
- .setExistingService(tmpCoRoutingCoRouting.getExistingService())
- .build());
- }
- }
- tempHard
- .setCoRoutingOrGeneral(finalCoRouting.build())
- .setCustomerCode(serviceHardConstraints.getCustomerCode());
-
- }
- }
- servicePathHardConstraints = tempHard.build();*/
-
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
.rev171017.routing.constraints.sp.HardConstraints tempHard = (org.opendaylight.yang.gen
.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing
servicePathHardConstraints = tempHard;
}
} else if (serviceSoftConstraints != null) {
- /*oftConstraintsBuilder tempSoft = new SoftConstraintsBuilder();
- coRoutingOrGeneral = serviceSoftConstraints.getCoRoutingOrGeneral();
- General tmpGeneral = null;
- CoRouting tmpCoRouting = null;
- if (coRoutingOrGeneral != null) {
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.GeneralBuilder finalGeneral =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.GeneralBuilder();
- org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.CoRoutingBuilder finalCoRouting =
- new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
- .rev171017.constraints.sp.co.routing.or.general.CoRoutingBuilder();
- if (coRoutingOrGeneral instanceof General) {
- tmpGeneral = (General) coRoutingOrGeneral;
- if (tmpGeneral != null) {
- Diversity tmpDiversity = tmpGeneral.getDiversity();
- if (tmpDiversity != null) {
- finalGeneral.setDiversity(
- new DiversityBuilder()
- .setExistingService(tmpDiversity.getExistingService())
- .setExistingServiceApplicability(
- new ExistingServiceApplicabilityBuilder()
- .setClli(tmpDiversity.getExistingServiceApplicability().isSite())
- .setNode(tmpDiversity.getExistingServiceApplicability().isNode())
- .setSrlg(tmpDiversity.getExistingServiceApplicability().isSrlg())
- .build())
- .build());
- }
- Exclude tmpExclude = tmpGeneral.getExclude();
- if (tmpExclude != null) {
- finalGeneral.setExclude(
- new ExcludeBuilder()
- .setSupportingServiceName(tmpExclude.getSupportingServiceName())
- .setClli(tmpExclude.getSite())
- .setNodeId(tmpExclude.getNodeId())
- //.setAffinity(value)
- //.setSRLG(value)
- .build());
- }
- Include tmpInclude = tmpGeneral.getInclude();
- if (tmpInclude != null) {
- finalGeneral.setInclude(
- new IncludeBuilder()
- //.setOrderedHops()
- .build());
- }
- Latency tmpLatency = tmpGeneral.getLatency();
- if (tmpLatency != null) {
- finalGeneral.setLatency(
- new LatencyBuilder()
- .setMaxLatency(tmpLatency.getMaxLatency())
- .build());
- }
- }
- tempSoft
- .setCoRoutingOrGeneral(finalGeneral.build())
- .setCustomerCode(serviceSoftConstraints.getCustomerCode());
- } else if (coRoutingOrGeneral instanceof CoRouting) {
- tmpCoRouting = (CoRouting)coRoutingOrGeneral;
- if (tmpCoRouting != null) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014
- .constraints.co.routing.or.general.co.routing.CoRouting tmpCoRoutingCoRouting =
- tmpCoRouting.getCoRouting();
- if (tmpCoRoutingCoRouting != null) {
- finalCoRouting.setCoRouting(
- new CoRoutingBuilder()
- .setExistingService(tmpCoRoutingCoRouting.getExistingService())
- .build());
- }
- }
- tempSoft
- .setCoRoutingOrGeneral(finalCoRouting.build())
- .setCustomerCode(serviceSoftConstraints.getCustomerCode());
-
- }
- }
- servicePathSoftConstraints = tempSoft.build();*/
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
.rev171017.routing.constraints.sp.SoftConstraints tempSoft = (org.opendaylight.yang.gen
.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public final class ModelMappingUtils {
- private static final Logger LOG = LoggerFactory.getLogger(ModelMappingUtils.class);
private ModelMappingUtils() {
}
*/
package org.opendaylight.transportpce.servicehandler.impl;
+import static org.mockito.ArgumentMatchers.any;
+
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.*;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfoBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-
-import static org.mockito.ArgumentMatchers.any;
-
public class ServicehandlerImplTest extends AbstractTest {
@Mock
@Test
public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
- ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
- ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
+ ListenableFuture<RpcResult<ServiceCreateOutput>> result =
+ servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
result.addListener(new Runnable() {
@Override
public void run() {
endSignal.await();
RpcResult<ServiceCreateOutput> rpcResult = result.get();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful() throws ExecutionException, InterruptedException {
+ public void createServiceShouldBeSuccessfulWhenPreformPCESuccessful()
+ throws ExecutionException, InterruptedException {
ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
- ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(input);
result.addListener(new Runnable() {
endSignal.await();
RpcResult<ServiceCreateOutput> rpcResult = result.get();
- Assert.assertEquals(ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
- ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
- ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
+ ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
+ servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
result.addListener(new Runnable() {
@Override
endSignal.await();
RpcResult<ServiceDeleteOutput> rpcResult = result.get();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
- ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
result.addListener(new Runnable() {
endSignal.await();
RpcResult<ServiceDeleteOutput> rpcResult = result.get();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
DataBroker dataBroker = getNewDataBroker();
Mockito.when(rendererServiceOperations.serviceDelete(any())).thenReturn(Futures.immediateFuture(any()));
- ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
+ ServicehandlerImpl servicehandlerImpl =
+ new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, null);
ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
endSignal.await();
RpcResult<ServiceDeleteOutput> rpcResult = result.get();
- Assert.assertEquals(ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ Assert.assertEquals(
+ ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
}
}