revision-date 2017-09-07;
}
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix ietf-network-topology;
revision-date 2015-06-08;
}
package org.opendaylight.transportpce.common.mapping;
import com.google.common.util.concurrent.CheckedFuture;
-
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
private Mapping createMappingObject(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint) {
MappingBuilder mpBldr = new MappingBuilder();
- mpBldr.setKey(new MappingKey(logicalConnectionPoint)).setLogicalConnectionPoint(logicalConnectionPoint)
+ mpBldr.withKey(new MappingKey(logicalConnectionPoint)).setLogicalConnectionPoint(logicalConnectionPoint)
.setSupportingCircuitPackName(circuitPackName).setSupportingPort(port.getPortName());
// Get OMS and OTS interface provisioned on the TTP's
}
private static CpToDegree createCpToDegreeObject(String circuitPackName, String degreeNumber) {
- return new CpToDegreeBuilder().setKey(new CpToDegreeKey(circuitPackName)).setCircuitPackName(circuitPackName)
+ return new CpToDegreeBuilder().withKey(new CpToDegreeKey(circuitPackName)).setCircuitPackName(circuitPackName)
.setDegreeNumber(new Long(degreeNumber)).build();
}
private boolean postPortMapping(Info deviceInfo, List<Mapping> portMapList, Integer nodeType,
List<CpToDegree> cp2DegreeList) {
NodesBuilder nodesBldr = new NodesBuilder();
- nodesBldr.setKey(new NodesKey(deviceInfo.getNodeId())).setNodeId(deviceInfo.getNodeId());
+ nodesBldr.withKey(new NodesKey(deviceInfo.getNodeId())).setNodeId(deviceInfo.getNodeId());
nodesBldr.setNodeType(NodeTypes.forValue(nodeType));
if (portMapList != null) {
package org.opendaylight.transportpce.common.openroadminterfaces;
import com.google.common.util.concurrent.ListenableFuture;
-
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.device.DeviceTransaction;
// State admin state to out of service
InterfaceBuilder ifBuilder = new InterfaceBuilder(intf2Delete);
if (ifBuilder.getType() == OtnOdu.class) {
- Interface1Builder oduBuilder = new Interface1Builder(intf2Delete.getAugmentation(Interface1.class));
+ Interface1Builder oduBuilder = new Interface1Builder(intf2Delete.augmentation(Interface1.class));
OduBuilder odu = new OduBuilder(oduBuilder.getOdu());
if (odu.getMaintTestsignal() != null) {
MaintTestsignalBuilder maintSignalBuilder =
.interfaces.rev161014.Interface1Builder otuBuilder =
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu
.interfaces.rev161014.Interface1Builder(intf2Delete
- .getAugmentation(org.opendaylight.yang.gen.v1
+ .augmentation(org.opendaylight.yang.gen.v1
.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class));
OtuBuilder otu = new OtuBuilder(otuBuilder.getOtu());
if (otu.getMaintLoopback() != null) {
<classifier>features</classifier>
<type>xml</type>
</dependency>
- <dependency>
+ <!-- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>odl-transportpce-inventory</artifactId>
<version>${project.version}</version>
<classifier>features</classifier>
<type>xml</type>
- </dependency>
+ </dependency> -->
</dependencies>
</project>
<mdsal.version>1.8.0-SNAPSHOT</mdsal.version>
<yangtools.version>2.0.7</yangtools.version>
<netconf.version>1.5.0-SNAPSHOT</netconf.version>
+ <restconf.version>1.8.0-SNAPSHOT</restconf.version>
<configfile.directory>etc/opendaylight/karaf</configfile.directory>
</properties>
<name>OpenDaylight :: transportpce</name>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>odl-restconf-all</artifactId>
+ <version>${restconf.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>odl-mdsal-broker</artifactId>
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
import com.google.common.io.Files;
-
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
-
import org.apache.karaf.scheduler.Job;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
@Override
public void run() {
- LOG.info("Running periodical device backup into {}", folder);
+ LOG.info("Running periodical device backup into {}", this.folder);
try {
backupAllDevices();
} catch (InterruptedException | ExecutionException e) {
* @return the folder
*/
public String getFolder() {
- return folder;
+ return this.folder;
}
/**
* @return the filePrefix
*/
public String getFilePrefix() {
- return filePrefix;
+ return this.filePrefix;
}
/**
* @throws ExecutionException execution exception
*/
private void backupAllDevices() throws InterruptedException, ExecutionException {
- ReadOnlyTransaction newReadOnlyTransaction = dataBroker.newReadOnlyTransaction();
+ ReadOnlyTransaction newReadOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
Optional<Topology> topology = newReadOnlyTransaction
.read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifiers.NETCONF_TOPOLOGY_II).get().toJavaUtil();
if (!topology.isPresent()) {
private void storeRoadmDevice(String nodeId) {
InstanceIdentifier<OrgOpenroadmDevice> deviceIi = InstanceIdentifier.create(OrgOpenroadmDevice.class);
Optional<OrgOpenroadmDevice> deviceObject =
- deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIi,
+ this.deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIi,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (!deviceObject.isPresent()) {
LOG.warn("Device object {} is not present.", nodeId);
}
String prepareFileName = prepareFileName(nodeId);
- File parent = new File(folder);
+ File parent = new File(this.folder);
if (!parent.exists() && !parent.isDirectory() && !parent.mkdirs()) {
- LOG.error("Could not create empty directory {}", folder);
- throw new IllegalStateException(String.format("Could not create empty directory %s", folder));
+ LOG.error("Could not create empty directory {}", this.folder);
+ throw new IllegalStateException(String.format("Could not create empty directory %s", this.folder));
}
- File file = new File(parent, filePrefix.concat(prepareFileName));
+ File file = new File(parent, this.filePrefix.concat(prepareFileName));
if (file.exists()) {
throw new IllegalStateException(String.format("The file %s already exists", file));
}
}
private String prepareFileName(String nodeId) {
- String format = filenameFormatter.format(new Date());
+ String format = this.filenameFormatter.format(new Date());
StringBuilder sb = new StringBuilder(format);
sb.append("__").append(nodeId).append("__").append(".xml");
return sb.toString();
LOG.trace("The node is null");
return "";
}
- NetconfNode netconfNode = node.getAugmentation(NetconfNode.class);
+ NetconfNode netconfNode = node.augmentation(NetconfNode.class);
if (netconfNode == null) {
LOG.trace("The node {} has not properties of NetconfNode", node);
return "";
}
- if (netconfNode.getAvailableCapabilities() == null
- || netconfNode.getAvailableCapabilities().getAvailableCapability() == null) {
+ if ((netconfNode.getAvailableCapabilities() == null)
+ || (netconfNode.getAvailableCapabilities().getAvailableCapability() == null)) {
LOG.trace("No available capabilities");
return "";
}
long count = netconfNode.getAvailableCapabilities().getAvailableCapability().stream()
- .filter(cp -> cp.getCapability() != null && cp.getCapability().contains(ORG_OPENROADM_DEVICE)).count();
+ .filter(cp -> (cp.getCapability() != null) && cp.getCapability().contains(ORG_OPENROADM_DEVICE)).count();
if (count < 1) {
LOG.trace("The node {} has not capabilities of OpenROADMDevice", node);
return "";
}
- if (node.getKey() == null || node.getKey().getNodeId() == null) {
+ if ((node.key() == null) || (node.key().getNodeId() == null)) {
LOG.trace("Node {} has invalid key", node);
return "";
}
- if ("controller-config".equalsIgnoreCase(node.getKey().getNodeId().getValue())) {
+ if ("controller-config".equalsIgnoreCase(node.key().getNodeId().getValue())) {
LOG.info("Got controller-config instead of roadm-node");
return "";
}
- return node.getKey().getNodeId().getValue();
+ return node.key().getNodeId().getValue();
}
}
public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
List<DataTreeModification<Node>> changesWithoutDefaultNetconfNode = getRealDevicesOnly(changes);
for (DataTreeModification<Node> device : changesWithoutDefaultNetconfNode) {
- String nodeId = device.getRootNode().getDataAfter().getKey().getNodeId().getValue();
- NetconfNode netconfNode = device.getRootNode().getDataAfter().getAugmentation(NetconfNode.class);
+ String nodeId = device.getRootNode().getDataAfter().key().getNodeId().getValue();
+ NetconfNode netconfNode = device.getRootNode().getDataAfter().augmentation(NetconfNode.class);
if (isCreate(device) || isUpdate(device)) {
LOG.info("Node {} was modified", nodeId);
try {
return;
}
if (ConnectionStatus.Connected.equals(connectionStatus)) {
- deviceInventory.initializeDevice(nodeId);
+ this.deviceInventory.initializeDevice(nodeId);
} else if (ConnectionStatus.Connecting.equals(connectionStatus)
|| ConnectionStatus.UnableToConnect.equals(connectionStatus)) {
LOG.info("The device is in {} state", connectionStatus);
*/
private static List<DataTreeModification<Node>> getRealDevicesOnly(Collection<DataTreeModification<Node>> changes) {
return changes.stream()
- .filter(change -> (change.getRootNode().getDataAfter() != null
+ .filter(change -> ((change.getRootNode().getDataAfter() != null)
&& !StringConstants.DEFAULT_NETCONF_NODEID
- .equalsIgnoreCase(change.getRootNode().getDataAfter().getKey().getNodeId().getValue())
- && change.getRootNode().getDataAfter().getAugmentation(NetconfNode.class) != null)
- || (change.getRootNode().getDataBefore() != null
+ .equalsIgnoreCase(change.getRootNode().getDataAfter().key().getNodeId().getValue())
+ && (change.getRootNode().getDataAfter().augmentation(NetconfNode.class) != null))
+ || ((change.getRootNode().getDataBefore() != null)
&& !StringConstants.DEFAULT_NETCONF_NODEID.equalsIgnoreCase(
- change.getRootNode().getDataBefore().getKey().getNodeId().getValue())
- && change.getRootNode().getDataBefore().getAugmentation(NetconfNode.class) != null
+ change.getRootNode().getDataBefore().key().getNodeId().getValue())
+ && (change.getRootNode().getDataBefore().augmentation(NetconfNode.class) != null)
)).collect(Collectors.toList());
}
* @return boolean true if the change is a new write
*/
private static boolean isCreate(DataTreeModification<Node> change) {
- return change.getRootNode().getDataBefore() == null && change.getRootNode().getDataAfter() != null
+ return (change.getRootNode().getDataBefore() == null) && (change.getRootNode().getDataAfter() != null)
&& ModificationType.WRITE.equals(change.getRootNode().getModificationType());
}
* @return boolean true if the node was deleted
*/
private static boolean isDelete(DataTreeModification<Node> change) {
- return change.getRootNode().getDataBefore() != null && change.getRootNode().getDataAfter() == null
+ return (change.getRootNode().getDataBefore() != null) && (change.getRootNode().getDataAfter() == null)
&& ModificationType.DELETE.equals(change.getRootNode().getModificationType());
}
}
}
if (rootNode.getModificationType() == ModificationType.DELETE) {
if (rootNode.getDataBefore() != null) {
- String nodeId = rootNode.getDataBefore().getKey().getNodeId().getValue();
+ String nodeId = rootNode.getDataBefore().key().getNodeId().getValue();
LOG.info("Node {} deleted", nodeId);
this.networkModelService.deleteOpenROADMnode(nodeId);
onDeviceDisConnected(nodeId);
}
continue;
}
- String nodeId = rootNode.getDataAfter().getKey().getNodeId().getValue();
- NetconfNode netconfNode = rootNode.getDataAfter().getAugmentation(NetconfNode.class);
+ String nodeId = rootNode.getDataAfter().key().getNodeId().getValue();
+ NetconfNode netconfNode = rootNode.getDataAfter().augmentation(NetconfNode.class);
if ((netconfNode != null) && !StringConstants.DEFAULT_NETCONF_NODEID.equals(nodeId)) {
switch (rootNode.getModificationType()) {
package org.opendaylight.transportpce.networkmodel;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
}
@Override
- public Future<RpcResult<DeleteLinkOutput>> deleteLink(DeleteLinkInput input) {
+ public ListenableFuture<RpcResult<DeleteLinkOutput>> deleteLink(DeleteLinkInput input) {
LinkId linkId = new LinkId(input.getLinkId());
// Building link instance identifier
}
}
- public Future<RpcResult<InitRoadmNodesOutput>> initRoadmNodes(InitRoadmNodesInput input) {
+ public ListenableFuture<RpcResult<InitRoadmNodesOutput>> initRoadmNodes(InitRoadmNodesInput input) {
boolean createRdmLinks = OrdLink.createRdm2RdmLinks(input,
- openRoadmTopology, dataBroker);
+ this.openRoadmTopology,this.dataBroker);
if (createRdmLinks) {
return RpcResultBuilder
.success(new InitRoadmNodesOutputBuilder().setResult(
}
@Override
- public Future<RpcResult<InitXpdrRdmLinksOutput>> initXpdrRdmLinks(InitXpdrRdmLinksInput input) {
+ public ListenableFuture<RpcResult<InitXpdrRdmLinksOutput>> initXpdrRdmLinks(InitXpdrRdmLinksInput input) {
// Assigns user provided input in init-network-view RPC to nodeId
boolean createXpdrRdmLinks = Rdm2XpdrLink.createXpdrRdmLinks(input.getLinksInput(),
- openRoadmTopology, dataBroker);
+ this.openRoadmTopology,this.dataBroker);
if (createXpdrRdmLinks) {
return RpcResultBuilder
.success(new InitXpdrRdmLinksOutputBuilder().setResult("Xponder Roadm Link created successfully"))
}
}
- public Future<RpcResult<InitRdmXpdrLinksOutput>> initRdmXpdrLinks(InitRdmXpdrLinksInput input) {
+ @Override
+ public ListenableFuture<RpcResult<InitRdmXpdrLinksOutput>> initRdmXpdrLinks(InitRdmXpdrLinksInput input) {
boolean createRdmXpdrLinks = Rdm2XpdrLink.createRdmXpdrLinks(input.getLinksInput(),
- openRoadmTopology, dataBroker);
+ this.openRoadmTopology,this.dataBroker);
if (createRdmXpdrLinks) {
return RpcResultBuilder
.success(new InitRdmXpdrLinksOutputBuilder().setResult("Roadm Xponder links created successfully"))
import java.util.Optional;
import java.util.concurrent.ExecutionException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.MountPoint;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
Optional<Protocols> protocolObject = this.deviceTransactionManager.getDataFromDevice(nodeId.getValue(),
LogicalDatastoreType.OPERATIONAL, protocolsIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (!protocolObject.isPresent() || (protocolObject.get().getAugmentation(Protocols1.class) == null)) {
+ if (!protocolObject.isPresent() || (protocolObject.get().augmentation(Protocols1.class) == null)) {
LOG.warn("LLDP subtree is missing : isolated openroadm device");
return false;
}
- NbrList nbrList = protocolObject.get().getAugmentation(Protocols1.class).getLldp().getNbrList();
+ NbrList nbrList = protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList();
LOG.info("LLDP subtree is present. Device has {} neighbours", nbrList.getIfName().size());
for (IfName ifName : nbrList.getIfName()) {
if (ifName.getRemoteSysName() == null) {
r2rlinkBuilderAToZ.setRdmANode(nodeId.getValue()).setDegANum(srcDegId.shortValue())
.setTerminationPointA(srcTpTx).setRdmZNode(destNodeId.getValue()).setDegZNum(destDegId.shortValue())
.setTerminationPointZ(destTpRx);
- if (!OrdLink.createRdm2RdmLinks(r2rlinkBuilderAToZ.build(), openRoadmTopology, dataBroker)) {
+ if (!OrdLink.createRdm2RdmLinks(r2rlinkBuilderAToZ.build(), this.openRoadmTopology, this.dataBroker)) {
LOG.error("OMS Link creation failed between node: {} and nodeId: {} in A->Z direction", nodeId.getValue(),
destNodeId.getValue());
return false;
r2rlinkBuilderZToA.setRdmANode(destNodeId.getValue()).setDegANum(destDegId.shortValue())
.setTerminationPointA(destTpTx).setRdmZNode(nodeId.getValue()).setDegZNum(srcDegId.shortValue())
.setTerminationPointZ(srcTpRx);
- if (!OrdLink.createRdm2RdmLinks(r2rlinkBuilderZToA.build(), openRoadmTopology, dataBroker)) {
+ if (!OrdLink.createRdm2RdmLinks(r2rlinkBuilderZToA.build(), this.openRoadmTopology, this.dataBroker)) {
LOG.error("OMS Link creation failed between node: {} and nodeId: {} in Z->A direction",
destNodeId.getValue(), nodeId.getValue());
return false;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.CheckedFuture;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
NetworkId nwId = new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID);
NetworkBuilder nwBuilder = new NetworkBuilder();
nwBuilder.setNetworkId(nwId);
- nwBuilder.setKey(new NetworkKey(nwId));
+ nwBuilder.withKey(new NetworkKey(nwId));
Link1Builder lnk1bldr = new Link1Builder();
LinkBuilder linkBuilder = openRoadmTopology.createLink(srcNode, destNode, srcTp, destTp);
lnk1bldr.setLinkType(isXponderInput ? OpenroadmLinkType.XPONDERINPUT : OpenroadmLinkType.XPONDEROUTPUT);
linkBuilder.addAugmentation(Link1.class, lnk1bldr.build());
LOG.info("Link id in the linkbldr {}", linkBuilder.getLinkId());
- LOG.info("Link with oppo link {}", linkBuilder.getAugmentation(Link1.class));
+ LOG.info("Link with oppo link {}", linkBuilder.augmentation(Link1.class));
Network1Builder nwBldr1 = new Network1Builder();
nwBldr1.setLink(ImmutableList.of(linkBuilder.build()));
nwBuilder.addAugmentation(Network1.class, nwBldr1.build());
import java.util.HashMap;
import java.util.concurrent.ExecutionException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
LOG.info("creating node in {}", NetworkUtils.CLLI_NETWORK_ID);
InstanceIdentifier<Node> iiClliNode = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.CLLI_NETWORK_ID)))
- .child(Node.class, clliNode.getKey())
+ .child(Node.class, clliNode.key())
.build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, iiClliNode, clliNode,
CREATE_MISSING_PARENTS);
LOG.info("creating node in {}", NetworkUtils.UNDERLAY_NETWORK_ID);
InstanceIdentifier<Node> iiOpenRoadmNode = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID)))
- .child(Node.class, openRoadmNode.getKey())
+ .child(Node.class, openRoadmNode.key())
.build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, iiOpenRoadmNode, openRoadmNode,
CREATE_MISSING_PARENTS);
NetworkUtils.OVERLAY_NETWORK_ID);
InstanceIdentifier<Node> iiOpenRoadmTopologyNode = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
- .child(Node.class, openRoadmTopologyNode.getKey())
+ .child(Node.class, openRoadmTopologyNode.key())
.build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, iiOpenRoadmTopologyNode,
openRoadmTopologyNode, CREATE_MISSING_PARENTS);
InstanceIdentifier<Link> iiOpenRoadmTopologyLink = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
.augmentation(Network1.class)
- .child(Link.class, openRoadmTopologyLink.getKey())
+ .child(Link.class, openRoadmTopologyLink.key())
.build();
writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, iiOpenRoadmTopologyLink,
openRoadmTopologyLink, CREATE_MISSING_PARENTS);
NetworkUtils.OVERLAY_NETWORK_ID);
InstanceIdentifier<Node> iiOpenRoadmTopologyNode = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
- .child(Node.class, openRoadmTopologyNode.getKey())
+ .child(Node.class, openRoadmTopologyNode.key())
.build();
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, iiOpenRoadmTopologyNode);
}
InstanceIdentifier<Link> iiOpenRoadmTopologyLink = InstanceIdentifier
.builder(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
.augmentation(Network1.class)
- .child(Link.class, openRoadmTopologyLink.getKey())
+ .child(Link.class, openRoadmTopologyLink.key())
.build();
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, iiOpenRoadmTopologyLink);
}
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
NodeBuilder nodeBldr = new NodeBuilder();
NodeId nwNodeId = new NodeId(clli);
nodeBldr.setNodeId(nwNodeId);
- nodeBldr.setKey(new NodeKey(nwNodeId));
+ nodeBldr.withKey(new NodeKey(nwNodeId));
/*
* create clli node augmentation
* defined in openroadm-clli-network.yang
NetworkBuilder nwBuilder = new NetworkBuilder();
NetworkId nwId = new NetworkId(NetworkUtils.CLLI_NETWORK_ID);
nwBuilder.setNetworkId(nwId);
- nwBuilder.setKey(new NetworkKey(nwId));
+ nwBuilder.withKey(new NetworkKey(nwId));
//set network type to clli
NetworkTypes1Builder clliNetworkTypesBldr = new NetworkTypes1Builder();
clliNetworkTypesBldr.setClliNetwork(new ClliNetworkBuilder().build());
package org.opendaylight.transportpce.networkmodel.util;
import com.google.common.collect.ImmutableList;
-
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
NodeBuilder nodeBldr = new NodeBuilder();
NodeId nwNodeId = new NodeId(nodeId);
nodeBldr.setNodeId(nwNodeId);
- nodeBldr.setKey(new NodeKey(nwNodeId));
+ nodeBldr.withKey(new NodeKey(nwNodeId));
Node1Builder node1bldr = new Node1Builder();
/*
// attribute
String clli = deviceInfo.getClli();
SupportingNodeBuilder supportbldr = new SupportingNodeBuilder();
- supportbldr.setKey(new SupportingNodeKey(new NetworkId(NetworkUtils.CLLI_NETWORK_ID), new NodeId(clli)));
+ supportbldr.withKey(new SupportingNodeKey(new NetworkId(NetworkUtils.CLLI_NETWORK_ID), new NodeId(clli)));
supportbldr.setNetworkRef(new NetworkId(NetworkUtils.CLLI_NETWORK_ID));
supportbldr.setNodeRef(new NodeId(clli));
nodeBldr.setSupportingNode(ImmutableList.of(supportbldr.build()));
NetworkBuilder openrdmnwBuilder = new NetworkBuilder();
NetworkId nwId = new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID);
openrdmnwBuilder.setNetworkId(nwId);
- openrdmnwBuilder.setKey(new NetworkKey(nwId));
+ openrdmnwBuilder.withKey(new NetworkKey(nwId));
// sets network type to OpenRoadmNetwork
NetworkTypes1Builder openRoadmNetworkTypesBldr = new NetworkTypes1Builder();
openRoadmNetworkTypesBldr.setOpenroadmNetwork(new OpenroadmNetworkBuilder().build());
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
NetworkBuilder nwBuilder = new NetworkBuilder();
NetworkId nwId = new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID);
nwBuilder.setNetworkId(nwId);
- nwBuilder.setKey(new NetworkKey(nwId));
+ nwBuilder.withKey(new NetworkKey(nwId));
// set network type to Transport Underlay
NetworkTypes1Builder topoNetworkTypesBldr = new NetworkTypes1Builder();
topoNetworkTypesBldr.setOpenroadmTopology(new OpenroadmTopologyBuilder().build());
String nodeIdtopo = new StringBuilder().append(nodeId).append("-XPDR1").toString();
// Ad degree node specific augmentation
nodebldr.setNodeId(new NodeId(nodeIdtopo));
- nodebldr.setKey(new NodeKey(new NodeId(nodeIdtopo)));
+ nodebldr.withKey(new NodeKey(new NodeId(nodeIdtopo)));
nodebldr.addAugmentation(Node1.class, node1bldr.build());
while (clientCounter != 0) {
// Create CLNT-TX termination
// Sets the value of Network-ref and Node-ref as a part of the supporting node
// attribute
SupportingNodeBuilder supportbldr = new SupportingNodeBuilder();
- supportbldr.setKey(new SupportingNodeKey(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID), new NodeId(nodeId)));
+ supportbldr.withKey(new SupportingNodeKey(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID), new NodeId(nodeId)));
supportbldr.setNetworkRef(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID));
supportbldr.setNodeRef(new NodeId(nodeId));
ArrayList<SupportingNode> supportlist = new ArrayList<>();
TerminationPointBuilder tpBldr = new TerminationPointBuilder();
TpId tp = new TpId(tpId);
TerminationPointKey tpKey = new TerminationPointKey(tp);
- tpBldr.setKey(tpKey);
+ tpBldr.withKey(tpKey);
tpBldr.setTpId(tp);
return tpBldr;
}
lnkBldr.setDestination(dstNodeBldr.build());
lnkBldr.setSource(srcNodeBldr.build());
lnkBldr.setLinkId(LinkIdUtil.buildLinkId(srcNode, srcTp, dstNode, destTp));
- lnkBldr.setKey(new LinkKey(lnkBldr.getLinkId()));
+ lnkBldr.withKey(new LinkKey(lnkBldr.getLinkId()));
org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1Builder lnk1Bldr =
new org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1Builder();
LinkId oppositeLinkId = LinkIdUtil.getOppositeLinkId(srcNode, srcTp, dstNode, destTp);
for (int i = 1; i < 97; i++) {
AvailableWavelengthsBuilder avalBldr = new AvailableWavelengthsBuilder();
avalBldr.setIndex((long) i);
- avalBldr.setKey(new AvailableWavelengthsKey((long) i));
+ avalBldr.withKey(new AvailableWavelengthsKey((long) i));
waveList.add(avalBldr.build());
}
new org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
.AvailableWavelengthsBuilder();
avalBldr.setIndex((long) i);
- avalBldr.setKey(
+ avalBldr.withKey(
new org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
.AvailableWavelengthsKey((long) i));
waveList.add(avalBldr.build());
*/
package org.opendaylight.transportpce.olm;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.olm.service.OlmPowerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseOutput;
* @return Result of the request
*/
@Override
- public Future<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
- return RpcResultBuilder.success(olmPowerService.getPm(input)).buildFuture();
+ public ListenableFuture<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
+ return RpcResultBuilder.success(this.olmPowerService.getPm(input)).buildFuture();
}
/**
* @return Result of the request
*/
@Override
- public Future<org.opendaylight.yangtools.yang.common.RpcResult<ServicePowerSetupOutput>> servicePowerSetup(
+ public ListenableFuture<RpcResult<ServicePowerSetupOutput>> servicePowerSetup(
ServicePowerSetupInput input) {
- return RpcResultBuilder.success(olmPowerService.servicePowerSetup(input)).buildFuture();
+ return RpcResultBuilder.success(this.olmPowerService.servicePowerSetup(input)).buildFuture();
}
/**
* @return Result of the request
*/
@Override
- public Future<RpcResult<ServicePowerTurndownOutput>> servicePowerTurndown(ServicePowerTurndownInput input) {
- return RpcResultBuilder.success(olmPowerService.servicePowerTurndown(input)).buildFuture();
+ public ListenableFuture<RpcResult<ServicePowerTurndownOutput>> servicePowerTurndown(ServicePowerTurndownInput input) {
+ return RpcResultBuilder.success(this.olmPowerService.servicePowerTurndown(input)).buildFuture();
}
/**
* @return Result of the request
*/
@Override
- public Future<RpcResult<CalculateSpanlossBaseOutput>> calculateSpanlossBase(CalculateSpanlossBaseInput input) {
- return RpcResultBuilder.success(olmPowerService.calculateSpanlossBase(input)).buildFuture();
+ public ListenableFuture<RpcResult<CalculateSpanlossBaseOutput>> calculateSpanlossBase(CalculateSpanlossBaseInput input) {
+ return RpcResultBuilder.success(this.olmPowerService.calculateSpanlossBase(input)).buildFuture();
}
@Override
- public Future<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
+ public ListenableFuture<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
CalculateSpanlossCurrentInput input) {
- return RpcResultBuilder.success(olmPowerService.calculateSpanlossCurrent(input)).buildFuture();
+ return RpcResultBuilder.success(this.olmPowerService.calculateSpanlossCurrent(input)).buildFuture();
}
@Override
- public Future<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
- return RpcResultBuilder.success(olmPowerService.servicePowerReset(input)).buildFuture();
+ public ListenableFuture<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
+ return RpcResultBuilder.success(this.olmPowerService.servicePowerReset(input)).buildFuture();
}
}
\ No newline at end of file
package org.opendaylight.transportpce.olm.power;
import com.google.common.util.concurrent.ListenableFuture;
-
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.transportpce.common.Timeouts;
String nodeId = input.getNodes().get(i).getNodeId();
String srcTpId = input.getNodes().get(i).getSrcTp();
String destTpId = input.getNodes().get(i).getDestTp();
- Optional<Nodes> inputNodeOptional = OlmUtils.getNode(nodeId, db);
+ Optional<Nodes> inputNodeOptional = OlmUtils.getNode(nodeId, this.db);
// If node type is transponder
if (inputNodeOptional.isPresent()
- && inputNodeOptional.get().getNodeType() != null
+ && (inputNodeOptional.get().getNodeType() != null)
&& inputNodeOptional.get().getNodeType().equals(NodeTypes.Xpdr)) {
Nodes inputNode = inputNodeOptional.get();
LOG.info("Getting data from input node {}", inputNode.getNodeType());
- LOG.info("Getting mapping data for node is {}", inputNode.getMapping().stream().filter(o -> o.getKey()
+ LOG.info("Getting mapping data for node is {}", inputNode.getMapping().stream().filter(o -> o.key()
.equals(new MappingKey(destTpId))).findFirst().toString());
// If its A-End transponder
if (destTpId.toLowerCase().contains("network")) {
- java.util.Optional<Mapping> mappingObject = inputNode.getMapping().stream().filter(o -> o.getKey()
+ java.util.Optional<Mapping> mappingObject = inputNode.getMapping().stream().filter(o -> o.key()
.equals(new MappingKey(destTpId))).findFirst();
if (mappingObject.isPresent()) {
Map<String, Double> txPowerRangeMap = getXponderPowerRange(mappingObject.get()
LOG.info("{} is a drop node. Net power settings needed", nodeId);
}
} else if (inputNodeOptional.isPresent()
- && inputNodeOptional.get().getNodeType() != null
+ && (inputNodeOptional.get().getNodeType() != null)
&& inputNodeOptional.get().getNodeType().equals(NodeTypes.Rdm)) {
// If Degree is transmitting end then set power
Nodes inputNode = inputNodeOptional.get();
String connectionNumber = srcTpId + "-" + destTpId + "-" + input.getWaveNumber();
LOG.info("Connection number is {}", connectionNumber);
if (destTpId.toLowerCase().contains("deg")) {
- Optional<Mapping> mappingObjectOptional = inputNode.getMapping().stream().filter(o -> o.getKey()
+ Optional<Mapping> mappingObjectOptional = inputNode.getMapping().stream().filter(o -> o.key()
.equals(new MappingKey(destTpId))).findFirst();
if (mappingObjectOptional.isPresent()) {
LOG.info("Dest point is Degree {}", mappingObjectOptional.get());
Mapping portMapping = mappingObjectOptional.get();
Optional<Interface> interfaceOpt;
try {
- interfaceOpt = openRoadmInterfaces.getInterface(nodeId, portMapping.getSupportingOts());
+ interfaceOpt = this.openRoadmInterfaces.getInterface(nodeId, portMapping.getSupportingOts());
} catch (OpenRoadmInterfaceException ex) {
LOG.error("Failed to get interface {} from node {}!", portMapping.getSupportingOts(),
nodeId, ex);
return false;
}
if (interfaceOpt.isPresent()) {
- BigDecimal spanLossTx = interfaceOpt.get().getAugmentation(Interface1.class).getOts()
+ BigDecimal spanLossTx = interfaceOpt.get().augmentation(Interface1.class).getOts()
.getSpanLossTransmit().getValue();
LOG.info("Spanloss TX is {}", spanLossTx);
BigDecimal powerValue = BigDecimal.valueOf(Math.min(spanLossTx.doubleValue() - 9, 2));
.child(Interface.class, new InterfaceKey(interfaceName));
Optional<Interface> nodeInterfaceOpt;
try {
- nodeInterfaceOpt = openRoadmInterfaces.getInterface(nodeId, interfaceName);
+ nodeInterfaceOpt = this.openRoadmInterfaces.getInterface(nodeId, interfaceName);
} catch (OpenRoadmInterfaceException ex) {
LOG.error("Failed to get interface {} from node {}!", interfaceName, nodeId, ex);
return false;
if (nodeInterfaceOpt.isPresent()) {
InterfaceBuilder intfBuilder = new InterfaceBuilder(nodeInterfaceOpt.get());
intfBuilder.setAdministrativeState(AdminStates.OutOfService);
- Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(nodeId);
+ Future<Optional<DeviceTransaction>> deviceTxFuture = this.deviceTransactionManager.getDeviceTransaction(nodeId);
DeviceTransaction deviceTx;
try {
Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.info("Fetching logical Connection Point value for port {} at circuit pack {}", portName, circuitPackName);
Optional<Ports> portObject =
- deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, portIID,
+ this.deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, portIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (portObject.isPresent()) {
Ports port = portObject.get();
private Map<String, Double> getSRGRxPowerRange(String nodeId, String srgId) {
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.info("Coming inside Xpdr power range");
- Optional<Mapping> mappingSRGOptional = OlmUtils.getNode(nodeId, db).flatMap(node -> node.getMapping()
- .stream().filter(o -> o.getKey()
+ Optional<Mapping> mappingSRGOptional = OlmUtils.getNode(nodeId, this.db).flatMap(node -> node.getMapping()
+ .stream().filter(o -> o.key()
.equals(new MappingKey(srgId))).findFirst());
if (mappingSRGOptional.isPresent()) {
LOG.info("Mapping object exists.");
LOG.info("Fetching logical Connection Point value for port {} at circuit pack {}{}", portName,
circuitPackName, portIID);
Optional<Ports> portObject =
- deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, portIID,
+ this.deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, portIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (portObject.isPresent()) {
Ports port = portObject.get();
nodeId, interfaceName);
Optional<Interface> interfaceOptional;
try {
- interfaceOptional = openRoadmInterfaces.getInterface(nodeId, interfaceName);
+ interfaceOptional = this.openRoadmInterfaces.getInterface(nodeId, interfaceName);
} catch (OpenRoadmInterfaceException ex) {
LOG.error("Failed to get interface {} from node {}!", interfaceName, nodeId, ex);
return false;
if (interfaceOptional.isPresent()) {
InterfaceBuilder ochInterfaceBuilder =
new InterfaceBuilder(interfaceOptional.get());
- OchBuilder ochBuilder = new OchBuilder(ochInterfaceBuilder.getAugmentation(
+ OchBuilder ochBuilder = new OchBuilder(ochInterfaceBuilder.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
.Interface1.class).getOch());
ochBuilder.setTransmitPower(new PowerDBm(txPower));
org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
.Interface1.class, new Interface1Builder().setOch(ochBuilder.build()).build());
- Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(nodeId);
+ Future<Optional<DeviceTransaction>> deviceTxFuture = this.deviceTransactionManager.getDeviceTransaction(nodeId);
DeviceTransaction deviceTx;
try {
Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
*/
private boolean setPowerLevel(String deviceId, OpticalControlMode mode, BigDecimal powerValue,
String connectionNumber) {
- Optional<RoadmConnections> rdmConnOpt = crossConnect.getCrossConnect(deviceId, connectionNumber);
+ Optional<RoadmConnections> rdmConnOpt = this.crossConnect.getCrossConnect(deviceId, connectionNumber);
if (rdmConnOpt.isPresent()) {
RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConnOpt.get());
rdmConnBldr.setOpticalControlMode(mode);
RoadmConnections newRdmConn = rdmConnBldr.build();
Future<Optional<DeviceTransaction>> deviceTxFuture =
- deviceTransactionManager.getDeviceTransaction(deviceId);
+ this.deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
try {
Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
import com.google.common.base.Strings;
import com.google.common.util.concurrent.ListenableFuture;
-
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@Override
public GetPmOutput getPm(GetPmInput pmInput) {
- GetPmOutputBuilder pmOutputBuilder = OlmUtils.pmFetch(pmInput, deviceTransactionManager);
+ GetPmOutputBuilder pmOutputBuilder = OlmUtils.pmFetch(pmInput, this.deviceTransactionManager);
return pmOutputBuilder.build();
}
@Override
public ServicePowerSetupOutput servicePowerSetup(ServicePowerSetupInput powerSetupInput) {
ServicePowerSetupOutputBuilder powerSetupOutput = new ServicePowerSetupOutputBuilder();
- boolean successValPowerCalculation = powerMgmt.setPower(powerSetupInput);
+ boolean successValPowerCalculation = this.powerMgmt.setPower(powerSetupInput);
if (successValPowerCalculation) {
powerSetupOutput.setResult(SUCCESS);
ServicePowerTurndownOutputBuilder powerTurnDownOutput = new ServicePowerTurndownOutputBuilder();
// TODO add flag or return failure instead of string
- if (powerMgmt.powerTurnDown(powerTurndownInput)) {
+ if (this.powerMgmt.powerTurnDown(powerTurndownInput)) {
powerTurnDownOutput.setResult(SUCCESS);
} else {
powerTurnDownOutput.setResult(FAILED);
List<RoadmLinks> roadmLinks = new ArrayList<>();
for (Link link : networkLinks) {
- Link1 roadmLinkAugmentation = link.getAugmentation(Link1.class);
+ Link1 roadmLinkAugmentation = link.augmentation(Link1.class);
if (roadmLinkAugmentation == null) {
LOG.debug("Missing OpenRoadm link augmentation in link {} from {} topology.",
link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
}
List<RoadmLinks> roadmLinks = new ArrayList<>();
for (Link link : networkLinks) {
- Link1 roadmLinkAugmentation = link.getAugmentation(Link1.class);
+ Link1 roadmLinkAugmentation = link.augmentation(Link1.class);
if (roadmLinkAugmentation == null) {
LOG.debug("Missing OpenRoadm link augmentation in link {} from {} topology.",
link.getLinkId().getValue(), NetworkUtils.OVERLAY_NETWORK_ID);
.augmentation(Network1.class)
.build();
Optional<Network1> networkOptional;
- try (ReadOnlyTransaction rtx = dataBroker.newReadOnlyTransaction()) {
+ try (ReadOnlyTransaction rtx = this.dataBroker.newReadOnlyTransaction()) {
//TODO change to constant from Timeouts class when it will be merged.
networkOptional = rtx.read(LogicalDatastoreType.CONFIGURATION, networkIID).get(Timeouts.DATASTORE_READ,
TimeUnit.MILLISECONDS).toJavaUtil();
}
List<Link> networkLinks = networkOptional.get().getLink();
- if (networkLinks == null || networkLinks.isEmpty()) {
+ if ((networkLinks == null) || networkLinks.isEmpty()) {
LOG.warn("Links are not present in {} topology.", NetworkUtils.OVERLAY_NETWORK_ID);
return Collections.emptyList();
}
*/
private OtsPmHolder getPmMeasurements(String nodeId, String tpID, String pmName) {
String realNodeId = getRealNodeId(nodeId);
- Mapping mapping = portMapping.getMapping(realNodeId, tpID);
+ Mapping mapping = this.portMapping.getMapping(realNodeId, tpID);
if (mapping == null) {
return null;
}
com.google.common.base.Optional<Interface> interfaceObject;
try {
Future<Optional<DeviceTransaction>> deviceTxFuture =
- deviceTransactionManager.getDeviceTransaction(realNodeId);
+ this.deviceTransactionManager.getDeviceTransaction(realNodeId);
java.util.Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
DeviceTransaction deviceTx;
if (deviceTxOpt.isPresent()) {
Interface intf = interfaceObject.get();
InterfaceBuilder interfaceBuilder = new InterfaceBuilder(intf);
OtsBuilder otsBuilder = new OtsBuilder();
- if (intf.getAugmentation(Interface1.class) != null
- && intf.getAugmentation(Interface1.class).getOts() != null) {
- Ots ots = intf.getAugmentation(Interface1.class).getOts();
+ if ((intf.augmentation(Interface1.class) != null)
+ && (intf.augmentation(Interface1.class).getOts() != null)) {
+ Ots ots = intf.augmentation(Interface1.class).getOts();
otsBuilder.setFiberType(ots.getFiberType());
spanLossRx = ots.getSpanLossReceive();
spanLossTx = ots.getSpanLossTransmit();
.setScale(0, RoundingMode.HALF_UP);
LOG.info("Spanloss Calculated as :" + spanLoss + "=" + srcOtsPmHoler.getOtsParameterVal() + "-"
+ destOtsPmHoler.getOtsParameterVal());
- if (spanLoss.doubleValue() < 28 && spanLoss.doubleValue() > 0) {
+ if ((spanLoss.doubleValue() < 28) && (spanLoss.doubleValue() > 0)) {
if (!setSpanLoss(roadmLinks.get(i).getSrcNodeId(), srcOtsPmHoler.getOtsInterfaceName(), spanLoss,
"TX")) {
LOG.info("Setting spanLoss failed for " + roadmLinks.get(i).getSrcNodeId());
KeyedInstanceIdentifier<Node, NodeKey> mappedNodeII =
InstanceIdentifiers.OVERLAY_NETWORK_II.child(Node.class, new NodeKey(new NodeId(mappedNodeId)));
com.google.common.base.Optional<Node> realNode;
- try (ReadOnlyTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction()) {
+ try (ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction()) {
realNode = readOnlyTransaction.read(LogicalDatastoreType.CONFIGURATION, mappedNodeII).get();
} catch (InterruptedException | ExecutionException e) {
LOG.error(e.getMessage(), e);
throw new IllegalStateException(e);
}
- if (!realNode.isPresent() || realNode.get().getSupportingNode() == null) {
+ if (!realNode.isPresent() || (realNode.get().getSupportingNode() == null)) {
throw new IllegalArgumentException(
String.format("Could not find node %s, or supporting node is not present", mappedNodeId));
}
List<SupportingNode> collect = realNode.get().getSupportingNode().stream()
- .filter(node -> node.getNetworkRef() != null
+ .filter(node -> (node.getNetworkRef() != null)
&& NetworkUtils.UNDERLAY_NETWORK_ID.equals(node.getNetworkRef().getValue())
- && node.getNodeRef() != null && !Strings.isNullOrEmpty(node.getNodeRef().getValue()))
+ && (node.getNodeRef() != null) && !Strings.isNullOrEmpty(node.getNodeRef().getValue()))
.collect(Collectors.toList());
- if (collect.isEmpty() || collect.size() > 1) {
+ if (collect.isEmpty() || (collect.size() > 1)) {
throw new IllegalArgumentException(String.format("Invalid support node count [%d] was found for node %s",
collect.size(), mappedNodeId));
}
--- /dev/null
+module old-ietf-network-topology {\r
+ yang-version 1;\r
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";\r
+ prefix lnk;\r
+\r
+ import ietf-inet-types {\r
+ prefix inet;\r
+ }\r
+ import old-ietf-network {\r
+ prefix nd;\r
+ }\r
+\r
+ organization "TBD";\r
+ contact\r
+ "WILL-BE-DEFINED-LATER";\r
+ description\r
+ "This module defines a common base model for network topology, \r
+ augmenting the base network model with links to connect nodes, \r
+ as well as termination points to terminate links on nodes.";\r
+\r
+ revision 2015-06-08 {\r
+ description\r
+ "Initial revision.";\r
+ reference "draft-ietf-i2rs-yang-network-topo-01";\r
+ }\r
+\r
+ typedef link-id {\r
+ type inet:uri;\r
+ description\r
+ "An identifier for a link in a topology.\r
+ The identifier may be opaque.\r
+ The identifier SHOULD be chosen such that the same link in a\r
+ real network topology will always be identified through the\r
+ same identifier, even if the model is instantiated in \r
+ separate datastores. An implementation MAY choose to capture\r
+ semantics in the identifier, for example to indicate the type\r
+ of link and/or the type of topology that the link is a part \r
+ of.";\r
+ }\r
+\r
+ typedef tp-id {\r
+ type inet:uri;\r
+ description\r
+ "An identifier for termination points on a node.\r
+ The identifier may be opaque.\r
+ The identifier SHOULD be chosen such that the same TP in a\r
+ real network topology will always be identified through the\r
+ same identifier, even if the model is instantiated in\r
+ separate datastores. An implementation MAY choose to capture\r
+ semantics in the identifier, for example to indicate the type\r
+ of TP and/or the type of node and topology that the TP is a \r
+ part of.";\r
+ }\r
+\r
+ grouping link-ref {\r
+ description\r
+ "References a link in a specific network.";\r
+ leaf link-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "nd:network-ref]/link/link-id";\r
+ }\r
+ description\r
+ "A type for an absolute reference a link instance.\r
+ (This type should not be used for relative references.\r
+ In such a case, a relative path should be used instead.)";\r
+ }\r
+ uses nd:network-ref;\r
+ }\r
+\r
+ grouping tp-ref {\r
+ description\r
+ "References a termination point in a specific node.";\r
+ leaf tp-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "nd:network-ref]/nd:node[nd:node-id=current()/../"+\r
+ "nd:node-ref]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "A type for an absolute reference to a termination point.\r
+ (This type should not be used for relative references.\r
+ In such a case, a relative path should be used instead.)";\r
+ }\r
+ uses nd:node-ref;\r
+ }\r
+\r
+ augment "/nd:network" {\r
+ description \r
+ "Add links to the network model.";\r
+ list link {\r
+ key "link-id";\r
+ description\r
+ "A Network Link connects a by Local (Source) node and\r
+ a Remote (Destination) Network Nodes via a set of the\r
+ nodes' termination points.\r
+ As it is possible to have several links between the same\r
+ source and destination nodes, and as a link could\r
+ potentially be re-homed between termination points, to\r
+ ensure that we would always know to distinguish between\r
+ links, every link is identified by a dedicated link\r
+ identifier.\r
+ Note that a link models a point-to-point link, not a\r
+ multipoint link.\r
+ Layering dependencies on links in underlay topologies are\r
+ not represented as the layering information of nodes and of\r
+ termination points is sufficient.";\r
+ container source {\r
+ description\r
+ "This container holds the logical source of a particular\r
+ link.";\r
+ leaf source-node {\r
+ type leafref {\r
+ path "../../../nd:node/nd:node-id";\r
+ }\r
+ mandatory true;\r
+ description\r
+ "Source node identifier, must be in same topology.";\r
+ }\r
+ leaf source-tp {\r
+ type leafref {\r
+ path "../../../nd:node[nd:node-id=current()/../"+\r
+ "source-node]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Termination point within source node that terminates\r
+ the link.";\r
+ }\r
+ }\r
+ container destination {\r
+ description\r
+ "This container holds the logical destination of a\r
+ particular link.";\r
+ leaf dest-node {\r
+ type leafref {\r
+ path "../../../nd:node/nd:node-id";\r
+ }\r
+ mandatory true;\r
+ description\r
+ "Destination node identifier, must be in the same\r
+ network.";\r
+ }\r
+ leaf dest-tp {\r
+ type leafref {\r
+ path "../../../nd:node[nd:node-id=current()/../"+\r
+ "dest-node]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Termination point within destination node that\r
+ terminates the link.";\r
+ }\r
+ }\r
+ leaf link-id {\r
+ type link-id;\r
+ description\r
+ "The identifier of a link in the topology.\r
+ A link is specific to a topology to which it belongs.";\r
+ }\r
+ list supporting-link {\r
+ key "network-ref link-ref";\r
+ description\r
+ "Identifies the link, or links, that this link\r
+ is dependent on.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-network/nd:network-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which underlay topology\r
+ supporting link is present.";\r
+ }\r
+ leaf link-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/.."+\r
+ "/network-ref]/link/link-id";\r
+ }\r
+ description\r
+ "This leaf identifies a link which is a part\r
+ of this link's underlay. Reference loops, in which\r
+ a link identifies itself as its underlay, either\r
+ directly or transitively, are not allowed.";\r
+ }\r
+ }\r
+ }\r
+ }\r
+ augment "/nd:network/nd:node" {\r
+ description\r
+ "Augment termination points which terminate links. \r
+ Termination points can ultimately be mapped to interfaces.";\r
+ list termination-point {\r
+ key "tp-id";\r
+ description\r
+ "A termination point can terminate a link.\r
+ Depending on the type of topology, a termination point\r
+ could, for example, refer to a port or an interface.";\r
+ leaf tp-id {\r
+ type tp-id;\r
+ description\r
+ "Termination point identifier.";\r
+ }\r
+ list supporting-termination-point {\r
+ key "network-ref node-ref tp-ref";\r
+ description\r
+ "The leaf list identifies any termination points that\r
+ the termination point is dependent on, or maps onto.\r
+ Those termination points will themselves be contained\r
+ in a supporting node.\r
+ This dependency information can be inferred from\r
+ the dependencies between links. For this reason,\r
+ this item is not separately configurable. Hence no\r
+ corresponding constraint needs to be articulated.\r
+ The corresponding information is simply provided by the\r
+ implementing system.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-node/nd:network-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which topology the\r
+ supporting termination point is present.";\r
+ }\r
+ leaf node-ref {\r
+ type leafref {\r
+ path "../../../nd:supporting-node/nd:node-ref";\r
+ }\r
+ description\r
+ "This leaf identifies in which node the supporting\r
+ termination point is present.";\r
+ }\r
+ leaf tp-ref {\r
+ type leafref {\r
+ path "/nd:network[nd:network-id=current()/../"+\r
+ "network-ref]/nd:node[nd:node-id=current()/../"+\r
+ "node-ref]/termination-point/tp-id";\r
+ }\r
+ description\r
+ "Reference to the underlay node, must be in a\r
+ different topology";\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+module old-ietf-network {\r
+ yang-version 1;\r
+ namespace "urn:ietf:params:xml:ns:yang:ietf-network";\r
+ prefix nd;\r
+\r
+ import ietf-inet-types {\r
+ prefix inet;\r
+ }\r
+\r
+ organization "TBD";\r
+ contact\r
+ "WILL-BE-DEFINED-LATER";\r
+ description\r
+ "This module defines a common base model for a collection \r
+ of nodes in a network. Node definitions s are further used\r
+ in network topologies and inventories.";\r
+\r
+ revision 2015-06-08 {\r
+ description\r
+ "Initial revision.";\r
+ reference "draft-ietf-i2rs-yang-network-topo-01";\r
+ }\r
+\r
+ typedef node-id {\r
+ type inet:uri;\r
+ description\r
+ "Identifier for a node.";\r
+ }\r
+\r
+ typedef network-id {\r
+ type inet:uri;\r
+ description\r
+ "Identifier for a network.";\r
+ }\r
+\r
+ grouping network-ref {\r
+ description\r
+ "Contains the information necessary to reference a network,\r
+ for example an underlay network.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "/network/network-id";\r
+ }\r
+ description\r
+ "Used to reference a network, for example an underlay\r
+ network.";\r
+ }\r
+ }\r
+\r
+ grouping node-ref {\r
+ description \r
+ "Contains the information necessary to reference a node.";\r
+ leaf node-ref {\r
+ type leafref {\r
+ path "/network[network-id=current()/../network-ref]"+\r
+ "/node/node-id";\r
+ }\r
+ description\r
+ "Used to reference a node. \r
+ Nodes are identified relative to the network they are\r
+ contained in.";\r
+ }\r
+ uses network-ref;\r
+ }\r
+\r
+ list network {\r
+ key "network-id";\r
+ description\r
+ "Describes a network.\r
+ A network typically contains an inventory of nodes,\r
+ topological information (augmented through \r
+ network-topology model), as well as layering \r
+ information.";\r
+ container network-types {\r
+ description\r
+ "Serves as an augmentation target. \r
+ The network type is indicated through corresponding\r
+ presence containers augmented into this container.";\r
+ }\r
+ leaf network-id {\r
+ type network-id;\r
+ description\r
+ "Identifies a network.";\r
+ }\r
+ leaf server-provided {\r
+ type boolean;\r
+ config false;\r
+ description\r
+ "Indicates whether the information concerning this\r
+ particular network is populated by the server \r
+ (server-provided true, the general case for network \r
+ information discovered from the server), \r
+ or whether it is configured by a client \r
+ (server-provided true, possible e.g. for \r
+ service overlays managed through a controller).";\r
+ }\r
+ list supporting-network {\r
+ key "network-ref";\r
+ description\r
+ "An underlay network, used to represent layered network\r
+ topologies.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "/network/network-id";\r
+ }\r
+ description\r
+ "References the underlay network.";\r
+ }\r
+ }\r
+ list node {\r
+ key "node-id";\r
+ description\r
+ "The inventory of nodes of this network.";\r
+ leaf node-id {\r
+ type node-id;\r
+ description\r
+ "Identifies a node uniquely within the containing \r
+ network.";\r
+ }\r
+ list supporting-node {\r
+ key "network-ref node-ref";\r
+ description\r
+ "Represents another node, in an underlay network, that \r
+ this node is supported by. Used to represent layering \r
+ structure.";\r
+ leaf network-ref {\r
+ type leafref {\r
+ path "../../../supporting-network/network-ref";\r
+ }\r
+ description\r
+ "References the underlay network that the \r
+ underlay node is part of.";\r
+ }\r
+ leaf node-ref {\r
+ type leafref {\r
+ path "/network/node/node-id";\r
+ }\r
+ description\r
+ "References the underlay node itself.";\r
+ }\r
+ }\r
+ }\r
+ }\r
+}\r
namespace "http://org/openroadm/clli/network";
prefix cn;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/network/topology";
prefix topo;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix nwt;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/network/types";
prefix nt;
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix nwt;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/network";
prefix net;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/opposite/links";
prefix opp-links;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix nwt;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/otn/network/topology";
prefix otn-topo;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix nwt;
revision-date 2015-06-08;
}
namespace "http://org/openroadm/xponder";
prefix xpndr;
- import ietf-network {
+ import old-ietf-network {
prefix nd;
revision-date 2015-06-08;
}
- import ietf-network-topology {
+ import old-ietf-network-topology {
prefix nwt;
revision-date 2015-06-08;
}
package org.opendaylight.transportpce.pce;
import com.google.common.base.Optional;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
return false;
}
this.allNodes = nw.getNode();
- Network1 nw1 = nw.getAugmentation(Network1.class);
+ Network1 nw1 = nw.augmentation(Network1.class);
this.allLinks = nw1.getLink();
if ((this.allNodes == null) || this.allNodes.isEmpty()) {
}
// extract node type
- Node1 node1 = node.getAugmentation(Node1.class);
+ Node1 node1 = node.augmentation(Node1.class);
if (node1 == null) {
LOG.error("validateNode: no Node1 (type) Augmentation for node: [{}]. Node is ignored",
nodeId.getValue());
OpenroadmLinkType tmplType = null;
// ID and type
- link1 = link.getAugmentation(Link1.class);
+ link1 = link.augmentation(Link1.class);
if (link1 == null) {
this.isValid = false;
LOG.error("PceLink: No Link augmentation available. Link is ignored {}", this.linkId);
// opposite link
LinkId tmpoppositeLink = null;
org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1 linkOpposite = link
- .getAugmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1.class);
+ .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.opposite.links.rev170929.Link1.class);
tmpoppositeLink = linkOpposite.getOppositeLink();
LOG.debug("PceLink: reading oppositeLink. {}", linkOpposite.toString());
if (tmpoppositeLink == null) {
Long tmplatency = (long)0;
Link1 link1 = null;
// latency
- link1 = link.getAugmentation(Link1.class);
+ link1 = link.augmentation(Link1.class);
tmplatency = link1.getLinkLatency();
if (tmplatency == null) {
tmplatency = (long) 0;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.Node1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev170929.OpenroadmNodeType;
if ((node == null) || (nodeId == null) || (nodeType == null)) {
LOG.error("PceNode: one of parameters is not populated : nodeId, node type");
- valid = false;
+ this.valid = false;
}
}
public void initWLlist() {
- availableWLindex.clear();
+ this.availableWLindex.clear();
if (!isValid()) {
return;
}
- Node1 node1 = node.getAugmentation(Node1.class);
+ Node1 node1 = this.node.augmentation(Node1.class);
- switch (nodeType) {
+ switch (this.nodeType) {
case SRG:
List<org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
.AvailableWavelengths> srgAvailableWL = node1.getSrgAttributes().getAvailableWavelengths();
if (srgAvailableWL == null) {
- valid = false;
+ this.valid = false;
LOG.error("initWLlist: SRG AvailableWavelengths is empty for node {}", this.toString());
return;
}
for (org.opendaylight.yang.gen.v1.http.org.openroadm.srg.rev170929.srg.node.attributes
.AvailableWavelengths awl : srgAvailableWL) {
- availableWLindex.add(awl.getIndex());
+ this.availableWLindex.add(awl.getIndex());
LOG.debug("initWLlist: SRG next = {} in {}" , awl.getIndex() , this.toString());
}
.AvailableWavelengths> degAvailableWL = node1.getDegreeAttributes().getAvailableWavelengths();
if (degAvailableWL == null) {
- valid = false;
+ this.valid = false;
LOG.error("initWLlist: DEG AvailableWavelengths is empty for node {}", this.toString());
return;
}
for (org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev170929.degree.node.attributes
.AvailableWavelengths awl : degAvailableWL) {
- availableWLindex.add(awl.getIndex());
+ this.availableWLindex.add(awl.getIndex());
LOG.debug("initWLlist: DEGREE next = {} in {}", awl.getIndex(), this.toString());
}
// HARD CODED 96
for (long i = 1; i <= 96; i++) {
- availableWLindex.add(i);
+ this.availableWLindex.add(i);
}
break;
default:
- LOG.error("initWLlist: unsupported node type {} in node {}" , nodeType, this.toString());
+ LOG.error("initWLlist: unsupported node type {} in node {}" , this.nodeType, this.toString());
break;
}
- if (availableWLindex.size() == 0) {
+ if (this.availableWLindex.size() == 0) {
LOG.debug("initWLlist: There are no available wavelengths in node {}", this.toString());
- valid = false;
+ this.valid = false;
}
- LOG.debug("initWLlist: availableWLindex size = {} in {}" , availableWLindex.size(), this.toString());
+ LOG.debug("initWLlist: availableWLindex size = {} in {}" , this.availableWLindex.size(), this.toString());
return;
}
}
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Node1 nodeTp =
- node.getAugmentation(
+ this.node.augmentation(
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Node1.class);
List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
.TerminationPoint> allTps = nodeTp.getTerminationPoint();
if (allTps == null) {
- valid = false;
+ this.valid = false;
LOG.error("initXndrTps: XPONDER TerminationPoint list is empty for node {}", this.toString());
return;
}
- valid = false;
+ this.valid = false;
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
.TerminationPoint tp : allTps) {
- TerminationPoint1 tp1 = tp.getAugmentation(TerminationPoint1.class);
+ TerminationPoint1 tp1 = tp.augmentation(TerminationPoint1.class);
if (tp1.getTpType() == OpenroadmTpType.XPONDERNETWORK) {
if (tp1.getXpdrNetworkAttributes().getWavelength() != null) {
- usedXpndrNWTps.add(tp.getTpId().getValue());
+ this.usedXpndrNWTps.add(tp.getTpId().getValue());
LOG.debug("initWLlist: XPONDER tp = {} is used", tp.getTpId().getValue());
} else {
- valid = true;
+ this.valid = true;
}
// find Client of this network TP
if ((client.equals("")) || (client == null)) {
LOG.error("initXndrTps: XPONDER {} NW TP doesn't have defined Client {}",
this.toString(),tp.getTpId().getValue());
- valid = false;
+ this.valid = false;
}
- clientPerNwTp.put(tp.getTpId().getValue(), client);
+ this.clientPerNwTp.put(tp.getTpId().getValue(), client);
}
}
}
public boolean checkTP(String tp) {
- if (usedXpndrNWTps.contains(tp)) {
+ if (this.usedXpndrNWTps.contains(tp)) {
return false;
}
return true;
}
public boolean checkWL(long index) {
- if (availableWLindex.contains(index)) {
+ if (this.availableWLindex.contains(index)) {
return true;
}
return false;
}
public boolean isValid() {
- return valid;
+ return this.valid;
}
public List<Long> getAvailableWLs() {
- return availableWLindex;
+ return this.availableWLindex;
}
public void addOutgoingLink(PceLink outLink) {
}
public List<PceLink> getOutgoingLinks() {
- return outgoingLinks;
+ return this.outgoingLinks;
}
public String getClient(String tp) {
- return clientPerNwTp.get(tp);
+ return this.clientPerNwTp.get(tp);
}
@Override
public String toString() {
- return "PceNode type=" + nodeType + " ID=" + nodeId.getValue();
+ return "PceNode type=" + this.nodeType + " ID=" + this.nodeId.getValue();
}
}
package org.opendaylight.transportpce.pce;
import com.google.common.collect.ImmutableList;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ZToADirectionBuilder;
private PceResult rc;
public PceResult getReturnStructure() {
- return rc;
+ return this.rc;
}
private Map<LinkId, PceLink> allPceLinks = null;
}
public PceResult buildDescriptions() {
- LOG.info("In buildDescriptions: AtoZ {}", pathAtoZ.toString());
+ LOG.info("In buildDescriptions: AtoZ {}", this.pathAtoZ.toString());
List<AToZ> atozList = new ArrayList<AToZ>();
- if (pathAtoZ == null) {
- rc.setRC(ResponseCodes.RESPONSE_FAILED);
+ if (this.pathAtoZ == null) {
+ this.rc.setRC(ResponseCodes.RESPONSE_FAILED);
LOG.error("In buildDescriptions: there is empty AtoZ path");
- return rc;
+ return this.rc;
}
- buildAtoZ(atozList, pathAtoZ);
+ buildAtoZ(atozList, this.pathAtoZ);
- rc.setAtoZDirection(new AToZDirectionBuilder().setRate(rc.getRate())
- .setAToZWavelengthNumber(rc.getResultWavelength()).setAToZ(atozList).build());
+ this.rc.setAtoZDirection(new AToZDirectionBuilder().setRate(this.rc.getRate())
+ .setAToZWavelengthNumber(this.rc.getResultWavelength()).setAToZ(atozList).build());
- pathZtoA = ImmutableList.copyOf(pathAtoZ).reverse();
- LOG.info("In buildDescriptions: ZtoA {}", pathZtoA.toString());
+ this.pathZtoA = ImmutableList.copyOf(this.pathAtoZ).reverse();
+ LOG.info("In buildDescriptions: ZtoA {}", this.pathZtoA.toString());
List<ZToA> ztoaList = new ArrayList<ZToA>();
- if (pathZtoA == null) {
- rc.setRC(ResponseCodes.RESPONSE_FAILED);
+ if (this.pathZtoA == null) {
+ this.rc.setRC(ResponseCodes.RESPONSE_FAILED);
LOG.error("In buildDescriptions: there is empty ZtoA path");
- return rc;
+ return this.rc;
}
- buildZtoA(ztoaList, pathZtoA);
+ buildZtoA(ztoaList, this.pathZtoA);
- rc.setZtoADirection(new ZToADirectionBuilder().setRate(rc.getRate())
- .setZToAWavelengthNumber(rc.getResultWavelength()).setZToA(ztoaList).build());
+ this.rc.setZtoADirection(new ZToADirectionBuilder().setRate(this.rc.getRate())
+ .setZToAWavelengthNumber(this.rc.getResultWavelength()).setZToA(ztoaList).build());
- return rc;
+ return this.rc;
}
private void buildAtoZ(List<AToZ> etoeList, List<PceLink> path) {
AToZKey clientKey = new AToZKey(index.toString());
Resource clientResource = new ResourceBuilder().setResource(stp).build();
- AToZ firstResource = new AToZBuilder().setId(tpName).setKey(clientKey).setResource(clientResource).build();
+ AToZ firstResource = new AToZBuilder().setId(tpName).withKey(clientKey).setResource(clientResource).build();
etoeList.add(firstResource);
index++;
// Source Resource
AToZKey sourceKey = new AToZKey(index.toString());
Resource nodeResource1 = new ResourceBuilder().setResource(sourceNode).build();
- AToZ srcResource = new AToZBuilder().setId(srcName).setKey(sourceKey).setResource(nodeResource1).build();
+ AToZ srcResource = new AToZBuilder().setId(srcName).withKey(sourceKey).setResource(nodeResource1).build();
index++;
etoeList.add(srcResource);
// Resource
AToZKey srcTPKey = new AToZKey(index.toString());// tpName);
Resource tpResource1 = new ResourceBuilder().setResource(stp).build();
- AToZ stpResource = new AToZBuilder().setId(tpName).setKey(srcTPKey).setResource(tpResource1).build();
+ AToZ stpResource = new AToZBuilder().setId(tpName).withKey(srcTPKey).setResource(tpResource1).build();
index++;
etoeList.add(stpResource);
// Link Resource
AToZKey linkKey = new AToZKey(index.toString());
Resource nodeResource2 = new ResourceBuilder().setResource(atozLink).build();
- AToZ linkResource = new AToZBuilder().setId(linkName).setKey(linkKey).setResource(nodeResource2).build();
+ AToZ linkResource = new AToZBuilder().setId(linkName).withKey(linkKey).setResource(nodeResource2).build();
index++;
etoeList.add(linkResource);
// Resource
AToZKey destTPKey = new AToZKey(index.toString());
Resource tpResource2 = new ResourceBuilder().setResource(dtp).build();
- AToZ ttpResource = new AToZBuilder().setId(tpName).setKey(destTPKey).setResource(tpResource2).build();
+ AToZ ttpResource = new AToZBuilder().setId(tpName).withKey(destTPKey).setResource(tpResource2).build();
index++;
etoeList.add(ttpResource);
// Target Resource
AToZKey targetKey = new AToZKey(index.toString());
Resource nodeResource3 = new ResourceBuilder().setResource(targetNode).build();
- lastResource = new AToZBuilder().setId(destName).setKey(targetKey).setResource(nodeResource3).build();
+ lastResource = new AToZBuilder().setId(destName).withKey(targetKey).setResource(nodeResource3).build();
lastLink = pcelink;
}
index++;
clientKey = new AToZKey(index.toString());
clientResource = new ResourceBuilder().setResource(stp).build();
- lastResource = new AToZBuilder().setId(tpName).setKey(clientKey).setResource(clientResource).build();
+ lastResource = new AToZBuilder().setId(tpName).withKey(clientKey).setResource(clientResource).build();
etoeList.add(lastResource);
}
ZToA lastResource = null;
// build Z size Client TP
- PceLink pcelink = allPceLinks.get(path.get(0).getOppositeLink());
+ PceLink pcelink = this.allPceLinks.get(path.get(0).getOppositeLink());
String tpName = pcelink.getClient();
String xname = pcelink.getSourceId().getValue();
TerminationPoint stp = new TerminationPointBuilder()
ZToAKey clientKey = new ZToAKey(index.toString());
Resource clientResource = new ResourceBuilder().setResource(stp).build();
- ZToA firstResource = new ZToABuilder().setId(tpName).setKey(clientKey).setResource(clientResource).build();
+ ZToA firstResource = new ZToABuilder().setId(tpName).withKey(clientKey).setResource(clientResource).build();
etoelist.add(firstResource);
index++;
for (PceLink pcelinkAtoZ : path) {
- pcelink = allPceLinks.get(pcelinkAtoZ.getOppositeLink());
+ pcelink = this.allPceLinks.get(pcelinkAtoZ.getOppositeLink());
LOG.debug("link to oppsite: {} to {}", pcelinkAtoZ.toString(), pcelink.toString());
String srcName = pcelink.getSourceId().getValue();
// Source Resource
ZToAKey sourceKey = new ZToAKey(index.toString());
Resource nodeResource1 = new ResourceBuilder().setResource(sourceNode).build();
- ZToA srcResource = new ZToABuilder().setId(srcName).setKey(sourceKey).setResource(nodeResource1).build();
+ ZToA srcResource = new ZToABuilder().setId(srcName).withKey(sourceKey).setResource(nodeResource1).build();
index++;
etoelist.add(srcResource);
// Resource
ZToAKey srcTPKey = new ZToAKey(index.toString());
Resource tpResource1 = new ResourceBuilder().setResource(stp).build();
- ZToA stpResource = new ZToABuilder().setId(tpName).setKey(srcTPKey).setResource(tpResource1).build();
+ ZToA stpResource = new ZToABuilder().setId(tpName).withKey(srcTPKey).setResource(tpResource1).build();
index++;
etoelist.add(stpResource);
// Link Resource
ZToAKey linkKey = new ZToAKey(index.toString());
Resource nodeResource2 = new ResourceBuilder().setResource(ztoaLink).build();
- ZToA linkResource = new ZToABuilder().setId(linkName).setKey(linkKey).setResource(nodeResource2).build();
+ ZToA linkResource = new ZToABuilder().setId(linkName).withKey(linkKey).setResource(nodeResource2).build();
index++;
etoelist.add(linkResource);
// Resource
ZToAKey destTPKey = new ZToAKey(index.toString());
Resource tpResource2 = new ResourceBuilder().setResource(ttp).build();
- ZToA ttpResource = new ZToABuilder().setId(tpName).setKey(destTPKey).setResource(tpResource2).build();
+ ZToA ttpResource = new ZToABuilder().setId(tpName).withKey(destTPKey).setResource(tpResource2).build();
index++;
etoelist.add(ttpResource);
// Target Resource
ZToAKey targetKey = new ZToAKey(index.toString());
Resource nodeResource3 = new ResourceBuilder().setResource(targetNode).build();
- lastResource = new ZToABuilder().setId(destName).setKey(targetKey).setResource(nodeResource3).build();
+ lastResource = new ZToABuilder().setId(destName).withKey(targetKey).setResource(nodeResource3).build();
lastLink = pcelink;
}
index++;
clientKey = new ZToAKey(index.toString());
clientResource = new ResourceBuilder().setResource(stp).build();
- lastResource = new ZToABuilder().setId(tpName).setKey(clientKey).setResource(clientResource).build();
+ lastResource = new ZToABuilder().setId(tpName).withKey(clientKey).setResource(clientResource).build();
etoelist.add(lastResource);
}
*/
package org.opendaylight.transportpce.pce.impl;
-import java.util.concurrent.Future;
-
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveOutput;
-
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PceService;
}
@Override
- public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
+ public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
LOG.info("RPC cancelResourceReserve request received");
- return RpcResultBuilder.success(pathComputationService.cancelResourceReserve(input)).buildFuture();
+ return RpcResultBuilder.success(this.pathComputationService.cancelResourceReserve(input)).buildFuture();
}
@Override
- public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
+ public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
LOG.info("RPC path computation request received");
- return RpcResultBuilder.success(pathComputationService.pathComputationRequest(input)).buildFuture();
+ return RpcResultBuilder.success(this.pathComputationService.pathComputationRequest(input)).buildFuture();
}
}
*/
package org.opendaylight.transportpce.renderer;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import java.util.concurrent.Future;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
return cmBldr.build();
}
- public static Future<RpcResult<ServiceImplementationRequestOutput>>
+ public static ListenableFuture<RpcResult<ServiceImplementationRequestOutput>>
createRpcResponse(ServiceImplementationRequestOutput payload) {
return RpcResultBuilder.success(payload).buildFuture();
}
} else if (desID == null) {
desID = values.getTpID();
NodesBuilder nb = new NodesBuilder();
- nb.setKey(new NodesKey(values.getNodeID()));
+ nb.withKey(new NodesKey(values.getNodeID()));
nb.setDestTp(desID);
nb.setSrcTp(srcID);
list.add(nb.build());
} else if (desID == null) {
desID = values.getTpID();
NodesBuilder nb = new NodesBuilder();
- nb.setKey(new NodesKey(values.getNodeID()));
+ nb.withKey(new NodesKey(values.getNodeID()));
nb.setDestTp(desID);
nb.setSrcTp(srcID);
list.add(nb.build());
}
public static int[] findTheLongestSubstring(String s1, String s2) {
- if (s1 == null || s2 == null) {
+ if ((s1 == null) || (s2 == null)) {
return null;
}
int[][] dp = new int[s1.length() + 1][s2.length() + 1];
package org.opendaylight.transportpce.renderer.openroadminterface;
import java.math.BigDecimal;
-
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
interfaceBuilder.setAdministrativeState(AdminStates.InService);
interfaceBuilder.setType(type);
interfaceBuilder.setName(key);
- interfaceBuilder.setKey(new InterfaceKey(key));
+ interfaceBuilder.withKey(new InterfaceKey(key));
return interfaceBuilder;
}
}
package org.opendaylight.transportpce.renderer.provisiondevice;
import com.google.common.collect.Sets;
-
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
}
NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
- nodeInterfaceBuilder.setKey(new NodeInterfaceKey(nodeId));
+ nodeInterfaceBuilder.withKey(new NodeInterfaceKey(nodeId));
nodeInterfaceBuilder.setNodeId(nodeId);
nodeInterfaceBuilder.setConnectionId(createdConnections);
nodeInterfaceBuilder.setEthInterfaceId(createdEthInterfaces);
}
}
failedToRollbackList.add(new FailedToRollbackBuilder()
- .setKey(new FailedToRollbackKey(nodeId))
+ .withKey(new FailedToRollbackKey(nodeId))
.setNodeId(nodeId)
.setInterface(failedInterfaces)
.build()
private boolean alarmSuppressionNodeRegistration(ServicePathInput input) {
NodelistBuilder nodeListBuilder = new NodelistBuilder();
- nodeListBuilder.setKey(new NodelistKey(input.getServiceName()));
+ nodeListBuilder.withKey(new NodelistKey(input.getServiceName()));
nodeListBuilder.setServiceName(input.getServiceName());
List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service
.nodelist.nodelist.Nodes> nodeList = new ArrayList<>();
servicesBuilder = new ServicesBuilder(services.get());
} else {
servicesBuilder = new ServicesBuilder();
- servicesBuilder.setKey(serviceKey);
+ servicesBuilder.withKey(serviceKey);
}
servicesBuilder.setTopology(topo);
package org.opendaylight.transportpce.renderer.rpcs;
-import java.util.concurrent.Future;
-
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererRollbackInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.renderer.rev170228.RendererRollbackOutput;
* @return Result of the request
*/
@Override
- public Future<RpcResult<ServicePathOutput>> servicePath(ServicePathInput input) {
+ public ListenableFuture<RpcResult<ServicePathOutput>> servicePath(ServicePathInput input) {
if (input.getOperation().getIntValue() == 1) {
LOG.info("Create operation request received");
- return RpcResultBuilder.success(deviceRenderer.setupServicePath(input, null)).buildFuture();
+ return RpcResultBuilder.success(this.deviceRenderer.setupServicePath(input, null)).buildFuture();
} else if (input.getOperation().getIntValue() == 2) {
LOG.info("Delete operation request received");
- return RpcResultBuilder.success(deviceRenderer.deleteServicePath(input)).buildFuture();
+ return RpcResultBuilder.success(this.deviceRenderer.deleteServicePath(input)).buildFuture();
}
return RpcResultBuilder.success(new ServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
}
* @return Success flag and nodes which failed to rollback
*/
@Override
- public Future<RpcResult<RendererRollbackOutput>> rendererRollback(RendererRollbackInput input) {
- return RpcResultBuilder.success(deviceRenderer.rendererRollback(input)).buildFuture();
+ public ListenableFuture<RpcResult<RendererRollbackOutput>> rendererRollback(RendererRollbackInput input) {
+ return RpcResultBuilder.success(this.deviceRenderer.rendererRollback(input)).buildFuture();
}
}
*/
package org.opendaylight.transportpce.renderer.rpcs;
-import java.util.concurrent.Future;
-
+import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.renderer.ModelMappingUtils;
import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
}
@Override
- public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
+ public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
+ public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
+ public ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
ServiceImplementationRequestInput input) {
String serviceName = input.getServiceName();
LOG.info("Calling RPC service impl request {} {}", serviceName);
- return ModelMappingUtils.createRpcResponse(rendererServiceOperations.serviceImplementation(input));
+ return ModelMappingUtils.createRpcResponse(this.rendererServiceOperations.serviceImplementation(input));
}
@Override
- public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
+ public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
// TODO Auto-generated method stub
return null;
}
NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
nodeInterfaceBuilder.setNodeId("node1");
- nodeInterfaceBuilder.setKey(new NodeInterfaceKey("node1"));
+ nodeInterfaceBuilder.withKey(new NodeInterfaceKey("node1"));
List<String> connectionID = new ArrayList<>();
connectionID.add("node1-PP");
nodeInterfaceBuilder.setConnectionId(connectionID);
*/
package org.opendaylight.transportpce.renderer.stub;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossBaseOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.olm.rev170418.CalculateSpanlossCurrentInput;
public class OlmServiceStub implements OlmService {
- @Override public Future<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
+ @Override public ListenableFuture<RpcResult<CalculateSpanlossCurrentOutput>> calculateSpanlossCurrent(
CalculateSpanlossCurrentInput input) {
return null;
}
- @Override public Future<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
+ @Override public ListenableFuture<RpcResult<GetPmOutput>> getPm(GetPmInput input) {
GetPmOutput output = new GetPmOutputBuilder()
.setNodeId("node1").setMeasurements(new ArrayList<>()).build();
return RpcResultBuilder.success(
output).buildFuture();
}
- @Override public Future<RpcResult<ServicePowerTurndownOutput>> servicePowerTurndown(
+ @Override public ListenableFuture<RpcResult<ServicePowerTurndownOutput>> servicePowerTurndown(
ServicePowerTurndownInput input) {
return null;
}
- @Override public Future<RpcResult<CalculateSpanlossBaseOutput>> calculateSpanlossBase(
+ @Override public ListenableFuture<RpcResult<CalculateSpanlossBaseOutput>> calculateSpanlossBase(
CalculateSpanlossBaseInput input) {
return null;
}
- @Override public Future<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
+ @Override public ListenableFuture<RpcResult<ServicePowerResetOutput>> servicePowerReset(ServicePowerResetInput input) {
return null;
}
- @Override public Future<RpcResult<ServicePowerSetupOutput>> servicePowerSetup(ServicePowerSetupInput input) {
+ @Override public ListenableFuture<RpcResult<ServicePowerSetupOutput>> servicePowerSetup(ServicePowerSetupInput input) {
return RpcResultBuilder.success(new ServicePowerSetupOutputBuilder().build()).buildFuture();
}
}
DeviceTransactionManager deviceTransactionManager) {
try {
MappingBuilder mappingBuilder = new MappingBuilder();
- mappingBuilder.setKey(new MappingKey(logicalConnPoint));
+ mappingBuilder.withKey(new MappingKey(logicalConnPoint));
mappingBuilder.setLogicalConnectionPoint(logicalConnPoint);
mappingBuilder.setSupportingOms("OMS");
mappingBuilder.setSupportingPort("8080");
public final class ServiceDataUtils {
public static Nodes createNode(String nodeId, String srcTp, String dstTp) {
- return new NodesBuilder().setNodeId(nodeId).setKey(new NodesKey(nodeId)).setSrcTp(srcTp)
+ return new NodesBuilder().setNodeId(nodeId).withKey(new NodesKey(nodeId)).setSrcTp(srcTp)
.setDestTp(dstTp).build();
}
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource
.resource.resource.Node node2 = nodesBuilder.setNodeIdentifier(new NodeIdentifierBuilder()
.setNodeId("XPONDER-1-2").build()).build();
- AToZ atoZ = new AToZBuilder().setId("1").setKey(new AToZKey("1")).setResource(new ResourceBuilder()
+ AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
.setResource(node1).build()).build();
- AToZ atoZ2 = new AToZBuilder().setId("1").setKey(new AToZKey("1")).setResource(new ResourceBuilder()
+ AToZ atoZ2 = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
.setResource(node2).build()).build();
atoZList.add(atoZ);
atoZList.add(atoZ2);
.setAToZ(atoZList)
.build();
List<ZToA> ztoAList = new ArrayList<ZToA>();
- ZToA ztoA = new ZToABuilder().setId("1").setKey(new ZToAKey("1")).setResource(new ResourceBuilder()
+ ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
.setResource(node1).build()).build();
- ZToA ztoA2 = new ZToABuilder().setId("1").setKey(new ZToAKey("1")).setResource(new ResourceBuilder()
+ ZToA ztoA2 = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
.setResource(node2).build()).build();
ztoAList.add(ztoA);
ztoAList.add(ztoA2);
TerminationPoint terminationPoint2 = terminationPointBuilder
.setTerminationPointIdentifier(new TerminationPointIdentifierBuilder().setNodeId("XPONDER-1-2")
.setTpId("XPONDER-1-2-" + tpId).build()).build();
- AToZ atoZ = new AToZBuilder().setId("1").setKey(new AToZKey("1")).setResource(new ResourceBuilder()
+ AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
.setResource(terminationPoint).build()).build();
- AToZ atoZ2 = new AToZBuilder().setId("2").setKey(new AToZKey("2")).setResource(new ResourceBuilder()
+ AToZ atoZ2 = new AToZBuilder().setId("2").withKey(new AToZKey("2")).setResource(new ResourceBuilder()
.setResource(terminationPoint2).build()).build();
atoZList.add(atoZ);
atoZList.add(atoZ2);
.setAToZ(atoZList)
.build();
List<ZToA> ztoAList = new ArrayList<ZToA>();
- ZToA ztoA = new ZToABuilder().setId("1").setKey(new ZToAKey("1")).setResource(new ResourceBuilder()
+ ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
.setResource(terminationPoint).build()).build();
- ZToA ztoA2 = new ZToABuilder().setId("2").setKey(new ZToAKey("2")).setResource(new ResourceBuilder()
+ ZToA ztoA2 = new ZToABuilder().setId("2").withKey(new ZToAKey("2")).setResource(new ResourceBuilder()
.setResource(terminationPoint).build()).build();
ztoAList.add(ztoA);
ztoAList.add(ztoA2);
.build();
Link link2 = new LinkBuilder().setLinkIdentifier(new LinkIdentifierBuilder().setLinkId("link 2").build())
.build();
- AToZ atoZ = new AToZBuilder().setId("1").setKey(new AToZKey("1")).setResource(new ResourceBuilder()
+ AToZ atoZ = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
.setResource(link1).build()).build();
- AToZ atoZ2 = new AToZBuilder().setId("1").setKey(new AToZKey("1")).setResource(new ResourceBuilder()
+ AToZ atoZ2 = new AToZBuilder().setId("1").withKey(new AToZKey("1")).setResource(new ResourceBuilder()
.setResource(link2).build()).build();
atoZList.add(atoZ);
atoZList.add(atoZ2);
.setAToZ(atoZList)
.build();
List<ZToA> ztoAList = new ArrayList<ZToA>();
- ZToA ztoA = new ZToABuilder().setId("1").setKey(new ZToAKey("1")).setResource(new ResourceBuilder()
+ ZToA ztoA = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
.setResource(link1).build()).build();
- ZToA ztoA2 = new ZToABuilder().setId("1").setKey(new ZToAKey("1")).setResource(new ResourceBuilder()
+ ZToA ztoA2 = new ZToABuilder().setId("1").withKey(new ZToAKey("1")).setResource(new ResourceBuilder()
.setResource(link2).build()).build();
ztoAList.add(ztoA);
ztoAList.add(ztoA2);
*/
package org.opendaylight.transportpce.servicehandler;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEnd;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.path.computation.request.input.ServiceAEndBuilder;
return txDirectionBuilder.build();
}
- public static Future<RpcResult<ServiceDeleteOutput>> createDeleteServiceReply(ServiceDeleteInput input,
+ public static ListenableFuture<RpcResult<ServiceDeleteOutput>> createDeleteServiceReply(ServiceDeleteInput input,
String finalAck, String message, String responseCode) {
ConfigurationResponseCommonBuilder builder = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator(finalAck).setResponseMessage(message).setResponseCode(responseCode);
return RpcResultBuilder.success(output).buildFuture();
}
- public static Future<RpcResult<ServiceCreateOutput>> createCreateServiceReply(ServiceCreateInput input,
+ public static ListenableFuture<RpcResult<ServiceCreateOutput>> createCreateServiceReply(ServiceCreateInput input,
String finalAck,
String message, String responseCode) {
ResponseParametersBuilder responseParameters = new ResponseParametersBuilder();
for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
.path.description.atoz.direction.AToZ tmp : pathDescription.getAToZDirection().getAToZ()) {
- AToZKey key = new AToZKey(tmp.getKey().getId());
- AToZ atoz = new AToZBuilder().setId(tmp.getId()).setKey(key)
+ AToZKey key = new AToZKey(tmp.key().getId());
+ AToZ atoz = new AToZBuilder().setId(tmp.getId()).withKey(key)
// .setResource(tmp.getResource())
.build();
atozList.add(atoz);
for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
.path.description.ztoa.direction.ZToA
tmp : pathDescription.getZToADirection().getZToA()) {
- ZToAKey key = new ZToAKey(tmp.getKey().getId());
- ZToA ztoa = new ZToABuilder().setId(tmp.getId()).setKey(key)
+ ZToAKey key = new ZToAKey(tmp.key().getId());
+ ZToA ztoa = new ZToABuilder().setId(tmp.getId()).withKey(key)
// .setResource(tmp.getResource())
.build();
ztoaList.add(ztoa);
*/
package org.opendaylight.transportpce.servicehandler.impl;
+import com.google.common.util.concurrent.ListenableFuture;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
}
@Override
- public Future<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
+ public ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
LOG.info("RPC service creation received");
// Validation
OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(input);
}
@Override
- public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
+ public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
LOG.info("RPC serviceDelete request received for {}", input.getServiceDeleteReqInfo().getServiceName());
String message = "";
}
@Override
- public Future<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
+ public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
ServiceFeasibilityCheckInput input) {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
- public Future<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
+ public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
- public Future<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
+ public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
- public Future<RpcResult<EquipmentNotificationOutput>> equipmentNotification(EquipmentNotificationInput input) {
+ public ListenableFuture<RpcResult<EquipmentNotificationOutput>> equipmentNotification(EquipmentNotificationInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<ServiceRerouteConfirmOutput>> serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
+ public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>> serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
+ public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
InstanceIdentifier<Services> servicesIID = InstanceIdentifier.create(ServiceList.class)
.child(Services.class, new ServicesKey(input.getServiceName()));
ReadOnlyTransaction rtx = this.db.newReadOnlyTransaction();
}
@Override
- public Future<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
+ public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
+ public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<NetworkReOptimizationOutput>> networkReOptimization(NetworkReOptimizationInput input) {
+ public ListenableFuture<RpcResult<NetworkReOptimizationOutput>> networkReOptimization(NetworkReOptimizationInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
+ public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
// TODO Auto-generated method stub
return null;
}
@Override
- public Future<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
+ public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
// TODO Auto-generated method stub
return null;
}
*/
package org.opendaylight.transportpce.test.common;
+import com.google.common.collect.ClassToInstanceMap;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ServiceLoader;
import java.util.concurrent.Executors;
import javassist.ClassPool;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
import org.opendaylight.mdsal.binding.generator.util.JavassistUtils;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.util.ListenerRegistry;
import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider;
this.dataBroker = createDataBroker();
this.notificationService = createNotificationService();
this.notificationPublishService = createNotificationPublishService();
- for (ListenerRegistration<SchemaContextListener> listener : mockedSchemaContext.listeners) {
- listener.getInstance().onGlobalContextUpdated(mockedSchemaContext.schemaContext);
+ for (ListenerRegistration<SchemaContextListener> listener : this.mockedSchemaContext.listeners) {
+ listener.getInstance().onGlobalContextUpdated(this.mockedSchemaContext.schemaContext);
}
}
@Override
public SchemaContext getSchemaContext() {
- return mockedSchemaContext.schemaContext;
+ return this.mockedSchemaContext.schemaContext;
}
@Override
public BindingNormalizedNodeCodecRegistry getBindingToNormalizedNodeCodec() {
- return mockedSchemaContext.bindingStreamCodecs;
+ return this.mockedSchemaContext.bindingStreamCodecs;
}
@Override
public NotificationService getNotificationService() {
- return notificationService;
+ return this.notificationService;
}
@Override
public NotificationPublishService getNotificationPublishService() {
- return notificationPublishService;
+ return this.notificationPublishService;
}
private DOMDataBroker createDOMDataBroker() {
- return new SerializedDOMDataBroker(datastores,
+ return new SerializedDOMDataBroker(this.datastores,
MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
}
this.listeners = ListenerRegistry.create();
this.bindingStreamCodecs = createBindingRegistry();
GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
- this.bindingToNormalized = new BindingToNormalizedNodeCodec(loading, bindingStreamCodecs);
+ this.bindingToNormalized = new BindingToNormalizedNodeCodec(loading, this.bindingStreamCodecs);
registerSchemaContextListener(this.bindingToNormalized);
}
@Override
public SchemaContext getSchemaContext() {
- return schemaContext;
+ return this.schemaContext;
}
/**
* @return SchemaContext a schema context
*/
private SchemaContext getSchemaContext(List<YangModuleInfo> moduleInfos) {
- moduleInfoBackedCntxt.addModuleInfos(moduleInfos);
+ this.moduleInfoBackedCntxt.addModuleInfos(moduleInfos);
Optional<SchemaContext> tryToCreateSchemaContext =
- moduleInfoBackedCntxt.tryToCreateSchemaContext().toJavaUtil();
+ this.moduleInfoBackedCntxt.tryToCreateSchemaContext().toJavaUtil();
if (!tryToCreateSchemaContext.isPresent()) {
LOG.error("Could not create the initial schema context. Schema context is empty");
throw new IllegalStateException();
@Override
public SchemaContext getGlobalContext() {
- return schemaContext;
+ return this.schemaContext;
}
@Override
public SchemaContext getSessionContext() {
- return schemaContext;
+ return this.schemaContext;
}
@Override
public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
SchemaContextListener listener) {
- return listeners.register(listener);
+ return this.listeners.register(listener);
}
/**
* @return BindingNormalizedNodeCodecRegistry the resulting binding registry
*/
private BindingNormalizedNodeCodecRegistry createBindingRegistry() {
- BindingRuntimeContext bindingContext = BindingRuntimeContext.create(moduleInfoBackedCntxt, schemaContext);
+ BindingRuntimeContext bindingContext = BindingRuntimeContext.create(this.moduleInfoBackedCntxt, this.schemaContext);
BindingNormalizedNodeCodecRegistry bindingNormalizedNodeCodecRegistry =
new BindingNormalizedNodeCodecRegistry(
StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())));
bindingNormalizedNodeCodecRegistry.onBindingRuntimeContextUpdated(bindingContext);
return bindingNormalizedNodeCodecRegistry;
}
+
+ /* (non-Javadoc)
+ * @see org.opendaylight.mdsal.dom.api.DOMExtensibleService#getExtensions()
+ */
+ @Override
+ public @NonNull ClassToInstanceMap<DOMSchemaServiceExtension> getExtensions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
}
</plugin>
</plugins>
</build>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>netconf-artifacts</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<artifactId>transportpce-stubmodels</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-topology</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>sal-netconf-connector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZ;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZKey;
this.tpOut = out;
this.tpIn = in;
this.node = node;
- resources = new ArrayList<Resource>();
- atoz = new ArrayList<AToZ>();
- ztoa = new ArrayList<ZToA>();
- ids = new ArrayList<String>();
+ this.resources = new ArrayList<Resource>();
+ this.atoz = new ArrayList<AToZ>();
+ this.ztoa = new ArrayList<ZToA>();
+ this.ids = new ArrayList<String>();
}
* create resource List.
*/
public void createListResource() {
- ids.clear();
- resources.clear();
- atoz.clear();
- ztoa.clear();
-
- resources.add(new ResourceBuilder().setResource(tpIn).build());
- ids.add(tpIn.getTerminationPointIdentifier().getNodeId().concat("-")
- .concat(tpIn.getTerminationPointIdentifier().getTpId()));
- resources.add(new ResourceBuilder().setResource(node).build());
- ids.add(node.getNodeIdentifier().getNodeId());
- resources.add(new ResourceBuilder().setResource(tpOut).build());
- ids.add(tpOut.getTerminationPointIdentifier().getNodeId().concat("-")
- .concat(tpOut.getTerminationPointIdentifier().getTpId()));
+ this.ids.clear();
+ this.resources.clear();
+ this.atoz.clear();
+ this.ztoa.clear();
+
+ this.resources.add(new ResourceBuilder().setResource(this.tpIn).build());
+ this.ids.add(this.tpIn.getTerminationPointIdentifier().getNodeId().concat("-")
+ .concat(this.tpIn.getTerminationPointIdentifier().getTpId()));
+ this.resources.add(new ResourceBuilder().setResource(this.node).build());
+ this.ids.add(this.node.getNodeIdentifier().getNodeId());
+ this.resources.add(new ResourceBuilder().setResource(this.tpOut).build());
+ this.ids.add(this.tpOut.getTerminationPointIdentifier().getNodeId().concat("-")
+ .concat(this.tpOut.getTerminationPointIdentifier().getTpId()));
}
/**
AToZ hop = null;
AToZKey atozKey = null;
createListResource();
- for (Resource resource : resources) {
+ for (Resource resource : this.resources) {
atozKey = new AToZKey(Integer.toString(odr));
resource = new ResourceBuilder().setResource(resource.getResource()).build();
hop = new AToZBuilder()
- .setKey(atozKey)
+ .withKey(atozKey)
.setResource(resource)
.build();
- atoz.add(hop);
+ this.atoz.add(hop);
odr++;
}
}
ZToA hop = null;
ZToAKey ztoaKey = null;
createListResource();
- for (Resource resource : resources) {
+ for (Resource resource : this.resources) {
ztoaKey = new ZToAKey(Integer.toString(odr));
resource = new ResourceBuilder().setResource(resource.getResource()).build();
hop = new ZToABuilder()
- .setKey(ztoaKey)
+ .withKey(ztoaKey)
.setResource(resource)
.build();
- ztoa.add(hop);
+ this.ztoa.add(hop);
odr++;
}
}
public TpNodeTp reverse() {
- return new TpNodeTp(tpOut, tpIn, node);
+ return new TpNodeTp(this.tpOut, this.tpIn, this.node);
}
@Override
public String toString() {
StringBuilder result = new StringBuilder("[ ");
- result.append("tpIn : " + tpIn.getTerminationPointIdentifier().getTpId());
- result.append(" - Node : " + node.getNodeIdentifier().getNodeId());
- result.append(" - tpOut : " + tpOut.getTerminationPointIdentifier().getTpId());
+ result.append("tpIn : " + this.tpIn.getTerminationPointIdentifier().getTpId());
+ result.append(" - Node : " + this.node.getNodeIdentifier().getNodeId());
+ result.append(" - tpOut : " + this.tpOut.getTerminationPointIdentifier().getTpId());
result.append(" ]");
return result.toString();
}
public List<AToZ> getAToZ() {
- return atoz;
+ return this.atoz;
}
public List<ZToA> getZToA() {
- return ztoa;
+ return this.ztoa;
}
public Node getNode() {
- return node;
+ return this.node;
}
public TerminationPoint getTpIn() {
- return tpIn;
+ return this.tpIn;
}
public TerminationPoint getTpOut() {
- return tpOut;
+ return this.tpOut;
}
}
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-
import java.util.Iterator;
import java.util.SortedSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
public StubpceImpl(NotificationPublishService notificationPublishService, DataBroker databroker) {
this.notificationPublishService = notificationPublishService;
this.db = databroker;
- pathDescriptionBuilder = null;
+ this.pathDescriptionBuilder = null;
if (initializePathDescriptionList(databroker)) {
fillPathDesciptionList();
}
}
@Override
- public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
+ public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
LOG.info("RPC cancelResourceReserve request received");
String message = "";
String responseCode = "";
String serviceName = input.getServiceName();
LOG.info("serviceName : {}", serviceName);
if (serviceName != null) {
- sendingPCE = new SendingPceRPCs(input,db,executor);
+ this.sendingPCE = new SendingPceRPCs(input,this.db,this.executor);
FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
String message = "";
ServicePathRpcResult notification = null;
@Override
public void onFailure(Throwable arg0) {
LOG.error("Cancel resource failed : {}", arg0);
- notification = new ServicePathRpcResultBuilder()
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("Cancel resource request failed : " + arg0.getMessage()).build();
try {
- notificationPublishService.putNotification(notification);
+ StubpceImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
public void onSuccess(Boolean response) {
LOG.info("response : {}", response);
if (response) {
- message = "Resource cancelled !";
- notification = new ServicePathRpcResultBuilder()
+ this.message = "Resource cancelled !";
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
- .setStatusMessage(message)
+ .setStatusMessage(this.message)
.build();
} else {
- message = sendingPCE.getError();
- notification = new ServicePathRpcResultBuilder()
+ this.message = StubpceImpl.this.sendingPCE.getError();
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
.setServiceName("")
- .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
+ .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message)
.build();
- message = "Cancel request failed !";
+ this.message = "Cancel request failed !";
}
- LOG.info(notification.toString());
+ LOG.info(this.notification.toString());
try {
- notificationPublishService.putNotification(notification);
+ StubpceImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- LOG.info(message);
+ LOG.info(this.message);
}
};
- ListenableFuture<Boolean> pce = sendingPCE.cancelResourceReserve();
- Futures.addCallback(pce, pceCallback, executor);
+ ListenableFuture<Boolean> pce = this.sendingPCE.cancelResourceReserve();
+ Futures.addCallback(pce, pceCallback, this.executor);
LOG.info("Cancel Resource Request in progress ...");
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator("No")
} else {
message = "serviceName / requestId is not correct !";
responseCode = "500";
- notification = new ServicePathRpcResultBuilder()
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage(message).build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
}
@Override
- public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
+ public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
LOG.info("RPC pathcomputation request received");
String message = "";
String responseCode = "";
boolean coherencyHardSoft = false;
boolean commonId = true;
ConfigurationResponseCommonBuilder configurationResponseCommon = null;
- compliancyCheck = new StubpceCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
- if (compliancyCheck.check(false, true)) {
+ this.compliancyCheck = new StubpceCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
+ if (this.compliancyCheck.check(false, true)) {
LOG.info("Service compliant !");
/**
* If compliant, service-request parameters are verified in order to
* a path and implement a service.
*/
LOG.info("checking Tx/Rx Info for AEnd ...");
- txrxCheck = new StubpceTxRxCheck(input.getServiceAEnd(), 1);
- if (txrxCheck.check()) {
+ this.txrxCheck = new StubpceTxRxCheck(input.getServiceAEnd(), 1);
+ if (this.txrxCheck.check()) {
LOG.info("Tx/Rx Info for AEnd checked !");
LOG.info("checking Tx/Rx Info for ZEnd ...");
- txrxCheck = new StubpceTxRxCheck(input.getServiceZEnd(), 2);
- if (txrxCheck.check()) {
+ this.txrxCheck = new StubpceTxRxCheck(input.getServiceZEnd(), 2);
+ if (this.txrxCheck.check()) {
LOG.info("Tx/Rx Info for ZEnd checked !");
/**
* If OK, common-id is verified in order to see if there is
* with hard/soft constraints provided in the input of the
* RPC.
*/
- if (input.getHardConstraints() != null || input.getSoftConstraints() != null) {
+ if ((input.getHardConstraints() != null) || (input.getSoftConstraints() != null)) {
LOG.info("Constraints specified !");
- checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
+ this.checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
input.getSoftConstraints());
- if (checkCoherencyHardSoft.check()) {
+ if (this.checkCoherencyHardSoft.check()) {
LOG.info("hard/soft constraints coherent !");
coherencyHardSoft = true;
} else {
commonId = false;
}
if (!commonId || (commonId && coherencyHardSoft)) {
- notification = new ServicePathRpcResultBuilder()
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
.setStatusMessage("Service compliant, submitting pathComputation Request ...").build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- sendingPCE = new SendingPceRPCs(input,db,executor);
+ this.sendingPCE = new SendingPceRPCs(input,this.db,this.executor);
FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
String message = "";
ServicePathRpcResult notification = null;
public void onFailure(Throwable arg0) {
LOG.error("Failure message : {}", arg0.toString());
LOG.error("Path calculation failed !");
- notification = new ServicePathRpcResultBuilder()
+ this.notification = new ServicePathRpcResultBuilder()
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("PCR Request failed : " + arg0.getMessage()).build();
try {
- notificationPublishService.putNotification(notification);
+ StubpceImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
public void onSuccess(Boolean response) {
LOG.info("response : {}", response);
if (response) {
- message = "Path Computated !";
+ this.message = "Path Computated !";
ServicePathRpcResultBuilder tmp = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
- .setStatusMessage(message);
- pathDescriptionBuilder = sendingPCE.getPathDescription();
- if (pathDescriptionBuilder != null) {
+ .setStatusMessage(this.message);
+ StubpceImpl.this.pathDescriptionBuilder = StubpceImpl.this.sendingPCE.getPathDescription();
+ if (StubpceImpl.this.pathDescriptionBuilder != null) {
PathDescription pathDescription = new org.opendaylight.yang.gen.v1.http.org
.transportpce.b.c._interface.servicepath.rev170426.service.path
.rpc.result.PathDescriptionBuilder()
- .setAToZDirection(pathDescriptionBuilder.getAToZDirection())
- .setZToADirection(pathDescriptionBuilder.getZToADirection())
+ .setAToZDirection(StubpceImpl.this.pathDescriptionBuilder.getAToZDirection())
+ .setZToADirection(StubpceImpl.this.pathDescriptionBuilder.getZToADirection())
.build();
tmp.setPathDescription(new PathDescriptionBuilder()
.setAToZDirection(pathDescription.getAToZDirection())
.setZToADirection(pathDescription.getZToADirection())
.build());
}
- notification = tmp.build();
+ this.notification = tmp.build();
} else {
- message = sendingPCE.getError();
- notification = new ServicePathRpcResultBuilder()
+ this.message = StubpceImpl.this.sendingPCE.getError();
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
.setServiceName("")
- .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
+ .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message)
.build();
- message = "Path not calculated!";
+ this.message = "Path not calculated!";
}
try {
- notificationPublishService.putNotification(notification);
+ StubpceImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- LOG.info(message);
+ LOG.info(this.message);
}
};
- ListenableFuture<Boolean> pce = sendingPCE.pathComputation();
- Futures.addCallback(pce, pceCallback, executor);
+ ListenableFuture<Boolean> pce = this.sendingPCE.pathComputation();
+ Futures.addCallback(pce, pceCallback, this.executor);
LOG.info("PathComputation Request in progress ...");
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator("No")
}
} else {
- message = txrxCheck.getMessage();
+ message = this.txrxCheck.getMessage();
responseCode = "500";
}
} else {
- message = txrxCheck.getMessage();
+ message = this.txrxCheck.getMessage();
responseCode = "500";
}
} else {
- message = compliancyCheck.getMessage();
+ message = this.compliancyCheck.getMessage();
responseCode = "500";
- notification = new ServicePathRpcResultBuilder()
+ this.notification = new ServicePathRpcResultBuilder()
.setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("Service not compliant : " + message).build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
if (pathDesc != null) {
iid = InstanceIdentifier.create(PathDescriptionList.class)
.child(PathDescriptions.class, new PathDescriptionsKey(pathDesc.getPathName()));
- writeTx = db.newWriteOnlyTransaction();
+ writeTx = this.db.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, pathDesc);
future = writeTx.submit();
try {
@SuppressWarnings("unused")
private Services readServiceList(String serviceName) {
Services result = null;
- ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
+ ReadOnlyTransaction readTx = this.db.newReadOnlyTransaction();
InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
new ServicesKey(serviceName));
Future<Optional<Services>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
@SuppressWarnings("unused")
private ServicePaths readServicePathList(String serviceName) {
ServicePaths result = null;
- ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
+ ReadOnlyTransaction readTx = this.db.newReadOnlyTransaction();
InstanceIdentifier<ServicePaths> iid = InstanceIdentifier.create(ServicePathList.class)
.child(ServicePaths.class, new ServicePathsKey(serviceName));
Future<Optional<ServicePaths>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
@SuppressWarnings("unused")
private PathDescriptions readPathDescriptionList(String pathName) {
PathDescriptions result = null;
- ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
+ ReadOnlyTransaction readTx = this.db.newReadOnlyTransaction();
InstanceIdentifier<PathDescriptions> iid = InstanceIdentifier.create(PathDescriptionList.class)
.child(PathDescriptions.class, new PathDescriptionsKey(pathName));
Future<Optional<PathDescriptions>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service
.path.PathDescriptionBuilder path = new org.opendaylight.yang.gen.v1.http.org.transportpce
.b.c._interface.service.types.rev170426.service.path.PathDescriptionBuilder();
- path.setAToZDirection(pathDescriptionBuilder.getAToZDirection());
- path.setZToADirection(pathDescriptionBuilder.getZToADirection());
+ path.setAToZDirection(this.pathDescriptionBuilder.getAToZDirection());
+ path.setZToADirection(this.pathDescriptionBuilder.getZToADirection());
ServicePaths service = new ServicePathsBuilder().setServicePathName(input.getServiceName())
.setSoftConstraints(input.getSoftConstraints()).setHardConstraints(input.getHardConstraints())
.setPathDescription(path.build()).build();
- WriteTransaction writeTx = db.newWriteOnlyTransaction();
+ WriteTransaction writeTx = this.db.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, service);
Future<Void> future = writeTx.submit();
try {
}
public PathDescriptionBuilder getPathDescriptionBuilder() {
- return pathDescriptionBuilder;
+ return this.pathDescriptionBuilder;
}
public void setPathDescriptionBuilder(PathDescriptionBuilder pathDescriptionBuilder) {
package org.opendaylight.transportpce.stubpce.topology;
import com.google.common.collect.Lists;
-
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
-
import org.opendaylight.transportpce.stubpce.TpNodeTp;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
Link link = path.getLink();
AToZKey atozKey = new AToZKey(Integer.toString(order));
Resource resource = new ResourceBuilder().setResource(link).build();
- AToZ hop = new AToZBuilder().setId(atozKey.getId()).setKey(atozKey).setResource(resource).build();
+ AToZ hop = new AToZBuilder().setId(atozKey.getId()).withKey(atozKey).setResource(resource).build();
atozList.add(hop);
order++;
}
atozDirection.setRate((long) 100).setAToZWavelengthNumber((long) 200).setAToZ(atozList);
- atoz.add(atozDirection.build());
+ this.atoz.add(atozDirection.build());
}
/**
Link link = path.getLink();
ZToAKey ztoaKey = new ZToAKey(Integer.toString(order));
Resource resource = new ResourceBuilder().setResource(link).build();
- ZToA hop = new ZToABuilder().setId(ztoaKey.getId()).setKey(ztoaKey).setResource(resource).build();
+ ZToA hop = new ZToABuilder().setId(ztoaKey.getId()).withKey(ztoaKey).setResource(resource).build();
ztoaList.add(hop);
order++;
}
ztoaDirection.setRate((long) 100).setZToAWavelengthNumber((long) 200).setZToA(ztoaList);
- ztoa.add(ztoaDirection.build());
+ this.ztoa.add(ztoaDirection.build());
}
/**
NodePath srg = null;
NodePath deg1 = null;
NodePath deg2 = null;
- for (NodePath node : nodepaths) {
+ for (NodePath node : this.nodepaths) {
//LOG.info(node.toString());
String id = node.getNodeId();
if (id.contains("XPDR")) {
LOG.info("buildDegToDeg ...");
NodePath deg1 = null;
NodePath deg2 = null;
- for (NodePath node : nodepaths) {
+ for (NodePath node : this.nodepaths) {
//LOG.info(node.toString());
String nodeId = node.getNodeId();
if (nodeId.contains("DEG1")) {
deg2 = node;
}
}
- if (deg1 != null && deg2 != null) {
+ if ((deg1 != null) && (deg2 != null)) {
List<Path> result = new ArrayList<Path>();
NodePath deb = deg1;
NodePath end = deg2;
*/
private void buildDegToSrgToXpdr(NodePath xpdr,NodePath srg,NodePath deg1,NodePath deg2,boolean reverse) {
LOG.info("buildDegToSrgToXpr ...");
- if (xpdr != null && srg != null && deg1 != null && deg2 != null) {
+ if ((xpdr != null) && (srg != null) && (deg1 != null) && (deg2 != null)) {
buildDeg(xpdr, srg, deg1, reverse);
buildDeg(xpdr, srg, deg2, reverse);
} else {
*/
private void buildXpdrToSrgToDeg(NodePath xpdr,NodePath srg,NodePath deg1,NodePath deg2,boolean reverse) {
LOG.info("buildXpdrToSrgToDeg ...");
- if (xpdr != null && srg != null && deg1 != null && deg2 != null) {
+ if ((xpdr != null) && (srg != null) && (deg1 != null) && (deg2 != null)) {
List<Path> result = new ArrayList<Path>();
for (Path xpdrPath : xpdr.getPath()) {
TpNodeTp tmpxpdr = xpdrPath.getTpNodeTp();
case 1: //last link
if (res instanceof Link) {
Link tp = (Link) res;
- if (tp != null && tp.getLinkIdentifier().getLinkId().contains(endBy)) {
+ if ((tp != null) && tp.getLinkIdentifier().getLinkId().contains(endBy)) {
result.add(tmp);
}
}
case 2: //last tp
if (res instanceof TerminationPoint) {
TerminationPoint tp = (TerminationPoint) res;
- if (tp != null && tp.getTerminationPointIdentifier().getTpId()
+ if ((tp != null) && tp.getTerminationPointIdentifier().getTpId()
.contains(endBy)) {
result.add(tmp);
}
if (atoz.getId().compareTo(id) == 0) {
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
.rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
- if (res != null && res instanceof Link) {
+ if ((res != null) && (res instanceof Link)) {
Link link = new LinkBuilder()
.setLinkIdentifier(new LinkIdentifierBuilder()
.setLinkId(atozLink)
.build())
.build();
- AToZKey atozKey = new AToZKey(atoz.getKey());
+ AToZKey atozKey = new AToZKey(atoz.key());
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
.pathdescription.rev170426.pce.resource.Resource resource = new ResourceBuilder()
.setResource(link).build();
- AToZ hop = new AToZBuilder().setId(atozKey.getId()).setKey(atozKey)
+ AToZ hop = new AToZBuilder().setId(atozKey.getId()).withKey(atozKey)
.setResource(resource).build();
it.remove();
if (!remove) {
if (atoz.getId().compareTo(id) == 0) {
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
.rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
- if (res != null && res instanceof TerminationPoint) {
+ if ((res != null) && (res instanceof TerminationPoint)) {
TerminationPoint tp = (TerminationPoint) res;
- if (tp != null && tp.getTerminationPointIdentifier().getTpId().contains(beginBy)) {
+ if ((tp != null) && tp.getTerminationPointIdentifier().getTpId().contains(beginBy)) {
LOG.info("tmp : {}", tmp.toString());
result.add(tmp);
}
* @param zend path zend Supernode nodeId
*/
public void buildPath(String zend) {
- if (superNode != null) {
- for (org.opendaylight.transportpce.stubpce.topology.Resource res : superNode.getResources()) {
- NodePath path = new NodePath(res, superNode.getSuperNodeId(), superNode.isXpdrSrgAbsent());
+ if (this.superNode != null) {
+ for (org.opendaylight.transportpce.stubpce.topology.Resource res : this.superNode.getResources()) {
+ NodePath path = new NodePath(res, this.superNode.getSuperNodeId(), this.superNode.isXpdrSrgAbsent());
path.fill();
- nodepaths.add(path);
+ this.nodepaths.add(path);
}
- LOG.info("nodepaths size : {}", nodepaths.size());
- build(superNode.isXpdrSrgAbsent(),superNode.getSuperNodeId(), zend);
+ LOG.info("nodepaths size : {}", this.nodepaths.size());
+ build(this.superNode.isXpdrSrgAbsent(),this.superNode.getSuperNodeId(), zend);
}
}
}
public SuperNode getSuperNode() {
- return superNode;
+ return this.superNode;
}
public void setSuperNode(SuperNode superNode) {
}
public List<AToZDirection> getAtoz() {
- return atoz;
+ return this.atoz;
}
public void setAtoz(List<AToZDirection> atoz) {
}
public List<ZToADirection> getZtoa() {
- return ztoa;
+ return this.ztoa;
}
public void setZtoa(List<ZToADirection> ztoa) {
}
public List<NodePath> getNodepaths() {
- return nodepaths;
+ return this.nodepaths;
}
public void setNodepaths(List<NodePath> nodepaths) {
package org.opendaylight.transportpce.stubpce.topology;
import com.google.common.collect.Lists;
-
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.SortedSet;
import java.util.TreeSet;
-
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
*/
private Boolean endNode(String end, List<String> supernodes) {
Boolean result = false;
- if (end != null && end.compareTo(" ") != 0) {
+ if ((end != null) && (end.compareTo(" ") != 0)) {
for (String node : supernodes) {
if (node.compareTo(end) == 0) {
result = true;
*/
public SuperNode getSuperNode(String nodeId) {
SuperNode result = null;
- if (network != null) {
- for (SuperNode tmp : network.getSuperNodes()) {
+ if (this.network != null) {
+ for (SuperNode tmp : this.network.getSuperNodes()) {
if (tmp.getSuperNodeId().compareTo(nodeId) == 0) {
result = tmp;
break;
if (tmp.startsWith(zend)) {
ztoalink = tmp;
}
- if (atozlink != null && ztoalink != null) {
+ if ((atozlink != null) && (ztoalink != null)) {
result.add(atozlink.concat("/").concat(ztoalink));
atozlink = null;
ztoalink = null;
*/
private List<String> getSuperNodeId() {
List<String> result = new ArrayList<String>();
- if (network.getSuperNodes().size() > 0) {
- for (SuperNode tmp : network.getSuperNodes()) {
+ if (this.network.getSuperNodes().size() > 0) {
+ for (SuperNode tmp : this.network.getSuperNodes()) {
result.add(tmp.getSuperNodeId());
}
}
*/
private List<String> getRoadmLinks() {
List<String> result = new ArrayList<String>();
- if (network.getRoadmToroadm().getLinks().size() > 0) {
- for (String tmp : network.getRoadmToroadm().getLinks()) {
+ if (this.network.getRoadmToroadm().getLinks().size() > 0) {
+ for (String tmp : this.network.getRoadmToroadm().getLinks()) {
result.add(tmp);
}
}
ztoa.add(split[1]);
}
}
- if (!atoz.isEmpty() && atoz.size() == ztoa.size()) {
+ if (!atoz.isEmpty() && (atoz.size() == ztoa.size())) {
NodeLinkNode node = new NodeLinkNode(aend, zend, atoz,ztoa,direct);
- paths.add(node);
+ this.paths.add(node);
}
} else {
* @param zend ending extremity path
*/
public void run(String aend, String zend) {
- if (network != null) {
+ if (this.network != null) {
List<String> supernodes = getSuperNodeId();
List<String> roadmLinks = getRoadmLinks();
- if (aend != null && zend != null) {
+ if ((aend != null) && (zend != null)) {
int size = supernodes.size();
String hop = null;
List<String> links = null;
AToZ atoz = it.next();
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription
.rev170426.pce.resource.resource.Resource res = atoz.getResource().getResource();
- int tmpkey = order + Integer.parseInt(atoz.getKey().getId());
+ int tmpkey = order + Integer.parseInt(atoz.key().getId());
AToZKey atozKey = new AToZKey(Integer.toString(tmpkey));
org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
.pathdescription.rev170426.pce.resource.Resource resource = new ResourceBuilder()
.setResource(res).build();
- AToZ hop = new AToZBuilder().setId(atozKey.getId()).setKey(atozKey).setResource(resource).build();
+ AToZ hop = new AToZBuilder().setId(atozKey.getId()).withKey(atozKey).setResource(resource).build();
it.remove();
it.add(hop);
tmpkey++;
*/
public List<String> getDeg(String atozLink, String ztoaLink) {
List<String> result = new ArrayList<String>();
- if (atozLink != null && ztoaLink != null) {
+ if ((atozLink != null) && (ztoaLink != null)) {
String [] split = atozLink.split("-", 4);
if (split.length == 4) {
result = Lists.newArrayList(split[1],split[3]);
}
if (resource != null) {
hop = new ZToABuilder()
- .setKey(ztoaKey)
+ .withKey(ztoaKey)
.setResource(resource)
.build();
ztoaList.add(hop);
ztoadirList.add(ztodir);
}
}
- if (!ztoadirList.isEmpty() && size == ztoadirList.size()) {
+ if (!ztoadirList.isEmpty() && (size == ztoadirList.size())) {
LOG.info("building PathDescriptions ...");
int index = 1;
String pathName = null;
if (split.length == 4) {
String aend = split[0].replaceAll("ROADM", "Node");
String zend = split[2].replaceAll("ROADM", "Node");
- if (aend != null && zend != null) {
+ if ((aend != null) && (zend != null)) {
LOG.info("getting super node for : {} and {}", aend, zend);
SuperNode aendSp = getSuperNode(aend);
SuperNode zendSp = getSuperNode(zend);
- if (aendSp != null && zendSp != null) {
+ if ((aendSp != null) && (zendSp != null)) {
result.add(aendSp);
result.add(zendSp);
}
String ztoaLink = null;
atozLink = tmp.getAtozLink().get(0);
ztoaLink = tmp.getZtoaLink().get(0);
- if (atozLink != null && ztoaLink != null) {
+ if ((atozLink != null) && (ztoaLink != null)) {
LOG.info("atozlink : {}", atozLink);
LOG.info("ztoalink : {}", ztoaLink);
InterNodePath interAend = new InterNodePath(aendSp);
int loop = 0;
while (loop < 2) {
List<SuperNode> hop = getSuperNodeEndLink(atozLinks.get(loop));
- if (!hop.isEmpty() && hop.size() == 2) {
+ if (!hop.isEmpty() && (hop.size() == 2)) {
aendSp = hop.get(0);
zendSp = hop.get(1);
InterNodePath interAend = new InterNodePath(aendSp);
LOG.info("interZend : {}", interZend.getAtoz().toString());
List<String> deg1 = getDeg(atozLinks.get(loop),ztoaLinks.get(loop));
LOG.info("deg1 : {}", deg1.toString());
- if (!deg1.isEmpty() && deg1.size() == 2) {
+ if (!deg1.isEmpty() && (deg1.size() == 2)) {
List<AToZDirection> cleanInterA = null;
List<AToZDirection> cleanInterZ = null;
if (zendSp.getSuperNodeId().compareTo(zend) == 0) {
}
public List<NodeLinkNode> getPaths() {
- return paths;
+ return this.paths;
}
public void setPaths(List<NodeLinkNode> paths) {
<version>0.2.0-SNAPSHOT</version>
<packaging>bundle</packaging>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>netconf-artifacts</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>transportpce-stubmodels</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-topology</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>sal-netconf-connector</artifactId>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
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.Executors;
-import java.util.concurrent.Future;
-
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs;
import org.opendaylight.transportpce.stubrenderer.StubrendererCompliancyCheck;
}
@Override
- public Future<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
+ public ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
ServiceImplementationRequestInput input) {
LOG.info("RPC serviceImplementationRequest request received");
String responseCode = "";
String message = "";
ConfigurationResponseCommonBuilder configurationResponseCommon = null;
- compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
- if (compliancyCheck.check(false, true)) {
+ this.compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
+ if (this.compliancyCheck.check(false, true)) {
LOG.info("Service compliant !");
/**
* If compliant, service-request parameters are verified in order to
* a path and implement a service.
*/
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
.setServiceName(input.getServiceName())
.setStatus(RpcStatusEx.Pending)
.setStatusMessage("Service compliant, submitting serviceImplementation Request ...")
.build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
+ SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor);
FutureCallback<Boolean> rendererCallback =
new FutureCallback<Boolean>() {
String message = "";
public void onFailure(Throwable arg0) {
LOG.error("Failure message : {}", arg0.toString());
LOG.error("Service implementation failed !");
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("PCR Request failed : {}" + arg0.getMessage()).build();
try {
- notificationPublishService.putNotification(notification);
+ StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
public void onSuccess(Boolean response) {
LOG.info("response : {}", response);
if (response) {
- message = "Service implemented !";
+ this.message = "Service implemented !";
TopologyBuilder topo = sendingRenderer.getTopology();
ServiceRpcResultSpBuilder tmp = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
.setServiceName(input.getServiceName())
.setStatus(RpcStatusEx.Successful)
- .setStatusMessage(message);
+ .setStatusMessage(this.message);
if (topo != null) {
PathTopology value = new PathTopologyBuilder()
.setAToZ(topo.getAToZ())
.build();
tmp.setPathTopology(value);
}
- notification = tmp.build();
+ this.notification = tmp.build();
} else {
- message = "Service implementation failed : " + sendingRenderer.getError();
- notification = new ServiceRpcResultSpBuilder()
+ this.message = "Service implementation failed : " + sendingRenderer.getError();
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
.setServiceName("")
- .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
+ .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message)
.build();
}
- LOG.info(notification.toString());
+ LOG.info(this.notification.toString());
try {
- notificationPublishService.putNotification(notification);
+ StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- LOG.info(message);
+ LOG.info(this.message);
}
};
ListenableFuture<Boolean> renderer = sendingRenderer.serviceImplementation();
- Futures.addCallback(renderer, rendererCallback, executor);
+ Futures.addCallback(renderer, rendererCallback, this.executor);
LOG.info("Service implmentation Request in progress ");
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setAckFinalIndicator("Yes")
.build();
return RpcResultBuilder.success(output).buildFuture();
} else {
- message = compliancyCheck.getMessage();
+ message = this.compliancyCheck.getMessage();
responseCode = "500";
LOG.info("Service not compliant caused by : {}", message);
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("Service not compliant caused by : " + message)
.build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
}
@Override
- public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
+ public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
String message = "";
LOG.info("RPC serviceDelete request received");
String responseCode = "";
ConfigurationResponseCommonBuilder configurationResponseCommon = null;
- compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
- if (compliancyCheck.check(false, true)) {
+ this.compliancyCheck = new StubrendererCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
+ if (this.compliancyCheck.check(false, true)) {
LOG.info("Service compliant !");
/**
* If compliant, service-request parameters are verified in order to
* a path and implement a service.
*/
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName())
.setStatus(RpcStatusEx.Pending)
.setStatusMessage("Service compliant, submitting serviceDelete Request ...")
.build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
+ SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(this.executor);
FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
String message = "";
ServiceRpcResultSp notification = null;
public void onFailure(Throwable arg0) {
LOG.error("Failure message : {}", arg0.toString());
LOG.error("Service delete failed !");
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("PCR Request failed : " + arg0.getMessage()).build();
try {
- notificationPublishService.putNotification(notification);
+ StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
public void onSuccess(Boolean response) {
LOG.info("response : {}", response);
if (response) {
- message = "Service deleted !";
- notification = new ServiceRpcResultSpBuilder()
+ this.message = "Service deleted !";
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
- .setStatusMessage(message).build();
+ .setStatusMessage(this.message).build();
} else {
- message = "Service delete failed : " + sendingRenderer.getError();
- notification = new ServiceRpcResultSpBuilder()
+ this.message = "Service delete failed : " + sendingRenderer.getError();
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName("")
- .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
+ .setStatus(RpcStatusEx.Failed).setStatusMessage(this.message)
.build();
}
- LOG.info(notification.toString());
+ LOG.info(this.notification.toString());
try {
- notificationPublishService.putNotification(notification);
+ StubrendererImpl.this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}
- LOG.info(message);
+ LOG.info(this.message);
}
};
ListenableFuture<Boolean> renderer = sendingRenderer.serviceDelete();
- Futures.addCallback(renderer, rendererCallback, executor);
+ Futures.addCallback(renderer, rendererCallback, this.executor);
message = "Service delete Request in progress ...";
LOG.info(message);
configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.build();
return RpcResultBuilder.success(output).buildFuture();
} else {
- message = compliancyCheck.getMessage();
+ message = this.compliancyCheck.getMessage();
LOG.info("Service not compliant caused by : {}", message);
responseCode = "500";
- notification = new ServiceRpcResultSpBuilder()
+ this.notification = new ServiceRpcResultSpBuilder()
.setNotificationType(ServicePathNotificationTypes.ServiceDelete)
.setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
.setStatusMessage("Service not compliant caused by : " + message)
.build();
try {
- notificationPublishService.putNotification(notification);
+ this.notificationPublishService.putNotification(this.notification);
} catch (InterruptedException e) {
LOG.info("notification offer rejected : {}", e);
}