2 * Copyright © 2020 Orange Labs, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.networkmodel.util;
10 import static org.hamcrest.CoreMatchers.containsString;
11 import static org.hamcrest.CoreMatchers.either;
12 import static org.hamcrest.CoreMatchers.hasItem;
13 import static org.hamcrest.CoreMatchers.hasItems;
14 import static org.hamcrest.CoreMatchers.not;
15 import static org.hamcrest.MatcherAssert.assertThat;
16 import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
17 import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertNotNull;
20 import static org.junit.Assert.assertNull;
21 import static org.junit.Assert.assertTrue;
22 import static org.junit.Assert.fail;
24 import com.google.gson.stream.JsonReader;
25 import java.io.FileReader;
26 import java.io.IOException;
27 import java.io.Reader;
28 import java.nio.charset.StandardCharsets;
29 import java.util.ArrayList;
30 import java.util.HashMap;
31 import java.util.List;
33 import java.util.stream.Collectors;
34 import org.junit.Test;
35 import org.opendaylight.transportpce.networkmodel.dto.TopologyShard;
36 import org.opendaylight.transportpce.networkmodel.util.test.JsonUtil;
37 import org.opendaylight.transportpce.networkmodel.util.test.NetworkmodelTestUtil;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.Network;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingKey;
43 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
44 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.NodesBuilder;
45 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.nodes.NodeInfoBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.OduSwitchingPools;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmLinkType;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmNodeType;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmTpType;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODU2;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODU2e;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODU4;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Link1;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.networks.network.node.SwitchingPools;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If100GE;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If100GEODU4;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GE;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2e;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCH;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4;
67 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
68 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.node.SupportingNode;
69 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
70 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
71 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkBuilder;
72 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
73 import org.opendaylight.yangtools.yang.common.QName;
74 import org.opendaylight.yangtools.yang.common.Uint16;
75 import org.opendaylight.yangtools.yang.common.Uint32;
76 import org.slf4j.Logger;
77 import org.slf4j.LoggerFactory;
79 public class OpenRoadmOtnTopologyTest {
81 private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmOtnTopologyTest.class);
82 private Nodes portMappingTpdr;
83 private Nodes portMappingSpdr;
84 private Nodes portMappingBad;
86 public OpenRoadmOtnTopologyTest() {
87 try (Reader reader = new FileReader("src/test/resources/portMapping.json", StandardCharsets.UTF_8);
88 JsonReader portMappingReader = new JsonReader(reader)) {
89 Network portMapping = (Network) JsonUtil.getInstance().getDataObjectFromJson(portMappingReader,
90 QName.create("http://org/opendaylight/transportpce/portmapping", "2022-03-16", "network"));
91 for (Nodes nodes : portMapping.nonnullNodes().values()) {
92 if (nodes.getNodeId().equals("XPDR-A1")) {
93 this.portMappingTpdr = nodes;
95 this.portMappingSpdr = nodes;
98 Map<MappingKey,Mapping> mappingList = new HashMap<>();
99 Mapping mapping = new MappingBuilder().setLogicalConnectionPoint("XPDR0-NETWORK0").build();
100 mappingList.put(mapping.key(),mapping);
101 this.portMappingBad = new NodesBuilder()
102 .setNodeId(this.portMappingTpdr.getNodeId())
103 .setNodeInfo(new NodeInfoBuilder(this.portMappingTpdr.getNodeInfo()).setNodeType(NodeTypes.Ila).build())
104 .setMapping(mappingList)
106 LOG.info("tpdr portMapping = {}", this.portMappingTpdr.toString());
107 LOG.info("spdr portMapping = {}", this.portMappingSpdr.toString());
108 LOG.info("ila portMapping = {}", this.portMappingBad.toString());
109 } catch (IOException e) {
110 LOG.error("Cannot init OpenRoadmOtnTopologyTest ", e);
111 fail("Cannot init OpenRoadmOtnTopologyTest ");
116 public void createTopologyShardForTpdrTest() {
117 TopologyShard topologyShard = OpenRoadmOtnTopology.createTopologyShard(this.portMappingTpdr);
118 assertNotNull("TopologyShard should never be null", topologyShard);
119 assertEquals("Should contain a single node", 1, topologyShard.getNodes().size());
120 assertEquals("Should contain no link", 0, topologyShard.getLinks().size());
121 Node node = topologyShard.getNodes().get(0);
122 assertEquals("XPDR-A1-XPDR1", node.getNodeId().getValue());
123 // tests supporting nodes
124 List<SupportingNode> supportingNodes = node.nonnullSupportingNode().values().stream()
125 .sorted((sn1, sn2) -> sn1.getNetworkRef().getValue().compareTo(sn2.getNetworkRef().getValue()))
126 .collect(Collectors.toList());
127 assertEquals("Should contain 3 supporting nodes", 3, supportingNodes.size());
128 assertEquals("clli-network", supportingNodes.get(0).getNetworkRef().getValue());
129 assertEquals("NodeA", supportingNodes.get(0).getNodeRef().getValue());
130 assertEquals("openroadm-network", supportingNodes.get(1).getNetworkRef().getValue());
131 assertEquals("XPDR-A1", supportingNodes.get(1).getNodeRef().getValue());
132 assertEquals("openroadm-topology", supportingNodes.get(2).getNetworkRef().getValue());
133 assertEquals("XPDR-A1-XPDR1", supportingNodes.get(2).getNodeRef().getValue());
134 assertEquals(OpenroadmNodeType.TPDR, node.augmentation(Node1.class).getNodeType());
138 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Node1.class)
142 List<TerminationPoint> tps = node.augmentation(
143 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
144 .nonnullTerminationPoint().values().stream()
145 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
146 .collect(Collectors.toList());
147 assertEquals("node should contain 4 TPs", 4, tps.size());
149 assertEquals("XPDR1-CLIENT1", tps.get(0).getTpId().getValue());
153 .augmentation(TerminationPoint1.class)
154 .getAssociatedConnectionMapTp()
159 "only If100GE interface capabitily expected",
161 tps.get(0).augmentation(
162 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
163 .TerminationPoint1.class)
164 .getTpSupportedInterfaces()
165 .getSupportedInterfaceCapability()
169 tps.get(0).augmentation(
170 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
171 .TerminationPoint1.class)
172 .getTpSupportedInterfaces().nonnullSupportedInterfaceCapability()
173 .values().stream().findFirst()
174 .get().getIfCapType());
176 "first TP must be of type client",
177 OpenroadmTpType.XPONDERCLIENT,
178 tps.get(0).augmentation(TerminationPoint1.class).getTpType());
180 assertEquals("XPDR1-NETWORK1", tps.get(2).getTpId().getValue());
183 tps.get(2).augmentation(TerminationPoint1.class)
184 .getAssociatedConnectionMapTp()
189 "only IfOCH interface capabitily expected",
191 tps.get(2).augmentation(
192 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
193 .TerminationPoint1.class)
194 .getTpSupportedInterfaces()
195 .getSupportedInterfaceCapability()
199 tps.get(2).augmentation(
200 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
201 .TerminationPoint1.class)
202 .getTpSupportedInterfaces()
203 .getSupportedInterfaceCapability()
204 .values().stream().findFirst()
208 "the rate should be null",
209 tps.get(2).augmentation(
210 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
211 .TerminationPoint1.class)
212 .getXpdrTpPortConnectionAttributes()
215 "third TP must be of type network",
216 OpenroadmTpType.XPONDERNETWORK,
217 tps.get(2).augmentation(TerminationPoint1.class).getTpType());
221 public void createTopologyShardForSpdrTest() {
222 TopologyShard topologyShard = OpenRoadmOtnTopology.createTopologyShard(this.portMappingSpdr);
223 assertNotNull("TopologyShard should never be null", topologyShard);
224 assertEquals("Should contain two nodes", 2, topologyShard.getNodes().size());
225 assertEquals("Should contain no link", 0, topologyShard.getLinks().size());
226 List<Node> nodes = topologyShard.getNodes().stream()
227 .sorted((n1, n2) -> n1.getNodeId().getValue().compareTo(n2.getNodeId().getValue()))
228 .collect(Collectors.toList());
229 for (Node node : nodes) {
235 public void createOtnLinksForOTU4NormalTest() {
236 String nodeA = "SPDRA";
237 String tpA = "XPDR1-NETWORK1";
238 String nodeZ = "SPDRZ";
239 String tpZ = "XPDR1-NETWORK1";
240 List<Link> links = OpenRoadmOtnTopology.createOtnLinks(nodeA, tpA, nodeZ, tpZ, OtnLinkType.OTU4).getLinks();
241 assertEquals("2 OTU4 links should have been created", 2, links.size());
242 List<Link> sortedLinks = links.stream()
243 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
244 .collect(Collectors.toList());
246 "name of OTU4 linkid AZ",
247 "OTU4-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1",
248 sortedLinks.get(0).getLinkId().getValue());
250 "name of OTU4 linkid ZA",
251 "OTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1",
252 sortedLinks.get(1).getLinkId().getValue());
253 assertEquals("SPDRA-XPDR1", sortedLinks.get(0).getSource().getSourceNode().getValue());
254 assertEquals("SPDRZ-XPDR1", sortedLinks.get(0).getDestination().getDestNode().getValue());
255 assertEquals("SPDRZ-XPDR1", sortedLinks.get(1).getSource().getSourceNode().getValue());
256 assertEquals("SPDRA-XPDR1", sortedLinks.get(1).getDestination().getDestNode().getValue());
258 "available BW at OTU4 creation should be 100G (100000)",
259 Uint32.valueOf(100000),
260 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
262 "used BW at OTU4 creation should be 0",
264 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
266 OpenroadmLinkType.OTNLINK,
267 sortedLinks.get(0).augmentation(
268 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1.class)
271 "opposite link must be present",
272 "OTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1",
273 sortedLinks.get(0).augmentation(
274 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1.class)
278 "otn link type should be OTU4",
280 sortedLinks.get(0).augmentation(
281 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.Link1.class)
286 public void createOtnLinksForNotManagedOtnlinktypeTest() {
287 String nodeA = "SPDRA";
288 String tpA = "XPDR1-NETWORK1";
289 String nodeZ = "SPDRZ";
290 String tpZ = "XPDR1-NETWORK1";
291 TopologyShard topoShard = OpenRoadmOtnTopology.createOtnLinks(nodeA, tpA, nodeZ, tpZ, OtnLinkType.ODU0);
292 assertNotNull("TopologyShard should never be null", topoShard);
293 assertNull("TopologyShard should not contain any node", topoShard.getNodes());
294 assertNull("TopologyShard should not contain any link", topoShard.getLinks());
298 public void createOtnLinksForODU4NormalTest() {
299 TopologyShard topoShard = OpenRoadmOtnTopology
301 NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(100000)),
302 NetworkmodelTestUtil.createTpList(false), OtnLinkType.ODTU4);
303 assertNotNull("TopologyShard should never be null", topoShard);
304 assertNull("list of nodes should be null", topoShard.getNodes());
305 List<Link> sortedLinks = topoShard.getLinks().stream()
306 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
307 .collect(Collectors.toList());
308 assertEquals("list of links should contain 4 links", 4, sortedLinks.size());
309 assertTrue("link 3 should be of type OTU4", sortedLinks.get(2).getLinkId().getValue().startsWith("OTU4-"));
311 "after odu4 creation, available BW of supported OTU4 should be 0",
313 sortedLinks.get(2).augmentation(Link1.class).getAvailableBandwidth());
315 "after odu4 creation, used BW of supported OTU4 should be 100 000",
316 Uint32.valueOf(100000),
317 sortedLinks.get(2).augmentation(Link1.class).getUsedBandwidth());
320 "ODTU4-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1",
321 sortedLinks.get(0).getLinkId().getValue());
323 "ODTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1",
324 sortedLinks.get(1).getLinkId().getValue());
325 assertEquals("SPDRA-XPDR1", sortedLinks.get(0).getSource().getSourceNode().getValue());
326 assertEquals("SPDRZ-XPDR1", sortedLinks.get(0).getDestination().getDestNode().getValue());
327 assertEquals("SPDRZ-XPDR1", sortedLinks.get(1).getSource().getSourceNode().getValue());
328 assertEquals("SPDRA-XPDR1", sortedLinks.get(1).getDestination().getDestNode().getValue());
330 "after odu4 creation, its available BW should be 100 000",
331 Uint32.valueOf(100000),
332 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
334 "after odu4 creation, its used BW should be 0",
336 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
338 OpenroadmLinkType.OTNLINK,
341 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1.class)
344 "opposite link must be present",
345 "ODTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1",
348 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1.class)
352 "otn link type should be ODTU4",
355 .augmentation(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630
359 assertEquals("list of TPs should contain 2 updated TPs", 2, topoShard.getTps().size());
361 "after ODU4 creation, its termination point should contain a TsPool list",
362 topoShard.getTps().get(0)
364 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
365 .TerminationPoint1.class)
366 .getXpdrTpPortConnectionAttributes()
369 "Ts pool list should be full, with 80 trib slots",
371 topoShard.getTps().get(0)
373 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
374 .TerminationPoint1.class)
375 .getXpdrTpPortConnectionAttributes()
379 "after ODU4 creation, its termination point should contain a TpnPool list",
380 topoShard.getTps().get(0)
382 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
383 .TerminationPoint1.class)
384 .getXpdrTpPortConnectionAttributes()
385 .getOdtuTpnPool().values().stream().findFirst()
389 "Tpn pool list should be full, with 80 trib ports",
391 topoShard.getTps().get(0)
393 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
394 .TerminationPoint1.class)
395 .getXpdrTpPortConnectionAttributes()
396 .getOdtuTpnPool().values().stream().findFirst()
403 public void createOtnLinksForODU4WhenOTU4HaveBadBWParamsTest() {
404 List<Link> otu4Links = NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(100000));
405 List<Link> otu4LinksWithBadBWParam = new ArrayList<>();
406 for (Link link : otu4Links) {
407 otu4LinksWithBadBWParam.add(new LinkBuilder(link).removeAugmentation(Link1.class).build());
409 TopologyShard topoShard =
410 OpenRoadmOtnTopology.createOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(false),
412 assertNotNull("TopologyShard should never be null", topoShard);
413 assertNull("list of nodes should be null", topoShard.getNodes());
414 assertNull("list of links should be null", topoShard.getLinks());
415 assertNull("list of tps should be null", topoShard.getTps());
417 otu4LinksWithBadBWParam.clear();
419 OpenRoadmOtnTopology.createOtnLinks(
420 NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(99000)),
421 NetworkmodelTestUtil.createTpList(false), OtnLinkType.OTU4);
422 assertNull("list of nodes should be null", topoShard.getNodes());
423 assertNull("list of links should be null", topoShard.getLinks());
424 assertNull("list of tps should be null", topoShard.getTps());
428 public void deleteOtnLinksForODU4NormalTest() {
429 TopologyShard topoShard =
430 OpenRoadmOtnTopology.deleteOtnLinks(
431 NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(0)),
432 NetworkmodelTestUtil.createTpList(true), OtnLinkType.OTU4);
433 assertNotNull("TopologyShard should never be null", topoShard);
434 assertEquals("list of links should contain 2 links", 2, topoShard.getLinks().size());
436 "after ODU4 deletion, available BW of supported OTU4 should be 100 000",
437 Uint32.valueOf(100000),
438 topoShard.getLinks().get(0).augmentation(Link1.class).getAvailableBandwidth());
440 "after ODU4 deletion, used BW of supported OTU4 should be 0",
442 topoShard.getLinks().get(0).augmentation(Link1.class).getUsedBandwidth());
444 assertEquals("list of TPs should contain 2 updated TPs", 2, topoShard.getTps().size());
446 "after ODU4 deletion, its termination points should not contain any TsPool list",
447 topoShard.getTps().get(0)
449 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
450 .TerminationPoint1.class)
451 .getXpdrTpPortConnectionAttributes()
454 "after ODU4 deletion, its termination points should not contain any TpnPool list",
455 topoShard.getTps().get(0)
457 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
458 .TerminationPoint1.class)
459 .getXpdrTpPortConnectionAttributes()
464 public void deleteOtnLinksForODU4WhenOTU4HaveBadBWParamsTest() {
465 List<Link> otu4Links = NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(0));
466 List<Link> otu4LinksWithBadBWParam = new ArrayList<>();
467 for (Link link : otu4Links) {
468 otu4LinksWithBadBWParam.add(new LinkBuilder(link).removeAugmentation(Link1.class).build());
470 TopologyShard topoShard =
471 OpenRoadmOtnTopology.deleteOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(true),
473 assertNotNull("TopologyShard should never be null", topoShard);
474 assertNull("list of nodes should be null", topoShard.getNodes());
475 assertNull("list of links should be null", topoShard.getLinks());
476 assertNull("list of tps should be null", topoShard.getTps());
480 public void updateOtnLinksFor10GTest() {
481 // tests update for 10G creation
482 TopologyShard topoShard =
483 OpenRoadmOtnTopology.updateOtnLinks(
484 NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(100000)),
485 NetworkmodelTestUtil.createTpList(true),
486 Uint32.valueOf(10), (short)1, (short)1, (short)8, false);
487 assertNotNull("TopologyShard should never be null", topoShard);
488 assertNull("list of nodes should be null", topoShard.getNodes());
489 List<Link> sortedLinks = topoShard.getLinks().stream()
490 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
491 .collect(Collectors.toList());
492 assertEquals("list of links should contain 2 links", 2, sortedLinks.size());
493 assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-"));
495 "after 10G creation, available BW of supported ODU4 should be 90000",
496 Uint32.valueOf(90000),
497 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
499 "after 10G creation, used BW of supported ODU4 should be 10000",
500 Uint32.valueOf(10000),
501 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
504 "after 10G creation, 8 (over 80) trib slot should be occupied",
506 topoShard.getTps().get(0)
508 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
509 .TerminationPoint1.class)
510 .getXpdrTpPortConnectionAttributes()
514 "trib slot 1-8 should no longer be present in Trib slot list",
515 topoShard.getTps().get(0)
517 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
518 .TerminationPoint1.class)
519 .getXpdrTpPortConnectionAttributes()
521 not(hasItems(Uint16.valueOf(1), Uint16.valueOf(8))));
523 "trib slot 9 should always be present in trib slot list",
524 topoShard.getTps().get(0)
526 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
527 .TerminationPoint1.class)
528 .getXpdrTpPortConnectionAttributes()
530 hasItem(Uint16.valueOf(9)));
532 "after 10G creation, 1 (over 80) trib port should be occupied",
534 topoShard.getTps().get(0)
536 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
537 .TerminationPoint1.class)
538 .getXpdrTpPortConnectionAttributes()
539 .getOdtuTpnPool().values().stream().findFirst()
544 "trib port 1 should no longer be present",
545 topoShard.getTps().get(0)
547 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
548 .TerminationPoint1.class)
549 .getXpdrTpPortConnectionAttributes()
550 .getOdtuTpnPool().values().stream().findFirst()
553 not(hasItem(Uint16.valueOf(1))));
555 // tests update for 10G deletion
557 topoShard = OpenRoadmOtnTopology.updateOtnLinks(topoShard.getLinks(), topoShard.getTps(), Uint32.valueOf(10),
558 (short)1, (short)1, (short)8, true);
559 sortedLinks = topoShard.getLinks().stream()
560 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
561 .collect(Collectors.toList());
562 assertEquals("list of links should contain 2 links", 2, sortedLinks.size());
563 assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-"));
565 "after 10G deletion, available BW of supported ODU4 should be 100 000",
566 Uint32.valueOf(100000),
567 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
569 "after 10G deletion, used BW of supported ODU4 should be 0",
571 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
574 "after 10G deletion, trib slot list should be full",
576 topoShard.getTps().get(0)
578 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
579 .TerminationPoint1.class)
580 .getXpdrTpPortConnectionAttributes()
584 "after 10G deletion, trib slot list should contain items 1-8",
585 topoShard.getTps().get(0)
587 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
588 .TerminationPoint1.class)
589 .getXpdrTpPortConnectionAttributes()
591 hasItems(Uint16.valueOf(1), Uint16.valueOf(8), Uint16.valueOf(9)));
593 "after 10G deletion, trib port list should be full",
595 topoShard.getTps().get(0)
597 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
598 .TerminationPoint1.class)
599 .getXpdrTpPortConnectionAttributes()
600 .getOdtuTpnPool().values().stream().findFirst()
605 "after 10G deletion, trib port list should contain items 1",
606 topoShard.getTps().get(0)
608 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
609 .TerminationPoint1.class)
610 .getXpdrTpPortConnectionAttributes()
611 .getOdtuTpnPool().values().stream().findFirst()
614 hasItem(Uint16.valueOf(1)));
618 public void updateOtnLinksFor1GCreationTest() {
619 // tests update for 1G creation
620 TopologyShard topoShard =
621 OpenRoadmOtnTopology.updateOtnLinks(
622 NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(100000)),
623 NetworkmodelTestUtil.createTpList(true),
624 Uint32.valueOf(1), (short)1, (short)1, (short)1, false);
625 assertNotNull("TopologyShard should never be null", topoShard);
626 assertNull("list of nodes should be null", topoShard.getNodes());
627 List<Link> sortedLinks = topoShard.getLinks().stream()
628 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
629 .collect(Collectors.toList());
630 assertEquals("list of links should contain 2 links", 2, sortedLinks.size());
631 assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-"));
633 "after 1G creation, available BW of supported ODU4 should be 99000",
634 Uint32.valueOf(99000),
635 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
637 "after 1G creation, used BW of supported ODU4 should be 1000",
638 Uint32.valueOf(1000),
639 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
642 "after 1G creation, 1 (over 80) trib slot should be occupied",
644 topoShard.getTps().get(0)
646 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
647 .TerminationPoint1.class)
648 .getXpdrTpPortConnectionAttributes()
652 "trib slot 1 should no longer be present in Trib slot list",
653 topoShard.getTps().get(0)
655 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
656 .TerminationPoint1.class)
657 .getXpdrTpPortConnectionAttributes()
659 not(hasItem(Uint16.valueOf(1))));
661 "trib slot 2 should always be present in Trib slot list",
662 topoShard.getTps().get(0)
664 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
665 .TerminationPoint1.class)
666 .getXpdrTpPortConnectionAttributes().getTsPool(),
667 hasItem(Uint16.valueOf(2)));
669 "after 1G creation, 1 (over 80) trib port should be occupied",
671 topoShard.getTps().get(0)
673 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
674 .TerminationPoint1.class)
675 .getXpdrTpPortConnectionAttributes()
676 .getOdtuTpnPool().values().stream().findFirst()
681 "trib port 1 should no longer be present in Trib port list",
682 topoShard.getTps().get(0)
684 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
685 .TerminationPoint1.class)
686 .getXpdrTpPortConnectionAttributes()
687 .getOdtuTpnPool().values().stream().findFirst()
690 not(hasItem(Uint16.valueOf(1))));
692 // tests update for 1G deletion
695 OpenRoadmOtnTopology.updateOtnLinks(
696 topoShard.getLinks(),
698 Uint32.valueOf(1), (short)1, (short)1, (short)1, true);
699 sortedLinks = topoShard.getLinks().stream()
700 .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue()))
701 .collect(Collectors.toList());
702 assertEquals("list of links should contain 2 links", 2, sortedLinks.size());
703 assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-"));
705 "after 1G deletion, available BW of supported ODU4 should be 100 000",
706 Uint32.valueOf(100000),
707 sortedLinks.get(0).augmentation(Link1.class).getAvailableBandwidth());
709 "after 1G deletion, used BW of supported ODU4 should be 0",
711 sortedLinks.get(0).augmentation(Link1.class).getUsedBandwidth());
714 "after 1G deletion, trib slot list should be full",
716 topoShard.getTps().get(0)
718 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
719 .TerminationPoint1.class)
720 .getXpdrTpPortConnectionAttributes()
724 "after 1G deletion, trib slot list should contain items 1 and 2",
725 topoShard.getTps().get(0)
727 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
728 .TerminationPoint1.class)
729 .getXpdrTpPortConnectionAttributes()
731 hasItems(Uint16.valueOf(1), Uint16.valueOf(2)));
733 "after 1G deletion, trib port list should be full",
735 topoShard.getTps().get(0)
737 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
738 .TerminationPoint1.class)
739 .getXpdrTpPortConnectionAttributes()
740 .getOdtuTpnPool().values().stream().findFirst()
745 "after 1G deletion, trib port list should contain items 1",
746 topoShard.getTps().get(0)
748 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
749 .TerminationPoint1.class)
750 .getXpdrTpPortConnectionAttributes()
751 .getOdtuTpnPool().values().stream().findFirst()
754 hasItem(Uint16.valueOf(1)));
758 public void updateOtnLinksForODU4WhenBWParamsNotPresentTest() {
759 List<Link> odu4Links = NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(100000));
760 List<Link> odu4LinksWithBadBWParam = new ArrayList<>();
761 for (Link link : odu4Links) {
762 odu4LinksWithBadBWParam.add(new LinkBuilder(link).removeAugmentation(Link1.class).build());
764 TopologyShard topoShard =
765 OpenRoadmOtnTopology.updateOtnLinks(
766 odu4LinksWithBadBWParam,
767 NetworkmodelTestUtil.createTpList(true),
768 Uint32.valueOf(1), (short)1, (short)1, (short)10, false);
769 assertNotNull("TopologyShard should never be null", topoShard);
770 assertNull("list of nodes should be null", topoShard.getNodes());
771 assertNull("list of links should be null", topoShard.getLinks());
772 assertNull("list of tps should be null", topoShard.getTps());
776 public void updateOtnLinksForODU4WhenAvailBWNotSufficientTest() {
777 List<Link> odu4LinksWithBadBWParam = NetworkmodelTestUtil
778 .createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(8000));
779 TopologyShard topoShard =
780 OpenRoadmOtnTopology.updateOtnLinks(
781 odu4LinksWithBadBWParam,
782 NetworkmodelTestUtil.createTpList(true),
783 Uint32.valueOf(10), (short)1, (short)1, (short)10, false);
784 assertNotNull("TopologyShard should never be null", topoShard);
785 assertNull("list of nodes should be null", topoShard.getNodes());
786 assertNull("list of links should be null", topoShard.getLinks());
787 assertNull("list of tps should be null", topoShard.getTps());
790 private void checkSpdrNode(Node node) {
792 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Node1.class)
793 .getXpdrAttributes().getXpdrNumber();
794 assertEquals("SPDR-SA1-XPDR" + xpdrNb, node.getNodeId().getValue());
795 if (xpdrNb.equals(Uint16.valueOf(1))) {
796 assertEquals(OpenroadmNodeType.MUXPDR, node.augmentation(Node1.class).getNodeType());
797 } else if (xpdrNb.equals(Uint16.valueOf(2))) {
798 assertEquals(OpenroadmNodeType.SWITCH, node.augmentation(Node1.class).getNodeType());
800 // tests supporting nodes
801 List<SupportingNode> supportingNodes = node.nonnullSupportingNode().values().stream()
802 .sorted((sn1, sn2) -> sn1.getNetworkRef().getValue().compareTo(sn2.getNetworkRef().getValue()))
803 .collect(Collectors.toList());
804 assertEquals("Should contain 3 supporting nodes", 3, supportingNodes.size());
805 assertEquals("clli-network", supportingNodes.get(0).getNetworkRef().getValue());
806 assertEquals("NodeSA", supportingNodes.get(0).getNodeRef().getValue());
807 assertEquals("openroadm-network", supportingNodes.get(1).getNetworkRef().getValue());
808 assertEquals("SPDR-SA1", supportingNodes.get(1).getNodeRef().getValue());
809 assertEquals("openroadm-topology", supportingNodes.get(2).getNetworkRef().getValue());
810 assertEquals("SPDR-SA1-XPDR" + xpdrNb, supportingNodes.get(2).getNodeRef().getValue());
811 checkSpdrSwitchingPools(
814 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Node1.class)
815 .getSwitchingPools());
816 List<TerminationPoint> tpList = node.augmentation(
817 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
818 .nonnullTerminationPoint().values().stream()
819 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
820 .collect(Collectors.toList());
821 checkSpdrTpList(xpdrNb, tpList);
824 private void checkSpdrSwitchingPools(Uint16 xpdrNb, SwitchingPools sp) {
825 List<OduSwitchingPools> oduSwitchingPools = new ArrayList<>(sp.nonnullOduSwitchingPools().values());
827 "switching-pools augmentation should contain a single odu-switching-pools",
829 oduSwitchingPools.size());
831 "switching-pool-number should be 1",
833 oduSwitchingPools.get(0).getSwitchingPoolNumber());
835 "switching-pool-type should be non-blocking",
837 oduSwitchingPools.get(0).getSwitchingPoolType().getName());
839 List<NonBlockingList> nonBlockingList =
840 new ArrayList<>(oduSwitchingPools.get(0).nonnullNonBlockingList().values());
841 if (xpdrNb.equals(Uint16.valueOf(1))) {
843 "Mux should contain 4 non blocking list",
845 nonBlockingList.size());
848 nonBlockingList.get(0).getNblNumber());
849 List<NonBlockingList> nblList = oduSwitchingPools.get(0).nonnullNonBlockingList().values().stream()
850 .sorted((nbl1, nbl2) -> nbl1.getNblNumber().compareTo(nbl2.getNblNumber()))
851 .collect(Collectors.toList());
852 for (NonBlockingList nbl : nblList) {
854 "for a 10G mux, interconnect BW should be 10G",
856 nbl.getAvailableInterconnectBandwidth());
857 assertEquals(Uint32.valueOf(1000000000), nbl.getInterconnectBandwidthUnit());
859 "for a 10G mux, non blocking list should contain 2 entries (client + network ports)",
862 String nb = nbl.getNblNumber().toString();
865 containsInAnyOrder(new TpId("XPDR1-NETWORK1"),
866 new TpId("XPDR1-CLIENT" + nb)));
868 } else if (xpdrNb.equals(Uint16.valueOf(2))) {
870 "Switch should contain a single non blocking list",
872 nonBlockingList.size());
875 nonBlockingList.get(0).getNblNumber());
877 "for a 100G Switch, non blocking list should contain 8 entries (4 clients + 4 network ports)",
878 nonBlockingList.get(0).getTpList(),
881 nonBlockingList.get(0).getTpList(),
883 new TpId("XPDR2-CLIENT1"), new TpId("XPDR2-NETWORK1"), new TpId("XPDR2-CLIENT2"),
884 new TpId("XPDR2-NETWORK2"), new TpId("XPDR2-CLIENT3"), new TpId("XPDR2-NETWORK3"),
885 new TpId("XPDR2-CLIENT4"), new TpId("XPDR2-NETWORK4")));
889 private void checkSpdrTpList(Uint16 xpdrNb, List<TerminationPoint> tpList) {
890 LOG.info("tpList = {}", tpList);
892 "only IfOCHOTU4ODU4 interface capabitily expected",
896 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
897 .TerminationPoint1.class)
898 .getTpSupportedInterfaces()
899 .getSupportedInterfaceCapability().values().stream().findFirst()
903 "the rate should be ODU4",
907 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
908 .TerminationPoint1.class)
909 .getXpdrTpPortConnectionAttributes()
912 "openroadm-topology",
913 tpList.get(4).getSupportingTerminationPoint().values().stream().findFirst()
914 .get().getNetworkRef().getValue());
916 "SPDR-SA1-XPDR" + xpdrNb,
917 tpList.get(4).getSupportingTerminationPoint().values().stream().findFirst()
918 .get().getNodeRef().getValue());
920 "XPDR" + xpdrNb + "-NETWORK1",
921 tpList.get(4).getSupportingTerminationPoint().values().stream().findFirst()
922 .get().getTpRef().getValue());
923 if (xpdrNb.equals(Uint16.valueOf(1))) {
924 assertEquals("should contain 5 TPs", 5, tpList.size());
925 assertEquals("XPDR1-CLIENT1", tpList.get(0).getTpId().getValue());
926 assertEquals("XPDR1-CLIENT2", tpList.get(1).getTpId().getValue());
927 assertEquals("XPDR1-NETWORK1", tpList.get(4).getTpId().getValue());
929 "supported interface capability of tp-id XPDR1-CLIENT2 should contain 2 if-cap-type",
933 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
934 .TerminationPoint1.class)
935 .getTpSupportedInterfaces()
936 .getSupportedInterfaceCapability().values().size());
938 "supported interface capability of tp-id XPDR1-CLIENT3 should contain 3 if-cap-type",
942 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
943 .TerminationPoint1.class)
944 .getTpSupportedInterfaces()
945 .getSupportedInterfaceCapability().values().size());
946 List<SupportedInterfaceCapability> sicListClient1 = tpList.get(0)
948 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
949 .TerminationPoint1.class)
950 .getTpSupportedInterfaces()
951 .getSupportedInterfaceCapability().values().stream().collect(Collectors.toList());
952 for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient1) {
953 assertThat("tp should have 2 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2",
954 String.valueOf(supportedInterfaceCapability.getIfCapType()),
955 either(containsString(String.valueOf(If10GEODU2e.VALUE)))
956 .or(containsString(String.valueOf(If10GEODU2.VALUE))));
958 List<SupportedInterfaceCapability> sicListClient3 = tpList.get(3)
960 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
961 .TerminationPoint1.class)
962 .getTpSupportedInterfaces()
963 .getSupportedInterfaceCapability().values().stream().collect(Collectors.toList());
964 for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
965 assertThat("tp should have 3 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2, if-10GE",
966 String.valueOf(supportedInterfaceCapability.getIfCapType()),
967 either(containsString(String.valueOf(If10GEODU2e.VALUE)))
968 .or(containsString(String.valueOf(If10GEODU2.VALUE)))
969 .or(containsString(String.valueOf(If10GE.VALUE))));
971 assertThat("the rate should be ODU2 or ODU2e",
972 String.valueOf(tpList.get(2)
974 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
975 .TerminationPoint1.class)
976 .getXpdrTpPortConnectionAttributes()
978 either(containsString(String.valueOf(ODU2e.VALUE)))
979 .or(containsString(String.valueOf(ODU2.VALUE))));
981 "TP should be of type client",
982 OpenroadmTpType.XPONDERCLIENT,
983 tpList.get(2).augmentation(TerminationPoint1.class).getTpType());
985 "TP should be of type network",
986 OpenroadmTpType.XPONDERNETWORK,
987 tpList.get(4).augmentation(TerminationPoint1.class).getTpType());
988 } else if (xpdrNb.equals(Uint16.valueOf(2))) {
989 assertEquals("should contain 8 TPs", 8, tpList.size());
990 assertEquals("XPDR2-CLIENT1", tpList.get(0).getTpId().getValue());
991 assertEquals("XPDR2-CLIENT2", tpList.get(1).getTpId().getValue());
992 assertEquals("XPDR2-NETWORK1", tpList.get(4).getTpId().getValue());
993 assertEquals("XPDR2-NETWORK2", tpList.get(5).getTpId().getValue());
995 "only IfOCHOTU4ODU4 interface capabitily expected",
999 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
1000 .TerminationPoint1.class)
1001 .getTpSupportedInterfaces()
1002 .getSupportedInterfaceCapability().values().stream().findFirst()
1006 "supported interface capability of tp should contain 2 IfCapType",
1010 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
1011 .TerminationPoint1.class)
1012 .getTpSupportedInterfaces()
1013 .getSupportedInterfaceCapability().values().size());
1014 List<SupportedInterfaceCapability> sicListClient3 = tpList.get(2)
1016 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
1017 .TerminationPoint1.class)
1018 .getTpSupportedInterfaces()
1019 .getSupportedInterfaceCapability().values().stream().collect(Collectors.toList());
1020 for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
1021 assertThat("tp should have 2 if-cap-type: if-100GE-ODU4, if-100GE",
1022 String.valueOf(supportedInterfaceCapability.getIfCapType()),
1023 either(containsString(String.valueOf(If100GEODU4.VALUE)))
1024 .or(containsString(String.valueOf(If100GE.VALUE))));
1027 "TP should be of type client", OpenroadmTpType.XPONDERCLIENT,
1028 tpList.get(2).augmentation(TerminationPoint1.class).getTpType());
1030 "TP should be of type network", OpenroadmTpType.XPONDERNETWORK,
1031 tpList.get(6).augmentation(TerminationPoint1.class).getTpType());