<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.11</version>
+ <version>2.0.14</version>
<scope>import</scope>
<type>pom</type>
</dependency>
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.Lldp;
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.lldp.container.lldp.PortConfig;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev170929.SupportedIfCapability;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint, String partnerLcp) {
+ List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327
+ .SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ for (String sup: getSupIfCapList(port)) {
+ if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
+ supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
+ }
+ }
MappingBuilder mpBldr = new MappingBuilder()
.withKey(new MappingKey(logicalConnectionPoint))
.setLogicalConnectionPoint(logicalConnectionPoint)
.setSupportingPort(port.getPortName())
.setPortDirection(port.getPortDirection().getName())
.setXponderType(XpdrNodeTypes.Tpdr)
- .setLcpHashVal(PortMappingUtils.fnv1size64(nodeId + "-" + logicalConnectionPoint));
+ .setLcpHashVal(PortMappingUtils.fnv1size64(nodeId + "-" + logicalConnectionPoint))
+ .setSupportedInterfaceCapability(supportedIntf);
if (port.getPortQual() != null) {
mpBldr.setPortQual(port.getPortQual().getName());
}
return mpBldr.build();
}
+ private List<String> getSupIfCapList(Ports port) {
+ List<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+ return
+ supIfCapClassList == null
+ ? Collections.emptyList()
+ : supIfCapClassList
+ .stream().map(e -> e.getSimpleName())
+ .collect(Collectors.toList());
+ }
+
private Ports getPort2(Ports port, String nodeId, String circuitPackName, StringBuilder circuitPackName2,
//circuitPackName2 will be updated by reference contrary to circuitPackName
List<CircuitPacks> circuitPackList, Map<String, String> lcpMap) {
private MappingBuilder updateMappingInterfaces(String nodeId, MappingBuilder mpBldr, Ports port) {
mpBldr.setSupportingOtu4(null)
- .setSupportingOdu4(null);
+ .setSupportingOdu4(null)
+ .setSupportingOducn(null)
+ .setSupportingOtucn(null);
for (Interfaces interfaces : port.getInterfaces()) {
Optional<Interface> openRoadmInterface = getInterfaceFromDevice(nodeId,
interfaces.getInterfaceName());
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.port.Interfaces;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.States;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOdu;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOtu;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev161014.maint.loopback.MaintLoopbackBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev161014.maint.testsignal.MaintTestsignalBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1Builder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.odu.container.OduBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.slf4j.Logger;
};
try {
txSubmitFuture.get();
- LOG.info("Successfully posted interface {} on node {}", ifBuilder.getName(), nodeId);
- boolean devicePortIsUptodated = false;
- while (!devicePortIsUptodated) {
- devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ LOG.info("Successfully posted/deleted interface {} on node {}", ifBuilder.getName(), nodeId);
+ // this check is not needed during the delete operation
+ // during the delete operation, ifBuilder does not contain supporting-cp and supporting-port
+ if (ifBuilder.getSupportingCircuitPackName() != null && ifBuilder.getSupportingPort() != null) {
+ boolean devicePortIsUptodated = false;
+ while (!devicePortIsUptodated) {
+ devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ }
+ LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
+ ifBuilder.getName(), ifBuilder.getSupportingPort());
}
- LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
- ifBuilder.getName(), ifBuilder.getSupportingPort());
timer.interrupt();
} catch (InterruptedException | ExecutionException e) {
throw new OpenRoadmInterfaceException(String.format("Failed to post interface %s on node %s!", ifBuilder
if (intf2DeleteOpt.isPresent()) {
Interface intf2Delete = intf2DeleteOpt.get();
// State admin state to out of service
- InterfaceBuilder ifBuilder = new InterfaceBuilder(intf2Delete);
- if (ifBuilder.getType() == OtnOdu.class) {
- Interface1Builder oduBuilder = new Interface1Builder(intf2Delete.augmentation(Interface1.class));
- OduBuilder odu = new OduBuilder(oduBuilder.getOdu());
- if (odu.getMaintTestsignal() != null) {
- MaintTestsignalBuilder maintSignalBuilder = new MaintTestsignalBuilder();
- maintSignalBuilder.setEnabled(false);
- odu.setMaintTestsignal(maintSignalBuilder.build());
- }
- oduBuilder.setOdu(odu.build());
- ifBuilder.addAugmentation(oduBuilder.build());
- } else if (ifBuilder.getType() == OtnOtu.class) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder
- otuBuilder =
- new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder(
- intf2Delete.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) {
- MaintLoopbackBuilder maintLoopBackBuilder = new MaintLoopbackBuilder();
- maintLoopBackBuilder.setEnabled(false);
- otu.setMaintLoopback(maintLoopBackBuilder.build());
- }
- otuBuilder.setOtu(otu.build());
- ifBuilder.addAugmentation(otuBuilder.build());
- }
- ifBuilder.setAdministrativeState(AdminStates.OutOfService);
+ InterfaceBuilder ifBuilder = new InterfaceBuilder()
+ .setAdministrativeState(AdminStates.OutOfService)
+ .setName(intf2Delete.getName())
+ .setType(intf2Delete.getType());
// post interface with updated admin state
try {
postInterface(nodeId, ifBuilder);
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.port.Interfaces;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.States;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev170626.OtnOdu;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev170626.OtnOtu;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev171215.maint.loopback.MaintLoopbackBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev171215.maint.testsignal.MaintTestsignalBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.odu.container.OduBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.otu.container.OtuBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.slf4j.Logger;
};
try {
txSubmitFuture.get();
- LOG.info("Successfully posted interface {} on node {}", ifBuilder.getName(), nodeId);
- boolean devicePortIsUptodated = false;
- while (!devicePortIsUptodated) {
- devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ LOG.info("Successfully posted/deleted interface {} on node {}", ifBuilder.getName(), nodeId);
+ // this check is not needed during the delete operation
+ // during the delete operation, ifBuilder does not contain supporting-cp and supporting-port
+ if (ifBuilder.getSupportingCircuitPackName() != null && ifBuilder.getSupportingPort() != null) {
+ boolean devicePortIsUptodated = false;
+ while (!devicePortIsUptodated) {
+ devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ }
+ LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
+ ifBuilder.getName(), ifBuilder.getSupportingPort());
}
- LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
- ifBuilder.getName(), ifBuilder.getSupportingPort());
timer.interrupt();
} catch (InterruptedException | ExecutionException e) {
throw new OpenRoadmInterfaceException(String.format("Failed to post interface %s on node %s!", ifBuilder
if (intf2DeleteOpt.isPresent()) {
Interface intf2Delete = intf2DeleteOpt.get();
// State admin state to out of service
- InterfaceBuilder ifBuilder = new InterfaceBuilder(intf2Delete);
- if (ifBuilder.getType() == OtnOdu.class) {
- Interface1Builder oduBuilder = new Interface1Builder(intf2Delete.augmentation(Interface1.class));
- OduBuilder odu = new OduBuilder(oduBuilder.getOdu());
- if (odu.getMaintTestsignal() != null) {
- MaintTestsignalBuilder maintSignalBuilder = new MaintTestsignalBuilder();
- maintSignalBuilder.setEnabled(false);
- odu.setMaintTestsignal(maintSignalBuilder.build());
- }
- oduBuilder.setOdu(odu.build());
- ifBuilder.addAugmentation(oduBuilder.build());
- } else if (ifBuilder.getType() == OtnOtu.class) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder
- otuBuilder =
- new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder(
- intf2Delete.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1
- .class));
- OtuBuilder otu = new OtuBuilder(otuBuilder.getOtu());
- if (otu.getMaintLoopback() != null) {
- MaintLoopbackBuilder maintLoopBackBuilder = new MaintLoopbackBuilder();
- maintLoopBackBuilder.setEnabled(false);
- otu.setMaintLoopback(maintLoopBackBuilder.build());
- }
- otuBuilder.setOtu(otu.build());
- ifBuilder.addAugmentation(otuBuilder.build());
- }
- ifBuilder.setAdministrativeState(AdminStates.OutOfService);
+ InterfaceBuilder ifBuilder = new InterfaceBuilder()
+ .setAdministrativeState(AdminStates.OutOfService)
+ .setName(intf2Delete.getName())
+ .setType(intf2Delete.getType());
// post interface with updated admin state
try {
postInterface(nodeId, ifBuilder);
};
try {
txSubmitFuture.get();
- LOG.info("Successfully posted interface {} on node {}", ifBuilder.getName(), nodeId);
- boolean devicePortIsUptodated = false;
- while (!devicePortIsUptodated) {
- devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ LOG.info("Successfully posted/deleted interface {} on node {}", ifBuilder.getName(), nodeId);
+ // this check is not needed during the delete operation
+ // during the delete operation, ifBuilder does not contain supporting-cp and supporting-port
+ if (ifBuilder.getSupportingCircuitPackName() != null && ifBuilder.getSupportingPort() != null) {
+ boolean devicePortIsUptodated = false;
+ while (!devicePortIsUptodated) {
+ devicePortIsUptodated = checkIfDevicePortIsUpdatedWithInterface(nodeId, ifBuilder);
+ }
+ LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
+ ifBuilder.getName(), ifBuilder.getSupportingPort());
}
- LOG.info("{} - {} - interface {} updated on port {}", nodeId, ifBuilder.getSupportingCircuitPackName(),
- ifBuilder.getName(), ifBuilder.getSupportingPort());
timer.interrupt();
} catch (InterruptedException | ExecutionException e) {
throw new OpenRoadmInterfaceException(String.format("Failed to post interface %s on node %s!", ifBuilder
// Though these could be redundant, but 'when' statements are causing problem,
// when deleting the interfaces trying to be deleted
.setName(intf2Delete.getName())
- .setType(intf2Delete.getType())
- // CP name and the ports are needed, since the post interface is validated
- .setSupportingCircuitPackName(intf2Delete.getSupportingCircuitPackName())
- .setSupportingPort(intf2Delete.getSupportingPort());
+ .setType(intf2Delete.getType());
// post interface with updated admin state
try {
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
<groupId>org.opendaylight.transportpce</groupId>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath />
</parent>
<groupId>org.opendaylight.transportpce</groupId>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath />
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<name>OpenDaylight :: transportpce :: swagger</name>
<properties>
- <netconf.version>2.0.11</netconf.version>
+ <netconf.version>2.0.14</netconf.version>
<configfile.directory>etc/opendaylight/karaf</configfile.directory>
</properties>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<name>OpenDaylight :: transportpce</name>
<properties>
- <netconf.version>2.0.11</netconf.version>
+ <netconf.version>2.0.14</netconf.version>
<configfile.directory>etc/opendaylight/karaf</configfile.directory>
</properties>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>karaf4-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>bundle-parent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.11</version>
+ <version>2.0.14</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
private static final Map<String, Class<? extends SupportedIfCapability>> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
StringConstants.SERVICE_TYPE_1GE, If1GEODU0.class,
StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.class,
- StringConstants.SERVICE_TYPE_100GE_T, If100GEODU4.class,
StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.class,
StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.class);
private static final Map<String, Integer> SERVICE_TYPE_ETH_TS_NB_MAP = Map.of(
LOG.error("PceOtnNode: one of parameters is not populated : nodeId, node type");
this.valid = false;
}
+ if (!SERVICE_TYPE_ETH_CLASS_MAP.containsKey(serviceType)
+ && !SERVICE_TYPE_ODU_LIST.contains(serviceType)) {
+ LOG.error("PceOtnNode: unsupported OTN Service Type {}", serviceType);
+ this.valid = false;
+ }
}
public void initXndrTps(String mode) {
node.getNodeId().getValue());
continue;
}
- // TODO what about SERVICE_TYPE_100GE_T ?
} else {
LOG.error("TP {} of {} does not allow any termination creation",
tp.getTpId().getValue(), node.getNodeId().getValue());
break;
case XPONDERCLIENT:
- if (SERVICE_TYPE_ETH_CLASS_MAP.containsKey(otnServiceType)
- && !StringConstants.SERVICE_TYPE_100GE_T.equals(this.otnServiceType)) {
- // TODO should we really exclude SERVICE_TYPE_100GE_T ?
+ if (SERVICE_TYPE_ETH_CLASS_MAP.containsKey(otnServiceType)) {
if (tp.augmentation(TerminationPoint1.class) == null) {
continue;
}
}
}
this.valid = SERVICE_TYPE_ODU_LIST.contains(this.otnServiceType)
- || SERVICE_TYPE_ETH_TS_NB_MAP.containsKey(this.otnServiceType)
- && isAzOrIntermediateAvl(mode, null, availableXpdrClientTps, availableXpdrNWTps)
- || StringConstants.SERVICE_TYPE_100GE_S.equals(this.otnServiceType)
- && isAzOrIntermediateAvl(mode, availableXpdrClientTps, availableXpdrClientTps, availableXpdrNWTps);
- //TODO very similar to isOtnServiceTypeValid method
- // check whether the different treatment for SERVICE_TYPE_100GE_S here is appropriate or not
+ || SERVICE_TYPE_ETH_CLASS_MAP.containsKey(this.otnServiceType)
+ && checkSwPool(availableXpdrNWTps, availableXpdrClientTps);
}
- private boolean checkSwPool(List<TpId> clientTps, List<TpId> netwTps, int nbClient, int nbNetw) {
+ private boolean checkSwPool(List<TpId> netwTps, List<TpId> clientTps) {
+
if (netwTps == null) {
return false;
}
- if (clientTps != null && nbClient == 1 && nbNetw == 1) {
- clientTps.sort(Comparator.comparing(TpId::getValue));
- netwTps.sort(Comparator.comparing(TpId::getValue));
- for (TpId nwTp : netwTps) {
- for (TpId clTp : clientTps) {
- for (NonBlockingList nbl : new ArrayList<>(node.augmentation(Node1.class).getSwitchingPools()
- .nonnullOduSwitchingPools().values().stream().findFirst().get()
- .getNonBlockingList().values())) {
- if (nbl.getTpList().contains(clTp) && nbl.getTpList().contains(nwTp)) {
- usableXpdrClientTps.add(clTp);
+ Node1 node1 = node.augmentation(Node1.class);
+ if (node1 == null) {
+ return false;
+ }
+ List<NonBlockingList> nblList = new ArrayList<>(
+ node1.getSwitchingPools().nonnullOduSwitchingPools()
+ .values().stream().findFirst().get()
+ .getNonBlockingList().values());
+ if (nblList == null) {
+ return false;
+ }
+ netwTps.sort(Comparator.comparing(TpId::getValue));
+
+ switch (modeType) {
+
+ case "intermediate":
+ for (NonBlockingList nbl: nblList) {
+ for (TpId nwTp : netwTps) {
+ if (nbl.getTpList().contains(nwTp)) {
usableXpdrNWTps.add(nwTp);
}
- if (usableXpdrClientTps.size() >= 1 && usableXpdrNWTps.size() >= 1
- //since nbClient == 1 && nbNetw == 1...
- && (this.clientPort == null || this.clientPort.equals(clTp.getValue()))) {
- clientPerNwTp.put(nwTp.getValue(), clTp.getValue());
+ if (usableXpdrNWTps.size() >= 2) {
return true;
}
}
}
- }
- }
- if (nbClient == 0 && nbNetw == 2) {
- netwTps.sort(Comparator.comparing(TpId::getValue));
- //TODO compared to above, nested loops are inverted below - does it make really sense ?
- // there is room to rationalize things here
- for (NonBlockingList nbl : new ArrayList<>(node.augmentation(Node1.class).getSwitchingPools()
- .nonnullOduSwitchingPools().values().stream().findFirst().get()
- .getNonBlockingList().values())) {
- for (TpId nwTp : netwTps) {
- if (nbl.getTpList().contains(nwTp)) {
- usableXpdrNWTps.add(nwTp);
- }
- if (usableXpdrNWTps.size() >= 2) {
- //since nbClient == 0 && nbNetw == 2...
- return true;
+ return false;
+
+ case "AZ":
+ if (clientTps == null) {
+ return false;
+ }
+ clientTps.sort(Comparator.comparing(TpId::getValue));
+ for (NonBlockingList nbl: nblList) {
+ for (TpId nwTp : netwTps) {
+ for (TpId clTp : clientTps) {
+ if (nbl.getTpList().contains(clTp) && nbl.getTpList().contains(nwTp)) {
+ usableXpdrClientTps.add(clTp);
+ usableXpdrNWTps.add(nwTp);
+ }
+ if (usableXpdrClientTps.size() >= 1 && usableXpdrNWTps.size() >= 1
+ && (this.clientPort == null || this.clientPort.equals(clTp.getValue()))) {
+ clientPerNwTp.put(nwTp.getValue(), clTp.getValue());
+ return true;
+ }
+ }
}
}
- }
+ return false;
+
+ default:
+ LOG.error("Unsupported mode type {}", modeType);
+ return false;
}
- return false;
}
private boolean checkTpForOdtuTermination(TerminationPoint1 ontTp1) {
}
public boolean isValid() {
- if (isNotValid(this)) {
+ if (nodeId == null || nodeType == null
+ || this.getSupNetworkNodeId() == null || this.getSupClliNodeId() == null) {
LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
valid = false;
}
return valid;
}
- private boolean isNotValid(final PceOtnNode poNode) {
- return poNode == null || poNode.nodeId == null || poNode.nodeType == null
- || poNode.getSupNetworkNodeId() == null || poNode.getSupClliNodeId() == null;
- }
-
- public boolean isPceOtnNodeValid(final PceOtnNode pceOtnNode) {
- if (isNotValid(pceOtnNode) || pceOtnNode.otnServiceType == null) {
- LOG.error(
- "PceOtnNode: one of parameters is not populated : nodeId, node type, supporting nodeId, otnServiceType"
- );
- return false;
- }
- if (VALID_NODETYPES_LIST.contains(pceOtnNode.nodeType)) {
- return isOtnServiceTypeValid(pceOtnNode);
- }
- LOG.error("PceOtnNode node type: node type is not one of MUXPDR or SWITCH or TPDR");
- return false;
- }
-
- private boolean isOtnServiceTypeValid(final PceOtnNode poNode) {
- if (poNode.modeType == null) {
- return false;
- }
- //Todo refactor Strings (mode and otnServiceType ) to enums
- if (poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_ODU4)
- && poNode.modeType.equals("AZ")) {
- return true;
- }
- return (poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_10GE)
- || poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_1GE)
- || poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_100GE_S))
- && isAzOrIntermediateAvl(poNode.modeType, null, poNode.availableXpdrClientTps, poNode.availableXpdrNWTps);
- //TODO SERVICE_TYPE_ETH_TS_NB_MAP.containsKey(this.otnServiceType) might be more appropriate here
- // but only SERVICE_TYPE_100GE_S is managed and not SERVICE_TYPE_100GE_M and _T
- }
-
- private boolean isAzOrIntermediateAvl(
- String mdType, List<TpId> clientTps0, List<TpId> clientTps, List<TpId> netwTps) {
- return mdType.equals("intermediate") && checkSwPool(clientTps0, netwTps, 0, 2)
- || mdType.equals("AZ") && checkSwPool(clientTps, netwTps, 1, 1);
- }
-
@Override
public void addOutgoingLink(PceLink outLink) {
this.outgoingLinks.add(outLink);
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
import org.opendaylight.transportpce.common.NetworkUtils;
import org.opendaylight.transportpce.common.StringConstants;
import org.opendaylight.transportpce.common.fixedflex.GridUtils;
}
- @Test
- public void testIsPceOtnNodeValid() {
- pceOtnNode = new PceOtnNode(node, OpenroadmNodeType.MUXPDR,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_10GE, null);
- pceOtnNode.initXndrTps("AZ");
- pceOtnNode.checkAvailableTribPort();
- pceOtnNode.checkAvailableTribSlot();
- Assert.assertFalse("not valid otn service Type" , pceOtnNode.isPceOtnNodeValid(pceOtnNode));
- }
-
- @Test
- public void testIsPceOtnNodeValidNode() {
- pceOtnNode = new PceOtnNode(node, OpenroadmNodeType.DEGREE,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_100GE_M, null);
- pceOtnNode.initXndrTps("AZ");
- pceOtnNode.checkAvailableTribPort();
- pceOtnNode.checkAvailableTribSlot();
- pceOtnNode = Mockito.spy(pceOtnNode);
- Mockito.when(pceOtnNode.getNodeId()).thenReturn(null);
- Assert.assertFalse("not valid node , nodeId is null" , pceOtnNode.isPceOtnNodeValid(pceOtnNode));
-
- }
-
- @Test
- public void testIsPceOtnNodeValidNodeTypeNull() {
- pceOtnNode = new PceOtnNode(node, null,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_100GE_M, null);
- pceOtnNode.initXndrTps("AZ");
- pceOtnNode.checkAvailableTribPort();
- pceOtnNode.checkAvailableTribSlot();
- Assert.assertFalse("not valid type, nodeType is null " , pceOtnNode.isPceOtnNodeValid(pceOtnNode));
- }
-
- @Test
- public void testIsPceOtnNodeValidNodeTypeDeg() {
- pceOtnNode = new PceOtnNode(node, OpenroadmNodeType.DEGREE,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_100GE_M, null);
- pceOtnNode.initXndrTps("AZ");
- Assert.assertFalse("not valid node , its type isn't one of MUXPDR or SWITCH or TPDR" ,
- pceOtnNode.isPceOtnNodeValid(pceOtnNode));
- }
-
- @Test
- public void testIsPceOtnNodeValidTrue() {
- pceOtnNode = new PceOtnNode(node, OpenroadmNodeType.MUXPDR,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_ODU4, null);
- pceOtnNode.initXndrTps("AZ");
- pceOtnNode.checkAvailableTribPort();
- pceOtnNode.checkAvailableTribSlot();
- Assert.assertTrue("valid otn service type ", pceOtnNode.isPceOtnNodeValid(pceOtnNode));
- }
-
- @Test
- public void testIsPceOtnNodeValidChecksw() {
- node = getNodeBuilder(geSupportingNodes(), OpenroadmTpType.XPONDERCLIENT).build();
- pceOtnNode = new PceOtnNode(node, OpenroadmNodeType.MUXPDR,
- new NodeId("optical"), ServiceFormat.OMS.getName(), StringConstants.SERVICE_TYPE_1GE, null);
- pceOtnNode.initXndrTps("mode");
- Assert.assertFalse("not valid otn service Type" , pceOtnNode.isPceOtnNodeValid(pceOtnNode));
- }
-
private Map<SupportingNodeKey, SupportingNode> geSupportingNodes() {
Map<SupportingNodeKey, SupportingNode> supportingNodes1 = new HashMap<>();
SupportingNode supportingNode1 = new SupportingNodeBuilder()
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
- <version>9.0.8</version>
+ <version>9.0.13</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.7</version>
+ <version>8.0.11</version>
<relativePath />
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.11</version>
+ <version>2.0.14</version>
<scope>import</scope>
<type>pom</type>
</dependency>
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ # Here you have remove the added oducn supporting port interface
+ del self.NETWORK2_CHECK_DICT["supporting-oducn"]
def test_21_check_no_interface_oduc2(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A2", "interface", "XPDR2-NETWORK1-ODUC2")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ # Check if port-mapping data is updated, where the supporting-oducn is deleted
+ def test_21a_check_no_oduc2(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-oducn"])
+
# 1f) Delete OTUC2 device interfaces
+
def test_22_service_path_delete_otuc2(self):
response = test_utils_rfc8040.device_renderer_service_path_request(
{
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ del self.NETWORK2_CHECK_DICT["supporting-otucn"]
def test_23_check_no_interface_otuc2(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-OTUC2")
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-755:768")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ def test_25a_check_no_otuc2(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-otucn"])
+
# 2a) create a OTUC3 device renderer
def test_26_service_path_create_otuc3(self):
response = test_utils_rfc8040.device_renderer_service_path_request(
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ del self.NETWORK2_CHECK_DICT["supporting-oducn"]
def test_35_check_no_interface_oduc3(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A2", "interface", "XPDR2-NETWORK1-ODUC3")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ def test_35a_check_no_oduc3(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-oducn"])
+
# 2f) Delete OTUC3 device interfaces
def test_36_service_path_delete_otuc3(self):
response = test_utils_rfc8040.device_renderer_service_path_request(
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ del self.NETWORK2_CHECK_DICT["supporting-otucn"]
def test_37_check_no_interface_otuc3(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-OTUC3")
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-755:768")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ def test_39a_check_no_otuc3(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-otucn"])
+
# 3a) create a OTUC4 device renderer
- def test_40_service_path_create_otuc3(self):
+ def test_40_service_path_create_otuc4(self):
response = test_utils_rfc8040.device_renderer_service_path_request(
{
'service-name': 'service_OTUC4',
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ del self.NETWORK2_CHECK_DICT["supporting-oducn"]
def test_49_check_no_interface_oduc4(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A2", "interface", "XPDR2-NETWORK1-ODUC4")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ def test_49a_check_no_oduc4(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-oducn"])
+
# 3f) Delete OTUC4 device interfaces
def test_50_service_path_delete_otuc4(self):
response = test_utils_rfc8040.device_renderer_service_path_request(
})
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn('Request processed', response['output']['result'])
+ del self.NETWORK2_CHECK_DICT["supporting-otucn"]
def test_51_check_no_interface_otuc4(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-OTUC4")
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A1", "interface", "XPDR2-NETWORK1-755:768")
self.assertEqual(response['status_code'], requests.codes.conflict)
+ def test_53a_check_no_otuc4(self):
+ response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
+ self.assertRaises(KeyError, lambda: response["supporting-otucn"])
+
# Disconnect the XPDR
def test_54_xpdr_device_disconnection(self):
response = test_utils_rfc8040.unmount_device("XPDR-A2")