}
OpenroadmNodeType nodeType = node1.getNodeType();
- PceOpticalNode pceNode = new PceOpticalNode(node, nodeType, node.getNodeId(),
- input.getServiceAEnd().getServiceFormat(), "optical");
- pceNode.validateAZxponder(anodeId, znodeId);
+ PceOpticalNode pceNode = new PceOpticalNode(node, nodeType);
+ pceNode.validateAZxponder(anodeId, znodeId, input.getServiceAEnd().getServiceFormat());
pceNode.initWLlist();
if (!pceNode.isValid()) {
this.azSrgs.add(nodeId);
break;
case XPONDER:
- pceNode.initXndrTps();
+ pceNode.initXndrTps(input.getServiceAEnd().getServiceFormat());
break;
default:
LOG.warn("endPceNode: Node {} is not SRG or XPONDER !", nodeId);
import org.opendaylight.transportpce.pce.SortPortsByName;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.Node1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.networks.network.node.termination.point.pp.attributes.UsedWavelength;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.available.freq.map.AvailFreqMapsKey;
private boolean valid = true;
- private final Node node;
- private final NodeId nodeId;
- private final OpenroadmNodeType nodeType;
- private final ServiceFormat serviceFormat;
- private final String pceNodeType;
+ private Node node;
+ private NodeId nodeId;
+ private OpenroadmNodeType nodeType;
// wavelength calculation per node type
private List<Long> availableWLindex = new ArrayList<>();
private Map<String, String> clientPerNwTp = new HashMap<>();
private final AvailFreqMapsKey freqMapKey = new AvailFreqMapsKey(GridConstant.C_BAND);
- public PceOpticalNode(Node node, OpenroadmNodeType nodeType, NodeId nodeId, ServiceFormat serviceFormat,
- String pceNodeType) {
- this.node = node;
- this.nodeId = nodeId;
- this.nodeType = nodeType;
- this.serviceFormat = serviceFormat;
- this.pceNodeType = pceNodeType;
-
- if ((node == null) || (nodeId == null) || (nodeType == null)) {
+ public PceOpticalNode(Node node, OpenroadmNodeType nodeType) {
+ if (node != null && node.getNodeId() != null && nodeType != null) {
+ this.node = node;
+ this.nodeId = node.getNodeId();
+ this.nodeType = nodeType;
+ } else {
LOG.error("PceNode: one of parameters is not populated : nodeId, node type");
this.valid = false;
}
TerminationPoint1 cntp1 = tp.augmentation(TerminationPoint1.class);
org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529.TerminationPoint1 nttp1 = tp
.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev200529
- .TerminationPoint1.class);
+ .TerminationPoint1.class);
OpenroadmTpType type = cntp1.getTpType();
LOG.info("type = {} for tp {}", type.getName(), tp);
case SRGRXPP:
case SRGTXPP:
case SRGTXRXPP:
- boolean used = true;
LOG.info("initSrgTpList: SRG-PP tp = {} found", tp.getTpId().getValue());
- try {
- List<UsedWavelength> usedWavelengths =
- new ArrayList<>(nttp1.getPpAttributes().getUsedWavelength().values());
- if (usedWavelengths.isEmpty()) {
- used = false;
- }
- } catch (NullPointerException e) {
- LOG.warn("initSrgTpList: 'usedWavelengths' for tp={} is null !", tp.getTpId().getValue());
- used = false;
- }
- if (!used) {
+ if (nttp1 == null || nttp1.getPpAttributes() == null
+ || nttp1.getPpAttributes().getUsedWavelength() == null
+ || nttp1.getPpAttributes().getUsedWavelength().values().isEmpty()) {
LOG.info("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
this.availableSrgPp.put(tp.getTpId().getValue(), cntp1.getTpType());
} else {
LOG.debug("initWLlist: availableWLindex size = {} in {}", this.availableWLindex.size(), this);
}
- public void initXndrTps() {
+ public void initXndrTps(ServiceFormat serviceFormat) {
LOG.info("PceNod: initXndrTps for node : {}", this.nodeId);
if (!isValid()) {
return;
LOG.error("initXndrTps: XPONDER {} NW TP doesn't have defined Client {}",
this, tp.getTpId().getValue());
}
- } else if (ServiceFormat.OTU.equals(this.serviceFormat)) {
+ } else if (ServiceFormat.OTU.equals(serviceFormat)) {
LOG.info("Infrastructure OTU4 connection");
this.valid = true;
} else {
- LOG.error("Service Format {} not managed yet", this.serviceFormat.getName());
+ LOG.error("Service Format {} not managed yet", serviceFormat.getName());
}
}
}
}
- public void validateAZxponder(String anodeId, String znodeId) {
+ public void validateAZxponder(String anodeId, String znodeId, ServiceFormat serviceFormat) {
if (!isValid()) {
return;
}
// Detect A and Z
if (this.getSupNetworkNodeId().equals(anodeId) || (this.getSupNetworkNodeId().equals(znodeId))) {
LOG.info("validateAZxponder: A or Z node detected == {}", nodeId.getValue());
- initXndrTps();
+ initXndrTps(serviceFormat);
return;
}
LOG.debug("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue());
@Override
public String getPceNodeType() {
- return this.pceNodeType;
+ return "optical";
}
@Override
import org.opendaylight.transportpce.pce.utils.PceTestData;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeBuilder;
// Link link=genereateLinkBuilder();
NodeBuilder node1Builder = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes());
- node = node1Builder.build();
+ node = node1Builder.setNodeId(new NodeId("test")).build();
PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-2-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
+ OpenroadmNodeType.SRG);
PceOpticalNode pceOpticalNode2 = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-1-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
+ OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
pceLink.setClient("XPONDER-CLIENT");
@Test
public void getIncludePceNodesTest() {
Assert.assertTrue(pceConstraints.getIncludePceNodes().size() == 0);
- pceConstraints.setIncludePceNode(new PceOpticalNode(null, null, null, null, null));
+ pceConstraints.setIncludePceNode(new PceOpticalNode(null, null));
Assert.assertTrue(pceConstraints.getIncludePceNodes().size() == 1);
}
import org.opendaylight.transportpce.pce.networkanalyzer.PceOpticalNode;
import org.opendaylight.transportpce.pce.utils.NodeUtils;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
// Link link=genereateLinkBuilder();
node = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes()).build();
- PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-2-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
- PceOpticalNode pceOpticalNode2 = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-1-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
+ PceOpticalNode pceOpticalNode = new PceOpticalNode(node, OpenroadmNodeType.SRG);
+ PceOpticalNode pceOpticalNode2 = new PceOpticalNode(node, OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
pceLink.setClient("XPONDER-CLIENT");
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.NodeKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
public class PceGraphTest {
"OpenROADM-3-1-DEG1",
"DEG1-TTP-TX", "DEG1-TTP-RX").build();
- node = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes()).build();
-
- pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-2-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
+ NodeId nodeId = new NodeId("OpenROADM-3-2-DEG1");
+ node = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes())
+ .setNodeId(nodeId).withKey(new NodeKey(nodeId))
+ .build();
+ pceOpticalNode = new PceOpticalNode(node, OpenroadmNodeType.DEGREE);
pceOpticalNode.checkWL(1);
pceOpticalNode.checkWL(2);
-
- pceOpticalNode2 = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("OpenROADM-3-1-DEG1"), ServiceFormat.Ethernet,
- "DEGREE");
+ NodeId nodeId2 = new NodeId("OpenROADM-3-1-DEG1");
+ Node node2 = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes())
+ .setNodeId(nodeId2).withKey(new NodeKey(nodeId2)).build();
+ pceOpticalNode2 = new PceOpticalNode(node2, OpenroadmNodeType.DEGREE);
pceOpticalNode2.checkWL(1);
pceOpticalNode2.checkWL(2);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
// init PceHardContraints
pceHardConstraints = new PceConstraints();
// pceHardConstraints.setp
- allPceNodes = Map.of(new NodeId("OpenROADM-3-2-DEG1"), pceOpticalNode,
- new NodeId("OpenROADM-3-1-DEG1"), pceOpticalNode2);
+ allPceNodes = Map.of(nodeId, pceOpticalNode, nodeId2, pceOpticalNode2);
rc = new PceResult();
pceGraph = new PceGraph(pceOpticalNode, pceOpticalNode2, allPceNodes,
pceHardConstraints,
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
Link link = createRoadmToRoadm("srcNode",
"destNode",
"srcTp", "destTp").build();
-
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes());
- Node node = node1Builder.build();
-
- PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ Node node = node1Builder.setNodeId(new NodeId("test")).build();
+ PceOpticalNode pceOpticalNode = new PceOpticalNode(node, OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
}
"srcTp", "destTp").build();
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes());
- Node node = node1Builder.build();
-
- PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ Node node = node1Builder.setNodeId(new NodeId("test")).build();
+ PceOpticalNode pceOpticalNode = new PceOpticalNode(node, OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
}
"srcTp", "destTp").build();
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes());
- Node node = node1Builder.build();
-
+ Node node = node1Builder.setNodeId(new NodeId("test")).build();
PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
}
"srcTp", "destTp").build();
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes());
- Node node = node1Builder.build();
-
+ Node node = node1Builder.setNodeId(new NodeId("test")).build();
PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
}
"srcTp", "destTp").build();
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes());
- Node node = node1Builder.build();
-
+ Node node = node1Builder.setNodeId(new NodeId("test")).build();
PceOpticalNode pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.SRG);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
Assert.assertNotNull(MapUtils.getOmsAttributesSpan(link));
Assert.assertNotNull(pceLink.calcSpanOSNR());
@Before
public void setUp() {
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes(), OpenroadmTpType.SRGTXRXPP);
- node = node1Builder.build();
+ node = node1Builder.setNodeId(new NodeId("test")).build();
}
@Test
public void isValidTest() {
OpenroadmNodeType nodeType = OpenroadmNodeType.ROADM;
- ServiceFormat serviceFormat = ServiceFormat.Ethernet;
- String pceNodeType = "pceNodeType";
- pceOpticalNode = new PceOpticalNode(node, nodeType, new NodeId("node_test"), serviceFormat, pceNodeType);
+ pceOpticalNode = new PceOpticalNode(node, nodeType);
Assert.assertTrue(pceOpticalNode.isValid());
}
public void testInitSrgTps() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.ROADM);
pceOpticalNode.initSrgTps();
- pceOpticalNode.initXndrTps();
+ pceOpticalNode.initXndrTps(ServiceFormat.OMS);
pceOpticalNode.initWLlist();
Assert.assertFalse(pceOpticalNode.isValid());
Assert.assertFalse(pceOpticalNode.checkWL(12));
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes(), OpenroadmTpType.XPONDERNETWORK);
Node specificNode = node1Builder.build();
pceOpticalNode = new PceOpticalNode(specificNode,
- OpenroadmNodeType.SRG, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.SRG);
pceOpticalNode.initWLlist();
Assert.assertTrue(pceOpticalNode.isValid());
Assert.assertTrue(pceOpticalNode.checkWL(12));
@Test
public void testInitXndrTpDegTypes() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.DEGREE, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.DEGREE);
pceOpticalNode.initWLlist();
Assert.assertTrue(pceOpticalNode.isValid());
Assert.assertFalse(pceOpticalNode.checkWL(12));
@Test
public void testInitXndrTpXpondrTypes() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.XPONDER, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.XPONDER);
pceOpticalNode.initWLlist();
Assert.assertTrue(pceOpticalNode.isValid());
Assert.assertTrue(pceOpticalNode.checkWL(12));
@Test
public void testInitWLlist() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
- pceOpticalNode.initXndrTps();
+ OpenroadmNodeType.ROADM);
+ pceOpticalNode.initXndrTps(ServiceFormat.OMS);
pceOpticalNode.initWLlist();
Assert.assertFalse(pceOpticalNode.isValid());
Assert.assertFalse(pceOpticalNode.checkWL(12));
@Test
public void testGetRdmSrgClient() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.ROADM);
pceOpticalNode.initSrgTps();
Assert.assertNull(pceOpticalNode.getRdmSrgClient("7"));
Assert.assertFalse(pceOpticalNode.isValid());
@Test
public void testGetRdmSrgClientEmpty() {
NodeBuilder node1Builder = getNodeBuilderEmpty(geSupportingNodes(), OpenroadmTpType.SRGTXRXPP);
- Node specificNode = node1Builder.build();
+ Node specificNode = node1Builder.setNodeId(new NodeId("test")).build();
pceOpticalNode = new PceOpticalNode(specificNode,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.ROADM);
pceOpticalNode.initSrgTps();
pceOpticalNode.initWLlist();
- pceOpticalNode.initXndrTps();
+ pceOpticalNode.initXndrTps(ServiceFormat.OMS);
Assert.assertNull(pceOpticalNode.getRdmSrgClient("7"));
Assert.assertFalse(pceOpticalNode.isValid());
Assert.assertFalse(pceOpticalNode.checkWL(12));
@Test
public void testGetRdmSrgClientDeg() {
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.DEGREE, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.DEGREE);
pceOpticalNode.initSrgTps();
Assert.assertNull(pceOpticalNode.getRdmSrgClient("7"));
Assert.assertFalse(pceOpticalNode.isValid());
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes(), OpenroadmTpType.SRGTXCP);
Node specificNode = node1Builder.build();
pceOpticalNode = new PceOpticalNode(specificNode,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.ROADM);
pceOpticalNode.initSrgTps();
Assert.assertFalse(pceOpticalNode.isValid());
Assert.assertFalse(pceOpticalNode.checkWL(12));
NodeBuilder node1Builder = getNodeBuilder(geSupportingNodes(), OpenroadmTpType.DEGREERXTTP);
node = node1Builder.build();
pceOpticalNode = new PceOpticalNode(node,
- OpenroadmNodeType.ROADM, new NodeId("optical"), ServiceFormat.OMS, "test");
+ OpenroadmNodeType.ROADM);
pceOpticalNode.initSrgTps();
Assert.assertNull(pceOpticalNode.getRdmSrgClient("2"));
Assert.assertFalse(pceOpticalNode.isValid());