project_category: ''
lifecycle_state: 'Incubation'
project_lead: &odl_transportpce_ptl
- name: 'Guillaume Lambert'
- email: 'guillaume.lambert@orange.com'
+ name: 'Gilles Thouenon'
+ email: 'gilles.thouenon@orange.com'
company: 'orange'
- id: 'guillaume.lambert'
+ id: 'gthouenon'
timezone: 'Europe/Paris'
primary_contact: *odl_transportpce_ptl
issue_tracking:
company: 'att'
id: 'b95quare'
timezone: 'America/New_York'
- - name: 'Gilles Thouenon'
- email: 'gilles.thouenon@orange.com'
+ - name: 'Guillaume Lambert'
+ email: 'guillaume.lambert@orange.com'
company: 'orange'
- id: 'gthouenon'
+ id: 'guillaume.lambert'
timezone: 'Europe/Paris'
- name: 'Shweta Vachhani'
email: 'sv111y@att.com'
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.5</version>
+ <version>2.0.7</version>
<scope>import</scope>
<type>pom</type>
</dependency>
public class CrossConnectImpl221 {
private static final Logger LOG = LoggerFactory.getLogger(CrossConnectImpl221.class);
+ private static final String DEV_TRANSACTION_NOT_FOUND = "Device transaction for device {} was not found!";
+ private static final String UNABLE_DEV_TRANSACTION = "Unable to obtain device transaction for device {}!";
private final DeviceTransactionManager deviceTransactionManager;
public CrossConnectImpl221(DeviceTransactionManager deviceTransactionManager) {
if (deviceTxOpt.isPresent()) {
deviceTx = deviceTxOpt.get();
} else {
- LOG.error("Device transaction for device {} was not found!", deviceId);
+ LOG.error(DEV_TRANSACTION_NOT_FOUND, deviceId);
return Optional.empty();
}
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Unable to obtain device transaction for device {}!", deviceId, e);
+ LOG.error(UNABLE_DEV_TRANSACTION, deviceId, e);
return Optional.empty();
}
if (deviceTxOpt.isPresent()) {
deviceTx = deviceTxOpt.get();
} else {
- LOG.error("Device transaction for device {} was not found!", deviceId);
+ LOG.error(DEV_TRANSACTION_NOT_FOUND, deviceId);
return null;
}
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Unable to obtain device transaction for device {}!", deviceId, e);
+ LOG.error(UNABLE_DEV_TRANSACTION, deviceId, e);
return null;
}
if (deviceTxOpt.isPresent()) {
deviceTx = deviceTxOpt.get();
} else {
- LOG.error("Device transaction for device {} was not found!", deviceId);
+ LOG.error(DEV_TRANSACTION_NOT_FOUND, deviceId);
return Optional.empty();
}
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Unable to obtain device transaction for device {}!", deviceId, e);
+ LOG.error(UNABLE_DEV_TRANSACTION, deviceId, e);
return Optional.empty();
}
break;
case Rx:
case Tx:
- if (!checkPartnerPortNotNull(port)) {
- LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG
- + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
- nodeId, port.getPortName(), circuitPackName);
+ Ports port2 = getPartnerPort(port, circuitPackName, nodeId);
+ if (port2 == null) {
continue;
}
String lcp1 = createLogicalConnectionPort(port, srgCpEntry.getKey(), portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
- nodeId, port.getPortName(), circuitPackName, lcp1);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class,
- new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
- Optional<Ports> port2Object = this.deviceTransactionManager
- .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
- Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port2Object.isEmpty()
- || port2Object.get().getPortQual().getIntValue()
- != Port.PortQual.RoadmExternal.getIntValue()) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
- nodeId, port.getPartnerPort().getPortName(),
- port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkPartnerPort(circuitPackName, port, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
- nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- portIndex++;
- continue;
- }
+ nodeId, port.getPortName(), circuitPackName, lcp1);
String lcp2 = createLogicalConnectionPort(port2, srgCpEntry.getKey(),portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
nodeId, port2.getPortName(), circuitPackName, lcp2);
return true;
}
+ private Ports getPartnerPort(Ports port, String circuitPackName, String nodeId) {
+ if (!checkPartnerPortNotNull(port)) {
+ LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
+ nodeId, port.getPortName(), circuitPackName);
+ return null;
+ }
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ Optional<Ports> port2Object = this.deviceTransactionManager
+ .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
+ Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (port2Object.isEmpty()
+ || port2Object.get().getPortQual().getIntValue() != Port.PortQual.RoadmExternal.getIntValue()) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
+ nodeId, port.getPartnerPort().getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ return null;
+ }
+ Ports port2 = port2Object.get();
+ if (!checkPartnerPort(circuitPackName, port, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
+ nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ //TODO check if we really needed to increment portIndex in this condition
+ // if yes this block should not be in getPartnerPort and must move back to createPpPortMapping
+ return null;
+ }
+ return port2;
+ }
+
private List<Ports> getPortList(String circuitPackName, String nodeId) {
InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
switch (cpMapValue.size()) {
case 1:
// port is bidirectional
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (portObject.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port = getTtpPort(cp1, cp1Name, nodeId);
+ if (port == null) {
return false;
}
- Ports port = portObject.get();
if (!checkTtpPort(port, cp1Name, nodeId, true)) {
continue;
}
-
String logicalConnectionPoint =
PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(), "TXRX");
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
break;
case 2:
// ports are unidirectionals
- ConnectionPorts cp2 = cpMapValue.get(1);
- String cp2Name = cp2.getCircuitPackName();
- InstanceIdentifier<Ports> port1ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> port1Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port1ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp2Name))
- .child(Ports.class, new PortsKey(cp2.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
- Optional<Ports> port2Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port2ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port1Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port1 = getTtpPort(cp1, cp1Name, nodeId);
+ if (port1 == null) {
return false;
}
- if (port2Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
+ ConnectionPorts cp2 = cpMapValue.get(1);
+ String cp2Name = cp2.getCircuitPackName();
+ Ports port2 = getTtpPort(cp2, cp2Name, nodeId);
+ if (port2 == null) {
return false;
}
-
- Ports port1 = port1Object.get();
- if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
+ if (!checkTtpPortsUnidir(port1, port2, cp1Name, cp2Name, nodeId)) {
continue;
}
-
- if (!checkPartnerPort(cp1Name, port1, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
- continue;
- }
- // Directions checks are the same for cp1 and cp2, no need to check them twice.
- if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
- continue;
- }
-
String logicalConnectionPoint1 = PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(),
port1.getPortDirection().getName().toUpperCase(Locale.getDefault()));
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
default:
LOG.error(PortMappingUtils.NOT_CORRECT_CONPORT_LOGMSG, nodeId, cpMapEntry.getKey());
continue;
+ //TODO should it be continue or return false ?
}
}
return true;
}
+ private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
+ InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(cpName))
+ .child(Ports.class, new PortsKey(cp.getPortName()));
+ LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
+ Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
+ LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
+ Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (portObject.isEmpty()) {
+ LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp.getPortName(), cpName);
+ return null;
+ }
+ return portObject.get();
+ }
+
private boolean checkPortQual(Ports port, String cpName, String nodeId) {
if (port.getPortQual() == null) {
return false;
return true;
}
- private NodeInfo createNodeInfo(Info deviceInfo) {
+ private boolean checkTtpPortsUnidir(Ports port1, Ports port2, String cp1Name, String cp2Name, String nodeId) {
+ if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkPartnerPort(cp1Name, port1, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
+ return false;
+ }
+ // Directions checks are the same for cp1 and cp2, no need to check them twice.
+ if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
+ return false;
+ }
+ return true;
+ }
+ private NodeInfo createNodeInfo(Info deviceInfo) {
if (deviceInfo.getNodeType() == null) {
// TODO make mandatory in yang
LOG.error(PortMappingUtils.NODE_TYPE_LOGMSG, deviceInfo.getNodeId(), "field missing");
return null;
}
-
NodeInfoBuilder nodeInfoBldr = new NodeInfoBuilder()
.setOpenroadmVersion(OpenroadmNodeVersion._121)
.setNodeClli(
if (deviceInfo.getIpAddress() != null) {
nodeInfoBldr.setNodeIpAddress(deviceInfo.getIpAddress());
}
-
return nodeInfoBldr.build();
}
private boolean createXpdrPortMapping(String nodeId, List<Mapping> portMapList) {
// Creating for Xponder Line and Client Ports
+ OrgOpenroadmDevice device = getXpdrDevice(nodeId);
+ if (device == null) {
+ return false;
+ }
+ Map<String, String> lcpMap = new HashMap<>();
+ Map<String, Mapping> mappingMap = new HashMap<>();
+ getXpdrMaps(device, nodeId, lcpMap, mappingMap);
+ if (device.getConnectionMap() == null) {
+ LOG.warn(PortMappingUtils.NO_CONMAP_LOGMSG, nodeId);
+ } else {
+ for (ConnectionMap cm : device.nonnullConnectionMap().values()) {
+ String skey = cm.getSource().getCircuitPackName() + "+" + cm.getSource().getPortName();
+ Destination destination0 = cm.nonnullDestination().values().iterator().next();
+ String dkey = destination0.getCircuitPackName() + "+" + destination0.getPortName();
+ if (!lcpMap.containsKey(skey)) {
+ LOG.error(PortMappingUtils.CONMAP_ISSUE_LOGMSG, nodeId, skey, dkey);
+ continue;
+ }
+ String slcp = lcpMap.get(skey);
+ Mapping mapping = mappingMap.get(slcp);
+ mappingMap.remove(slcp);
+ portMapList.add(createXpdrMappingObject(nodeId, null, null, null, null, mapping,
+ //dlcp
+ lcpMap.containsKey(dkey) ? lcpMap.get(dkey) : null,
+ null));
+ }
+ }
+ if (device.getOduSwitchingPools() != null) {
+ postPortMapping(nodeId, null, null, null, getSwitchingPoolList(device, lcpMap, nodeId), null);
+ }
+ mappingMap.forEach((k,v) -> portMapList.add(v));
+ return true;
+ }
+
+ private OrgOpenroadmDevice getXpdrDevice(String nodeId) {
InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (deviceObject.isEmpty()) {
LOG.error(PortMappingUtils.CANNOT_GET_DEV_CONF_LOGMSG, nodeId);
- return false;
+ return null;
}
OrgOpenroadmDevice device = deviceObject.get();
if (device.getCircuitPacks() == null) {
LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, PortMappingUtils.FOUND);
- return false;
+ return null;
}
+ return device;
+ }
- Map<String, String> lcpMap = new HashMap<>();
- Map<String, Mapping> mappingMap = new HashMap<>();
+ private void getXpdrMaps(OrgOpenroadmDevice device, String nodeId,
+ Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
List<CircuitPacks> circuitPackList = new ArrayList<>(device.nonnullCircuitPacks().values());
circuitPackList.sort(Comparator.comparing(CircuitPack::getCircuitPackName));
if (device.getXponder() == null) {
}
} else {
LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, PortMappingUtils.FOUND);
- for (Xponder xponder : deviceObject.get().nonnullXponder().values()) {
+ for (Xponder xponder : device.nonnullXponder().values()) {
// Variables to keep track of number of line ports and client ports
int line = 1;
int client = 1;
XpdrNodeTypes xponderType = xponder.getXpdrType();
for (XpdrPort xpdrPort : xponder.nonnullXpdrPort().values().stream()
.sorted((xp1, xp2) -> xp1.getIndex().compareTo(xp2.getIndex())).collect(Collectors.toList())) {
- String circuitPackName = xpdrPort.getCircuitPackName();
- String portName = xpdrPort.getPortName();
- // If there xponder-subtree has missing circuit-packs or ports,
- // This gives a null-pointer expection,
- Optional<CircuitPacks> cpList = device.nonnullCircuitPacks().values().stream()
- .filter(cp -> cp.getCircuitPackName().equals(circuitPackName)).findFirst();
- if (cpList.isEmpty()) {
- LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
- nodeId, circuitPackName);
- continue;
- }
- Optional<Ports> portsList = cpList.get().nonnullPorts().values().stream()
- .filter(p -> p.getPortName().equals(portName)).findFirst();
- if (portsList.isEmpty()) {
- LOG.warn(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
- nodeId, portName, circuitPackName, "in the device");
+ Ports port = getXpdrPorts(device, xpdrPort, nodeId);
+ if (port == null) {
continue;
}
int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
- xponderNb, xponderType, circuitPackName, portsList.get(),
+ xponderNb, xponderType, xpdrPort.getCircuitPackName(), port,
circuitPackList, lcpMap, mappingMap);
line = counters[0];
client = counters[1];
}
}
}
+ }
- if (device.getConnectionMap() == null) {
- LOG.warn(PortMappingUtils.NO_CONMAP_LOGMSG, nodeId);
- } else {
- for (ConnectionMap cm : deviceObject.get().nonnullConnectionMap().values()) {
- String skey = cm.getSource().getCircuitPackName() + "+" + cm.getSource().getPortName();
- Destination destination0 = cm.nonnullDestination().values().iterator().next();
- String dkey = destination0.getCircuitPackName() + "+" + destination0.getPortName();
- if (!lcpMap.containsKey(skey)) {
- LOG.error(PortMappingUtils.CONMAP_ISSUE_LOGMSG, nodeId, skey, dkey);
- continue;
- }
- String slcp = lcpMap.get(skey);
- Mapping mapping = mappingMap.get(slcp);
- mappingMap.remove(slcp);
- portMapList.add(createXpdrMappingObject(nodeId, null, null, null, null, mapping,
- //dlcp
- lcpMap.containsKey(dkey) ? lcpMap.get(dkey) : null,
- null));
- }
+ private Ports getXpdrPorts(OrgOpenroadmDevice device, XpdrPort xpdrPort, String nodeId) {
+ String circuitPackName = xpdrPort.getCircuitPackName();
+ String portName = xpdrPort.getPortName();
+ // If there xponder-subtree has missing circuit-packs or ports,
+ // This gives a null-pointer expection,
+ Optional<CircuitPacks> cpList = device.nonnullCircuitPacks().values().stream()
+ .filter(cp -> cp.getCircuitPackName().equals(circuitPackName)).findFirst();
+ if (cpList.isEmpty()) {
+ LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
+ nodeId, circuitPackName);
+ return null;
+ }
+ Optional<Ports> portsList = cpList.get().nonnullPorts().values().stream()
+ .filter(p -> p.getPortName().equals(portName)).findFirst();
+ if (portsList.isEmpty()) {
+ LOG.warn(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
+ nodeId, portName, circuitPackName, "in the device");
+ return null;
}
+ return portsList.get();
+ }
- if (device.getOduSwitchingPools() != null) {
- List<SwitchingPoolLcp> switchingPoolList = new ArrayList<>();
- for (OduSwitchingPools odp : device.nonnullOduSwitchingPools().values()) {
- Map<NonBlockingListKey,NonBlockingList> nbMap = new HashMap<>();
- for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org
- .openroadm.device.odu.switching.pools.NonBlockingList nbl : odp.nonnullNonBlockingList().values()) {
- if (nbl.getPortList() == null) {
+ private List<SwitchingPoolLcp> getSwitchingPoolList(OrgOpenroadmDevice device,
+ Map<String, String> lcpMap, String nodeId) {
+ List<SwitchingPoolLcp> switchingPoolList = new ArrayList<>();
+ for (OduSwitchingPools odp : device.nonnullOduSwitchingPools().values()) {
+ Map<NonBlockingListKey,NonBlockingList> nbMap = new HashMap<>();
+ for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org
+ .openroadm.device.odu.switching.pools.NonBlockingList nbl : odp.nonnullNonBlockingList().values()) {
+ if (nbl.getPortList() == null) {
+ continue;
+ }
+ List<String> lcpList = new ArrayList<>();
+ for (PortList item : nbl.nonnullPortList().values()) {
+ String key = item.getCircuitPackName() + "+" + item.getPortName();
+ if (!lcpMap.containsKey(key)) {
+ LOG.error(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG,
+ nodeId, item.getPortName(), item.getCircuitPackName(), "to a logical connection point");
continue;
}
- List<String> lcpList = new ArrayList<>();
- for (PortList item : nbl.nonnullPortList().values()) {
- String key = item.getCircuitPackName() + "+" + item.getPortName();
- if (!lcpMap.containsKey(key)) {
- LOG.error(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG,
- nodeId, item.getPortName(), item.getCircuitPackName(), "to a logical connection point");
- continue;
- }
- lcpList.add(lcpMap.get(key));
- }
- NonBlockingList nonBlockingList = new NonBlockingListBuilder()
- .setNblNumber(nbl.getNblNumber())
- .setInterconnectBandwidth(nbl.getInterconnectBandwidth())
- .setInterconnectBandwidthUnit(nbl.getInterconnectBandwidthUnit())
- .setLcpList(lcpList)
- .build();
- nbMap.put(nonBlockingList.key(), nonBlockingList);
+ lcpList.add(lcpMap.get(key));
}
- SwitchingPoolLcp splBldr = new SwitchingPoolLcpBuilder()
+ NonBlockingList nonBlockingList = new NonBlockingListBuilder()
+ .setNblNumber(nbl.getNblNumber())
+ .setInterconnectBandwidth(nbl.getInterconnectBandwidth())
+ .setInterconnectBandwidthUnit(nbl.getInterconnectBandwidthUnit())
+ .setLcpList(lcpList)
+ .build();
+ nbMap.put(nonBlockingList.key(), nonBlockingList);
+ }
+ switchingPoolList.add(
+ new SwitchingPoolLcpBuilder()
.setSwitchingPoolNumber(odp.getSwitchingPoolNumber())
.setSwitchingPoolType(SwitchingPoolTypes.forValue(odp.getSwitchingPoolType().getIntValue()))
.setNonBlockingList(nbMap)
- .build();
- switchingPoolList.add(splBldr);
- }
- postPortMapping(nodeId, null, null, null, switchingPoolList, null);
+ .build());
}
-
- mappingMap.forEach((k,v) -> portMapList.add(v));
- return true;
+ return switchingPoolList;
}
private boolean checkPartnerPortNotNull(Ports port) {
break;
case Rx:
case Tx:
- if (!checkPartnerPortNotNull(port)) {
- LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG
- + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
- nodeId, port.getPortName(), circuitPackName);
+ Ports port2 = getPartnerPort(port, circuitPackName, nodeId);
+ if (port2 == null) {
continue;
}
String lcp1 = createLogicalConnectionPort(port, srgCpEntry.getKey(), portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
nodeId, port.getPortName(), circuitPackName, lcp1);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class,
- new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
- Optional<Ports> port2Object = this.deviceTransactionManager
- .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
- Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port2Object.isEmpty()
- || port2Object.get().getPortQual().getIntValue()
- != PortQual.RoadmExternal.getIntValue()) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
- nodeId, port.getPartnerPort().getPortName(),
- port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkPartnerPort(circuitPackName, port, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
- nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- portIndex++;
- continue;
- }
String lcp2 = createLogicalConnectionPort(port2, srgCpEntry.getKey(),portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
nodeId, port2.getPortName(), circuitPackName, lcp2);
return true;
}
+ private Ports getPartnerPort(Ports port, String circuitPackName, String nodeId) {
+ if (!checkPartnerPortNotNull(port)) {
+ LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
+ nodeId, port.getPortName(), circuitPackName);
+ return null;
+ }
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ Optional<Ports> port2Object = this.deviceTransactionManager
+ .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
+ Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (port2Object.isEmpty()
+ || port2Object.get().getPortQual().getIntValue() != PortQual.RoadmExternal.getIntValue()) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
+ nodeId, port.getPartnerPort().getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ return null;
+ }
+ Ports port2 = port2Object.get();
+ if (!checkPartnerPort(circuitPackName, port, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
+ nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ //TODO check if we really needed to increment portIndex in this condition
+ // if yes this block should not be in getPartnerPort and must move back to createPpPortMapping
+ return null;
+ }
+ return port2;
+ }
+
private List<Ports> getPortList(String circuitPackName, String nodeId) {
InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
switch (cpMapValue.size()) {
case 1:
// port is bidirectional
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (portObject.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port = getTtpPort(cp1, cp1Name, nodeId);
+ if (port == null) {
return false;
}
- Ports port = portObject.get();
if (!checkTtpPort(port, cp1Name, nodeId, true)) {
continue;
}
-
String logicalConnectionPoint =
PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(), "TXRX");
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
break;
case 2:
// ports are unidirectionals
- ConnectionPorts cp2 = cpMapValue.get(1);
- String cp2Name = cp2.getCircuitPackName();
- InstanceIdentifier<Ports> port1ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> port1Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port1ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp2Name))
- .child(Ports.class, new PortsKey(cp2.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
- Optional<Ports> port2Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port2ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port1Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port1 = getTtpPort(cp1, cp1Name, nodeId);
+ if (port1 == null) {
return false;
}
- if (port2Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
+ ConnectionPorts cp2 = cpMapValue.get(1);
+ String cp2Name = cp2.getCircuitPackName();
+ Ports port2 = getTtpPort(cp2, cp2Name, nodeId);
+ if (port2 == null) {
return false;
}
-
- Ports port1 = port1Object.get();
- if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
- continue;
- }
-
- if (!checkPartnerPort(cp1Name, port1, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
- continue;
- }
- // Directions checks are the same for cp1 and cp2, no need to check them twice.
- if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
+ if (!checkTtpPortsUnidir(port1, port2, cp1Name, cp2Name, nodeId)) {
continue;
}
-
String logicalConnectionPoint1 = PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(),
port1.getPortDirection().getName().toUpperCase(Locale.getDefault()));
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
default:
LOG.error(PortMappingUtils.NOT_CORRECT_CONPORT_LOGMSG, nodeId, cpMapEntry.getKey());
continue;
+ //TODO should it be continue or return false ?
}
}
return true;
}
+ private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
+ InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(cpName))
+ .child(Ports.class, new PortsKey(cp.getPortName()));
+ LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
+ Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
+ LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
+ Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (portObject.isEmpty()) {
+ LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp.getPortName(), cpName);
+ return null;
+ }
+ return portObject.get();
+ }
+
private boolean checkPortQual(Ports port, String cpName, String nodeId) {
if (port.getPortQual() == null) {
return false;
return true;
}
- private NodeInfo createNodeInfo(Info deviceInfo) {
+ private boolean checkTtpPortsUnidir(Ports port1, Ports port2, String cp1Name, String cp2Name, String nodeId) {
+ if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkPartnerPort(cp1Name, port1, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
+ return false;
+ }
+ // Directions checks are the same for cp1 and cp2, no need to check them twice.
+ if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
+ return false;
+ }
+ return true;
+ }
+ private NodeInfo createNodeInfo(Info deviceInfo) {
if (deviceInfo.getNodeType() == null) {
// TODO make mandatory in yang
LOG.error(PortMappingUtils.NODE_TYPE_LOGMSG, deviceInfo.getNodeId(), "field missing");
return null;
}
-
NodeInfoBuilder nodeInfoBldr = new NodeInfoBuilder()
.setOpenroadmVersion(OpenroadmNodeVersion._221)
.setNodeClli(
if (deviceInfo.getIpAddress() != null) {
nodeInfoBldr.setNodeIpAddress(deviceInfo.getIpAddress());
}
-
return nodeInfoBldr.build();
}
import com.google.common.util.concurrent.FluentFuture;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
private boolean createXpdrPortMapping(String nodeId, List<Mapping> portMapList) {
// Creating for Xponder Line and Client Ports
+ OrgOpenroadmDevice device = getXpdrDevice(nodeId);
+ if (device == null) {
+ return false;
+ }
+ Map<String, String> lcpMap = new HashMap<>();
+ Map<String, Mapping> mappingMap = new HashMap<>();
+ getXpdrMaps(device, nodeId, lcpMap, mappingMap);
+ if (device.getConnectionMap() == null) {
+ LOG.warn(PortMappingUtils.NO_CONMAP_LOGMSG, nodeId);
+ } else {
+ for (ConnectionMap cm : device.nonnullConnectionMap().values()) {
+ String skey = cm.getSource().getCircuitPackName() + "+" + cm.getSource().getPortName();
+ Destination destination0 = cm.nonnullDestination().values().iterator().next();
+ String dkey = destination0.getCircuitPackName() + "+" + destination0.getPortName();
+ if (!lcpMap.containsKey(skey)) {
+ LOG.error(PortMappingUtils.CONMAP_ISSUE_LOGMSG, nodeId, skey, dkey);
+ continue;
+ }
+ String slcp = lcpMap.get(skey);
+ Mapping mapping = mappingMap.get(slcp);
+ mappingMap.remove(slcp);
+ portMapList.add(createXpdrMappingObject(nodeId, null, null, null, null, mapping,
+ //dlcp
+ lcpMap.containsKey(dkey) ? lcpMap.get(dkey) : null,
+ null));
+ }
+ }
+ if (device.getOduSwitchingPools() != null) {
+ postPortMapping(nodeId, null, null, null, getSwitchingPoolList(device, lcpMap, nodeId), null);
+ }
+ mappingMap.forEach((k,v) -> portMapList.add(v));
+ return true;
+ }
+
+ private OrgOpenroadmDevice getXpdrDevice(String nodeId) {
InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (deviceObject.isEmpty()) {
LOG.error(PortMappingUtils.CANNOT_GET_DEV_CONF_LOGMSG, nodeId);
- return false;
+ return null;
}
OrgOpenroadmDevice device = deviceObject.get();
if (device.getCircuitPacks() == null) {
LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, PortMappingUtils.FOUND);
- return false;
+ return null;
}
+ return device;
+ }
- Map<String, String> lcpMap = new HashMap<>();
- Map<String, Mapping> mappingMap = new HashMap<>();
+ private void getXpdrMaps(OrgOpenroadmDevice device, String nodeId,
+ Map<String, String> lcpMap, Map<String, Mapping> mappingMap) {
List<CircuitPacks> circuitPackList = new ArrayList<>(device.nonnullCircuitPacks().values());
circuitPackList.sort(Comparator.comparing(CircuitPack::getCircuitPackName));
if (device.getXponder() == null) {
}
} else {
LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, PortMappingUtils.FOUND);
- for (Xponder xponder : deviceObject.get().nonnullXponder().values()) {
+ for (Xponder xponder : device.nonnullXponder().values()) {
// Variables to keep track of number of line ports and client ports
int line = 1;
int client = 1;
XpdrNodeTypes xponderType = xponder.getXpdrType();
for (XpdrPort xpdrPort : xponder.nonnullXpdrPort().values().stream()
.sorted((xp1, xp2) -> xp1.getIndex().compareTo(xp2.getIndex())).collect(Collectors.toList())) {
- String circuitPackName = xpdrPort.getCircuitPackName();
- String portName = xpdrPort.getPortName();
- // If there xponder-subtree has missing circuit-packs or ports,
- // This gives a null-pointer expection,
- Optional<CircuitPacks> cpList = device.nonnullCircuitPacks().values().stream()
- .filter(cp -> cp.getCircuitPackName().equals(circuitPackName)).findFirst();
- if (cpList.isEmpty()) {
- LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
- nodeId, circuitPackName);
- continue;
- }
- Optional<Ports> portsList = cpList.get().nonnullPorts().values().stream()
- .filter(p -> p.getPortName().equals(portName)).findFirst();
- if (portsList.isEmpty()) {
- LOG.warn(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
- nodeId, portName, circuitPackName, "in the device");
+ Ports port = getXpdrPorts(device, xpdrPort, nodeId);
+ if (port == null) {
continue;
}
int[] counters = fillXpdrLcpsMaps(line, client, nodeId,
- xponderNb, xponderType, circuitPackName, portsList.get(),
+ xponderNb, xponderType, xpdrPort.getCircuitPackName(), port,
circuitPackList, lcpMap, mappingMap);
line = counters[0];
client = counters[1];
}
}
}
+ }
- if (device.getConnectionMap() == null) {
- LOG.warn(PortMappingUtils.NO_CONMAP_LOGMSG, nodeId);
- } else {
- for (ConnectionMap cm : deviceObject.get().nonnullConnectionMap().values()) {
- String skey = cm.getSource().getCircuitPackName() + "+" + cm.getSource().getPortName();
- Destination destination0 = cm.nonnullDestination().values().iterator().next();
- String dkey = destination0.getCircuitPackName() + "+" + destination0.getPortName();
- if (!lcpMap.containsKey(skey)) {
- LOG.error(PortMappingUtils.CONMAP_ISSUE_LOGMSG, nodeId, skey, dkey);
- continue;
- }
- String slcp = lcpMap.get(skey);
- Mapping mapping = mappingMap.get(slcp);
- mappingMap.remove(slcp);
- portMapList.add(createXpdrMappingObject(nodeId, null, null, null, null, mapping,
- //dlcp
- lcpMap.containsKey(dkey) ? lcpMap.get(dkey) : null,
- null));
- }
+ private Ports getXpdrPorts(OrgOpenroadmDevice device, XpdrPort xpdrPort, String nodeId) {
+ String circuitPackName = xpdrPort.getCircuitPackName();
+ String portName = xpdrPort.getPortName();
+ // If there xponder-subtree has missing circuit-packs or ports,
+ // This gives a null-pointer expection,
+ Optional<CircuitPacks> cpList = device.nonnullCircuitPacks().values().stream()
+ .filter(cp -> cp.getCircuitPackName().equals(circuitPackName)).findFirst();
+ if (cpList.isEmpty()) {
+ LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
+ nodeId, circuitPackName);
+ return null;
+ }
+ Optional<Ports> portsList = cpList.get().nonnullPorts().values().stream()
+ .filter(p -> p.getPortName().equals(portName)).findFirst();
+ if (portsList.isEmpty()) {
+ LOG.warn(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG + PortMappingUtils.PORTMAPPING_IGNORE_LOGMSG,
+ nodeId, portName, circuitPackName, "in the device");
+ return null;
}
+ return portsList.get();
+ }
- if (device.getOduSwitchingPools() != null) {
- List<SwitchingPoolLcp> switchingPoolList = new ArrayList<>();
- for (OduSwitchingPools odp : device.nonnullOduSwitchingPools().values()) {
- Map<NonBlockingListKey,NonBlockingList> nbMap = new HashMap<>();
- for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org
- .openroadm.device.odu.switching.pools.NonBlockingList nbl : odp.nonnullNonBlockingList().values()) {
- if (nbl.getPortList() == null) {
+ private List<SwitchingPoolLcp> getSwitchingPoolList(OrgOpenroadmDevice device,
+ Map<String, String> lcpMap, String nodeId) {
+ List<SwitchingPoolLcp> switchingPoolList = new ArrayList<>();
+ for (OduSwitchingPools odp : device.nonnullOduSwitchingPools().values()) {
+ Map<NonBlockingListKey,NonBlockingList> nbMap = new HashMap<>();
+ for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org
+ .openroadm.device.odu.switching.pools.NonBlockingList nbl : odp.nonnullNonBlockingList().values()) {
+ if (nbl.getPortList() == null) {
+ continue;
+ }
+ List<String> lcpList = new ArrayList<>();
+ for (PortList item : nbl.nonnullPortList().values()) {
+ String key = item.getCircuitPackName() + "+" + item.getPortName();
+ if (!lcpMap.containsKey(key)) {
+ LOG.error(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG,
+ nodeId, item.getPortName(), item.getCircuitPackName(), "to a logical connection point");
continue;
}
- List<String> lcpList = new ArrayList<>();
- for (PortList item : nbl.nonnullPortList().values()) {
- String key = item.getCircuitPackName() + "+" + item.getPortName();
- if (!lcpMap.containsKey(key)) {
- LOG.error(PortMappingUtils.NO_ASSOC_FOUND_LOGMSG,
- nodeId, item.getPortName(), item.getCircuitPackName(), "to a logical connection point");
- continue;
- }
- lcpList.add(lcpMap.get(key));
- }
- NonBlockingList nonBlockingList = new NonBlockingListBuilder()
- .setNblNumber(nbl.getNblNumber())
- .setInterconnectBandwidth(nbl.getInterconnectBandwidth())
- .setInterconnectBandwidthUnit(nbl.getInterconnectBandwidthUnit())
- .setLcpList(lcpList)
- .build();
- nbMap.put(nonBlockingList.key(), nonBlockingList);
+ lcpList.add(lcpMap.get(key));
}
- SwitchingPoolLcp splBldr = new SwitchingPoolLcpBuilder()
+ NonBlockingList nonBlockingList = new NonBlockingListBuilder()
+ .setNblNumber(nbl.getNblNumber())
+ .setInterconnectBandwidth(nbl.getInterconnectBandwidth())
+ .setInterconnectBandwidthUnit(nbl.getInterconnectBandwidthUnit())
+ .setLcpList(lcpList)
+ .build();
+ nbMap.put(nonBlockingList.key(), nonBlockingList);
+ }
+ switchingPoolList.add(
+ new SwitchingPoolLcpBuilder()
.setSwitchingPoolNumber(odp.getSwitchingPoolNumber())
.setSwitchingPoolType(odp.getSwitchingPoolType())
- //TODO differs from 2.2.1 SwitchingPoolTypes.forValue(odp.getSwitchingPoolType().getIntValue()
+ //TODO differs from 2.2.1 SwitchingPoolTypes.forValue(odp.getSwitchingPoolType().getIntValue())
.setNonBlockingList(nbMap)
- .build();
- switchingPoolList.add(splBldr);
- }
- postPortMapping(nodeId, null, null, null, switchingPoolList, null);
+ .build());
}
-
- mappingMap.forEach((k,v) -> portMapList.add(v));
- return true;
+ return switchingPoolList;
}
private boolean checkPartnerPortNotNull(Ports port) {
break;
case Rx:
case Tx:
- if (!checkPartnerPortNotNull(port)) {
- LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG
- + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
- nodeId, port.getPortName(), circuitPackName);
+ Ports port2 = getPartnerPort(port, circuitPackName, nodeId);
+ if (port2 == null) {
continue;
}
String lcp1 = createLogicalConnectionPort(port, srgCpEntry.getKey(), portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
nodeId, port.getPortName(), circuitPackName, lcp1);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class,
- new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
- Optional<Ports> port2Object = this.deviceTransactionManager
- .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
- Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port2Object.isEmpty()
- || port2Object.get().getPortQual().getIntValue()
- != PortQual.RoadmExternal.getIntValue()) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
- nodeId, port.getPartnerPort().getPortName(),
- port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkPartnerPort(circuitPackName, port, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG
- + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
- nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
- port.getPortName(), circuitPackName);
- portIndex++;
- continue;
- }
String lcp2 = createLogicalConnectionPort(port2, srgCpEntry.getKey(),portIndex);
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
nodeId, port2.getPortName(), circuitPackName, lcp2);
return true;
}
+ private Ports getPartnerPort(Ports port, String circuitPackName, String nodeId) {
+ if (!checkPartnerPortNotNull(port)) {
+ LOG.info(PortMappingUtils.NO_VALID_PARTNERPORT_LOGMSG + PortMappingUtils.CANNOT_AS_LCP_LOGMSG,
+ nodeId, port.getPortName(), circuitPackName);
+ return null;
+ }
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ Optional<Ports> port2Object = this.deviceTransactionManager
+ .getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
+ Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (port2Object.isEmpty()
+ || port2Object.get().getPortQual().getIntValue() != PortQual.RoadmExternal.getIntValue()) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_GET_ERROR_LOGMSG,
+ nodeId, port.getPartnerPort().getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ return null;
+ }
+ Ports port2 = port2Object.get();
+ if (!checkPartnerPort(circuitPackName, port, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG + PortMappingUtils.PARTNERPORT_CONF_ERROR_LOGMSG,
+ nodeId, port2.getPortName(), port.getPartnerPort().getCircuitPackName(),
+ port.getPortName(), circuitPackName);
+ //TODO check if we really needed to increment portIndex in this condition
+ // if yes this block should not be in getPartnerPort and must move back to createPpPortMapping
+ return null;
+ }
+ return port2;
+ }
+
private List<Ports> getPortList(String circuitPackName, String nodeId) {
InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
if (partnerLcp != null) {
mpBldr.setPartnerLcp(partnerLcp);
}
- if (port.augmentation(Ports1.class) != null && port.augmentation(Ports1.class).getPortCapabilities() != null) {
+ Collection<SupportedInterfaceCapability> supIntfCapaList = getSupIntfCapaList(port);
+ if (supIntfCapaList != null) {
List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327
.SupportedIfCapability>> supportedIntf = new ArrayList<>();
SupportedInterfaceCapability sic1 = null;
- for (SupportedInterfaceCapability sic : port.augmentation(Ports1.class).getPortCapabilities()
- .nonnullSupportedInterfaceCapability().values()) {
+ for (SupportedInterfaceCapability sic : supIntfCapaList) {
supportedIntf.add(sic.getIfCapType());
sic1 = sic;
}
return mpBldr.build();
}
+ private Collection<SupportedInterfaceCapability> getSupIntfCapaList(Ports port) {
+ return
+ port.augmentation(Ports1.class) == null || port.augmentation(Ports1.class).getPortCapabilities() == null
+ ? null
+ : port.augmentation(Ports1.class).getPortCapabilities().nonnullSupportedInterfaceCapability().values();
+ }
+
private ArrayList<OpucnTribSlotDef> getOpucnTribSlots(String deviceId, String mxpProfileName) {
ArrayList<OpucnTribSlotDef> minMaxOpucnTribSlots = new ArrayList<>(2);
switch (cpMapValue.size()) {
case 1:
// port is bidirectional
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (portObject.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port = getTtpPort(cp1, cp1Name, nodeId);
+ if (port == null) {
return false;
}
- Ports port = portObject.get();
if (!checkTtpPort(port, cp1Name, nodeId, true)) {
continue;
}
-
String logicalConnectionPoint =
PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(), "TXRX");
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
break;
case 2:
// ports are unidirectionals
- ConnectionPorts cp2 = cpMapValue.get(1);
- String cp2Name = cp2.getCircuitPackName();
- InstanceIdentifier<Ports> port1ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp1Name))
- .child(Ports.class, new PortsKey(cp1.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
- Optional<Ports> port1Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port1ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(cp2Name))
- .child(Ports.class, new PortsKey(cp2.getPortName()));
- LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
- Optional<Ports> port2Object = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, port2ID, Timeouts.DEVICE_READ_TIMEOUT,
- Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (port1Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp1.getPortName(), cp1Name);
+ Ports port1 = getTtpPort(cp1, cp1Name, nodeId);
+ if (port1 == null) {
return false;
}
- if (port2Object.isEmpty()) {
- LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp2.getPortName(), cp2Name);
+ ConnectionPorts cp2 = cpMapValue.get(1);
+ String cp2Name = cp2.getCircuitPackName();
+ Ports port2 = getTtpPort(cp2, cp2Name, nodeId);
+ if (port2 == null) {
return false;
}
-
- Ports port1 = port1Object.get();
- if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
- continue;
- }
- Ports port2 = port2Object.get();
- if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
- continue;
- }
-
- if (!checkPartnerPort(cp1Name, port1, port2)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
- continue;
- }
- // Directions checks are the same for cp1 and cp2, no need to check them twice.
- if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
- LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
- nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
+ if (!checkTtpPortsUnidir(port1, port2, cp1Name, cp2Name, nodeId)) {
continue;
}
-
String logicalConnectionPoint1 = PortMappingUtils.degreeTtpNodeName(cpMapEntry.getKey().toString(),
port1.getPortDirection().getName().toUpperCase(Locale.getDefault()));
LOG.info(PortMappingUtils.ASSOCIATED_LCP_LOGMSG,
default:
LOG.error(PortMappingUtils.NOT_CORRECT_CONPORT_LOGMSG, nodeId, cpMapEntry.getKey());
continue;
+ //TODO should it be continue or return false ?
}
}
return true;
}
+ private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
+ InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(cpName))
+ .child(Ports.class, new PortsKey(cp.getPortName()));
+ LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
+ Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
+ LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
+ Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+ if (portObject.isEmpty()) {
+ LOG.error(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, cp.getPortName(), cpName);
+ return null;
+ }
+ return portObject.get();
+ }
+
private boolean checkPortQual(Ports port, String cpName, String nodeId) {
if (port.getPortQual() == null) {
return false;
return true;
}
- private NodeInfo createNodeInfo(Info deviceInfo) {
+ private boolean checkTtpPortsUnidir(Ports port1, Ports port2, String cp1Name, String cp2Name, String nodeId) {
+ if (!checkTtpPort(port1, cp1Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkTtpPort(port2, cp2Name, nodeId, false)) {
+ return false;
+ }
+ if (!checkPartnerPort(cp1Name, port1, port2)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port2.getPortName(), cp2Name, port1.getPortName(), cp1Name);
+ return false;
+ }
+ // Directions checks are the same for cp1 and cp2, no need to check them twice.
+ if (!checkPartnerPortNoDir(cp2Name, port2, port1)) {
+ LOG.error(PortMappingUtils.NOT_CORRECT_PARTNERPORT_LOGMSG,
+ nodeId, port1.getPortName(), cp1Name, port2.getPortName(), cp2Name);
+ return false;
+ }
+ return true;
+ }
+ private NodeInfo createNodeInfo(Info deviceInfo) {
if (deviceInfo.getNodeType() == null) {
// TODO make mandatory in yang
LOG.error(PortMappingUtils.NODE_TYPE_LOGMSG, deviceInfo.getNodeId(), "field missing");
return null;
}
-
NodeInfoBuilder nodeInfoBldr = new NodeInfoBuilder()
.setOpenroadmVersion(OpenroadmNodeVersion._71)
.setNodeClli(
if (deviceInfo.getIpAddress() != null) {
nodeInfoBldr.setNodeIpAddress(deviceInfo.getIpAddress());
}
-
return nodeInfoBldr.build();
}
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
<groupId>org.opendaylight.transportpce</groupId>
supported over ODU4 in transponders or switchponders using higher rate network
interfaces.
+In Silicon release, the management of TopologyUpdateNotification coming from the *Topology Management*
+module was implemented. This functionality enables the controller to update the information of existing
+services according to the online status of the network infrastructure. If any service is affected by
+the topology update and the *odl-transportpce-nbi* feature is installed, the Service Handler will send a
+notification to a Kafka server with the service update information.
+
PCE
^^^
The population of OTN links (OTU4 and ODU4), and the adjustment of the tributary ports/slots
pool occupancy when OTN services are created is supported since Magnesium SR2.**
+Since Silicon release, the Topology Management module process NETCONF event received through an
+event stream (as defined in RFC 5277) between devices and the NETCONF adapter of the controller.
+Current implementation detects device configuration changes and updates the topology datastore accordingly.
+Then, it sends a TopologyUpdateNotification to the *Service Handler* to indicate that a change has been
+detected in the network that may affect some of the already existing services.
Renderer
^^^^^^^^
- PCE to Topology Management
- Service Handler to Renderer
- Renderer to OLM
+- Network Model to Service Handler
Pce Service
^^^^^^^^^^^
- This feature provides function to be able to stub some of TransportPCE modules, pce and
renderer (Stubpce and Stubrenderer).
- Stubs are used for development purposes and can be used for some of the functionnal tests.
+ Stubs are used for development purposes and can be used for some of the functional tests.
Interfaces to external software
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This feature allows TransportPCE application to expose at its northbound interface other APIs than
those defined by the OpenROADM MSA. With this feature, TransportPCE provides part of the Transport-API
-specified by the Open Networking Foundation. More specifically, part of the Topology Service component
-is implemented, allowing to expose to higher level applications an abstraction of its OpenROADM
-topologies in the form of topologies respecting the T-API modelling. The current version of TransportPCE
-implements the *tapi-topology.yang* model in the revision 2018-12-10 (T-API v2.1.2).
+specified by the Open Networking Foundation. More specifically, the Topology Service and Connectivity
+Service components are implemented, allowing to expose to higher level applications an abstraction of
+its OpenROADM topologies in the form of topologies respecting the T-API modelling, as well as
+creating/deleting connectivity services between the Service Interface Points (SIPs) exposed by the
+T-API topology. The current version of TransportPCE implements the *tapi-topology.yang* and
+*tapi-connectivity.yang* models in the revision 2018-12-10 (T-API v2.1.2).
+Additionally, support for the Notification Service component will be added in future releases, which
+will allow higher level applications to create/delete a Notification Subscription Service to receive
+several T-API notifications as defined in the *tapi-notification.yang* model.
-- RPC call
+T-API Topology Service
+~~~~~~~~~~~~~~~~~~~~~~
+
+- RPC calls implemented:
- get-topology-details
+ - get-node-details
+
+ - get-node-edge-point-details
+
+ - get-link-details
+
+ - get-topology-list
+
+
As in IETF or OpenROADM topologies, T-API topologies are composed of lists of nodes and links that
abstract a set of network resources. T-API specifies the *T0 - Multi-layer topology* which is, as
indicated by its name, a single topology that collapses network logical abstraction for all network
represented by a bidirectional OTN link in TAPI topology, while retaining their available bandwidth
characteristics.
-Two kinds of topologies are currently implemented. The first one is the *"T0 - Multi-layer topology"*
+Phosphorus SR0 extends the T-API topology service implementation by bringing a fully described topology.
+*T0 - Full Multi-layer topology* is derived from the existing *T0 - Multi-layer topology*. But the ROADM
+infrastructure is not abstracted and the higher level application can get more details on the composition
+of the ROADM infrastructure controlled by TransportPCE. Each ROADM node found in the *openroadm-network*
+is converted into a *Photonic Media* node. The details of these T-API nodes are obtained from the
+*openroadm-topology*. Therefore, the external traffic ports of *Degree* and *SRG* nodes are represented
+with a set of Network Edge Points (NEPs) and SIPs belonging to the *Photonic Media* node and a pair of
+roadm-to-roadm links present in *openroadm-topology* is represented by a bidirectional *OMS* link in TAPI
+topology.
+Additionally, T-API topology related information is stored in TransportPCE datastore in the same way as
+OpenROADM topology layers. When a node is connected to the controller through the corresponding *REST API*,
+the T-API topology context gets updated dynamically and stored.
+
+.. note::
+
+ A naming nomenclature is defined to be able to map T-API and OpenROADM data.
+ i.e., T-API_roadm_Name = OpenROADM_roadmID+T-API_layer
+ i.e., T-API_roadm_nep_Name = OpenROADM_roadmID+T-API_layer+OpenROADM_terminationPointID
+
+Three kinds of topologies are currently implemented. The first one is the *"T0 - Multi-layer topology"*
defined in the reference implementation of T-API. This topology gives an abstraction from data coming
from openroadm-topology and otn-topology. Such topology may be rather complex since most of devices are
represented through several nodes and links.
Another topology, named *"Transponder 100GE"*, is also implemented. That latter provides a higher level
of abstraction, much simpler, for the specific case of 100GE transponder, in the form of a single
DSR node.
+Lastly, the *T0 - Full Multi-layer topology* topology was added. This topology collapses the data coming
+from openroadm-network, openroadm-topology and otn-topology. It gives a complete view of the optical
+network as defined in the reference implementation of T-API
The figure below shows an example of TAPI abstractions as performed by TransportPCE starting from Aluminium SR2.
port is connected to Add/Drop nodes of the ROADM infrastructure are retrieved in order to
abstract only relevant information.
+This request builds the TAPI *T0 - Full Multi-layer* topology with respect to the information existing in
+the T-API topology context stored in OpenDaylight datastores.
+
+.. code:: json
+
+ {
+ "tapi-topology:input": {
+ "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology"
+ }
+ }
+
+**REST API** : *POST /restconf/operations/tapi-topology:get-node-details*
+
+This request returns the information, stored in the Topology Context, of the corresponding T-API node.
+The user can provide, either the Uuid associated to the attribute or its name.
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "tapi-topology:input": {
+ "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology",
+ "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONINC_MEDIA"
+ }
+ }
+
+**REST API** : *POST /restconf/operations/tapi-topology:get-node-edge-point-details*
+
+This request returns the information, stored in the Topology Context, of the corresponding T-API NEP.
+The user can provide, either the Uuid associated to the attribute or its name.
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "tapi-topology:input": {
+ "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology",
+ "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONINC_MEDIA",
+ "tapi-topology:ep-id-or-name": "ROADM-A1+PHOTONINC_MEDIA+DEG1-TTP-TXRX"
+ }
+ }
+
+**REST API** : *POST /restconf/operations/tapi-topology:get-link-details*
+
+This request returns the information, stored in the Topology Context, of the corresponding T-API link.
+The user can provide, either the Uuid associated to the attribute or its name.
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "tapi-topology:input": {
+ "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology",
+ "tapi-topology:link-id-or-name": "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX"
+ }
+ }
+
+T-API Connectivity & Common Services
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Phosphorus SR0 extends the T-API interface support by implementing the T-API connectivity Service.
+This interface enables a higher level controller or an orchestrator to request the creation of
+connectivity services as defined in the *tapi-connectivity* model. As it is necessary to indicate the
+two (or more) SIPs (or endpoints) of the connectivity service, the *tapi-common* model is implemented
+to retrieve from the datastore all the innformation related to the SIPs in the tapi-context.
+Current implementation of the connectivity service maps the *connectivity-request* into the appropriate
+*openroadm-service-create* and relies on the Service Handler to perform path calculation and configuration
+of devices. Results received from the PCE and the Rendererare mapped back into T-API to create the
+corresponding Connection End Points (CEPs) and Connections in the T-API Connectivity Context and store it
+in the datastore.
+
+This first implementation includes the creation of:
+
+- ROADM-to-ROADM tapi-connectivity service (MC connectivity service)
+- OTN tapi-connectivity services (OCh/OTU, OTSi/OTU & ODU connectivity services)
+- Ethernet tapi-connectivity services (DSR connectivity service)
+
+- RPC calls implemented
+
+ - create-connectivity-service
+
+ - get-connectivity-service-details
+
+ - get-connection-details
+
+ - delete-connectivity-service
+
+ - get-connection-end-point-details
+
+ - get-connectivity-service-list
+
+ - get-service-interface-point-details
+
+ - get-service-interface-point-list
+
+Creating a T-API Connectivity service
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use the *tapi* interface to create any end-to-end connectivity service on a T-API based
+network. Two kind of end-to-end "optical" connectivity services are managed by TransportPCE T-API module:
+- 10GE service from client port to client port of two OTN Xponders (MUXPDR or SWITCH)
+- Media Channel (MC) connectivity service from client add/drop port (PP port of SRG) to
+client add/drop port of two ROADMs.
+
+As mentioned earlier, T-API module interfaces with the Service Handler to automatically invoke the
+*renderer* module to create all required tapi connections and cross-connection on each device
+supporting the service.
+
+Before creating a low-order OTN connectivity service (1GE or 10GE services terminating on
+client port of MUXPDR or SWITCH), the user must ensure that a high-order ODU4 container
+exists and has previously been configured (it means structured to support low-order otn services)
+to support low-order OTN containers.
+
+Thus, OTN connectivity service creation implies three steps:
+1. OTSi/OTU connectivity service from network port to network port of two OTN Xponders (MUXPDR or SWITCH in Photonic media layer)
+2. ODU connectivity service from network port to network port of two OTN Xponders (MUXPDR or SWITCH in DSR/ODU layer)
+3. 10GE connectivity service creation from client port to client port of two OTN Xponders (MUXPDR or SWITCH in DSR/ODU layer)
+
+The first step corresponds to the OCH-OTU4 service from network port to network port of OpenROADM.
+The corresponding T-API cross and top connections are created between the CEPs of the T-API nodes
+involved in each request.
+
+Additionally, an *MC connectivity service* could be created between two ROADMs to create an optical
+tunnel and reserve resources in advance. This kind of service corresponds to the OC service creation
+use case described earlier.
+
+The management of other OTN services through T-API (1GE-ODU0, 100GE...) is planned for future releases.
+
+Any-Connectivity service creation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+As for the Service Creation described for OpenROADM, the initial steps are the same:
+
+- Connect netconf devices to the controller
+- Create XPDR-RDM links and configure RDM-to-RDM links (in openroadm topologies)
+
+Bidirectional T-API links between xpdr and rdm nodes must be created manually. To that end, use the
+following REST RPCs:
+
+From xpdr <--> rdm:
+^^^^^^^^^^^^^^^^^^^
+
+**REST API** : *POST /restconf/operations/transportpce-tapinetworkutils:init-xpdr-rdm-tapi-link*
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "input": {
+ "xpdr-node": "<XPDR_OpenROADM_id>",
+ "network-tp": "<XPDR_TP_OpenROADM_id>",
+ "rdm-node": "<ROADM_OpenROADM_id>",
+ "add-drop-tp": "<ROADM_TP_OpenROADM_id>"
+ }
+ }
+
+Use the following REST RPC to invoke T-API module in order to create a bidirectional connectivity
+service between two devices. The network should be composed of two ROADMs and two Xponders (SWITCH or MUX)
+
+**REST API** : *POST /restconf/operations/tapi-connectivity:create-connectivity-service*
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "tapi-connectivity:input": {
+ "tapi-connectivity:end-point": [
+ {
+ "tapi-connectivity:layer-protocol-name": "<Node_TAPI_Layer>",
+ "tapi-connectivity:service-interface-point": {
+ "tapi-connectivity:service-interface-point-uuid": "<SIP_UUID_of_NEP>"
+ },
+ "tapi-connectivity:administrative-state": "UNLOCKED",
+ "tapi-connectivity:operational-state": "ENABLED",
+ "tapi-connectivity:direction": "BIDIRECTIONAL",
+ "tapi-connectivity:role": "SYMMETRIC",
+ "tapi-connectivity:protection-role": "WORK",
+ "tapi-connectivity:local-id": "<OpenROADM node ID>",
+ "tapi-connectivity:name": [
+ {
+ "tapi-connectivity:value-name": "OpenROADM node id",
+ "tapi-connectivity:value": "<OpenROADM node ID>"
+ }
+ ]
+ },
+ {
+ "tapi-connectivity:layer-protocol-name": "<Node_TAPI_Layer>",
+ "tapi-connectivity:service-interface-point": {
+ "tapi-connectivity:service-interface-point-uuid": "<SIP_UUID_of_NEP>"
+ },
+ "tapi-connectivity:administrative-state": "UNLOCKED",
+ "tapi-connectivity:operational-state": "ENABLED",
+ "tapi-connectivity:direction": "BIDIRECTIONAL",
+ "tapi-connectivity:role": "SYMMETRIC",
+ "tapi-connectivity:protection-role": "WORK",
+ "tapi-connectivity:local-id": "<OpenROADM node ID>",
+ "tapi-connectivity:name": [
+ {
+ "tapi-connectivity:value-name": "OpenROADM node id",
+ "tapi-connectivity:value": "<OpenROADM node ID>"
+ }
+ ]
+ }
+ ],
+ "tapi-connectivity:connectivity-constraint": {
+ "tapi-connectivity:service-layer": "<TAPI_Service_Layer>",
+ "tapi-connectivity:service-type": "POINT_TO_POINT_CONNECTIVITY",
+ "tapi-connectivity:service-level": "Some service-level",
+ "tapi-connectivity:requested-capacity": {
+ "tapi-connectivity:total-size": {
+ "value": "<CAPACITY>",
+ "unit": "GB"
+ }
+ }
+ },
+ "tapi-connectivity:state": "Some state"
+ }
+ }
+
+As for the previous RPC, MC and OTSi correspond to PHOTONIC_MEDIA layer services,
+ODU to ODU layer services and 10GE/DSR to DSR layer services. This RPC invokes the
+*Service Handler* module to trigger the *PCE* to compute a path over the
+*otn-topology* that must contains ODU4 links with valid bandwidth parameters. Once the path is computed
+and validated, the T-API CEPs (associated with a NEP), cross connections and top connections will be created
+according to the service request and the topology objects inside the computed path. Then, the *renderer* and
+*OLM* are invoked to implement the end-to-end path into the devices and to update the status of the connections
+and connectivity service.
+
+.. note::
+ Refer to the "Unconstrained E2E Service Provisioning" use cases from T-API Reference Implementation to get
+ more details about the process of connectivity service creation
+
+Deleting a connectivity service
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use the following REST RPC to invoke *TAPI* module in order to delete a given optical
+connectivity service.
+
+**REST API** : *POST /restconf/operations/tapi-connectivity:delete-connectivity-service*
+
+**Sample JSON Data**
+
+.. code:: json
+
+ {
+ "tapi-connectivity:input": {
+ "tapi-connectivity:service-id-or-name": "<Service_UUID_or_Name>"
+ }
+ }
+
+.. note::
+ Deleting OTN connectivity services implies proceeding in the reverse way to their creation. Thus, OTN
+ connectivity service deletion must respect the three following steps:
+ 1. delete first all 10GE services supported over any ODU4 to be deleted
+ 2. delete ODU4
+ 3. delete MC-OTSi supporting the just deleted ODU4
+
+T-API Notification Service
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In future releases, the T-API notification service will be implemented. The objective will be to write and read
+T-API notifications stored in topics of a Kafka server as explained later in the odl-transportpce-nbinotifications
+section, but T-API based.
+
+
odl-transportpce-dmaap-client
-----------------------------
This feature allows TransportPCE application to send notifications on ONAP Dmaap Message router
following service request results.
This feature listens on NBI notifications and sends the PublishNotificationService content to
-Dmaap on the topic "unauthenticated.TPCE" through a POST request on /events/unauthenticated.TPCE
+Dmaap on the topic "unauthenticated. TPCE" through a POST request on /events/unauthenticated.TPCE
It uses Jackson to serialize the notification to JSON and jersey client to send the POST request.
odl-transportpce-nbinotifications
It is basically composed of two kinds of elements. First are the 'publishers' that are in charge of sending a notification to
a Kafka server. To protect and only allow specific classes to send notifications, each publisher
is dedicated to an authorized class.
-Then are the 'subscribers' that are in charge of reading notifications from a Kafka server.
+There are the 'subscribers' that are in charge of reading notifications from a Kafka server.
So when the feature is called to write notification to a Kafka server, it will serialize the notification
into JSON format and then will publish it in a topic of the server via a publisher.
And when the feature is called to read notifications from a Kafka server, it will retrieve it from
are equivalent to::
- $ nosetests transportpce_tests/2.2.1/test01_portmapping.py
+ $ nosetests transportpce_tests/7.1/test01_portmapping.py
but will ask tests script to use the controller `lighty.io <https://lighty.io/>`_
build instead of Karaf.
there to build the controller from sources and adapt OLM default timers.
They can also depend on `sims121` or `sims221` or `sims71` profiles to download
simulators of OpenROADM devices when needed.
+Other profiles named from the pattern `build_karaf_testsXXX` have also been
+added to configure separate karaf instances with alternate listening ports
+in order to use concurrency.
The `depend` parameter in `tox.ini` allows tox to establish the most efficient
tests order strategy when calling tox without the `-e` option.
$ tox -e buildcontroller,sims121,tests121
+or with karaf alternate builds::
+
+ $ tox -e buildcontroller,build_karaf_tests121,sims121,tests121
+
will build the controller and download simulators before running every functional
tests for OpenROADM devices 1.2.1.
Once that done, you only need to list the others sims versions profiles before
$ tox -e sims221,sims71,tests_hybrid
+or with karaf alternate builds::
+
+ $ tox -e build_karaf_tests_hybrid,sims221,sims71,tests_hybrid
+
Also the same way arguments can be passed to the `launch_tests.sh` script,
tests names can be passed as argument when calling the corresponding tox profiles.
for every OpenROADM devices supported versions::
$ tox -p 3 -e buildcontroller,sims121,sims221,sims71,tests121,tests221,tests71 portmapping
+
+or with karaf alternate builds::
+
+ $ tox -p 3 -e buildcontroller,build_karaf_tests121,build_karaf_tests221,build_karaf_tests71,sims121,sims221,sims71,tests121,tests221,tests71 portmapping
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath />
</parent>
<groupId>org.opendaylight.transportpce</groupId>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath />
</parent>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2021 Orange and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>single-feature-parent</artifactId>
+ <version>9.0.8</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.transportpce</groupId>
+ <artifactId>odl-transportpce-swagger</artifactId>
+ <version>5.0.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name>OpenDaylight :: transportpce :: swagger</name>
+
+ <properties>
+ <netconf.version>2.0.7</netconf.version>
+ <configfile.directory>etc/opendaylight/karaf</configfile.directory>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>netconf-artifacts</artifactId>
+ <version>${netconf.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>odl-mdsal-apidocs</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+
+<!-- skipping test since this is an umbrella project / folder -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<name>OpenDaylight :: transportpce</name>
<properties>
- <netconf.version>2.0.5</netconf.version>
+ <netconf.version>2.0.7</netconf.version>
<configfile.directory>etc/opendaylight/karaf</configfile.directory>
</properties>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<module>odl-transportpce-inventory</module>
<module>odl-transportpce-nbinotifications</module>
<module>odl-transportpce-dmaap-client</module>
+ <module>odl-transportpce-swagger</module>
</modules>
</project>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
}
public boolean addNode(String deviceId, String openROADMversion) {
- boolean sqlResult = false;
+ //boolean sqlResult = false;
return inode121.addNode(deviceId);
}
} catch (SQLException e) {
LOG.error("Something wrong when fetching node in DB", e);
}
- return nodeExists == 0 ? false : true;
+ return nodeExists != 0;
}
public boolean dataExists(String tableName, String searchKeys) {
} catch (SQLException e) {
LOG.error("Something wrong when fetching data in DB", e);
}
- return dataExists == 0 ? false : true;
+ return dataExists != 0;
}
/* public void getRoadmShelves(String nodeId, String openRoadmVersion)
} catch (SQLException e) {
LOG.error("Something wrong when fetching node in DB", e);
}
- return nodeExists == 0 ? false : true;
+ return nodeExists != 0;
}
public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
} catch (SQLException e) {
LOG.error("Something wrong when fetching node in DB", e);
}
- return nodeExists == 0 ? false : true;
+ return nodeExists != 0;
}
public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>karaf4-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<type>xml</type>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>odl-transportpce-swagger</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
LOG.info("Serialized event {}", serialized);
return serialized.getBytes(StandardCharsets.UTF_8);
} catch (IOException e) {
+ LOG.error("exception raised during serialization", e);
return new byte[0];
}
}
LOG.info("Serialized event {}", serialized);
return serialized.getBytes(StandardCharsets.UTF_8);
} catch (IOException e) {
+ LOG.error("exception raised during serialization", e);
return new byte[0];
}
}
LOG.warn("Kafka property file '{}' is empty", propertyFileName);
}
} catch (IOException e) {
- LOG.warn("Kafka property file '{}' was not found in the classpath", propertyFileName);
+ LOG.error("Kafka property file '{}' was not found in the classpath", propertyFileName, e);
}
return props;
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>bundle-parent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>3.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
String sourceTpId = link.getSrcTpId();
String destNodeId = link.getDestNodeId();
String destTpId = link.getDestTpid();
- OtsPmHolder srcOtsPmHoler = getPmMeasurements(sourceNodeId, sourceTpId, "OpticalPowerOutput");
- if (srcOtsPmHoler == null) {
- srcOtsPmHoler = getPmMeasurements(sourceNodeId, sourceTpId, "OpticalPowerOutputOSC");
- }
- OtsPmHolder destOtsPmHoler = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInput");
- if (destOtsPmHoler == null) {
- destOtsPmHoler = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInputOSC");
+ OtsPmHolder srcOtsPmHolder = getPmMeasurements(sourceNodeId, sourceTpId, "OpticalPowerOutput");
+ if (srcOtsPmHolder == null) {
+ srcOtsPmHolder = getPmMeasurements(sourceNodeId, sourceTpId, "OpticalPowerOutputOSC");
+ if (srcOtsPmHolder == null) {
+ LOG.warn("OTS configuration issue at {} - {}", sourceNodeId, sourceTpId);
+ continue;
+ }
}
-
- if (srcOtsPmHoler.getOtsInterfaceName() == null || destOtsPmHoler.getOtsInterfaceName() == null) {
- LOG.warn("OTS is not present for the link {}", link);
- continue;
+ OtsPmHolder destOtsPmHolder = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInput");
+ if (destOtsPmHolder == null) {
+ destOtsPmHolder = getPmMeasurements(destNodeId, destTpId, "OpticalPowerInputOSC");
+ if (destOtsPmHolder == null) {
+ LOG.warn("OTS configuration issue at {} - {}", destNodeId, destTpId);
+ continue;
+ }
}
- spanLoss = BigDecimal.valueOf(srcOtsPmHoler.getOtsParameterVal() - destOtsPmHoler.getOtsParameterVal())
+ spanLoss = BigDecimal.valueOf(srcOtsPmHolder.getOtsParameterVal() - destOtsPmHolder.getOtsParameterVal())
.setScale(1, RoundingMode.HALF_UP);
LOG.info("Spanloss Calculated as :{}={}-{}",
- spanLoss, srcOtsPmHoler.getOtsParameterVal(), destOtsPmHoler.getOtsParameterVal());
+ spanLoss, srcOtsPmHolder.getOtsParameterVal(), destOtsPmHolder.getOtsParameterVal());
if (spanLoss.doubleValue() > 28) {
LOG.warn("Span Loss is out of range of OpenROADM specifications");
}
if (spanLoss.intValue() <= 0) {
spanLoss = BigDecimal.valueOf(0);
}
- if (!setSpanLoss(sourceNodeId, srcOtsPmHoler.getOtsInterfaceName(), spanLoss, "TX")) {
+ if (!setSpanLoss(sourceNodeId, srcOtsPmHolder.getOtsInterfaceName(), spanLoss, "TX")) {
LOG.info("Setting spanLoss failed for {}", sourceNodeId);
return null;
}
- if (!setSpanLoss(destNodeId, destOtsPmHoler.getOtsInterfaceName(), spanLoss, "RX")) {
+ if (!setSpanLoss(destNodeId, destOtsPmHolder.getOtsInterfaceName(), spanLoss, "RX")) {
LOG.info("Setting spanLoss failed for {}", destNodeId);
return null;
}
InstanceIdentifier<?> resourceKeyIID =
findClassKeyIdentifiers(input.getResourceType(), input.getResourceIdentifier());
+ if (resourceKeyIID == null) {
+ return pmOutputBuilder;
+ }
CurrentPmEntryKey resourceKey = new CurrentPmEntryKey(resourceKeyIID,
convertResourceTypeEnum(input.getResourceType()),"");
InstanceIdentifier<CurrentPmList> iidCurrentPmList = InstanceIdentifier.create(CurrentPmList.class);
private static InstanceIdentifier<?> findClassKeyIdentifiers(ResourceTypeEnum wantedResourceType,
ResourceIdentifier wantedResourceIdentifier) {
+ if (wantedResourceIdentifier.getResourceName() == null) {
+ LOG.debug("resource {} is null", wantedResourceType);
+ return null;
+ }
switch (wantedResourceType) {
case Device:
return InstanceIdentifier.create(OrgOpenroadmDevice.class);
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.5</version>
+ <version>2.0.7</version>
<scope>import</scope>
<type>pom</type>
</dependency>
+++ /dev/null
-module org-openroadm-ospf {
- namespace "http://org/openroadm/ospf";
- prefix org-openroadm-ospf;
-
- import ietf-inet-types {
- prefix inet;
- revision-date 2013-07-15;
- }
- import ietf-yang-types {
- prefix yang;
- revision-date 2013-07-15;
- }
- import org-openroadm-device {
- prefix org-openroadm-device;
- revision-date 2020-05-29;
- }
- import org-openroadm-routing {
- prefix org-openroadm-routing;
- revision-date 2020-05-29;
- }
- import org-openroadm-key-chain {
- prefix org-openroadm-key-chain;
- revision-date 2019-11-29;
- }
-
- organization
- "Open ROADM MSA";
- contact
- "OpenROADM.org";
- description
- "This model defines the Yang model for ospf.
-
- This model reuses data items defined in the IETF YANG model for
- OSPF described by draft-ietf-ospf-yang-00.
-
- Some attributes which are not required in Open ROADM MSA are removed.
- Yang file included are changed to fit into Open ROADM MSA yang structure.
-
- IETF code is subject to the following copyright and license:
- Copyright (c) IETF Trust and the persons identified as authors of
- the code.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, is permitted pursuant to, and subject to the license
- terms contained in, the Simplified BSD License set forth in
- Section 4.c of the IETF Trust's Legal Provisions Relating
- to IETF Documents (http://trustee.ietf.org/license-info).";
-
- revision 2020-05-29 {
- description
- "Version 7.1.0";
- }
- revision 2020-03-27 {
- description
- "Version 7.0.0";
- }
- revision 2019-11-29 {
- description
- "Version 6.1.0";
- }
- revision 2019-09-27 {
- description
- "Version 6.0.0";
- }
- revision 2019-05-31 {
- description
- "Version 5.1.0";
- }
- revision 2019-03-29 {
- description
- "Version 5.0.0";
- }
- revision 2018-03-30 {
- description
- "Initial revision.";
- }
-
- feature multi-topology {
- description
- "Support MTR.";
- }
-
- feature multi-area-adj {
- description
- "OSPF multi-area adjacency support as in RFC 5185.";
- }
-
- feature router-id {
- description
- "Set router ID per instance.";
- }
-
- feature demand-circuit {
- description
- "OSPF demand circuit support as in RFC 1793.";
- }
-
- feature mtu-ignore {
- description
- "Disable OSPF MTU mismatch detection on receiving
- DBD packets.";
- }
-
- feature lls {
- description
- "OSPF link-local signaling (LLS) as in RFC 5613.";
- }
-
- feature prefix-suppression {
- description
- "OSPF prefix suppression support as in RFC 6860.";
- }
-
- feature bfd {
- description
- "OSPF BFD support.";
- }
-
- feature ttl-security {
- description
- "OSPF ttl security check.";
- }
-
- feature nsr {
- description
- "Non-Stop-Routing (NSR).";
- }
-
- feature graceful-restart {
- description
- "Graceful OSPF Restart as defined in RFC3623 and RFC5187.";
- }
-
- feature protocol-shutdown {
- description
- "Shutdown the protocol.";
- }
-
- feature auto-cost {
- description
- "Calculate OSPF interface cost according to
- reference bandwidth.";
- }
-
- feature max-ecmp {
- description
- "Setting maximum number of ECMP paths.";
- }
-
- feature max-lsa {
- description
- "Setting maximum number of LSAs OSPF will receive.";
- }
-
- feature te-rid {
- description
- "TE router-id.";
- }
-
- feature ldp-igp-sync {
- description
- "LDP IGP synchronization.";
- }
-
- feature ldp-igp-autoconfig {
- description
- "LDP IGP auto-config.";
- }
-
- feature protocol-if-shutdown {
- description
- "Shutdown the protocol over an interface.";
- }
-
- feature ospfv3-authentication-ipsec {
- description
- "Use IPsec for OSPFv3 authentication.";
- }
-
- feature instance-inheritance {
- description
- "Support instance inheritance";
- }
-
- feature area-inheritance {
- description
- "Support area inheritance";
- }
-
- feature interface-inheritance {
- description
- "Support interface inheritance";
- }
-
- identity ospf {
- base org-openroadm-routing:routing-protocol;
- description
- "OSPF Protocol";
- }
-
- identity ospfv2 {
- base ospf;
- description
- "OSPFv2";
- }
-
- identity ospfv3 {
- base ospf;
- description
- "OSPFv3";
- }
-
- identity operation-mode {
- description
- "OSPF operation mode.";
- }
-
- identity ships-in-the-night {
- base operation-mode;
- description
- "Ships-in-the-night operation mode in which
- each OSPF instance carries only one address family";
- }
-
- identity area-type {
- description
- "Base identity for OSPF area type.";
- }
-
- identity normal {
- base area-type;
- description
- "OSPF normal area.";
- }
-
- identity stub {
- base area-type;
- description
- "OSPF stub area.";
- }
-
- identity nssa {
- base area-type;
- description
- "OSPF NSSA area.";
- }
-
- identity if-link-type {
- description
- "Base identity for OSPF interface link type.";
- }
-
- identity if-link-type-normal {
- base if-link-type;
- description
- "OSPF interface link type normal.";
- }
-
- identity if-link-type-virtual-link {
- base if-link-type;
- description
- "OSPF interface link type virtual link.";
- }
-
- identity if-link-type-sham-link {
- base if-link-type;
- description
- "OSPF interface link type sham link.";
- }
-
- typedef uint24 {
- type uint32 {
- range "0 .. 16777215";
- }
- description
- "24-bit unsigned integer.";
- }
-
- typedef area-id-type {
- type union {
- type uint32;
- type yang:dotted-quad;
- }
- description
- "Area ID type.";
- }
-
- typedef if-state-type {
- type enumeration {
- enum Down {
- value 1;
- description
- "Interface down state";
- }
- enum Loopback {
- value 2;
- description
- "Interface loopback state";
- }
- enum Waiting {
- value 3;
- description
- "Interface waiting state";
- }
- enum Point-to-Point {
- value 4;
- description
- "Interface point-to-point state";
- }
- enum DR {
- value 5;
- description
- "Interface Designated Router (DR) state";
- }
- enum BDR {
- value 6;
- description
- "Interface Backup Designated Router (BDR) state";
- }
- enum DR-Other {
- value 7;
- description
- "Interface Other Designated Router state";
- }
- }
- description
- "OSPF interface state type.";
- }
-
- typedef nbr-state-type {
- type enumeration {
- enum Down {
- value 1;
- description
- "Neighbor down state";
- }
- enum Attempt {
- value 2;
- description
- "Neighbor attempt state";
- }
- enum Init {
- value 3;
- description
- "Neighbor init state";
- }
- enum 2-Way {
- value 4;
- description
- "Neighbor 2-Way state";
- }
- enum ExStart {
- value 5;
- description
- "Neighbor exchange start state";
- }
- enum Exchange {
- value 6;
- description
- "Neighbor exchange state";
- }
- enum Loading {
- value 7;
- description
- "Neighbor loading state";
- }
- enum Full {
- value 8;
- description
- "Neighbor full state";
- }
- }
- description
- "OSPF neighbor state type.";
- }
-
- typedef restart-helper-status-type {
- type enumeration {
- enum Not-Helping {
- value 1;
- description
- "Restart helper status not helping.";
- }
- enum Helping {
- value 2;
- description
- "Restart helper status helping.";
- }
- }
- description
- "Restart helper status type.";
- }
-
- typedef restart-exit-reason-type {
- type enumeration {
- enum None {
- value 1;
- description
- "Not attempted.";
- }
- enum InProgress {
- value 2;
- description
- "Restart in progress.";
- }
- enum Completed {
- value 3;
- description
- "Successfully completed.";
- }
- enum TimedOut {
- value 4;
- description
- "Timed out.";
- }
- enum TopologyChanged {
- value 5;
- description
- "Aborted due to topology change.";
- }
- }
- description
- "Describes the outcome of the last attempt at a
- graceful restart, either by itself or acting
- as a helper.";
- }
-
- typedef packet-type {
- type enumeration {
- enum Hello {
- value 1;
- description
- "OSPF hello packet.";
- }
- enum Database-Descripton {
- value 2;
- description
- "OSPF database description packet.";
- }
- enum Link-State-Request {
- value 3;
- description
- "OSPF link state request packet.";
- }
- enum Link-State-Update {
- value 4;
- description
- "OSPF link state update packet.";
- }
- enum Link-State-Ack {
- value 5;
- description
- "OSPF link state acknowlegement packet.";
- }
- }
- description
- "OSPF packet type.";
- }
-
- typedef nssa-translator-state-type {
- type enumeration {
- enum Enabled {
- value 1;
- description
- "NSSA translator enabled state.";
- }
- enum Elected {
- description
- "NSSA translator elected state.";
- }
- enum Disabled {
- value 3;
- description
- "NSSA translator disabled state.";
- }
- }
- description
- "OSPF NSSA translator state type.";
- }
-
- typedef restart-status-type {
- type enumeration {
- enum Not-Restarting {
- value 1;
- description
- "Router is not restarting.";
- }
- enum Planned-Restart {
- description
- "Router is going through planned restart.";
- }
- enum Unplanned-Restart {
- value 3;
- description
- "Router is going through unplanned restart.";
- }
- }
- description
- "OSPF graceful restart status type.";
- }
-
- grouping interface-common-config {
- description
- "Common configuration for all types of interfaces,
- including virtual link and sham link";
- leaf cost {
- type uint16 {
- range "1..65535" {
- error-message "Configured value is out of range";
- }
- }
- description
- "Interface cost.";
- }
- leaf hello-interval {
- type uint16 {
- range "1..65535" {
- error-message "Configured value is out of range";
- }
- }
- units "seconds";
- description
- "Time between hello packets.";
- }
- leaf dead-interval {
- type uint16 {
- range "1..65535" {
- error-message "Configured value is out of range";
- }
- }
- units "seconds";
- must '../dead-interval > ../hello-interval' {
- error-message "The dead interval must be larger than the hello interval";
- description
- "The value MUST be greater than 'hello-internval'.";
- }
- description
- "Interval after which a neighbor is declared dead.";
- }
- leaf rtrPriority {
- type uint8 {
- range "0..255";
- }
- description
- "Router priority for DR election.";
- }
- leaf retransmit-interval {
- type uint16 {
- range "1..65535" {
- error-message "Configured value is out of range";
- }
- }
- units "seconds";
- description
- "Time between retransmitting unacknowledged Link State
- Advertisements (LSAs).";
- }
- leaf transmit-delay {
- type uint16 {
- range "1..65535" {
- error-message "Configured value is out of range";
- }
- }
- units "seconds";
- description
- "Estimated time needed to send link-state update.";
- }
- leaf mtu-ignore {
- if-feature "mtu-ignore";
- type boolean;
- description
- "Enable/Disable ignoring of MTU in DBD packets.";
- }
- container authentication {
- description
- "Authentication configuration.";
- choice auth-type-selection {
- description
- "Options for expressing authentication setting";
- case auth-ipsec {
- when "../../../../../org-openroadm-routing:type = 'ospfv3'" {
- description
- "Applied to OSPFv3 only";
- }
- if-feature "ospfv3-authentication-ipsec";
- leaf sa {
- type string;
- description
- "SA name";
- }
- }
- case auth-trailer-key-chain {
- leaf key-chain {
- type org-openroadm-key-chain:key-chain-ref;
- description
- "key-chain name";
- }
- }
- case auth-trailer-key {
- leaf key {
- type string {
- length "1..8" {
- error-message "Configured string exceeds the maximum length";
- }
- }
- description
- "Key string in ASCII format.";
- }
- }
- }
- }
- }
-
- grouping interface-config {
- description
- "Configuration for real interfaces.";
- leaf network-type {
- type enumeration {
- enum broadcast {
- description
- "Specify OSPF broadcast multi-access network.";
- }
- enum non-broadcast {
- description
- "Specify OSPF Non-Broadcast Multi-Access
- (NBMA) network.";
- }
- enum point-to-multipoint {
- description
- "Specify OSPF point-to-multipoint network.";
- }
- enum point-to-point {
- description
- "Specify OSPF point-to-point network.";
- }
- }
- description
- "Network type.";
- }
- leaf passive {
- type boolean;
- description
- "Enable/Disable passive.";
- }
- uses interface-common-config;
- }
-
- grouping tlv {
- description
- "TLV";
- leaf type {
- type uint16;
- description
- "TLV type.";
- }
- leaf length {
- type uint16;
- description
- "TLV length.";
- }
- leaf value {
- type yang:hex-string;
- description
- "TLV value.";
- }
- }
-
- grouping ospfv2-lsa-body {
- description
- "OSPFv2 LSA body.";
- container router {
- when '../../header/type = 1' {
- description
- "Only apply to Router-LSA.";
- }
- description
- "Router LSA.";
- leaf flags {
- type bits {
- bit V {
- description
- "When set, the router is an endpoint of one or
- more virtual links.";
- }
- bit E {
- description
- "When set, the router is an AS Boundary Router
- (ASBR).";
- }
- bit B {
- description
- "When set, the router is an Area Border Router (ABR).";
- }
- }
- description
- "Flags";
- }
- leaf num-of-links {
- type uint16;
- description
- "Number of links.";
- }
- list link {
- key "link-id link-data";
- description
- "Router LSA link.";
- leaf link-id {
- type union {
- type inet:ipv4-address;
- type yang:dotted-quad;
- }
- description
- "Link ID";
- }
- leaf link-data {
- type union {
- type inet:ipv4-address;
- type uint32;
- }
- description
- "Link data.";
- }
- leaf type {
- type uint8;
- description
- "Link type.";
- }
- list topology {
- key "mt-id";
- description
- "Topology specific information.";
- leaf mt-id {
- type uint8;
- description
- "The MT-ID for topology enabled on the link.";
- }
- leaf metric {
- type uint16;
- description
- "Metric for the topology.";
- }
- }
- }
- }
- container network {
- when '../../header/type = 2' {
- description
- "Only apply to network LSA.";
- }
- description
- "Network LSA.";
- leaf network-mask {
- type inet:ipv4-address;
- description
- "The IP address mask for the network";
- }
- leaf-list attached-router {
- type yang:dotted-quad;
- description
- "List of the routers attached to the network.";
- }
- }
- container summary {
- when '../../header/type = 3 or ../../header/type = 4' {
- description
- "Only apply to Summary-LSA.";
- }
- description
- "Summary LSA.";
- leaf network-mask {
- type inet:ipv4-address;
- description
- "The IP address mask for the network";
- }
- list topology {
- key "mt-id";
- description
- "Topology specific information.";
- leaf mt-id {
- type uint8;
- description
- "The MT-ID for topology enabled on the link.";
- }
- leaf metric {
- type uint24;
- description
- "Metric for the topology.";
- }
- }
- }
- container external {
- when '../../header/type = 5 or ../../header/type = 7' {
- description
- "Only apply to AS-external-LSA and NSSA-LSA.";
- }
- description
- "External LSA.";
- leaf network-mask {
- type inet:ipv4-address;
- description
- "The IP address mask for the network";
- }
- list topology {
- key "mt-id";
- description
- "Topology specific information.";
- leaf mt-id {
- type uint8;
- description
- "The MT-ID for topology enabled on the link.";
- }
- leaf flags {
- type bits {
- bit E {
- description
- "When set, the metric specified is a Type 2
- external metric.";
- }
- }
- description
- "Flags.";
- }
- leaf metric {
- type uint24;
- description
- "Metric for the topology.";
- }
- leaf forwarding-address {
- type inet:ipv4-address;
- description
- "Forwarding address.";
- }
- leaf external-route-tag {
- type uint32;
- description
- "Route tag.";
- }
- }
- }
- }
-
- grouping ospfv3-lsa-options {
- description
- "OSPFv3 LSA options";
- leaf options {
- type bits {
- bit DC {
- description
- "When set, the router support demand circuits.";
- }
- bit R {
- description
- "When set, the originator is an active router.";
- }
- bit N {
- description
- "If set, the router is attached to an NSSA";
- }
- bit E {
- description
- "This bit describes the way AS-external-LSAs
- are flooded";
- }
- bit V6 {
- description
- "If clear, the router/link should be excluded
- from IPv6 routing calculaton";
- }
- }
- mandatory true;
- description
- "OSPFv3 LSA options.";
- }
- }
-
- grouping ospfv3-lsa-prefix {
- description
- "OSPFv3 LSA prefix.";
- leaf prefix {
- type inet:ip-prefix;
- description
- "Prefix";
- }
- leaf prefix-options {
- type bits {
- bit NU {
- description
- "When set, the prefix should be excluded
- from IPv6 unicast calculations.";
- }
- bit LA {
- description
- "When set, the prefix is actually an IPv6 interface
- address of the Advertising Router.";
- }
- bit P {
- description
- "When set, the NSSA area prefix should be
- readvertised by the translating NSSA area border.";
- }
- bit DN {
- description
- "When set, the inter-area-prefix-LSA or
- AS-external-LSA prefix has been advertised in a VPN
- environment.";
- }
- }
- mandatory true;
- description
- "Prefix options.";
- }
- }
-
- grouping ospfv3-lsa-external {
- description
- "AS-External and NSSA LSA.";
- leaf metric {
- type uint24;
- description
- "Metric";
- }
- leaf flags {
- type bits {
- bit E {
- description
- "When set, the metric specified is a Type 2
- external metric.";
- }
- }
- description
- "Flags.";
- }
- leaf referenced-ls-type {
- type uint16;
- description
- "Referenced Link State type.";
- }
- uses ospfv3-lsa-prefix;
- leaf forwarding-address {
- type inet:ipv6-address;
- description
- "Forwarding address.";
- }
- leaf external-route-tag {
- type uint32;
- description
- "Route tag.";
- }
- leaf referenced-link-state-id {
- type uint32;
- description
- "Referenced Link State ID.";
- }
- }
-
- grouping ospfv3-lsa-body {
- description
- "OSPFv3 LSA body.";
- container router {
- when '../../header/type = 8193' {
- description
- "Only apply to Router-LSA.";
- }
- description
- "Router LSA.";
- leaf flags {
- type bits {
- bit V {
- description
- "When set, the router is an endpoint of one or
- more virtual links.";
- }
- bit E {
- description
- "When set, the router is an AS Boundary Router
- (ASBR).";
- }
- bit B {
- description
- "When set, the router is an Area Border Router (ABR).";
- }
- bit Nt {
- description
- "When set, the router is an NSSA border router
- that is unconditionally translating NSSA-LSAs
- into AS-external-LSAs.";
- }
- }
- mandatory true;
- description
- "LSA option.";
- }
- uses ospfv3-lsa-options;
- list link {
- key "interface-id neighbor-interface-id neighbor-router-id";
- description
- "Router LSA link.";
- leaf interface-id {
- type uint32;
- description
- "Interface ID.";
- }
- leaf neighbor-interface-id {
- type uint32;
- description
- "Neighbor Interface ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor Router ID";
- }
- leaf type {
- type uint8;
- description
- "Link type.";
- }
- leaf metric {
- type uint16;
- description
- "Metric.";
- }
- }
- }
- container network {
- when '../../header/type = 8194' {
- description
- "Only apply to network LSA.";
- }
- description
- "Network LSA.";
- uses ospfv3-lsa-options;
- leaf-list attached-router {
- type yang:dotted-quad;
- description
- "List of the routers attached to the network.";
- }
- }
- container inter-area-prefix {
- when '../../header/type = 8195' {
- description
- "Only apply to inter-area-prefix LSA.";
- }
- description
- "Inter-Area-Prefix LSA.";
- leaf metric {
- type uint24;
- description
- "Metric";
- }
- uses ospfv3-lsa-prefix;
- }
- container inter-area-router {
- when '../../header/type = 8196' {
- description
- "Only apply to inter-area-router LSA.";
- }
- description
- "Inter-Area-Router LSA.";
- uses ospfv3-lsa-options;
- leaf metric {
- type uint24;
- description
- "Metric";
- }
- leaf destination-router-id {
- type yang:dotted-quad;
- description
- "The Router ID of the router being described by the LSA.";
- }
- }
- container as-external {
- when '../../header/type = 16389' {
- description
- "Only apply to as-external LSA.";
- }
- description
- "AS-External LSA.";
- uses ospfv3-lsa-external;
- }
- container nssa {
- when '../../header/type = 8199' {
- description
- "Only apply to nssa LSA.";
- }
- description
- "NSSA LSA.";
- uses ospfv3-lsa-external;
- }
- container link {
- when '../../header/type = 8' {
- description
- "Only apply to link LSA.";
- }
- description
- "Link LSA.";
- leaf rtr-priority {
- type uint8;
- description
- "Router Priority of the interface.";
- }
- uses ospfv3-lsa-options;
- leaf link-local-interface-address {
- type inet:ipv6-address;
- description
- "The originating router's link-local
- interface address on the link.";
- }
- leaf num-of-prefixes {
- type uint32;
- description
- "Number of prefixes.";
- }
- list prefix {
- key "prefix";
- description
- "List of prefixes associated with the link.";
- uses ospfv3-lsa-prefix;
- }
- }
- container intra-area-prefix {
- when '../../header/type = 8201' {
- description
- "Only apply to intra-area-prefix LSA.";
- }
- description
- "Intra-Area-Prefix LSA.";
- leaf referenced-ls-type {
- type uint16;
- description
- "Referenced Link State type.";
- }
- leaf referenced-link-state-id {
- type uint32;
- description
- "Referenced Link State ID.";
- }
- leaf referenced-adv-router {
- type inet:ipv4-address;
- description
- "Referenced Advertising Router.";
- }
- leaf num-of-prefixes {
- type uint16;
- description
- "Number of prefixes.";
- }
- list prefix {
- key "prefix";
- description
- "List of prefixes associated with the link.";
- uses ospfv3-lsa-prefix;
- leaf metric {
- type uint24;
- description
- "Metric";
- }
- }
- }
- }
-
- grouping lsa-header {
- description
- "Common LSA for OSPFv2 and OSPFv3";
- leaf age {
- type uint16;
- mandatory true;
- description
- "LSA age.";
- }
- leaf type {
- type uint16;
- mandatory true;
- description
- "LSA type.";
- }
- leaf adv-router {
- type yang:dotted-quad;
- mandatory true;
- description
- "LSA advertising router.";
- }
- leaf seq-num {
- type uint32;
- mandatory true;
- description
- "LSA sequence number.";
- }
- leaf checksum {
- type uint16;
- mandatory true;
- description
- "LSA checksum.";
- }
- leaf length {
- type uint16;
- mandatory true;
- description
- "LSA length.";
- }
- }
-
- grouping ospfv2-lsa {
- description
- "OSPFv2 LSA.";
- container header {
- description
- "Decoded OSPFv2 LSA header data.";
- leaf option {
- type bits {
- bit DC {
- description
- "When set, the router support demand circuits.";
- }
- bit P {
- description
- "Only used in type-7 LSA. When set, the NSSA
- border router should translate the type-7 LSA
- to type-5 LSA.";
- }
- bit MC {
- description
- "When set, the router support MOSPF.";
- }
- bit E {
- description
- "This bit describes the way AS-external-LSAs
- are flooded";
- }
- }
- mandatory true;
- description
- "LSA option.";
- }
- leaf lsa-id {
- type inet:ipv4-address;
- mandatory true;
- description
- "LSA ID.";
- }
- leaf opaque-type {
- when '../../header/type = 9 or ../../header/type = 10 or ../../header/type = 11' {
- description
- "Only apply to opaque LSA.";
- }
- type uint8;
- mandatory true;
- description
- "Opaque type.";
- }
- leaf opaque-id {
- when '../../header/type = 9 or ../../header/type = 10 or ../../header/type = 11' {
- description
- "Only apply to opaque LSA.";
- }
- type uint24;
- mandatory true;
- description
- "Opaque id.";
- }
- uses lsa-header;
- }
- container body {
- description
- "Decoded OSPFv2 LSA body data.";
- uses ospfv2-lsa-body;
- }
- }
-
- grouping ospfv3-lsa {
- description
- "Decoded OSPFv3 LSA.";
- container header {
- description
- "Decoded OSPFv3 LSA header data.";
- leaf lsa-id {
- type uint32;
- mandatory true;
- description
- "LSA ID.";
- }
- uses lsa-header;
- }
- container body {
- description
- "Decoded OSPF LSA body data.";
- uses ospfv3-lsa-body;
- }
- }
-
- grouping lsa-common {
- description
- "Common field for OSPF LSA represenation.";
- leaf decoded-completed {
- type boolean;
- description
- "The OSPF LSA body is fully decoded.";
- }
- }
-
- grouping link-scope-lsa {
- description
- "OSPF link-scope LSA.";
- uses lsa-common;
- choice version {
- description
- "OSPFv2 or OSPFv3 LSA body.";
- container ospfv2 {
- when "../../../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "Applied to OSPFv2 only";
- }
- description
- "OSPFv2 LSA";
- uses ospfv2-lsa;
- }
- container ospfv3 {
- when "../../../../../../../org-openroadm-routing:type = 'ospfv3'" {
- description
- "Applied to OSPFv3 only";
- }
- description
- "OSPFv3 LSA";
- uses ospfv3-lsa;
- }
- }
- }
-
- grouping area-scope-lsa {
- description
- "OSPF area-scope LSA.";
- uses lsa-common;
- choice version {
- description
- "OSPFv2 or OSPFv3 LSA body.";
- container ospfv2 {
- when "../../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "Applied to OSPFv2 only";
- }
- description
- "OSPFv2 LSA";
- uses ospfv2-lsa;
- }
- container ospfv3 {
- when "../../../../../../org-openroadm-routing:type = 'ospfv3'" {
- description
- "Applied to OSPFv3 only";
- }
- description
- "OSPFv3 LSA";
- uses ospfv3-lsa;
- }
- }
- }
-
- grouping as-scope-lsa {
- description
- "OSPF AS-scope LSA.";
- uses lsa-common;
- choice version {
- description
- "OSPFv2 or OSPFv3 LSA body.";
- container ospfv2 {
- when "../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "Applied to OSPFv2 only";
- }
- description
- "OSPFv2 LSA";
- uses ospfv2-lsa;
- }
- container ospfv3 {
- when "../../../../../org-openroadm-routing:type = 'ospfv3'" {
- description
- "Applied to OSPFv3 only";
- }
- description
- "OSPFv3 LSA";
- uses ospfv3-lsa;
- }
- }
- }
-
- grouping lsa-key {
- description
- "OSPF LSA key.";
- leaf lsa-id {
- type union {
- type inet:ipv4-address;
- type uint32;
- }
- description
- "LSA ID.";
- }
- leaf adv-router {
- type inet:ipv4-address;
- description
- "Advertising router.";
- }
- }
-
- grouping af-area-config {
- description
- "OSPF address-family specific area config state.";
- list range {
- key "prefix";
- description
- "Summarize routes matching address/mask (border
- routers only)";
- leaf prefix {
- type inet:ip-prefix;
- description
- "IPv4 or IPv6 prefix";
- }
- leaf advertise {
- type boolean;
- description
- "Advertise or hide.";
- }
- leaf cost {
- type uint24 {
- range "0..16777214";
- }
- description
- "Cost of summary route.";
- }
- }
- }
-
- grouping area-config {
- description
- "OSPF area config state.";
- leaf area-type {
- type identityref {
- base area-type;
- }
- default "normal";
- description
- "Area type.";
- }
- leaf summary {
- when "../area-type = 'stub' or ../area-type = 'nssa'" {
- description
- "Summary generation valid for stub/NSSA area.";
- }
- type boolean;
- description
- "Enable/Disable summary generation to the stub or
- NSSA area.";
- }
- leaf default-cost {
- when "../area-type = 'stub' or ../area-type = 'nssa'" {
- description
- "Default cost for LSA advertised into stub or
- NSSA area.";
- }
- type uint32 {
- range "1..16777215";
- }
- description
- "Set the summary default-cost for a stub or NSSA area.";
- }
- uses af-area-config {
- when "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:operation-mode = 'org-openroadm-ospf:ships-in-the-night'" {
- description
- "Ships in the night configuration.";
- }
- }
- }
-
- grouping instance-config {
- description
- "OSPF instance config state.";
- leaf router-id {
- if-feature "router-id";
- type yang:dotted-quad;
- mandatory true;
- description
- "Defined in RFC 2328. A 32-bit number
- that uniquely identifies the router.";
- }
- container admin-distance {
- description
- "Admin distance config state.";
- choice granularity {
- description
- "Options for expressing admin distance
- for intra-area and inter-area route";
- case detail {
- leaf intra-area {
- type uint8 {
- range "1..255" {
- error-message "Configured value is out of range";
- }
- }
- description
- "Admin distance for intra-area route.";
- }
- leaf inter-area {
- type uint8 {
- range "1..255" {
- error-message "Configured value is out of range";
- }
- }
- description
- "Admin distance for inter-area route.";
- }
- }
- }
- leaf external {
- type uint8 {
- range "1..255" {
- error-message "Configured value is out of range";
- }
- }
- description
- "Admin distance for both external route.";
- }
- }
- container graceful-restart {
- if-feature "graceful-restart";
- description
- "Graceful restart config state.";
- leaf enable {
- type boolean;
- description
- "Enable/Disable graceful restart as defined in RFC 3623.";
- }
- leaf helper-enable {
- type boolean;
- default "true";
- description
- "Enable RestartHelperSupport in RFC 3623 Section B.2.";
- }
- leaf restart-interval {
- type uint16 {
- range "1..1800";
- }
- units "seconds";
- default "120";
- description
- "RestartInterval option in RFC 3623 Section B.1.";
- }
- leaf helper-strict-lsa-checking {
- type boolean;
- description
- "RestartHelperStrictLSAChecking option in RFC 3623
- Section B.2.";
- }
- }
- container auto-cost {
- if-feature "auto-cost";
- description
- "Auto cost config state.";
- leaf enable {
- type boolean;
- description
- "Enable/Disable auto cost.";
- }
- leaf reference-bandwidth {
- type uint32 {
- range "1..4294967";
- }
- units "Mbits";
- description
- "Configure reference bandwidth in term of Mbits";
- }
- }
- }
-
- grouping interface-operation {
- description
- "OSPF interface operation state.";
- reference
- "RFC2328 Section 9";
- uses interface-config;
- leaf state {
- type if-state-type;
- description
- "Interface state.";
- }
- leaf hello-timer {
- type uint32;
- units "milliseconds";
- description
- "Hello timer.";
- }
- leaf wait-timer {
- type uint32;
- units "milliseconds";
- description
- "Wait timer.";
- }
- leaf dr {
- type inet:ipv4-address;
- description
- "DR.";
- }
- leaf bdr {
- type inet:ipv4-address;
- description
- "BDR.";
- }
- }
-
- grouping neighbor-operation {
- description
- "OSPF neighbor operation data.";
- leaf address {
- type inet:ip-address;
- description
- "Neighbor address.";
- }
- leaf dr {
- type inet:ipv4-address;
- description
- "Designated Router.";
- }
- leaf bdr {
- type inet:ipv4-address;
- description
- "Backup Designated Router.";
- }
- leaf state {
- type nbr-state-type;
- description
- "OSPF neighbor state.";
- }
- }
-
- grouping instance-operation {
- description
- "OSPF Address Family operation state.";
- leaf router-id {
- type yang:dotted-quad;
- description
- "Defined in RFC 2328. A 32-bit number
- that uniquely identifies the router.";
- }
- }
-
- grouping route-content {
- description
- "This grouping defines OSPF-specific route attributes.";
- leaf metric {
- type uint32;
- description
- "OSPF route metric.";
- }
- leaf tag {
- type uint32;
- default "0";
- description
- "OSPF route tag.";
- }
- leaf route-type {
- type enumeration {
- enum intra-area {
- description
- "OSPF intra-area route";
- }
- enum inter-area {
- description
- "OSPF inter-area route";
- }
- enum external-1 {
- description
- "OSPF external route type 1";
- }
- enum external-2 {
- description
- "OSPF External route type 2";
- }
- enum nssa-1 {
- description
- "OSPF NSSA external route type 1";
- }
- enum nssa-2 {
- description
- "OSPF NSSA external route type 2";
- }
- }
- description
- "OSPF route type";
- }
- }
-
- grouping notification-instance-hdr {
- description
- "This group describes common instance specific
- data for notifications.";
- leaf routing-instance {
- type org-openroadm-routing:routing-instance-ref;
- description
- "Describe the routing instance.";
- }
- leaf routing-protocol-name {
- type string;
- description
- "Describes the name of the OSPF routing protocol.";
- }
- container instance-af {
- description
- "Describes the address family of the OSPF instance.";
- leaf af {
- type identityref {
- base org-openroadm-routing:address-family;
- }
- description
- "Address-family of the instance.";
- }
- }
- }
-
- notification if-state-change {
- description
- "This notification is sent when interface
- state change is detected.";
- uses notification-instance-hdr;
- leaf link-type {
- type identityref {
- base if-link-type;
- }
- description
- "Type of OSPF interface.";
- }
- container interface {
- description
- "Normal interface.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- }
- container virtual-link {
- description
- "virtual-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- }
- container sham-link {
- description
- "sham-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf local-ip-addr {
- type inet:ip-address;
- description
- "Sham link local address.";
- }
- leaf remote-ip-addr {
- type inet:ip-address;
- description
- "Sham link remote address.";
- }
- }
- leaf state {
- type if-state-type;
- description
- "Interface state.";
- }
- }
-
- notification if-config-error {
- description
- "This notification is sent when interface
- config error is detected.";
- uses notification-instance-hdr;
- leaf link-type {
- type identityref {
- base if-link-type;
- }
- description
- "Type of OSPF interface.";
- }
- container interface {
- description
- "Normal interface.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- leaf packet-source {
- type yang:dotted-quad;
- description
- "Source address.";
- }
- }
- container virtual-link {
- description
- "virtual-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- }
- container sham-link {
- description
- "sham-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf local-ip-addr {
- type inet:ip-address;
- description
- "Sham link local address.";
- }
- leaf remote-ip-addr {
- type inet:ip-address;
- description
- "Sham link remote address.";
- }
- }
- leaf packet-type {
- type packet-type;
- description
- "OSPF packet type.";
- }
- leaf error {
- type enumeration {
- enum badVersion {
- description
- "Bad version";
- }
- enum areaMismatch {
- description
- "Area mistmatch";
- }
- enum unknownNbmaNbr {
- description
- "Unknown NBMA neighbor";
- }
- enum unknownVirtualNbr {
- description
- "Unknown virtual link neighbor";
- }
- enum authTypeMismatch {
- description
- "Auth type mismatch";
- }
- enum authFailure {
- description
- "Auth failure";
- }
- enum netMaskMismatch {
- description
- "Network mask mismatch";
- }
- enum helloIntervalMismatch {
- description
- "Hello interval mismatch";
- }
- enum deadIntervalMismatch {
- description
- "Dead interval mismatch";
- }
- enum optionMismatch {
- description
- "Option mismatch";
- }
- enum mtuMismatch {
- description
- "MTU mismatch";
- }
- enum duplicateRouterId {
- description
- "Duplicate router ID";
- }
- enum noError {
- description
- "No error";
- }
- }
- description
- "Error code.";
- }
- }
-
- notification nbr-state-change {
- description
- "This notification is sent when neighbor
- state change is detected.";
- uses notification-instance-hdr;
- leaf link-type {
- type identityref {
- base if-link-type;
- }
- description
- "Type of OSPF interface.";
- }
- container interface {
- description
- "Normal interface.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- leaf neighbor-ip-addr {
- type yang:dotted-quad;
- description
- "Neighbor address.";
- }
- }
- container virtual-link {
- description
- "virtual-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- }
- container sham-link {
- description
- "sham-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf local-ip-addr {
- type inet:ip-address;
- description
- "Sham link local address.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- leaf neighbor-ip-addr {
- type yang:dotted-quad;
- description
- "Neighbor address.";
- }
- }
- leaf state {
- type nbr-state-type;
- description
- "Neighbor state.";
- }
- }
-
- notification nbr-restart-helper-status-change {
- description
- "This notification is sent when neighbor restart
- helper status change is detected.";
- uses notification-instance-hdr;
- leaf link-type {
- type identityref {
- base if-link-type;
- }
- description
- "Type of OSPF interface.";
- }
- container interface {
- description
- "Normal interface.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- leaf neighbor-ip-addr {
- type yang:dotted-quad;
- description
- "Neighbor address.";
- }
- }
- container virtual-link {
- description
- "virtual-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- }
- leaf status {
- type restart-helper-status-type;
- description
- "Restart helper status.";
- }
- leaf age {
- type uint32;
- units "seconds";
- description
- "Remaining time in current OSPF graceful restart
- interval, if the router is acting as a restart
- helper for the neighbor.";
- }
- leaf exit-reason {
- type restart-exit-reason-type;
- description
- "Restart helper exit reason.";
- }
- }
-
- notification rx-bad-packet {
- description
- "This notification is sent when an OSPF packet
- has been received on a interface that cannot be parsed.";
- uses notification-instance-hdr;
- leaf link-type {
- type identityref {
- base if-link-type;
- }
- description
- "Type of OSPF interface.";
- }
- container interface {
- description
- "Normal interface.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- leaf packet-source {
- type yang:dotted-quad;
- description
- "Source address.";
- }
- }
- container virtual-link {
- description
- "virtual-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf neighbor-router-id {
- type yang:dotted-quad;
- description
- "Neighbor router id.";
- }
- }
- container sham-link {
- description
- "sham-link.";
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf local-ip-addr {
- type inet:ip-address;
- description
- "Sham link local address.";
- }
- leaf remote-ip-addr {
- type inet:ip-address;
- description
- "Sham link remote address.";
- }
- }
- leaf packet-type {
- type packet-type;
- description
- "OSPF packet type.";
- }
- }
-
- notification lsdb-approaching-overflow {
- description
- "This notification is sent when the number of LSAs
- in the router's link state database has exceeded
- ninety percent of the ext-lsdb-limit.";
- uses notification-instance-hdr;
- leaf ext-lsdb-limit {
- type uint32;
- description
- "The maximum number of non-default AS-external LSAs
- entries that can be stored in the link state database.";
- }
- }
-
- notification lsdb-overflow {
- description
- "This notification is sent when the number of LSAs
- in the router's link state database has exceeded
- ext-lsdb-limit.";
- uses notification-instance-hdr;
- leaf ext-lsdb-limit {
- type uint32;
- description
- "The maximum number of non-default AS-external LSAs
- entries that can be stored in the link state database.";
- }
- }
-
- notification nssa-translator-status-change {
- description
- "This notification is sent when there is a change
- in the router's ability to translate OSPF NSSA LSAs
- OSPF AS-External LSAs.";
- uses notification-instance-hdr;
- leaf area-id {
- type uint32;
- description
- "Area ID.";
- }
- leaf status {
- type nssa-translator-state-type;
- description
- "NSSA translator status.";
- }
- }
-
- notification restart-status-change {
- description
- "This notification is sent when the graceful restart
- state for the router has changed.";
- uses notification-instance-hdr;
- leaf status {
- type restart-status-type;
- description
- "Restart status.";
- }
- leaf restart-interval {
- type uint16 {
- range "1..1800";
- }
- units "seconds";
- default "120";
- description
- "Restart interval.";
- }
- leaf exit-reason {
- type restart-exit-reason-type;
- description
- "Restart exit reason.";
- }
- }
-
- grouping ospf-grp {
- container ospf {
- description
- "OSPF.";
- container all-instances-inherit {
- if-feature "instance-inheritance";
- description
- "Inheritance support to all instances.";
- container area {
- description
- "Area config to be inherited by all areas in
- all instances.";
- }
- container interface {
- description
- "Interface config to be inherited by all interfaces
- in all instances.";
- }
- }
- leaf operation-mode {
- type identityref {
- base operation-mode;
- }
- default "org-openroadm-ospf:ships-in-the-night";
- description
- "OSPF operation mode.";
- }
- list instance {
- key "routing-instance af";
- description
- "An OSPF routing protocol instance.";
- leaf routing-instance {
- type org-openroadm-routing:routing-instance-ref;
- description
- "For protocol centric model, which is supported in
- default-instance only, this could reference any layer 3
- routing-instance.
- For routing-instance centric model, must reference the
- enclosing routing-instance.";
- }
- leaf af {
- type identityref {
- base org-openroadm-routing:address-family;
- }
- description
- "Address-family of the instance.";
- }
- uses instance-config;
- container all-areas-inherit {
- if-feature "area-inheritance";
- description
- "Inheritance for all areas.";
- container area {
- description
- "Area config to be inherited by all areas.";
- }
- container interface {
- description
- "Interface config to be inherited by all interfaces
- in all areas.";
- }
- }
- list area {
- key "area-id";
- description
- "List of ospf areas";
- leaf area-id {
- type yang:dotted-quad;
- description
- "Area ID.";
- }
- uses area-config;
- container all-interfaces-inherit {
- if-feature "interface-inheritance";
- description
- "Inheritance for all interfaces";
- container interface {
- description
- "Interface config to be inherited by all
- interfaces.";
- }
- }
- list virtual-link {
- when "../area-id != '0' and ../area-type = 'normal'" {
- description
- "Transit area must be non-backbone normal area.";
- }
- key "router-id";
- description
- "OSPF virtual link";
- leaf router-id {
- type yang:dotted-quad;
- description
- "Virtual link router ID.";
- }
- uses interface-common-config;
- }
- list interface {
- key "interface";
- description
- "List of OSPF interfaces.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- uses interface-config;
- }
- }
- }
- }
- description
- "Grouping for OSPF";
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol" {
- when "org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
- description
- "This augment is only valid for a routing protocol instance
- of OSPF (type 'ospfv2' or 'ospfv3').";
- }
- description
- "OSPF augmentation.";
- uses ospf-grp;
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance" {
- when "../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or
- ../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
- description
- "This augment is only valid for OSPF
- (type 'ospfv2' or 'ospfv3').";
- }
- if-feature "multi-topology";
- description
- "OSPF multi-topology routing-protocol augmentation.";
- }
-
- grouping topology-cost-grp {
- list topology {
- key "name";
- description
- "OSPF interface topology.";
- leaf name {
- type leafref {
- path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
- }
- description
- "One of the topology enabled on this interface";
- }
- leaf cost {
- type uint32;
- description
- "Interface cost for this topology";
- }
- }
- description
- "Grouping for topology cost";
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance/org-openroadm-ospf:area/org-openroadm-ospf:interface" {
- when "../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "This augment is only valid for OSPFv2.";
- }
- if-feature "org-openroadm-ospf:multi-topology";
- description
- "OSPF multi-topology interface augmentation.";
- uses topology-cost-grp;
- }
-
- grouping ospf-lsa-grp {
- container ospf {
- description
- "OSPF";
- list instance {
- key "routing-instance af";
- description
- "An OSPF routing protocol instance.";
- leaf routing-instance {
- type org-openroadm-routing:routing-instance-ref;
- description
- "For protocol centric model, which is supported in
- default-instance only, this could reference any layer 3
- routing-instance.
- For routing-instance centric model, must reference the
- enclosing routing-instance.";
- }
- leaf af {
- type identityref {
- base org-openroadm-routing:address-family;
- }
- description
- "Address-family of the instance.";
- }
- uses instance-operation;
- list area {
- key "area-id";
- description
- "List of OSPF areas";
- leaf area-id {
- type area-id-type;
- description
- "Area ID.";
- }
- list interface {
- key "interface";
- description
- "List of OSPF interfaces.";
- leaf interface {
- type org-openroadm-device:interface-ref;
- description
- "Interface.";
- }
- uses interface-operation;
- list neighbor {
- key "neighbor-id";
- description
- "List of OSPF neighbors.";
- leaf neighbor-id {
- type inet:ipv4-address;
- description
- "Neighbor ID.";
- }
- uses neighbor-operation;
- }
- list link-scope-lsas {
- when "../../../../../org-openroadm-routing:type = 'ospfv3'" {
- description
- "Link scope LSA only exists in OSPFv3.";
- }
- key "lsa-type";
- description
- "List OSPF link scope LSA databases";
- leaf lsa-type {
- type uint8;
- description
- "OSPF link scope LSA type.";
- }
- list link-scope-lsa {
- key "lsa-id adv-router";
- description
- "List of OSPF link scope LSAs";
- uses lsa-key;
- uses link-scope-lsa;
- }
- }
- }
- list area-scope-lsas {
- key "lsa-type";
- description
- "List OSPF area scope LSA databases";
- leaf lsa-type {
- type uint8;
- description
- "OSPF area scope LSA type.";
- }
- list area-scope-lsa {
- key "lsa-id adv-router";
- description
- "List of OSPF area scope LSAs";
- uses lsa-key;
- uses area-scope-lsa;
- }
- }
- }
- list as-scope-lsas {
- key "lsa-type";
- description
- "List OSPF AS scope LSA databases";
- leaf lsa-type {
- type uint8;
- description
- "OSPF AS scope LSA type.";
- }
- list as-scope-lsa {
- key "lsa-id adv-router";
- description
- "List of OSPF AS scope LSAs";
- uses lsa-key;
- uses as-scope-lsa;
- }
- }
- }
- }
- description
- "Grouping for ospf lsa";
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol" {
- when "org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
- description
- "This augment is only valid for a routing protocol instance
- of type 'ospfv2' or 'ospfv3'.";
- }
- description
- "OSPF configuration.";
- uses ospf-lsa-grp;
- }
-
- grouping topology-area-grp {
- list topology {
- key "name";
- description
- "OSPF topology.";
- leaf name {
- type leafref {
- path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
- }
- description
- "RIB";
- }
- list area {
- key "area-id";
- description
- "List of ospf areas";
- leaf area-id {
- type area-id-type;
- description
- "Area ID.";
- }
- }
- }
- description
- "Grouping for topology area";
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance" {
- when "../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "This augment is only valid for OSPFv2.";
- }
- if-feature "multi-topology";
- description
- "OSPF multi-topology routing-protocol augmentation.";
- uses topology-area-grp;
- }
-
- grouping topology-grp {
- list topology {
- key "name";
- description
- "OSPF interface topology.";
- leaf name {
- type leafref {
- path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
- }
- description
- "One of the topology enabled on this interface";
- }
- }
- description
- "Grouping for topology";
- }
-
- augment "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance/org-openroadm-ospf:area/org-openroadm-ospf:interface" {
- when "../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
- description
- "This augment is only valid for OSPFv2.";
- }
- if-feature "org-openroadm-ospf:multi-topology";
- description
- "OSPF multi-topology interface augmentation.";
- uses topology-grp;
- }
-}
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.18.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>2.25.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
- <version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
<executions>
<execution>
<goals>
counter++;
}
} catch (IllegalArgumentException e) {
- LOG.debug(" in GnpyResult: the element {} is not a ipv4Address ", nodeIp);
+ LOG.error(" in GnpyResult: the element {} is not a ipv4Address ", nodeIp, e);
}
}
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
- <version>9.0.6</version>
+ <version>9.0.8</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
public class OpenRoadmInterface710 {
private static final String MAPPING_ERROR_EXCEPTION_MESSAGE =
"Unable to get mapping from PortMapping for node % and logical connection port %s";
+ private static final String ODUC4 = "-ODUC4";
private final PortMapping portMapping;
private final OpenRoadmInterfaces openRoadmInterfaces;
.setMaintTestsignal(maintTestsignal.build());
InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
- logicalConnPoint + "-ODUC4");
+ logicalConnPoint + ODUC4);
// Create a list
List<String> listSupportingOtucnInterface = new ArrayList<>();
.setMaintTestsignal(maintTestsignal.build());
InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
- alogicalConnPoint + "-ODUC4");
+ alogicalConnPoint + ODUC4);
// Create a list
List<String> listSupportingOtucnInterface = new ArrayList<>();
.setMaintTestsignal(maintTestsignal.build());
InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
- logicalConnPoint + "-ODUC4");
+ logicalConnPoint + ODUC4);
// Create a list
List<String> listSupportingOtucnInterface = new ArrayList<>();
.setMaintTestsignal(maintTestsignal.build());
InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
- alogicalConnPoint + "-ODUC4");
+ alogicalConnPoint + ODUC4);
// Create a list
List<String> listSupportingOtucnInterface = new ArrayList<>();
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
package org.opendaylight.transportpce.tapi.connectivity;
import com.google.common.util.concurrent.ListenableFuture;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public ListenableFuture<RpcResult<GetConnectivityServiceDetailsOutput>> getConnectivityServiceDetails(
GetConnectivityServiceDetailsInput input) {
// TODO Auto-generated method stub
- Uuid serviceUuid = new Uuid(input.getServiceIdOrName());
+ Uuid serviceUuid = getUuidFromIput(input.getServiceIdOrName());
ConnectivityService service = this.tapiContext.getConnectivityService(serviceUuid);
if (service == null) {
LOG.error("Service {} doesnt exist in tapi context", input.getServiceIdOrName());
public ListenableFuture<RpcResult<GetConnectionDetailsOutput>> getConnectionDetails(
GetConnectionDetailsInput input) {
// TODO Auto-generated method stub
- Uuid connectionUuid = new Uuid(UUID.nameUUIDFromBytes(input.getConnectionIdOrName()
- .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid connectionUuid = getUuidFromIput(input.getConnectionIdOrName());
Connection connection = this.tapiContext.getConnection(connectionUuid);
if (connection == null) {
LOG.error("Connection {} doesnt exist in tapi context", input.getConnectionIdOrName());
DeleteConnectivityServiceInput input) {
//TODO Auto-generated method stub
// TODO add try
- Uuid serviceUuid = new Uuid(input.getServiceIdOrName());
- this.tapiContext.deleteConnectivityService(serviceUuid);
- ListenableFuture<RpcResult<ServiceDeleteOutput>> output =
- this.serviceHandler.serviceDelete(new ServiceDeleteInputBuilder()
- .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
- .setServiceName(input.getServiceIdOrName())
- .setTailRetention(ServiceDeleteReqInfo.TailRetention.No)
- .build())
- .setSdncRequestHeader(new SdncRequestHeaderBuilder()
- .setRequestId("request-1")
- .setRpcAction(RpcActions.ServiceDelete)
- .setNotificationUrl("notification url")
- .setRequestSystemId("appname")
- .build())
- .build());
- if (output == null) {
- return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to delete Link").buildFuture();
+ if (input.getServiceIdOrName() != null) {
+ try {
+ Uuid serviceUuid = getUuidFromIput(input.getServiceIdOrName());
+ this.tapiContext.deleteConnectivityService(serviceUuid);
+ ListenableFuture<RpcResult<ServiceDeleteOutput>> output =
+ this.serviceHandler.serviceDelete(new ServiceDeleteInputBuilder()
+ .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
+ .setServiceName(input.getServiceIdOrName())
+ .setTailRetention(ServiceDeleteReqInfo.TailRetention.No)
+ .build())
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRequestId("request-1")
+ .setRpcAction(RpcActions.ServiceDelete)
+ .setNotificationUrl("notification url")
+ .setRequestSystemId("appname")
+ .build())
+ .build());
+ RpcResult<ServiceDeleteOutput> rpcResult = output.get();
+ if (!rpcResult.getResult().getConfigurationResponseCommon().getResponseCode()
+ .equals(ResponseCodes.RESPONSE_FAILED)) {
+ LOG.info("Service is being deleted and devices are being rolled back");
+ return RpcResultBuilder.success(new DeleteConnectivityServiceOutputBuilder().build()).buildFuture();
+ }
+ LOG.error("Failed to delete service. Deletion process failed");
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Failed to delete service.", e);
+ }
}
- LOG.info("Service is being deleted and devices are being rolled back");
- return RpcResultBuilder.success(new DeleteConnectivityServiceOutputBuilder().build()).buildFuture();
+ return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
+ "Failed to delete Service").buildFuture();
}
@Override
public ListenableFuture<RpcResult<GetConnectionEndPointDetailsOutput>> getConnectionEndPointDetails(
GetConnectionEndPointDetailsInput input) {
// TODO Auto-generated method stub
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(input.getTopologyIdOrName()
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(input.getNodeIdOrName()
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(input.getNepIdOrName()
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid cepUuid = new Uuid(UUID.nameUUIDFromBytes(input.getCepIdOrName()
- .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid topoUuid = getUuidFromIput(input.getTopologyIdOrName());
+ Uuid nodeUuid = getUuidFromIput(input.getNodeIdOrName());
+ Uuid nepUuid = getUuidFromIput(input.getNepIdOrName());
+ Uuid cepUuid = getUuidFromIput(input.getCepIdOrName());
ConnectionEndPoint cep = this.tapiContext.getTapiCEP(topoUuid, nodeUuid, nepUuid, cepUuid);
if (cep == null) {
LOG.error("Cep doesnt exist in tapi context");
return RpcResultBuilder.success(new GetConnectionEndPointDetailsOutputBuilder().setConnectionEndPoint(
new ConnectionEndPointBuilder(cep).build()).build()).buildFuture();
}
+
+ private Uuid getUuidFromIput(String serviceIdOrName) {
+ try {
+ UUID.fromString(serviceIdOrName);
+ LOG.info("Given attribute {} is a UUID", serviceIdOrName);
+ return new Uuid(serviceIdOrName);
+ } catch (IllegalArgumentException e) {
+ LOG.info("Given attribute {} is not a UUID", serviceIdOrName);
+ return new Uuid(UUID.nameUUIDFromBytes(serviceIdOrName.getBytes(StandardCharsets.UTF_8)).toString());
+ }
+ }
}
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPEGigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
.Link link : rdmTordmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
- Link tapiLink = createTapiOmsLink(link);
+ Link tapiLink = createTapiOmsLink(link, rdmTordmLinkList.stream()
+ .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink()))
+ .findAny().orElse(null));
linksToNotConvert.add(link
.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
.getOppositeLink().getValue());
}
public void convertRoadmNode(Node roadm, Network openroadmTopo) {
+ this.ietfNodeId = roadm.getNodeId().getValue();
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist = new HashMap<>();
// 1. Get degree and srg nodes to map TPs into NEPs
if (openroadmTopo.getNode() == null) {
List<Node> nodeList = new ArrayList<Node>(openroadmTopo.getNode().values());
for (Node node:nodeList) {
if (node.getSupportingNode().values().stream().noneMatch(sp -> sp.getNodeRef().getValue()
- .equals(roadm.getNodeId().getValue()))) {
+ .equals(this.ietfNodeId))) {
LOG.warn("Abstracted node {} is not part of {}",
- node.getNodeId().getValue(), roadm.getNodeId().getValue());
+ node.getNodeId().getValue(), this.ietfNodeId);
continue;
}
if (node.augmentation(Node1.class) == null
// Convert TP List in NEPs and put it in onepl
LOG.info("Degree port List: {}", degPortList);
// TODO: deg port could be sip. e.g. MDONS
- oneplist.putAll(populateNepsForRdmNode(roadm.getNodeId().getValue(), degPortList, false));
+ oneplist.putAll(populateNepsForRdmNode(degPortList, false));
// oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), degPortList, false));
numNeps += degPortList.size() * 3;
break;
.collect(Collectors.toList());
// Convert TP List in NEPs and put it in onepl
LOG.info("Srg port List: {}", srgPortList);
- oneplist.putAll(populateNepsForRdmNode(roadm.getNodeId().getValue(), srgPortList, true));
+ oneplist.putAll(populateNepsForRdmNode(srgPortList, true));
// oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), srgPortList, true));
numNeps += srgPortList.size() * 3;
numSips += srgPortList.size();
return onepBldr.build();
}
- private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(String nodeId,
- List<TerminationPoint> tpList,
+ private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
boolean withSip) {
// create neps for MC and OTSiMC and Photonic Media
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
- for (int i = 0; i < tpList.size(); i++) {
+ for (TerminationPoint tp:tpList) {
+ // Admin and oper state common for all tps
+ AdminStates admin = tp.augmentation(TerminationPoint1.class).getAdministrativeState();
+ State oper = tp.augmentation(TerminationPoint1.class).getOperationalState();
// PHOTONIC MEDIA nep
- LOG.info("NEP = {}", String.join("+", nodeId, PHTNC_MEDIA, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, PHTNC_MEDIA,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
+ LOG.info("PHOTO NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()));
Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, PHTNC_MEDIA, tpList.get(i).getTpId().getValue()))
+ .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+
+ OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, PHTNC_MEDIA,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep.key(), onep);
- }
- for (int i = 0; i < tpList.size(); i++) {
+
// MC nep
- LOG.info("NEP = {}", String.join("+", nodeId, MC, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, MC,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, MC, tpList.get(i).getTpId().getValue()))
+ LOG.info("MC NEP = {}", String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()));
+ Name nepName1 = new NameBuilder()
+ .setValueName(MC + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+ OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, MC,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
+ .setName(Map.of(nepName1.key(), nepName1))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
- tpList.get(i), String.join("+", nodeId, MC)));
+ onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
+ tp, String.join("+", this.ietfNodeId, MC)));
}
- OwnedNodeEdgePoint onep = onepBldr.build();
- onepMap.put(onep.key(), onep);
- }
- for (int i = 0; i < tpList.size(); i++) {
+ OwnedNodeEdgePoint onep1 = onepBldr1.build();
+ onepMap.put(onep1.key(), onep1);
+
// OTSiMC nep
- LOG.info("NEP = {}", String.join("+", nodeId, OTSI_MC, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, OTSI_MC,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, OTSI_MC, tpList.get(i).getTpId().getValue()))
+ LOG.info("OTSi NEP = {}", String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()));
+ Name nepName2 = new NameBuilder()
+ .setValueName(OTSI_MC + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+
+ OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI_MC,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
+ .setName(Map.of(nepName2.key(), nepName2))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
- onepMap.put(onep.key(), onep);
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
+ onepMap.put(onep2.key(), onep2);
}
return onepMap;
}
.build();
ruleList.put(rule.key(), rule);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group").getBytes(Charset.forName("UTF-8")))
- .toString()))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((this.ietfNodeId + " node rule group")
+ .getBytes(Charset.forName("UTF-8"))).toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepMap)
.build();
.setUuid(sipUuid)
.setName(Map.of(sipName.key(), sipName))
.setLayerProtocolName(layerProtocol)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(
+ tp.augmentation(TerminationPoint1.class).getAdministrativeState()))
+ .setOperationalState(setTapiOperationalState(
+ tp.augmentation(TerminationPoint1.class).getOperationalState()))
.setLifecycleState(LifecycleState.INSTALLED)
.setAvailableCapacity(new AvailableCapacityBuilder().build())
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
for (SupportedInterfaceCapability sic : sicList) {
switch (lpn.getName()) {
case "DSR":
+ case "ODU":
switch (sic.getIfCapType().getSimpleName()) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqSet.add(ODUTYPEODU0.class);
+ sclpqSet.add(DIGITALSIGNALTYPEGigE.class);
+ break;
case "If10GEODU2e":
sclpqSet.add(ODUTYPEODU2E.class);
sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
}
private Link createTapiOmsLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link link) {
+ .ietf.network.topology.rev180226.networks.network.Link link,
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
String sourceNode = getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue());
String sourceTp = link.getSource().getSourceTp().getValue();
String destNode = getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue());
String destTp = link.getDestination().getDestTp().getValue();
+ AdminStates oppositeLinkAdminState = null;
+ State oppositeLinkOperState = null;
+ if (oppositeLink != null) {
+ oppositeLinkAdminState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState();
+ oppositeLinkOperState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState();
+ }
Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
Uuid sourceUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode,
PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(link
+ .augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState(), oppositeLinkAdminState))
+ .setOperationalState(setTapiOperationalState(link
+ .augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState(), oppositeLinkOperState))
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.networks.network.Link link:xpdrRdmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link oppositeLink = xpdrRdmLinkList.stream()
+ .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink())).findAny().orElse(null);
+
+ AdminStates oppositeLinkAdminState = null;
+ State oppositeLinkOperState = null;
+ if (oppositeLink != null) {
+ oppositeLinkAdminState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState();
+ oppositeLinkOperState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState();
+ }
+
String sourceNode = (link.getSource().getSourceNode().getValue().contains("ROADM"))
? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
: link.getSource().getSourceNode().getValue();
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(link
+ .augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState(), oppositeLinkAdminState))
+ .setOperationalState(setTapiOperationalState(link
+ .augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState(), oppositeLinkOperState))
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPEGigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
// node transformation
Map<NodeKey, Node> nodeMap = new HashMap<>(transformXpdrToTapiNode(
- nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXponderType(), oorOduSwitchingPool,
- mapping.getSupportedInterfaceCapability()));
-
+ nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXponderType(), oorOduSwitchingPool));
// add nodes and sips to tapi context
mergeNodeinTopology(nodeMap);
mergeSipsinContext(this.sipMap);
private Map<NodeKey, Node> transformXpdrToTapiNode(String nodeId, List<Mapping> xpdrClMaps,
List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType,
- OduSwitchingPools oorOduSwitchingPool,
- List<Class<? extends SupportedIfCapability>>
- supportedInterfaceCapability) {
+ OduSwitchingPools oorOduSwitchingPool) {
Map<NodeKey, Node> nodeMap = new HashMap<>();
LOG.info("creation of a DSR/ODU node for {}", nodeId);
Uuid nodeUuidDsr = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, DSR))
LayerProtocolName.ODU);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols,
- nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool,
- supportedInterfaceCapability);
+ nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
nodeMap.put(dsrNode.key(), dsrNode);
List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols,
- nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null,
- supportedInterfaceCapability);
+ nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null);
nodeMap.put(otsiNode.key(), otsiNode);
private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, List<LayerProtocolName> layerProtocols,
String nodeId, Uuid nodeUuid, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
- XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
Map<RuleKey, Rule> ruleList = new HashMap<>();
if (layerProtocols.contains(LayerProtocolName.DSR)) {
// neps for dsr/odu layer
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> dsroduNeps =
- createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType, supportedInterfaceCapability);
+ createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType);
onepl.putAll(dsroduNeps);
nodeRuleGroupList = createNodeRuleGroupForDsrNode(nodeId, oorOduSwitchingPool, ruleList, onepl);
} else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
// neps for photonic layer
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> phtmdNeps =
- createXpdrPhtnMdNeps(nodeId, xpdrNetMaps, supportedInterfaceCapability);
+ createXpdrPhtnMdNeps(nodeId, xpdrNetMaps);
onepl.putAll(phtmdNeps);
nodeRuleGroupList = createNodeRuleGroupForOtsiNode(nodeId, xpdrNetMaps, ruleList);
} else {
}
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrPhtnMdNeps(String nodeId,
- List<Mapping> xpdrNetMaps, List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ List<Mapping> xpdrNetMaps) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
// iNep creation on otsi node
.build();
OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
- Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- true, String.join("+", nodeId, I_OTSI), supportedInterfaceCapability,
- transformOperState(xpdrNetMaps.get(i).getPortOperState()),
- transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+ Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+ true, String.join("+", nodeId, I_OTSI),
+ xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// eNep creation on otsi node
.build();
OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
- Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- false, String.join("+", nodeId, E_OTSI), supportedInterfaceCapability,
- transformOperState(xpdrNetMaps.get(i).getPortOperState()),
- transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+ Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+ false, String.join("+", nodeId, E_OTSI),
+ xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// Photonic Media Nep creation on otsi node
.build();
OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
- Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
- false, String.join("+", nodeId, PHTNC_MEDIA), supportedInterfaceCapability,
- transformOperState(xpdrNetMaps.get(i).getPortOperState()),
- transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+ Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+ false, String.join("+", nodeId, PHTNC_MEDIA),
+ xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
return onepl;
}
private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrDsrOduNeps(String nodeId, List<Mapping> xpdrClMaps,
- List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+ List<Mapping> xpdrNetMaps,
+ XpdrNodeTypes xponderType) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
// client nep creation on DSR node
for (int i = 0; i < xpdrClMaps.size(); i++) {
}
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
- Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
- String.join("+", nodeId, DSR), supportedInterfaceCapability,
- transformOperState(xpdrClMaps.get(i).getPortOperState()),
- transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
+ Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
+ String.join("+", nodeId, DSR), xpdrClMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrClMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// network nep creation on I_ODU node
.build();
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
- Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, false,
- String.join("+", nodeId, I_ODU), supportedInterfaceCapability,
- transformOperState(xpdrNetMaps.get(i).getPortOperState()),
- transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+ Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, false,
+ String.join("+", nodeId, I_ODU), xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
// network nep creation on E_ODU node
for (int i = 0; i < xpdrNetMaps.size(); i++) {
- LOG.info("eODU NEP = {}", String.join("+", nodeId, E_ODU, xpdrNetMaps.get(i).getLogicalConnectionPoint()));
+ LOG.info("eODU NEP = {}", String.join("+", nodeId, E_ODU,
+ xpdrNetMaps.get(i).getLogicalConnectionPoint()));
Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
(String.join("+", nodeId, E_ODU, xpdrNetMaps.get(i).getLogicalConnectionPoint()))
.getBytes(Charset.forName("UTF-8"))).toString());
.build();
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
- Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, true,
- String.join("+", nodeId, E_ODU), supportedInterfaceCapability,
- transformOperState(xpdrNetMaps.get(i).getPortOperState()),
- transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+ Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, true,
+ String.join("+", nodeId, E_ODU), xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+ transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+ transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
onepl.put(onep.key(), onep);
}
return onepl;
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, PHTNC_MEDIA, tpId))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
- .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState).setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
+ OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
+ .setUuid(nepUuid)
+ .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+ .setName(Map.of(nepName.key(), nepName))
+ .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(adminState).setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep.key(), onep);
// MC nep
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName1 = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(MC + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, MC, tpId))
.build();
OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName2 = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(OTSI_MC + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, OTSI_MC, tpId))
.build();
- OwnedNodeEdgePointBuilder onepBldr2 = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid2)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
- .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState).setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep2 = onepBldr2.build();
+
+ OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
+ .setUuid(nepUuid2)
+ .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+ .setName(Map.of(nepName2.key(), nepName2))
+ .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(adminState).setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep2.key(), onep2);
return onepMap;
}
private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
- createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
+ createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setOwnedNodeEdgePoint(oneplist)
- .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
+ .setNodeRuleGroup(createNodeRuleGroupForRdmNode(orNodeId, nodeUuid, oneplist.values()))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setErrorCharacteristic("error")
.build();
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
+ private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String orNodeId, Uuid nodeUuid,
Collection<OwnedNodeEdgePoint> onepl) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
.build();
ruleList.put(rule.key(), rule);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group")
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group")
.getBytes(Charset.forName("UTF-8"))).toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepMap)
case "DSR":
case "ODU":
switch (sic.getIfCapType().getSimpleName()) {
+ // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+ // port are extended in the config file
+ case "If1GEODU0":
+ sclpqList.add(ODUTYPEODU0.class);
+ sclpqList.add(DIGITALSIGNALTYPEGigE.class);
+ break;
case "If10GEODU2e":
sclpqList.add(ODUTYPEODU2E.class);
sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error populating TAPI topology: ", e);
}
- LOG.info("Roadm Node added succesfully.");
+ LOG.info("Node added succesfully.");
}
private void mergeLinkinTopology(Map<LinkKey, Link> linkMap) {
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.ListenableFuture;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
public ListenableFuture<RpcResult<GetNodeDetailsOutput>> getNodeDetails(GetNodeDetailsInput input) {
// TODO Auto-generated method stub
// TODO -> maybe we get errors when having CEPs?
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(input.getTopologyIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid topoUuid = getUuidFromIput(input.getTopologyIdOrName());
// Node id: if roadm -> ROADM+PHOTONIC_MEDIA. if xpdr -> XPDR-XPDR+DSR/OTSi
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(input.getNodeIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid nodeUuid = getUuidFromIput(input.getNodeIdOrName());
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node = this.tapiContext
.getTapiNode(topoUuid, nodeUuid);
if (node == null) {
GetNodeEdgePointDetailsInput input) {
// TODO Auto-generated method stub
// TODO -> maybe we get errors when having CEPs?
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(input.getTopologyIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid topoUuid = getUuidFromIput(input.getTopologyIdOrName());
// Node id: if roadm -> ROADMid+PHOTONIC_MEDIA. if xpdr -> XPDRid-XPDRnbr+DSR/OTSi
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(input.getNodeIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid nodeUuid = getUuidFromIput(input.getNodeIdOrName());
// NEP id: if roadm -> ROADMid+PHOTONIC_MEDIA/MC/OTSiMC+TPid.
// if xpdr -> XPDRid-XPDRnbr+DSR/eODU/iODU/iOTSi/eOTSi/PHOTONIC_MEDIA+TPid
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(input.getEpIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid nepUuid = getUuidFromIput(input.getEpIdOrName());
OwnedNodeEdgePoint nep = this.tapiContext.getTapiNEP(topoUuid, nodeUuid, nepUuid);
if (nep == null) {
LOG.error("Invalid TAPI nep name");
@Override
public ListenableFuture<RpcResult<GetLinkDetailsOutput>> getLinkDetails(GetLinkDetailsInput input) {
// TODO Auto-generated method stub
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(input.getTopologyIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid topoUuid = getUuidFromIput(input.getTopologyIdOrName());
// Link id: same as OR link id
- Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes(input.getLinkIdOrName().getBytes(Charset.forName("UTF-8")))
- .toString());
+ Uuid linkUuid = getUuidFromIput(input.getLinkIdOrName());
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link = this.tapiContext
.getTapiLink(topoUuid, linkUuid);
if (link == null) {
@Override
public ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>>
getServiceInterfacePointDetails(GetServiceInterfacePointDetailsInput input) {
- Uuid sipUuid = new Uuid(input.getSipIdOrName());
+ Uuid sipUuid = getUuidFromIput(input.getSipIdOrName());
Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
this.tapiContext.getTapiContext().getServiceInterfacePoint();
if (sips == null || sips.isEmpty()) {
// TODO --> not yet implemented
return null;
}
+
+ private Uuid getUuidFromIput(String serviceIdOrName) {
+ try {
+ UUID.fromString(serviceIdOrName);
+ LOG.info("Given attribute {} is a UUID", serviceIdOrName);
+ return new Uuid(serviceIdOrName);
+ } catch (IllegalArgumentException e) {
+ LOG.info("Given attribute {} is not a UUID", serviceIdOrName);
+ return new Uuid(UUID.nameUUIDFromBytes(serviceIdOrName.getBytes(StandardCharsets.UTF_8)).toString());
+ }
+ }
}
public Topology createFullOtnTopology() throws TapiTopologyException {
// read openroadm-topology
Network openroadmTopo = readTopology(InstanceIdentifiers.OVERLAY_NETWORK_II);
- List<Link> linkList = new ArrayList<>();
- if (openroadmTopo.augmentation(Network1.class) != null) {
- linkList.addAll(openroadmTopo.augmentation(Network1.class).getLink().values());
- }
- List<Link> xponderOutLinkList = linkList.stream()
- .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
- .collect(Collectors.toList());
- List<Link> xponderInLinkList = linkList.stream()
- .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
- .collect(Collectors.toList());
- // read otn-topology
- Network otnTopo = readTopology(InstanceIdentifiers.OTN_NETWORK_II);
- Map<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> otnNodeMap = otnTopo.nonnullNode()
- .values().stream().collect(Collectors.toMap(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.rev180226.networks.network.Node::getNodeId, node -> node));
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_FULL_MULTILAYER
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Name name = new NameBuilder().setValue(TopologyUtils.T0_FULL_MULTILAYER).setValueName("TAPI Topology Name")
+ .build();
+ if (openroadmTopo != null) {
+ List<Link> linkList = new ArrayList<>();
+ if (openroadmTopo.augmentation(Network1.class) != null) {
+ linkList.addAll(openroadmTopo.augmentation(Network1.class).getLink().values());
+ }
+ List<Link> xponderOutLinkList = linkList.stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
+ .collect(Collectors.toList());
+ List<Link> xponderInLinkList = linkList.stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
+ .collect(Collectors.toList());
+ // read otn-topology
+ Network otnTopo = readTopology(InstanceIdentifiers.OTN_NETWORK_II);
+ Map<NodeId, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node> otnNodeMap = otnTopo.nonnullNode()
+ .values().stream().collect(Collectors.toMap(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node::getNodeId, node -> node));
- Map<String, List<String>> networkPortMap = new HashMap<>();
- Iterator<Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node>> itOtnNodeMap = otnNodeMap
- .entrySet().iterator();
- while (itOtnNodeMap.hasNext()) {
- Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> entry = itOtnNodeMap.next();
- String portMappingNodeId = entry.getValue().getSupportingNode().values().stream()
- .filter(sn -> sn.getNetworkRef().getValue().equals(NetworkUtils.UNDERLAY_NETWORK_ID))
- .findFirst()
- .get().getNodeRef().getValue();
- List<String> networkPortList = new ArrayList<>();
- for (TerminationPoint tp: entry.getValue().augmentation(Node1.class).getTerminationPoint().values()) {
- // TODO -> why are we checking with respect to XPDR links?? Is there a real purpose on doing that?
- if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)
- && checkTp(entry.getKey().getValue(), portMappingNodeId, tp, xponderOutLinkList,
- xponderInLinkList)) {
- networkPortList.add(tp.getTpId().getValue());
+ Map<String, List<String>> networkPortMap = new HashMap<>();
+ Iterator<Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
+ .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node>> itOtnNodeMap = otnNodeMap
+ .entrySet().iterator();
+ while (itOtnNodeMap.hasNext()) {
+ Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
+ .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> entry = itOtnNodeMap.next();
+ String portMappingNodeId = entry.getValue().getSupportingNode().values().stream()
+ .filter(sn -> sn.getNetworkRef().getValue().equals(NetworkUtils.UNDERLAY_NETWORK_ID))
+ .findFirst()
+ .get().getNodeRef().getValue();
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp: entry.getValue().augmentation(Node1.class).getTerminationPoint().values()) {
+ // TODO -> why are we checking with respect to XPDR links?? Is there a real purpose on doing that?
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)
+ && checkTp(entry.getKey().getValue(), portMappingNodeId, tp, xponderOutLinkList,
+ xponderInLinkList)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ if (!networkPortList.isEmpty()) {
+ networkPortMap.put(entry.getKey().getValue(), networkPortList);
}
}
- if (!networkPortList.isEmpty()) {
- networkPortMap.put(entry.getKey().getValue(), networkPortList);
+ Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
+ tapiNodeList = new HashMap<>();
+ Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link>
+ tapiLinkList = new HashMap<>();
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topoUuid);
+ Iterator<Map.Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
+ while (it.hasNext()) {
+ String nodeId = it.next().getKey();
+ tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
+ tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
}
- }
- Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
- tapiNodeList = new HashMap<>();
- Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link>
- tapiLinkList = new HashMap<>();
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topoUuid);
- Iterator<Map.Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
- while (it.hasNext()) {
- String nodeId = it.next().getKey();
- tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- }
- // roadm infrastructure not abstracted
- // read openroadm-network
- Network openroadmNet = readTopology(InstanceIdentifiers.UNDERLAY_NETWORK_II);
- if (openroadmNet != null && openroadmNet.nonnullNode().values().stream().filter(nt ->
+ // roadm infrastructure not abstracted
+ // read openroadm-network
+ Network openroadmNet = readTopology(InstanceIdentifiers.UNDERLAY_NETWORK_II);
+ if (openroadmNet != null && openroadmNet.nonnullNode().values().stream().filter(nt ->
nt.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
- .getNodeType().equals(OpenroadmNodeType.ROADM)).count() > 0) {
- // map roadm nodes
- for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node
- roadm:openroadmNet.nonnullNode().values().stream().filter(
- nt -> nt.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.common.network.rev200529.Node1.class)
- .getNodeType().equals(OpenroadmNodeType.ROADM))
+ .getNodeType().equals(OpenroadmNodeType.ROADM)).count() > 0) {
+ // map roadm nodes
+ for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node roadm:openroadmNet.nonnullNode().values().stream()
+ .filter(nt -> nt.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Node1.class)
+ .getNodeType().equals(OpenroadmNodeType.ROADM))
.collect(Collectors.toList())) {
- tapiFactory.convertRoadmNode(roadm, openroadmTopo);
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ tapiFactory.convertRoadmNode(roadm, openroadmTopo);
+ tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ }
+ } else {
+ LOG.warn("No roadm nodes exist in the network");
}
- } else {
- LOG.warn("No roadm nodes exist in the network");
- }
- // map roadm to roadm link
- List<Link> rdmTordmLinkList = linkList.stream()
+ // map roadm to roadm link
+ List<Link> rdmTordmLinkList = linkList.stream()
.filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
.collect(Collectors.toList());
- tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- // map xpdr_input to roadm and xpdr_output to roadm links.
- xponderInLinkList.addAll(xponderOutLinkList);
- tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ // map xpdr_input to roadm and xpdr_output to roadm links.
+ xponderInLinkList.addAll(xponderOutLinkList);
+ tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
- if (otnTopo.augmentation(Network1.class) != null) {
- Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
+ if (otnTopo.augmentation(Network1.class) != null) {
+ Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
.network.LinkKey, Link> otnLinkMap = otnTopo.augmentation(Network1.class).getLink();
- tapiFactory.convertLinks(otnLinkMap);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- }
- Name name = new NameBuilder().setValue(TopologyUtils.T0_FULL_MULTILAYER).setValueName("TAPI Topology Name")
- .build();
- // Retrieve created sips map in TapiFactory when mapping all the nodes
- this.tapiSips = tapiFactory.getTapiSips();
- return new TopologyBuilder()
+ tapiFactory.convertLinks(otnLinkMap);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ }
+ // Retrieve created sips map in TapiFactory when mapping all the nodes
+ this.tapiSips = tapiFactory.getTapiSips();
+ return new TopologyBuilder()
.setName(Map.of(name.key(), name))
.setUuid(topoUuid)
.setNode(tapiNodeList)
.setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
- LayerProtocolName.DSR))
+ LayerProtocolName.DSR))
.setLink(tapiLinkList).build();
+ }
+ return new TopologyBuilder()
+ .setName(Map.of(name.key(), name))
+ .setUuid(topoUuid)
+ .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
+ LayerProtocolName.DSR))
+ .build();
}
public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getSipMap() {
topologyBuilder.setNode(mapNode);
return topologyBuilder.build();
}
-
-}
+}
\ No newline at end of file
private static final Logger LOG = LoggerFactory.getLogger(TapiContext.class);
public static final String TAPI_CONTEXT = "T-API context";
+ public static final String NODE_NOT_PRESENT = "Node is not present in datastore";
private final NetworkTransactionService networkTransactionService;
public TapiContext(NetworkTransactionService networkTransactionService) {
Optional<Node> optNode = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, nodeIID)
.get();
if (!optNode.isPresent()) {
- LOG.error("Node is not present in datastore");
+ LOG.error(NODE_NOT_PRESENT);
return null;
}
// TODO -> Need to remove CEPs from NEPs. If not error from get Topology details output
Node node = optNode.get();
+ LOG.debug("NEPs of node before creating map to be returned to the getTapiNode function = {}",
+ node.getOwnedNodeEdgePoint().size());
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
for (OwnedNodeEdgePoint onep: node.getOwnedNodeEdgePoint().values()) {
if (onep.augmentation(OwnedNodeEdgePoint1.class) == null) {
if (onep.getMappedServiceInterfacePoint() != null) {
newOnepBuilder.setMappedServiceInterfacePoint(onep.getMappedServiceInterfacePoint());
}
- onepMap.put(newOnepBuilder.key(), newOnepBuilder.build());
+ OwnedNodeEdgePoint newOnep = newOnepBuilder.build();
+ onepMap.put(newOnep.key(), newOnep);
}
+ LOG.debug("NEPs of node after creating map to be returned to the getTapiNode function = {}",
+ onepMap.size());
return new NodeBuilder(node)
.setOwnedNodeEdgePoint(onepMap)
.build();
.read(LogicalDatastoreType.OPERATIONAL, nepIID)
.get();
if (!optNode.isPresent()) {
- LOG.error("Node is not present in datastore");
+ LOG.error(NODE_NOT_PRESENT);
return null;
}
return optNode.get();
Optional<Link> optLink = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, linkIID)
.get();
if (!optLink.isPresent()) {
- LOG.error("Node is not present in datastore");
+ LOG.error(NODE_NOT_PRESENT);
return null;
}
return optLink.get();
try {
this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, connectivityServIID);
this.networkTransactionService.commit().get();
+ LOG.info("Connectivity service deleted");
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to delete Connectivity service", e);
}
Optional<OwnedNodeEdgePoint> optNode = this.networkTransactionService
.read(LogicalDatastoreType.OPERATIONAL, nepIID).get();
if (!optNode.isPresent()) {
- LOG.error("Node is not present in datastore");
+ LOG.error(NODE_NOT_PRESENT);
return null;
}
if (optNode.get().augmentation(OwnedNodeEdgePoint1.class) == null) {
return optNode.get().augmentation(OwnedNodeEdgePoint1.class).getCepList().getConnectionEndPoint()
.get(new ConnectionEndPointKey(cepUuid));
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt read node in topology");
+ LOG.error("Couldnt read node in topology", e);
return null;
}
}
--- /dev/null
+/*
+ * Copyright © 2021 Nokia, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.tapi.connectivity;
+
+import static org.mockito.ArgumentMatchers.any;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.HashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.transportpce.common.InstanceIdentifiers;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.pce.service.PathComputationService;
+import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
+import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl;
+import org.opendaylight.transportpce.tapi.topology.TopologyUtils;
+import org.opendaylight.transportpce.tapi.utils.TapiConnectivityDataUtils;
+import org.opendaylight.transportpce.tapi.utils.TapiContext;
+import org.opendaylight.transportpce.tapi.utils.TapiInitialORMapping;
+import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
+import org.opendaylight.transportpce.test.AbstractTest;
+import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceOutput;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TapiConnectivityImplTest extends AbstractTest {
+
+ @Mock
+ private PathComputationService pathComputationService;
+
+ @Mock
+ private RendererServiceOperations rendererServiceOperations;
+
+ @Mock
+ private NotificationPublishService notificationPublishService;
+
+ @Mock
+ private TapiPceListenerImpl tapipceListenerImpl;
+
+ @Mock
+ private TapiRendererListenerImpl tapirendererListenerImpl;
+
+ @Mock
+ private TapiServiceHandlerListenerImpl tapiserviceHandlerListenerImpl;
+
+ @Mock
+ private PceListenerImpl pceListenerImpl;
+
+ @Mock
+ private RendererListenerImpl rendererListenerImpl;
+
+ @Mock
+ private NetworkModelListenerImpl networkModelListenerImpl;
+
+ private static final Logger LOG = LoggerFactory.getLogger(TapiConnectivityImplTest.class);
+ public static ServiceDataStoreOperations serviceDataStoreOperations;
+ public static TapiContext tapiContext;
+ public static TopologyUtils topologyUtils;
+ public static ConnectivityUtils connectivityUtils;
+ public static TapiInitialORMapping tapiInitialORMapping;
+ public static NetworkTransactionService networkTransactionService;
+ private ListeningExecutorService executorService;
+ private CountDownLatch endSignal;
+ private static final int NUM_THREADS = 5;
+ private boolean callbackRan;
+
+ @Before
+ public void setUp() throws InterruptedException, ExecutionException {
+ executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
+ endSignal = new CountDownLatch(1);
+ // Need to have datastore populated to enable the mapping from TAPI to OR
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
+ TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.PORTMAPPING_FILE);
+
+ callbackRan = false;
+ MockitoAnnotations.openMocks(this);
+
+ networkTransactionService = new NetworkTransactionImpl(
+ new RequestProcessor(getDataStoreContextUtil().getDataBroker()));
+ serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
+ tapiContext = new TapiContext(networkTransactionService);
+ topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker());
+ connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext);
+ tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils,
+ tapiContext, serviceDataStoreOperations);
+ tapiInitialORMapping.performTopoInitialMapping();
+ LOG.info("setup done");
+ }
+
+ @Test
+ public void createConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+
+ TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
+ tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+
+ ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
+ tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<CreateConnectivityServiceOutput> rpcResult = result.get();
+ Assert.assertEquals(
+ RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ }
+
+ @Test
+ public void createConnServiceShouldBeSuccessfulWhenPerformPCESuccessful()
+ throws ExecutionException, InterruptedException {
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+
+ CreateConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceCreateInput();
+ Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
+
+ TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
+ tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
+ tapiConnectivity.createConnectivityService(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<CreateConnectivityServiceOutput> rpcResult = result.get();
+ Assert.assertTrue(rpcResult.isSuccessful());
+ }
+
+ @Test
+ public void deleteConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+
+ TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
+ tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+
+ ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
+ tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
+ Assert.assertEquals(
+ RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ }
+
+ @Test
+ public void deleteConnServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ DeleteConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceDeleteInput1();
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+
+ TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
+ tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
+ tapiConnectivity.deleteConnectivityService(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
+ Assert.assertEquals(
+ RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ }
+
+ @Test
+ public void deleteConnServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
+
+ OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+
+ TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
+ tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+
+ ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
+ serviceDataStoreOperations.createService(createInput);
+ tapiContext.updateConnectivityContext(TapiConnectivityDataUtils.createConnService(), new HashMap<>());
+
+ DeleteConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceDeleteInput();
+ ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
+ tapiConnectivity.deleteConnectivityService(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ callbackRan = true;
+ endSignal.countDown();
+ }
+ }, executorService);
+
+ endSignal.await();
+
+ RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
+ Assert.assertTrue(rpcResult.isSuccessful());
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2021 Nokia, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.tapi.provider;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.common.network.RequestProcessor;
+import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
+import org.opendaylight.transportpce.tapi.impl.TapiProvider;
+import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
+import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl;
+import org.opendaylight.transportpce.tapi.topology.TapiNetconfTopologyListener;
+import org.opendaylight.transportpce.tapi.topology.TapiPortMappingListener;
+import org.opendaylight.transportpce.tapi.utils.TapiListener;
+import org.opendaylight.transportpce.test.AbstractTest;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.tapinetworkutils.rev210408.TransportpceTapinetworkutilsService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TapiCommonService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.TapiConnectivityService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.TapiTopologyService;
+
+public class TapiProviderTest extends AbstractTest {
+ public static NetworkTransactionService networkTransactionService;
+
+ @Mock
+ RpcProviderService rpcProviderRegistry;
+
+ @Mock
+ OrgOpenroadmServiceService serviceHandler;
+
+ @Mock
+ ServiceDataStoreOperations serviceDataStoreOperations;
+
+ @Mock
+ TapiListener tapiListener;
+
+ @Mock
+ TransportpceTapinetworkutilsService tapiNetworkUtils;
+
+ @Mock
+ TapiPortMappingListener tapiPortMappingListener;
+
+ @Mock
+ TapiNetconfTopologyListener topologyListener;
+
+ @Mock
+ TapiPceListenerImpl pceListenerImpl;
+
+ @Mock
+ TapiRendererListenerImpl rendererListenerImpl;
+
+ @Mock
+ TapiServiceHandlerListenerImpl serviceHandlerListenerImpl;
+
+ private AutoCloseable closeable;
+
+ @Before
+ public void openMocks() {
+ closeable = MockitoAnnotations.openMocks(this);
+ }
+
+ @BeforeClass
+ public static void setUp() {
+ networkTransactionService = new NetworkTransactionImpl(
+ new RequestProcessor(getDataBroker()));
+ }
+
+ @Test
+ public void testInitRegisterTapiToRpcRegistry() {
+ TapiProvider provider = new TapiProvider(getDataBroker(), rpcProviderRegistry, serviceHandler,
+ serviceDataStoreOperations, tapiListener, networkTransactionService, topologyListener,
+ tapiPortMappingListener, tapiNetworkUtils, pceListenerImpl, rendererListenerImpl,
+ serviceHandlerListenerImpl, getNotificationService());
+
+ provider.init();
+
+ verify(rpcProviderRegistry, times(1))
+ .registerRpcImplementation(any(), any(TapiConnectivityService.class));
+ verify(rpcProviderRegistry, times(2))
+ .registerRpcImplementation(any(), any(TapiTopologyService.class));
+ verify(rpcProviderRegistry, times(2))
+ .registerRpcImplementation(any(), any(TapiCommonService.class));
+ }
+
+ @After
+ public void releaseMocks() throws Exception {
+ closeable.close();
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2021 Nokia, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.tapi.topology;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.either;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import com.google.common.util.concurrent.FluentFuture;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+import org.eclipse.jdt.annotation.Nullable;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.common.InstanceIdentifiers;
+import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
+import org.opendaylight.transportpce.test.AbstractTest;
+import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
+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.OpenroadmTpType;
+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.Networks;
+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;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
+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;
+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.LinkId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
+ private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToFullTapiTopoTest.class);
+
+ private static Node otnMuxA;
+ private static Node otnMuxC;
+ private static Node otnSwitch;
+ private static Node tpdr100G;
+ private static Node roadmA;
+ private static Node roadmC;
+ private static Network openroadmNet;
+ private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinks;
+ private static Map<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> ortopoLinks;
+ private static Uuid topologyUuid;
+ private static DataBroker dataBroker = getDataBroker();
+
+ @BeforeClass
+ public static void setUp() throws InterruptedException, ExecutionException {
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OPENROADM_TOPOLOGY_FILE, InstanceIdentifiers.OVERLAY_NETWORK_II);
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OPENROADM_NETWORK_FILE, InstanceIdentifiers.UNDERLAY_NETWORK_II);
+ TopologyDataUtils.writeTopologyFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.OTN_TOPOLOGY_FILE, InstanceIdentifiers.OTN_NETWORK_II);
+ TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
+ TapiTopologyDataUtils.PORTMAPPING_FILE);
+
+ KeyedInstanceIdentifier<Node, NodeKey> muxAIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("otn-topology")))
+ .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR1")));
+ FluentFuture<Optional<Node>> muxAFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, muxAIID);
+ otnMuxA = muxAFuture.get().get();
+ KeyedInstanceIdentifier<Node, NodeKey> muxCIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("otn-topology")))
+ .child(Node.class, new NodeKey(new NodeId("SPDR-SC1-XPDR1")));
+ FluentFuture<Optional<Node>> muxCFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, muxCIID);
+ otnMuxC = muxCFuture.get().get();
+ KeyedInstanceIdentifier<Node, NodeKey> switchIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("otn-topology")))
+ .child(Node.class, new NodeKey(new NodeId("SPDR-SA1-XPDR2")));
+ FluentFuture<Optional<Node>> switchFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, switchIID);
+ otnSwitch = switchFuture.get().get();
+ KeyedInstanceIdentifier<Node, NodeKey> roadmaIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("openroadm-network")))
+ .child(Node.class, new NodeKey(new NodeId("ROADM-A1")));
+ FluentFuture<Optional<Node>> roadmaFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, roadmaIID);
+ roadmA = roadmaFuture.get().get();
+ KeyedInstanceIdentifier<Node, NodeKey> roadmcIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("openroadm-network")))
+ .child(Node.class, new NodeKey(new NodeId("ROADM-C1")));
+ FluentFuture<Optional<Node>> roadmcFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, roadmcIID);
+ roadmC = roadmcFuture.get().get();
+
+ KeyedInstanceIdentifier<Node, NodeKey> tpdrIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("otn-topology")))
+ .child(Node.class, new NodeKey(new NodeId("XPDR-A1-XPDR1")));
+ FluentFuture<Optional<Node>> tpdrFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, tpdrIID);
+ tpdr100G = tpdrFuture.get().get();
+
+ InstanceIdentifier<Network1> linksIID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("otn-topology")))
+ .augmentation(Network1.class);
+ FluentFuture<Optional<Network1>> linksFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, linksIID);
+ otnLinks = linksFuture.get().get().getLink();
+
+ InstanceIdentifier<Network1> links1IID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("openroadm-topology")))
+ .augmentation(Network1.class);
+ FluentFuture<Optional<Network1>> links1Future = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, links1IID);
+ ortopoLinks = links1Future.get().get().getLink();
+
+ InstanceIdentifier<Network> ortopo1IID = InstanceIdentifier.create(Networks.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network
+ .class, new NetworkKey(new NetworkId("openroadm-topology")));
+ FluentFuture<Optional<Network>> ortopoFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, ortopo1IID);
+ openroadmNet = ortopoFuture.get().get();
+
+ topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_FULL_MULTILAYER.getBytes(
+ Charset.forName("UTF-8"))).toString());
+ LOG.info("TEST SETUP READY");
+ }
+
+ @Test
+ public void convertNodeWhenNoStates() {
+ Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", null, null);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ tapiFactory.convertNode(tpdr, networkPortList);
+
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
+ Uuid enetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
+ assertNull("Administrative State should not be present", enepN.getAdministrativeState());
+ assertNull("Operational State should not be present", enepN.getOperationalState());
+
+ OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
+ assertNull("Administrative State should not be present", inepN.getAdministrativeState());
+ assertNull("Operational State should not be present", inepN.getOperationalState());
+
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
+ Uuid enepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
+ assertNull("Administrative State should not be present", enep.getAdministrativeState());
+ assertNull("Operational State should not be present", enep.getOperationalState());
+
+ Uuid inepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
+ assertNull("Administrative State should not be present", inep.getAdministrativeState());
+ assertNull("Operational State should not be present", inep.getOperationalState());
+
+ Uuid photnepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
+ assertNull("Administrative State should not be present", photnep.getAdministrativeState());
+ assertNull("Operational State should not be present", photnep.getOperationalState());
+ }
+
+ @Test
+ public void convertNodeWhenBadStates1() {
+ Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.OutOfService,
+ State.OutOfService);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ tapiFactory.convertNode(tpdr, networkPortList);
+
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
+ Uuid enetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, enepN.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, enepN.getOperationalState());
+
+ OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, inepN.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, inepN.getOperationalState());
+
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
+ Uuid enepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, enep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, enep.getOperationalState());
+
+ Uuid inepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, inep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, inep.getOperationalState());
+
+ Uuid photnepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, photnep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, photnep.getOperationalState());
+ }
+
+ @Test
+ public void convertNodeWhenBadStates2() {
+ Node tpdr = changeTerminationPointState(tpdr100G, "XPDR1-NETWORK1", AdminStates.Maintenance,
+ State.Degraded);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ tapiFactory.convertNode(tpdr, networkPortList);
+
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node dsrNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(dsrNodeUuid));
+ Uuid enetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enetworkNepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, enepN.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, enepN.getOperationalState());
+
+ OwnedNodeEdgePoint inepN = dsrNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inetworkNepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, inepN.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, inepN.getOperationalState());
+
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node otsiNode = tapiFactory
+ .getTapiNodes().get(new
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey(otsiNodeUuid));
+ Uuid enepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint enep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(enepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, enep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, enep.getOperationalState());
+
+ Uuid inepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint inep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(inepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, inep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, inep.getOperationalState());
+
+ Uuid photnepUuid = new Uuid(
+ UUID.nameUUIDFromBytes(("XPDR-A1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ OwnedNodeEdgePoint photnep = otsiNode.nonnullOwnedNodeEdgePoint().get(new OwnedNodeEdgePointKey(photnepUuid));
+ assertEquals("Administrative State should be Locked",
+ AdministrativeState.LOCKED, photnep.getAdministrativeState());
+ assertEquals("Operational State should be Disabled",
+ OperationalState.DISABLED, photnep.getOperationalState());
+ }
+
+ @Test
+ public void convertOtnLinkWhenNoState() {
+ HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
+ link = changeOtnLinkState(otnLinks.get(new LinkKey(
+ new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null);
+ otnLinksAlt.replace(link.key(), link);
+
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinksAlt);
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertNull("Administrative State should not be present", tapiLinks.get(0).getAdministrativeState());
+ assertEquals("Administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
+ assertNull("Operational State should not be present", tapiLinks.get(0).getOperationalState());
+ assertEquals("Operational state should be ENABLED",
+ OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
+ }
+
+ @Test
+ public void convertOtnLinkWhenNoStateOnOppositeLink() {
+ HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
+ link = changeOtnLinkState(otnLinks.get(new LinkKey(
+ new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null);
+ otnLinksAlt.replace(link.key(), link);
+
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinksAlt);
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertNull("Administrative State should not be present", tapiLinks.get(0).getAdministrativeState());
+ assertEquals("Administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
+ assertNull("Operational State should not be present", tapiLinks.get(0).getOperationalState());
+ assertEquals("Operational state should be ENABLED",
+ OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
+ }
+
+ @Test
+ public void convertOtnLinkWhenBadState1() {
+ HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
+ link = changeOtnLinkState(otnLinks.get(new LinkKey(
+ new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
+ AdminStates.OutOfService, State.OutOfService);
+ otnLinksAlt.replace(link.key(), link);
+
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinksAlt);
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Administrative state should be LOCKED",
+ AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
+ assertEquals("Administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
+ assertEquals("Operational state should be DISABLED",
+ OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
+ assertEquals("Operational state should be ENABLED",
+ OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
+ }
+
+ @Test
+ public void convertOtnLinkWhenBadState2() {
+ HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
+ link = changeOtnLinkState(otnLinks.get(new LinkKey(
+ new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))),
+ AdminStates.Maintenance, State.Degraded);
+ otnLinksAlt.replace(link.key(), link);
+
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinksAlt);
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Administrative state should be LOCKED",
+ AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
+ assertEquals("Administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
+ assertEquals("Operational state should be DISABLED",
+ OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
+ assertEquals("Operational state should be ENABLED",
+ OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
+ }
+
+ @Test
+ public void convertOtnLinkWhenBadStateOnOppositeLink() {
+ HashMap<LinkKey, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks);
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link
+ link = changeOtnLinkState(otnLinks.get(new LinkKey(
+ new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))),
+ AdminStates.OutOfService, State.OutOfService);
+ otnLinksAlt.replace(link.key(), link);
+
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinksAlt);
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Administrative state should be LOCKED",
+ AdministrativeState.LOCKED, tapiLinks.get(0).getAdministrativeState());
+ assertEquals("Administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, tapiLinks.get(2).getAdministrativeState());
+ assertEquals("Operational state should be DISABLED",
+ OperationalState.DISABLED, tapiLinks.get(0).getOperationalState());
+ assertEquals("Operational state should be ENABLED",
+ OperationalState.ENABLED, tapiLinks.get(2).getOperationalState());
+ }
+
+ @Test
+ public void convertNodeForTransponder100G() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : tpdr100G.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(tpdr100G, networkPortList);
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream()
+ .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
+ .collect(Collectors.toList());
+
+ assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
+
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkDsrNode(tapiNodes.get(1), dsrNodeUuid, "tpdr", "XPDR-A1-XPDR1");
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("XPDR-A1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkOtsiNode(tapiNodes.get(0), otsiNodeUuid, "tpdr", "XPDR-A1-XPDR1");
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
+ "XPDR-A1-XPDR1+iODU+XPDR1-NETWORK1", "XPDR-A1-XPDR1+iOTSi+XPDR1-NETWORK1", "XPDR-A1-XPDR1");
+ }
+
+ @Test
+ public void convertNodeForOtnMuxponder() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortList);
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream()
+ .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
+ .collect(Collectors.toList());
+
+ assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "mux", "SPDR-SA1-XPDR1");
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "mux", "SPDR-SA1-XPDR1");
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkTransitionalLink(tapiLinks.get(0), dsrNodeUuid, otsiNodeUuid,
+ "SPDR-SA1-XPDR1+iODU+XPDR1-NETWORK1", "SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
+ }
+
+ @Test
+ public void convertNodeForOtnSwitch() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp : otnSwitch.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnSwitch, networkPortList);
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream()
+ .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
+ .collect(Collectors.toList());
+
+ assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
+
+ Uuid dsrNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkDsrNode(tapiNodes.get(0), dsrNodeUuid, "switch", "SPDR-SA1-XPDR2");
+ Uuid otsiNodeUuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR2+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkOtsiNode(tapiNodes.get(1), otsiNodeUuid, "switch", "SPDR-SA1-XPDR2");
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> tapiLinks
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkTransitionalLink(tapiLinks.get(1), dsrNodeUuid, otsiNodeUuid,
+ "SPDR-SA1-XPDR2+iODU+XPDR2-NETWORK4", "SPDR-SA1-XPDR2+iOTSi+XPDR2-NETWORK4", "SPDR-SA1-XPDR2");
+ }
+
+ @Test
+ public void convertOtnLink() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ List<String> networkPortListC = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxC.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListC.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxC, networkPortListC);
+ tapiFactory.convertLinks(otnLinks);
+ assertEquals("Link list size should be 4", 4, tapiFactory.getTapiLinks().size());
+
+ Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid link1Uuid =
+ new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid link2Uuid =
+ new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkOtnLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
+ "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
+ checkOtnLink(links.get(3), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
+ "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
+ }
+
+ @Test
+ public void convertNodeForRoadmWhenNoOtnMuxAttached() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ tapiFactory.convertRoadmNode(roadmA, openroadmNet);
+
+ assertEquals("Node list size should be 1", 1, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be empty", 0, tapiFactory.getTapiLinks().size());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
+ Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkOtsiNode(tapiNodes.get(0), roadmNodeUuid, "roadm", "ROADM-A1");
+ }
+
+ @Test
+ public void convertNodeForRoadmWhenRoadmNeighborAttached() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ tapiFactory.convertRoadmNode(roadmA, openroadmNet);
+ tapiFactory.convertRoadmNode(roadmC, openroadmNet);
+
+ List<Link> rdmTordmLinkList = ortopoLinks.values().stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
+ .collect(Collectors.toList());
+ tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
+
+ assertEquals("Node list size should be 2", 2, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be 1", 1, tapiFactory.getTapiLinks().size());
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream().collect(Collectors.toList());
+ Uuid roadmaNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkOtsiNode(tapiNodes.get(1), roadmaNodeUuid, "roadm", "ROADM-A1");
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-C1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA+DEG2-TTP-TXRX"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-C1+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid linkUuid =
+ new Uuid(UUID.nameUUIDFromBytes("ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkOmsLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
+ "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX");
+ }
+
+ @Test
+ public void convertNodeForRoadmWhenOtnMuxAttached() {
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topologyUuid);
+ List<String> networkPortListA = new ArrayList<>();
+ for (TerminationPoint tp : otnMuxA.augmentation(Node1.class).getTerminationPoint().values()) {
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ networkPortListA.add(tp.getTpId().getValue());
+ }
+ }
+ tapiFactory.convertNode(otnMuxA, networkPortListA);
+ tapiFactory.convertRoadmNode(roadmA, openroadmNet);
+ List<Link> xponderOutLinkList = ortopoLinks.values().stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
+ .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
+ || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
+ && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
+ || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
+ .collect(Collectors.toList());
+ List<Link> xponderInLinkList = ortopoLinks.values().stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
+ .filter(lk1 -> ((lk1.getSource().getSourceNode().equals(otnMuxA.getNodeId())
+ || lk1.getSource().getSourceNode().getValue().contains(roadmA.getNodeId().getValue()))
+ && (lk1.getDestination().getDestNode().equals(otnMuxA.getNodeId())
+ || lk1.getDestination().getDestNode().getValue().contains(roadmA.getNodeId().getValue()))))
+ .collect(Collectors.toList());
+ xponderInLinkList.addAll(xponderOutLinkList);
+ tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
+ assertEquals("Node list size should be 3", 3, tapiFactory.getTapiNodes().size());
+ assertEquals("Link list size should be 2", 2, tapiFactory.getTapiLinks().size());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiNodes
+ = tapiFactory.getTapiNodes().values().stream()
+ .sorted((n1, n2) -> n1.getUuid().getValue().compareTo(n2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ Uuid roadmNodeUuid = new Uuid(UUID.nameUUIDFromBytes((roadmA.getNodeId().getValue() + "+PHOTONIC_MEDIA")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkOtsiNode(tapiNodes.get(1), roadmNodeUuid, "roadm", "ROADM-A1");
+
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link> links
+ = tapiFactory.getTapiLinks().values().stream()
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("ROADM-A1+PHOTONIC_MEDIA".getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+PHOTONIC_MEDIA+XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes(("ROADM-A1+PHOTONIC_MEDIA+SRG1-PP2-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid linkUuid =
+ new Uuid(UUID.nameUUIDFromBytes("ROADM-A1-SRG1-SRG1-PP2-TXRXtoSPDR-SA1-XPDR1-XPDR1-NETWORK1"
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkXpdrRdmLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, linkUuid,
+ "ROADM-A1-SRG1-SRG1-PP2-TXRXtoSPDR-SA1-XPDR1-XPDR1-NETWORK1");
+ }
+
+ private void checkDsrNode(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
+ Uuid nodeUuid, String dsrNodeType, String nodeId) {
+ assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
+ assertEquals("incorrect node name", nodeId + "+DSR", node.getName().get(
+ new NameKey("dsr/odu node name")).getValue());
+ assertEquals("administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, node.getAdministrativeState());
+ assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
+ assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
+ assertEquals("value-name should be 'dsr/odu node name'",
+ "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
+ assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
+ 2, node.getLayerProtocolName().size());
+ assertThat("dsr node should manage 2 protocol layers : dsr and odu",
+ node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
+ List<OwnedNodeEdgePoint> inepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint_N")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ List<OwnedNodeEdgePoint> enepsN = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint_N")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ List<OwnedNodeEdgePoint> nepsC;
+ switch (dsrNodeType) {
+ case "switch":
+ nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Switch-DSR node should have 4 eNEPs network", 4, enepsN.size());
+ assertEquals("Switch-DSR node should have 4 iNEPs network", 4, inepsN.size());
+ assertEquals("Switch-DSR node should have 4 NEPs client", 4, nepsC.size());
+ OwnedNodeEdgePoint nep1 = nepsC.get(2);
+ Uuid client4NepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR2-CLIENT4").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepClient100GSwitch(nep1, client4NepUuid, nodeId + "+DSR+XPDR2-CLIENT4", "NodeEdgePoint_C");
+ OwnedNodeEdgePoint enep2 = enepsN.get(3);
+ OwnedNodeEdgePoint inep2 = inepsN.get(3);
+ Uuid enetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR2-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepNetworkODU4(enep2, enetworkNepUuid, nodeId + "+eODU+XPDR2-NETWORK1", "eNodeEdgePoint_N", true);
+ checkNepNetworkODU4(inep2, inetworkNepUuid, nodeId + "+iODU+XPDR2-NETWORK1", "iNodeEdgePoint_N", false);
+ List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, enetworkNepUuid, nodeUuid);
+ break;
+ case "mux":
+ nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("NodeEdgePoint_C")))
+ .sorted((nep3, nep4) -> nep3.getUuid().getValue().compareTo(nep4.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Mux-DSR node should have 1 eNEP network", 1, enepsN.size());
+ assertEquals("Mux-DSR node should have 1 iNEP network", 1, inepsN.size());
+ assertEquals("Mux-DSR node should have 4 NEPs client", 4, nepsC.size());
+ OwnedNodeEdgePoint nep3 = nepsC.get(2);
+ Uuid client3NepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT3").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepClient10G(nep3, client3NepUuid, nodeId + "+DSR+XPDR1-CLIENT3", "NodeEdgePoint_C");
+
+ OwnedNodeEdgePoint enep4 = enepsN.get(0);
+ OwnedNodeEdgePoint inep4 = inepsN.get(0);
+ Uuid enetworkNepUuid2 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid2 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepNetworkODU4(enep4, enetworkNepUuid2, nodeId + "+eODU+XPDR1-NETWORK1", "eNodeEdgePoint_N", true);
+ checkNepNetworkODU4(inep4, inetworkNepUuid2, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
+ false);
+ List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForMuxDSR(nrgList2, client3NepUuid, enetworkNepUuid2, nodeUuid);
+ break;
+ case "tpdr":
+ nepsC = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("100G-tpdr")))
+ .sorted((nep5, nep6) -> nep5.getUuid().getValue().compareTo(nep6.getUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("Tpdr-DSR node should have 2 eNEPs network", 2, enepsN.size());
+ assertEquals("Tpdr-DSR node should have 2 iNEPs network", 2, inepsN.size());
+ assertEquals("Tpdr-DSR node should have 2 NEPs client", 2, nepsC.size());
+ OwnedNodeEdgePoint nep5 = nepsC.get(0);
+ Uuid client1NepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+DSR+XPDR1-CLIENT1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepClient100GTpdr(nep5, client1NepUuid, nodeId + "+DSR+XPDR1-CLIENT1", "100G-tpdr");
+
+ OwnedNodeEdgePoint enep6 = enepsN.get(0);
+ OwnedNodeEdgePoint inep6 = inepsN.get(1);
+ Uuid enetworkNepUuid3 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ Uuid inetworkNepUuid3 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iODU+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepNetworkODU4(enep6, enetworkNepUuid3, nodeId + "+eODU+XPDR1-NETWORK1", "eNodeEdgePoint_N", true);
+ checkNepNetworkODU4(inep6, inetworkNepUuid3, nodeId + "+iODU+XPDR1-NETWORK1", "iNodeEdgePoint_N",
+ false);
+ List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForTpdrDSR(nrgList3, client1NepUuid, enetworkNepUuid3, nodeUuid);
+ break;
+ default:
+ fail();
+ break;
+ }
+ }
+
+ private void checkOtsiNode(
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node,
+ Uuid nodeUuid, String otsiNodeType, String nodeId) {
+ assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
+ List<OwnedNodeEdgePoint> nepsI = null;
+ List<OwnedNodeEdgePoint> nepsE = null;
+ List<OwnedNodeEdgePoint> nepsP = null;
+ List<OwnedNodeEdgePoint> nepsMc = null;
+ List<OwnedNodeEdgePoint> nepsOtsimc = null;
+ List<OwnedNodeEdgePoint> nepsPhot = null;
+ if (!otsiNodeType.equals("roadm")) {
+ assertEquals("incorrect node name", nodeId + "+OTSi", node.getName().get(
+ new NameKey("otsi node name")).getValue());
+ assertEquals("value-name should be 'dsr/odu node name'",
+ "otsi node name", node.nonnullName().values().stream().findFirst().get().getValueName());
+ nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ nepsE = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("eNodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ nepsP = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("PhotMedNodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ } else {
+ assertEquals("incorrect node name", nodeId + "+PHOTONIC_MEDIA", node.getName().get(
+ new NameKey("roadm node name")).getValue());
+ assertEquals("value-name should be 'dsr/odu node name'",
+ "roadm node name", node.nonnullName().values().stream().findFirst().get().getValueName());
+ nepsMc = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("MEDIA_CHANNELNodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ nepsOtsimc = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("OTSi_MEDIA_CHANNELNodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ nepsPhot = node.nonnullOwnedNodeEdgePoint().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("PHOTONIC_MEDIANodeEdgePoint")))
+ .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ }
+ assertEquals("administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, node.getAdministrativeState());
+ assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
+ assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
+ assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
+ 1, node.getLayerProtocolName().size());
+ assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
+ LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
+
+ switch (otsiNodeType) {
+ case "switch":
+ assertEquals("Switch-OTSi node should have 4 eNEPs", 4, nepsE.size());
+ assertEquals("Switch-OTSi node should have 4 iNEPs", 4, nepsI.size());
+ assertEquals("Switch-OTSi node should have 4 photNEPs", 4, nepsP.size());
+ OwnedNodeEdgePoint nep1 = nepsI.get(1);
+ Uuid inepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep1, inepUuid, nodeId + "+iOTSi+XPDR2-NETWORK2", "iNodeEdgePoint", true);
+ OwnedNodeEdgePoint nep2 = nepsE.get(0);
+ Uuid enepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR2-NETWORK2").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep2, enepUuid, nodeId + "+eOTSi+XPDR2-NETWORK2", "eNodeEdgePoint", false);
+ OwnedNodeEdgePoint photNep = nepsP.get(1);
+ Uuid pnepUuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiNode(photNep, pnepUuid, nodeId + "+PHOTONIC_MEDIA+XPDR2-NETWORK2", "PhotMedNodeEdgePoint",
+ false);
+ List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForSwitchOTSi(nrgList, enepUuid, inepUuid, nodeUuid);
+ break;
+ case "mux":
+ assertEquals("Mux-OTSi node should have 1 eNEP", 1, nepsE.size());
+ assertEquals("Mux-OTSi node should have 1 iNEPs", 1, nepsI.size());
+ assertEquals("Mux-OTSi node should have 1 photNEPs", 1, nepsP.size());
+ OwnedNodeEdgePoint nep3 = nepsE.get(0);
+ Uuid enepUuid2 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep3, enepUuid2, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
+ OwnedNodeEdgePoint nep4 = nepsI.get(0);
+ Uuid inepUuid2 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep4, inepUuid2, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
+ OwnedNodeEdgePoint photNep1 = nepsP.get(0);
+ Uuid pnep1Uuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiNode(photNep1, pnep1Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
+ false);
+ List<NodeRuleGroup> nrgList2 = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForMuxOTSi(nrgList2, enepUuid2, inepUuid2, nodeUuid);
+ break;
+ case "tpdr":
+ assertEquals("Tpdr-OTSi node should have 2 eNEPs", 2, nepsE.size());
+ assertEquals("Tpdr-OTSi node should have 2 iNEPs", 2, nepsI.size());
+ assertEquals("Tpdr-OTSi node should have 2 photNEPs", 2, nepsP.size());
+ OwnedNodeEdgePoint nep5 = nepsE.get(0);
+ Uuid enepUuid3 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+eOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep5, enepUuid3, nodeId + "+eOTSi+XPDR1-NETWORK1", "eNodeEdgePoint", false);
+ OwnedNodeEdgePoint nep6 = nepsI.get(0);
+ Uuid inepUuid3 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+iOTSi+XPDR1-NETWORK1").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiNode(nep6, inepUuid3, nodeId + "+iOTSi+XPDR1-NETWORK1", "iNodeEdgePoint", true);
+ OwnedNodeEdgePoint photNep2 = nepsP.get(0);
+ Uuid pnep2Uuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiNode(photNep2, pnep2Uuid, nodeId + "+PHOTONIC_MEDIA+XPDR1-NETWORK1", "PhotMedNodeEdgePoint",
+ false);
+ List<NodeRuleGroup> nrgList3 = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForTpdrOTSi(nrgList3, enepUuid3, inepUuid3, nodeUuid);
+ break;
+ case "roadm":
+ assertEquals("Roadm node should have 10 MC NEPs", 10, nepsMc.size());
+ assertEquals("Roadm node should have 10 OTSiMC NEPs", 10, nepsOtsimc.size());
+ assertEquals("Roadm node should have 10 PHOT_MEDIA NEPs", 10, nepsPhot.size());
+ // For Degree node
+ OwnedNodeEdgePoint nep7 = nepsMc.get(6);
+ Uuid mcnepUuid3 = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX").getBytes(Charset.forName("UTF-8")))
+ .toString());
+ checkNepOtsiRdmNode(nep7, mcnepUuid3, nodeId + "+MEDIA_CHANNEL+DEG1-TTP-TXRX",
+ "MEDIA_CHANNELNodeEdgePoint", false);
+ OwnedNodeEdgePoint nep8 = nepsOtsimc.get(0);
+ Uuid otmcnepUuid3 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiRdmNode(nep8, otmcnepUuid3, nodeId + "+OTSi_MEDIA_CHANNEL+DEG1-TTP-TXRX",
+ "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
+ OwnedNodeEdgePoint photNep3 = nepsPhot.get(3);
+ Uuid pnep3Uuid = new Uuid(
+ UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiRdmNode(photNep3, pnep3Uuid, nodeId + "+PHOTONIC_MEDIA+DEG1-TTP-TXRX",
+ "PHOTONIC_MEDIANodeEdgePoint", false);
+ // For srg node
+ OwnedNodeEdgePoint nep9 = nepsMc.get(0);
+ Uuid mcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiRdmNode(nep9, mcnepUuid4, nodeId + "+MEDIA_CHANNEL+SRG1-PP1-TXRX",
+ "MEDIA_CHANNELNodeEdgePoint", true);
+ OwnedNodeEdgePoint nep10 = nepsOtsimc.get(9);
+ Uuid otmcnepUuid4 = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiRdmNode(nep10, otmcnepUuid4, nodeId + "+OTSi_MEDIA_CHANNEL+SRG1-PP1-TXRX",
+ "OTSi_MEDIA_CHANNELNodeEdgePoint", false);
+ OwnedNodeEdgePoint photNep4 = nepsPhot.get(4);
+ Uuid pnep4Uuid = new Uuid(UUID.nameUUIDFromBytes((nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX")
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ checkNepOtsiRdmNode(photNep4, pnep4Uuid, nodeId + "+PHOTONIC_MEDIA+SRG1-PP1-TXRX",
+ "PHOTONIC_MEDIANodeEdgePoint", false);
+ List<NodeRuleGroup> nrgList4 = node.nonnullNodeRuleGroup().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkNodeRuleGroupForRdm(nrgList4, 30);
+ break;
+ default:
+ fail();
+ break;
+ }
+ }
+
+ private void checkNepClient10G(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ Name name = nameList.get(0);
+ assertEquals("value of client nep should be '" + portName + "'",
+ portName, name.getValue());
+ assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
+ nepName, name.getValueName());
+ assertEquals("Client nep should support 3 kind of cep",
+ 3, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("client nep should support 3 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
+ assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, false);
+ }
+
+ private void checkNepNetworkODU4(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
+ boolean withSip) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ Name name = nameList.get(0);
+ assertEquals("value of network nep should be '" + portName + "'",
+ portName, name.getValue());
+ assertEquals("value-name of network nep for '" + portName + "' should be '" + nepName + "'",
+ nepName, name.getValueName());
+ assertEquals("Network nep should support 1 kind of cep",
+ 1, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("network nep should support 1 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItem(ODUTYPEODU4.class));
+ assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, withSip);
+ }
+
+ private void checkNodeRuleGroupForTpdrDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
+ Uuid nodeUuid) {
+ assertEquals("transponder DSR should contain 2 node rule group", 2, nrgList.size());
+ for (NodeRuleGroup nodeRuleGroup : nrgList) {
+ assertEquals("each node-rule-group should contain 2 NEP for transponder DSR",
+ 2, nodeRuleGroup.getNodeEdgePoint().size());
+ }
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
+ assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
+ assertThat("node-rule-group nb 1 should be between nep-client1 and nep-network1",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
+ assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
+ nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
+ assertEquals("node-rule-group nb 1 should be between nep-client1 and nep-network1 of the same node",
+ nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
+ List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
+ assertEquals("node-rule-group nb 1 should contain a single rule", 1, rule.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", rule.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, rule.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForMuxDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
+ Uuid nodeUuid) {
+ assertEquals("muxponder DSR should contain 4 node rule group", 4, nrgList.size());
+ for (NodeRuleGroup nodeRuleGroup : nrgList) {
+ assertEquals("each node-rule-group should contain 2 NEP for muxponder DSR",
+ 2, nodeRuleGroup.getNodeEdgePoint().size());
+ }
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).nonnullNodeEdgePoint().values());
+ assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
+ assertThat("node-rule-group nb 2 should be between nep-client4 and nep-network1",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(networkNepUuid.getValue())).or(containsString(clientNepUuid.getValue())));
+ assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
+ nodeEdgePointList.get(0).getNodeUuid(), nodeUuid);
+ assertEquals("node-rule-group nb 2 should be between nep-client4 and nep-network1 of the same node",
+ nodeEdgePointList.get(1).getNodeUuid(), nodeUuid);
+ List<Rule> rule = new ArrayList<>(nrgList.get(1).nonnullRule().values());
+ assertEquals("node-rule-group nb 2 should contain a single rule", 1, rule.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", rule.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, rule.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, rule.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForSwitchDSR(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid,
+ Uuid nodeUuid) {
+ assertEquals("Switch-DSR should contain a single node rule group", 1, nrgList.size());
+ assertEquals("Switch-DSR node-rule-group should contain 8 NEP", 8, nrgList.get(0).getNodeEdgePoint().size());
+ List<NodeEdgePoint> nrg = nrgList.get(0).nonnullNodeEdgePoint().values().stream()
+ .sorted((nrg1, nrg2) -> nrg1.getNodeEdgePointUuid().getValue()
+ .compareTo(nrg2.getNodeEdgePointUuid().getValue()))
+ .collect(Collectors.toList());
+ assertEquals("in the sorted node-rule-group, nep number 7 should be XPDR2-NETWORK1",
+ networkNepUuid, nrg.get(7).getNodeEdgePointUuid());
+ assertEquals("in the sorted node-rule-group, nep number 4 should be XPDR2-CLIENT4",
+ clientNepUuid, nrg.get(4).getNodeEdgePointUuid());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nrg.get(4).getNodeUuid());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nrg.get(3).getNodeUuid());
+ @Nullable
+ List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
+ assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", ruleList.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, ruleList.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForRdm(List<NodeRuleGroup> nrgList, int nbNeps) {
+ assertEquals("RDM infra node - OTSi should contain a single node rule groups", 1, nrgList.size());
+ if (nbNeps > 0) {
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
+ assertEquals("RDM infra node -rule-group should contain " + nbNeps + " NEP",
+ nbNeps, nodeEdgePointList.size());
+ } else {
+ assertNull("RDM infra node -rule-group should contain no NEP", nrgList.get(0).getNodeEdgePoint());
+ }
+ List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
+ assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", ruleList.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, ruleList.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForTpdrOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
+ Uuid nodeUuid) {
+ assertEquals("Tpdr-OTSi should contain two node rule groups", 2, nrgList.size());
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
+ assertEquals("Tpdr-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
+ assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ assertThat("Tpdr-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
+ List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
+ assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", ruleList.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, ruleList.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForMuxOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
+ Uuid nodeUuid) {
+ assertEquals("Mux-OTSi should contain a single node rule group", 1, nrgList.size());
+ List<NodeEdgePoint> nodeEdgePointList = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
+ assertEquals("Mux-OTSi node-rule-group should contain 2 NEP", 2, nodeEdgePointList.size());
+ assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ assertThat("Mux-OTSi node-rule-group should be between eNEP and iNEP of XPDR1-NETWORK1",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList.get(0).getNodeUuid());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList.get(1).getNodeUuid());
+ List<Rule> ruleList = new ArrayList<>(nrgList.get(0).nonnullRule().values());
+ assertEquals("node-rule-group should contain a single rule", 1, ruleList.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", ruleList.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, ruleList.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, ruleList.get(0).getRuleType());
+ }
+
+ private void checkNodeRuleGroupForSwitchOTSi(List<NodeRuleGroup> nrgList, Uuid enepUuid, Uuid inepUuid,
+ Uuid nodeUuid) {
+ assertEquals("Switch-OTSi should contain 4 node rule group", 4, nrgList.size());
+ for (NodeRuleGroup nodeRuleGroup : nrgList) {
+ assertEquals("each node-rule-group should contain 2 NEP for Switch-OTSi",
+ 2, nodeRuleGroup.getNodeEdgePoint().size());
+ }
+ List<NodeEdgePoint> nodeEdgePointList1 = new ArrayList<>(nrgList.get(3).nonnullNodeEdgePoint().values());
+ assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
+ nodeEdgePointList1.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ assertThat("Switch-OTSi node-rule-group nb 4 should be between eNEP and iNEP of XPDR2-NETWORK2",
+ nodeEdgePointList1.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(enepUuid.getValue())).or(containsString(inepUuid.getValue())));
+ List<NodeEdgePoint> nodeEdgePointList0 = new ArrayList<>(nrgList.get(0).getNodeEdgePoint().values());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList0.get(0).getNodeUuid());
+ assertEquals("any item of the node-rule-group should have the same nodeUuid",
+ nodeUuid, nodeEdgePointList0.get(1).getNodeUuid());
+ List<Rule> ruleList0 = new ArrayList<>(nrgList.get(0).nonnullRule().values());
+ assertEquals("node-rule-group should contain a single rule", 1, ruleList0.size());
+ assertEquals("local-id of the rule should be 'forward'",
+ "forward", ruleList0.get(0).getLocalId());
+ assertEquals("the forwarding rule should be 'MAYFORWARDACROSSGROUP'",
+ ForwardingRule.MAYFORWARDACROSSGROUP, ruleList0.get(0).getForwardingRule());
+ assertEquals("the rule type should be 'FORWARDING'",
+ RuleType.FORWARDING, ruleList0.get(0).getRuleType());
+ }
+
+ private void checkNepClient100GSwitch(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ assertEquals("value of client nep should be '" + portName + "'",
+ portName, nameList.get(0).getValue());
+ assertEquals("value-name of client nep for '" + portName + "' should be '" + nepName + "'",
+ nepName, nameList.get(0).getValueName());
+ assertEquals("Client nep should support 2 kind of cep",
+ 2, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("client nep should support 2 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
+ assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, false);
+ }
+
+ private void checkNepClient100GTpdr(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ assertEquals("value of client nep should be '" + portName + "'",
+ portName, nameList.get(0).getValue());
+ assertEquals("value-name of client nep for '" + portName + "' should be 100G-tpdr'",
+ nepName, nameList.get(0).getValueName());
+ assertEquals("Client nep should support 1 kind of cep",
+ 1, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("client nep should support 2 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItems(DIGITALSIGNALTYPE100GigE.class));
+ assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, false);
+ }
+
+ private void checkNepOtsiNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
+ boolean withSip) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ assertEquals("value of OTSi nep should be '" + portName + "'",
+ portName, nameList.get(0).getValue());
+ assertEquals("value-name of OTSi nep should be '" + nepName + "'",
+ nepName, nameList.get(0).getValueName());
+ assertEquals("OTSi nep should support 2 kind of cep",
+ 2, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("OTSi nep should support 2 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
+ assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
+ LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, withSip);
+ }
+
+ private void checkNepOtsiRdmNode(OwnedNodeEdgePoint nep, Uuid nepUuid, String portName, String nepName,
+ boolean withSip) {
+ assertEquals("bad uuid for " + portName, nepUuid, nep.getUuid());
+ List<Name> nameList = new ArrayList<>(nep.nonnullName().values());
+ assertEquals("value of OTSi nep should be '" + portName + "'",
+ portName, nameList.get(0).getValue());
+ assertEquals("value-name of OTSi nep should be '" + nepName + "'",
+ nepName, nameList.get(0).getValueName());
+ assertEquals("OTSi nep of RDM infra node should support only 1 kind of cep",
+ 1, nep.getSupportedCepLayerProtocolQualifier().size());
+ assertThat("OTSi nep should support 2 kind of cep",
+ nep.getSupportedCepLayerProtocolQualifier(),
+ hasItems(PHOTONICLAYERQUALIFIEROMS.class));
+ assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
+ LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
+ checkCommonPartOfNep(nep, withSip);
+ }
+
+ private void checkCommonPartOfNep(OwnedNodeEdgePoint nep, boolean withSip) {
+ assertEquals("link port direction should be DIRECTIONAL",
+ PortDirection.BIDIRECTIONAL, nep.getLinkPortDirection());
+ assertEquals("administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, nep.getAdministrativeState());
+ assertEquals("termination state should be TERMINATED BIDIRECTIONAL",
+ TerminationState.TERMINATEDBIDIRECTIONAL, nep.getTerminationState());
+ assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, nep.getLifecycleState());
+ if (withSip) {
+ assertEquals("Given nep should support 1 SIP", 1, nep.getMappedServiceInterfacePoint().size());
+ }
+ assertEquals("termination direction should be BIDIRECTIONAL",
+ TerminationDirection.BIDIRECTIONAL, nep.getTerminationDirection());
+ assertEquals("operational state of client nep should be ENABLED",
+ OperationalState.ENABLED, nep.getOperationalState());
+ assertEquals("link-port-role of client nep should be SYMMETRIC",
+ PortRole.SYMMETRIC, nep.getLinkPortRole());
+ }
+
+ private void checkTransitionalLink(org.opendaylight.yang.gen.v1
+ .urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
+ Uuid node1Uuid, Uuid node2Uuid, String tp1, String tp2, String ietfNodeId) {
+ Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((ietfNodeId + "--" + tp1 + "--" + tp2)
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
+ assertEquals("Available capacity unit should be GBPS",
+ CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());
+ assertEquals("Available capacity -total size value should be 100",
+ Uint64.valueOf(100), link.getAvailableCapacity().getTotalSize().getValue());
+ assertEquals("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
+ 2, link.getTransitionedLayerProtocolName().size());
+ assertThat("transitional link should be between 2 nodes of protocol layers ODU and PHOTONIC_MEDIA",
+ link.getTransitionedLayerProtocolName(),
+ hasItems(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()));
+ assertEquals("transitional link should be BIDIRECTIONAL",
+ ForwardingDirection.BIDIRECTIONAL, link.getDirection());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
+ .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
+ assertThat("transitional links should terminate on DSR node and Photonic node",
+ nodeEdgePointList.get(0).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("transitional links should terminate on DSR node and Photonic node",
+ nodeEdgePointList.get(1).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ Uuid nep1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1.getBytes(Charset.forName("UTF-8"))).toString());
+ Uuid nep2Uuid = new Uuid(UUID.nameUUIDFromBytes(tp2.getBytes(Charset.forName("UTF-8"))).toString());
+ assertThat("transitional links should terminate on " + tp1 + " and " + tp2 + " neps",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
+ assertThat("transitional links should terminate on DSR node and Photonic node",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(nep1Uuid.getValue())).or(containsString(nep2Uuid.getValue())));
+ }
+
+ private void checkOtnLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
+ Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
+ String linkName) {
+ assertEquals("bad name for the link", linkName, link.getName().get(
+ new NameKey("otn link name")).getValue());
+ assertEquals("bad uuid for link", linkUuid, link.getUuid());
+ assertEquals("Available capacity unit should be MBPS",
+ CapacityUnit.MBPS, link.getAvailableCapacity().getTotalSize().getUnit());
+ String prefix = linkName.split("-")[0];
+ if ("OTU4".equals(prefix)) {
+ assertEquals("Available capacity -total size value should be 0",
+ Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue());
+ } else if ("ODU4".equals(prefix)) {
+ assertEquals("Available capacity -total size value should be 100 000",
+ Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue());
+ }
+ assertEquals("Total capacity unit should be GBPS",
+ CapacityUnit.GBPS, link.getTotalPotentialCapacity().getTotalSize().getUnit());
+ assertEquals("Total capacity -total size value should be 100",
+ Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
+ if ("OTU4".equals(prefix)) {
+ assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
+ LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ } else if ("ODU4".equals(prefix)) {
+ assertEquals("otn link should be between 2 nodes of protocol layers ODU",
+ LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
+ }
+ assertEquals("otn tapi link should be BIDIRECTIONAL",
+ ForwardingDirection.BIDIRECTIONAL, link.getDirection());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
+ .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
+ assertThat("otn links should terminate on two distinct nodes",
+ nodeEdgePointList.get(0).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("otn links should terminate on two distinct nodes",
+ nodeEdgePointList.get(1).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("otn links should terminate on two distinct tps",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ assertThat("otn links should terminate on two distinct tps",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ assertEquals("operational state should be ENABLED",
+ OperationalState.ENABLED, link.getOperationalState());
+ assertEquals("administrative state should be UNLOCKED",
+ AdministrativeState.UNLOCKED, link.getAdministrativeState());
+ }
+
+ private void checkOmsLink(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
+ Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
+ String linkName) {
+ assertEquals("bad name for the link", linkName, link.getName().get(
+ new NameKey("OMS link name")).getValue());
+ assertEquals("bad uuid for link", linkUuid, link.getUuid());
+ assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
+ LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ assertEquals("otn tapi link should be BIDIRECTIONAL",
+ ForwardingDirection.BIDIRECTIONAL, link.getDirection());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
+ .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
+ assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
+ assertThat("oms links should terminate on two distinct nodes",
+ nodeEdgePointList.get(0).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct nodes",
+ nodeEdgePointList.get(1).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct tps",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct tps",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ }
+
+ private void checkXpdrRdmLink(org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.topology.rev181210.topology.Link link,
+ Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid, Uuid linkUuid,
+ String linkName) {
+ assertEquals("bad name for the link", linkName, link.getName().get(
+ new NameKey("XPDR-RDM link name")).getValue());
+ assertEquals("bad uuid for link", linkUuid, link.getUuid());
+ assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
+ LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ assertEquals("otn tapi link should be BIDIRECTIONAL",
+ ForwardingDirection.BIDIRECTIONAL, link.getDirection());
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
+ .link.NodeEdgePoint> nodeEdgePointList = new ArrayList<>(link.nonnullNodeEdgePoint().values());
+ assertEquals("oms link should be between 2 neps",2 , nodeEdgePointList.size());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(0).getTopologyUuid());
+ assertEquals("topology uuid should be the same for the two termination point of the link",
+ topologyUuid, nodeEdgePointList.get(1).getTopologyUuid());
+ assertThat("oms links should terminate on two distinct nodes",
+ nodeEdgePointList.get(0).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct nodes",
+ nodeEdgePointList.get(1).getNodeUuid().getValue(),
+ either(containsString(node1Uuid.getValue())).or(containsString(node2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct tps",
+ nodeEdgePointList.get(0).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ assertThat("oms links should terminate on two distinct tps",
+ nodeEdgePointList.get(1).getNodeEdgePointUuid().getValue(),
+ either(containsString(tp1Uuid.getValue())).or(containsString(tp2Uuid.getValue())));
+ }
+
+ private Node changeTerminationPointState(Node initialNode, String tpid, AdminStates admin, State oper) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder tpdr1Bldr
+ = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1Builder(
+ initialNode.augmentation(Node1.class));
+ Map<TerminationPointKey, TerminationPoint> tps = new HashMap<>(tpdr1Bldr.getTerminationPoint());
+ TerminationPointBuilder tpBldr = new TerminationPointBuilder(
+ tps.get(new TerminationPointKey(new TpId(tpid))));
+ tpBldr.addAugmentation(new TerminationPoint1Builder(tpBldr.augmentation(TerminationPoint1.class))
+ .setAdministrativeState(admin)
+ .setOperationalState(oper)
+ .build());
+ tps.replace(tpBldr.key(), tpBldr.build());
+ tpdr1Bldr.setTerminationPoint(tps);
+ return new NodeBuilder(initialNode).addAugmentation(tpdr1Bldr.build()).build();
+ }
+
+ private org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link changeOtnLinkState(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .Link initiallink, AdminStates admin, State oper) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .LinkBuilder linkBldr = new
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .LinkBuilder(initiallink);
+ linkBldr.addAugmentation(new Link1Builder(linkBldr.augmentation(Link1.class))
+ .setAdministrativeState(admin)
+ .setOperationalState(oper)
+ .build());
+ return linkBldr.build();
+ }
+}
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointDetailsOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointListInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointListOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.get.service._interface.point.list.output.Sip;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.get.service._interface.point.list.output.SipKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetLinkDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetLinkDetailsOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeDetailsOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeEdgePointDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeEdgePointDetailsOutput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetTopologyDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetTopologyDetailsOutput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Node;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.get.topology.details.output.Topology;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
@Nullable
Topology topology = rpcResult.getResult().getTopology();
assertNotNull("Topology should not be null", topology);
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.TPDR_100G.getBytes(Charset.forName("UTF-8")))
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.TPDR_100G.getBytes(StandardCharsets.UTF_8))
.toString());
assertEquals("incorrect topology uuid", topoUuid, topology.getUuid());
assertEquals("Node list size should be 1", 1, topology.getNode().size());
Name nodeName = topology.getNode().values().stream().findFirst().get().getName()
.get(new NameKey("Tpdr100g node name"));
assertEquals("Node name should be 'Tpdr100g over WDM node'", "Tpdr100g over WDM node", nodeName.getValue());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(nodeName.getValue().getBytes(Charset.forName("UTF-8")))
+ Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(nodeName.getValue().getBytes(StandardCharsets.UTF_8))
.toString());
assertEquals("incorrect node uuid", nodeUuid, topology.getNode().values().stream().findFirst().get().getUuid());
long nb = topology.getNode().values().stream().findFirst().get().getOwnedNodeEdgePoint().size();
@Test
public void getTopologyDetailsForOtnTopologyWithOtnLinksWhenSuccessful()
- throws ExecutionException, InterruptedException {
+ throws ExecutionException, InterruptedException {
GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(TopologyUtils.T0_MULTILAYER);
TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils);
ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
assertEquals("Link list should contain 8 transitional links", 8, nbOmsLinks);
assertEquals("Link list should contain 2 OTN links", 2, nbOtnLinks);
- Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8))
.toString());
- Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(Charset.forName("UTF-8")))
+ Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8))
.toString());
- Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8))
.toString());
- Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(Charset.forName("UTF-8")))
+ Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8))
.toString());
Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR+XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR+XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
Uuid link1Uuid =
new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
Uuid link2Uuid =
new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(StandardCharsets.UTF_8)).toString());
List<Link> links = topology.nonnullLink().values().stream()
.filter(l -> l.getName().containsKey(new NameKey("otn link name")))
"OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
}
+ @Test
+ public void getTopologyDetailsForFullTapiTopologyWithLinksWhenSuccessful()
+ throws ExecutionException, InterruptedException {
+ GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER);
+ TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils);
+ ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
+ @Nullable
+ Topology topology = rpcResult.getResult().getTopology();
+ assertNotNull("Topology should not be null", topology);
+ // 2 Nodes per Xpdr/Spdr node (DSR-ODU & PHOT) + 1 Node per Roadm
+ assertEquals("Node list size should be 18", 18, topology.getNode().size());
+ long nb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr"))))
+ .count();
+ // 2 client ports in configuration -> removed the checkTp so we have 2 NEPs
+ assertEquals("XPDR-A1-XPDR1+DSR should only have two client neps", 2, nb1);
+ long inb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals("XPDR-A1-XPDR1+DSR should only have two internal network neps", 2, inb1);
+ long enb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals("XPDR-A1-XPDR1+DSR should only have two external network neps", 2, enb1);
+ long nb2 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+DSR (mux) should have 4 client neps", 4, nb2);
+ long inb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+DSR (mux) should have a single internal network nep", 1, inb3);
+ long enb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+DSR (mux) should have a single external network nep", 1, enb3);
+ long nb4 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+DSR (switch) should have 4 client neps", 4, nb4);
+ long inb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+DSR (switch) should have 4 internal network neps", 4, inb5);
+ long enb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+DSR"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+DSR (switch) should have 4 external network neps", 4, enb5);
+
+ // Now lets check for the Photonic media nodes (same nodes as for DSR + 1 Roadm node)
+ nb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint"))))
+ .count();
+ // 2 client ports in configuration -> removed the checkTp so we have 2 NEPs
+ assertEquals("XPDR-A1-XPDR1+OTSi should only have two internal network neps", 2, nb1);
+ inb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
+ .count();
+ assertEquals("XPDR-A1-XPDR1+OTSi should only have two external network neps", 2, inb1);
+ enb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("XPDR-A1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("PhotMedNodeEdgePoint"))))
+ .count();
+ assertEquals("XPDR-A1-XPDR1+OTSi should only have two photonic network neps", 2, enb1);
+ nb2 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+OTSi (mux) should have a single internal network nep", 1, nb2);
+ inb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+OTSi (mux) should have a single external network nep", 1, inb3);
+ enb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR1+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("PhotMedNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR1+OTSi (mux) should have a single photonic network nep", 1, enb3);
+ nb4 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+OTSi (switch) should have 4 internal network neps", 4, nb4);
+ inb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+OTSi (switch) should have 4 external network neps", 4, inb5);
+ enb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals("SPDR-SA1-XPDR2+OTSi"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("PhotMedNodeEdgePoint"))))
+ .count();
+ assertEquals("SPDR-SA1-XPDR2+OTSi (switch) should have 4 photonic network neps", 4, enb5);
+ // We should have 3 neps per DEGREE-TTP port and 3 neps per SRG-PP port
+ long inb6 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals(
+ "ROADM-A1+PHOTONIC_MEDIA"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().values().stream().findFirst().get().getValue().contains("DEG")))
+ .count();
+ assertEquals("ROADM-A1+PHOTONIC_MEDIA (DEGREE) should have 6 network neps", 6, inb6);
+ long enb6 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .filter(node -> node.getName().values().stream().findFirst().get().getValue().equals(
+ "ROADM-A1+PHOTONIC_MEDIA"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().values().stream().findFirst().get().getValue().contains("SRG")))
+ .count();
+ assertEquals("ROADM-A1+PHOTONIC_MEDIA (SRG) should have 24 network neps", 24, enb6);
+
+ // Links in openroadm topology which include Roadm-to-Roadm and Xpdr-to-Roadm (ortopo / 2)
+ // + transitional links -> 1 per network port of Xpdr + OTN links / 2
+ assertEquals("Link list size should be 27", 27, topology.getLink().size());
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes("T0 - Full Multi-layer topology".getBytes()).toString());
+ assertEquals("incorrect topology uuid", topoUuid, topology.getUuid());
+ assertEquals("topology name should be T0 - Full Multi-layer topology",
+ "T0 - Full Multi-layer topology",
+ topology.nonnullName().values().stream().findFirst().get().getValue());
+
+ long nbDsrOduNodes = topology.nonnullNode().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("dsr/odu node name"))).count();
+ long nbPhotonicNodes = topology.nonnullNode().values().stream()
+ .filter(n -> n.getName().containsKey(new NameKey("otsi node name"))).count();
+ // In DSR/ODU we create one node per Xpdr (no filtering out)
+ assertEquals("Node list should contain 8 DSR-ODU nodes", 8, nbDsrOduNodes);
+ // We need to add the Roadms as Photonic nodes. Instead of 1 node as roadm infra we have 2 roadm nodes
+ assertEquals("Node list should contain 8 Photonics nodes", 8, nbPhotonicNodes);
+ long nbTransititionalLinks = topology.getLink().values().stream()
+ .filter(l -> l.getName().containsKey(new NameKey("transitional link name"))).count();
+ // Roadm-to-Roadm
+ long nbOmsLinks = topology.getLink().values().stream()
+ .filter(l -> l.getName().containsKey(new NameKey("OMS link name"))).count();
+ // Xpdr-to-Roadm
+ long nbOmsLinks1 = topology.getLink().values().stream()
+ .filter(l -> l.getName().containsKey(new NameKey("XPDR-RDM link name"))).count();
+ long nbOtnLinks = topology.getLink().values().stream()
+ .filter(l -> l.getName().containsKey(new NameKey("otn link name"))).count();
+ // 1 transitional link per NETWORK port
+ assertEquals("Link list should contain 16 transitional links", 16, nbTransititionalLinks);
+ // 1 OMS per ROADM-to-ROADM link + Existing XPDR-tp-ROADM link in openroadm topology
+ assertEquals("Link list should contain 9 OMS links", 9, nbOmsLinks + nbOmsLinks1);
+ // Should we consider OTN links as links or connections??
+ assertEquals("Link list should contain 2 OTN links", 2, nbOtnLinks);
+
+ Uuid node1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8))
+ .toString());
+ Uuid node2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+DSR".getBytes(StandardCharsets.UTF_8))
+ .toString());
+ Uuid node3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8))
+ .toString());
+ Uuid node4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+OTSi".getBytes(StandardCharsets.UTF_8))
+ .toString());
+ Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+eODU+XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ Uuid tp2Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+eODU+XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ Uuid tp3Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SA1-XPDR1+iOTSi+XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ Uuid link1Uuid =
+ new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ Uuid link2Uuid =
+ new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"
+ .getBytes(StandardCharsets.UTF_8)).toString());
+
+ List<Link> links = topology.nonnullLink().values().stream()
+ .filter(l -> l.getName().containsKey(new NameKey("otn link name")))
+ .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
+ .collect(Collectors.toList());
+ checkOtnLink(links.get(0), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid,
+ "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
+ checkOtnLink(links.get(1), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid,
+ "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1");
+ }
+
+ @Test
+ public void getNodeAndNepsDetailsWhenSuccessful()
+ throws ExecutionException, InterruptedException {
+ GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER);
+ TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils);
+ ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
+ @Nullable
+ Topology topology = rpcResult.getResult().getTopology();
+ for (Node node:topology.getNode().values()) {
+ String nodeName = node.getName().values().stream().findFirst().get().getValue();
+ GetNodeDetailsInput input1 = TapiTopologyDataUtils.buildGetNodeDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER, nodeName);
+ ListenableFuture<RpcResult<GetNodeDetailsOutput>> result1 = tapiTopoImpl.getNodeDetails(input1);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetNodeDetailsOutput> rpcResult1 = result1.get();
+ @Nullable
+ Node node1 = rpcResult1.getResult().getNode();
+ assertNotNull("Node should not be null", node1);
+ for (OwnedNodeEdgePoint onep:node1.getOwnedNodeEdgePoint().values()) {
+ String onepName = onep.getName().values().stream().findFirst().get().getValue();
+ GetNodeEdgePointDetailsInput input2 = TapiTopologyDataUtils.buildGetNodeEdgePointDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER, nodeName, onepName);
+ ListenableFuture<RpcResult<GetNodeEdgePointDetailsOutput>> result2
+ = tapiTopoImpl.getNodeEdgePointDetails(input2);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetNodeEdgePointDetailsOutput> rpcResult2 = result2.get();
+ org.opendaylight.yang.gen.v1
+ .urn.onf.otcc.yang.tapi.topology.rev181210.get.node.edge.point.details.output.NodeEdgePoint
+ onep1 = rpcResult2.getResult().getNodeEdgePoint();
+ assertNotNull("Node Edge Point should not be null", onep1);
+ }
+ }
+ }
+
+ @Test
+ public void getLinkDetailsWhenSuccessful()
+ throws ExecutionException, InterruptedException {
+ GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER);
+ TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils);
+ ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = tapiTopoImpl.getTopologyDetails(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
+ @Nullable
+ Topology topology = rpcResult.getResult().getTopology();
+ for (Link link:topology.getLink().values()) {
+ String linkName = link.getName().values().stream().findFirst().get().getValue();
+ GetLinkDetailsInput input1 = TapiTopologyDataUtils.buildGetLinkDetailsInput(
+ TopologyUtils.T0_FULL_MULTILAYER, linkName);
+ ListenableFuture<RpcResult<GetLinkDetailsOutput>> result1 = tapiTopoImpl.getLinkDetails(input1);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetLinkDetailsOutput> rpcResult1 = result1.get();
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.get.link.details.output.Link link1
+ = rpcResult1.getResult().getLink();
+ assertNotNull("Link should not be null", link1);
+ }
+ }
+
+ @Test
+ public void getSipDetailsWhenSuccessful()
+ throws ExecutionException, InterruptedException {
+ GetServiceInterfacePointListInput input = TapiTopologyDataUtils.buildServiceInterfacePointListInput();
+ TapiTopologyImpl tapiTopoImpl = new TapiTopologyImpl(getDataBroker(), tapiContext, topologyUtils);
+ ListenableFuture<RpcResult<GetServiceInterfacePointListOutput>> result = tapiTopoImpl
+ .getServiceInterfacePointList(input);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetServiceInterfacePointListOutput> rpcResult = result.get();
+ Map<SipKey, Sip> sipMap = rpcResult.getResult().getSip();
+ for (Sip sip:sipMap.values()) {
+ Uuid sipUuid = sip.getUuid();
+ GetServiceInterfacePointDetailsInput input1 = TapiTopologyDataUtils
+ .buildGetServiceInterfacePointDetailsInput(sipUuid);
+ ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>> result1
+ = tapiTopoImpl.getServiceInterfacePointDetails(input1);
+ result.addListener(new Runnable() {
+ @Override
+ public void run() {
+ endSignal.countDown();
+ }
+ }, executorService);
+ endSignal.await();
+ RpcResult<GetServiceInterfacePointDetailsOutput> rpcResult1 = result1.get();
+ org.opendaylight.yang.gen.v1
+ .urn.onf.otcc.yang.tapi.common.rev181210.get.service._interface.point.details.output.Sip sip1
+ = rpcResult1.getResult().getSip();
+ assertNotNull("Sip should not be null", sip1);
+ }
+ }
+
private void checkOtnLink(Link link, Uuid topoUuid, Uuid node1Uuid, Uuid node2Uuid, Uuid tp1Uuid, Uuid tp2Uuid,
- Uuid linkUuid, String linkName) {
+ Uuid linkUuid, String linkName) {
assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("otn link name")).getValue());
assertEquals("bad uuid for link", linkUuid, link.getUuid());
assertEquals("Available capacity unit should be MBPS",
--- /dev/null
+/*
+ * Copyright © 2021 Nokia, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.tapi.utils;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.RpcActions;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeaderBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirectionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirectionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.create.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.create.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.TotalSizeBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.local._class.Name;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.local._class.NameBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.ProtectionRole;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.ServiceType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.constraint.RequestedCapacityBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityService;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.Connection;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.ConnectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.ConnectionKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.end.point.ServiceInterfacePointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.ConnectivityConstraintBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.EndPoint;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.EndPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.EndPointKey;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+
+public final class TapiConnectivityDataUtils {
+ public static CreateConnectivityServiceInput buildConnServiceCreateInput() {
+
+ EndPoint endPoint1 = getEndPoint1Builder().build();
+ EndPoint endPoint2 = getEndPoint2Builder().build();
+ Map<EndPointKey, EndPoint> endPointMap = new HashMap<>();
+ endPointMap.put(endPoint1.key(), endPoint1);
+ endPointMap.put(endPoint2.key(), endPoint2);
+
+ return new CreateConnectivityServiceInputBuilder()
+ .setEndPoint(endPointMap)
+ .setConnectivityConstraint(new ConnectivityConstraintBuilder().setServiceLayer(LayerProtocolName.DSR)
+ .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).setServiceLevel("some service-level")
+ .setRequestedCapacity(new RequestedCapacityBuilder()
+ .setTotalSize(new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
+ .setValue(Uint64.valueOf(10)).build()).build()).build())
+ .setState("some state")
+ .build();
+ }
+
+ public static DeleteConnectivityServiceInput buildConnServiceDeleteInput() {
+ return new DeleteConnectivityServiceInputBuilder()
+ .setServiceIdOrName(UUID.nameUUIDFromBytes("service 1".getBytes(StandardCharsets.UTF_8)).toString())
+ .build();
+ }
+
+ private static EndPointBuilder getEndPoint2Builder() {
+ Name name = new NameBuilder().setValueName("OpenROADM node id").setValue("SPDR-SC1-XPDR1").build();
+ return new EndPointBuilder().setLayerProtocolName(LayerProtocolName.DSR)
+ .setAdministrativeState(AdministrativeState.UNLOCKED)
+ .setOperationalState(OperationalState.ENABLED)
+ .setDirection(PortDirection.BIDIRECTIONAL)
+ .setRole(PortRole.SYMMETRIC)
+ .setProtectionRole(ProtectionRole.NA)
+ .setLocalId("SPDR-SC1-XPDR1")
+ .setName(Map.of(name.key(), name))
+ .setServiceInterfacePoint(new ServiceInterfacePointBuilder().setServiceInterfacePointUuid(
+ new Uuid("25812ef2-625d-3bf8-af55-5e93946d1c22")).build());
+ }
+
+ private static EndPointBuilder getEndPoint1Builder() {
+ Name name = new NameBuilder().setValueName("OpenROADM node id").setValue("SPDR-SA1-XPDR1").build();
+ return new EndPointBuilder().setLayerProtocolName(LayerProtocolName.DSR)
+ .setAdministrativeState(AdministrativeState.UNLOCKED)
+ .setOperationalState(OperationalState.ENABLED)
+ .setDirection(PortDirection.BIDIRECTIONAL)
+ .setRole(PortRole.SYMMETRIC)
+ .setProtectionRole(ProtectionRole.NA)
+ .setLocalId("SPDR-SA1-XPDR1")
+ .setName(Map.of(name.key(), name))
+ .setServiceInterfacePoint(new ServiceInterfacePointBuilder().setServiceInterfacePointUuid(
+ new Uuid("c14797a0-adcc-3875-a1fe-df8949d1a2d7")).build());
+ }
+
+ public static ServiceCreateInput buildServiceCreateInput() {
+
+ return new ServiceCreateInputBuilder()
+ .setCommonId("commonId")
+ .setConnectionType(ConnectionType.Service)
+ .setCustomer("Customer")
+ .setServiceName(UUID.nameUUIDFromBytes("service 1".getBytes(StandardCharsets.UTF_8)).toString())
+ .setServiceAEnd(getServiceAEndBuild().build())
+ .setServiceZEnd(getServiceZEndBuild().build())
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
+ .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url").build())
+ .build();
+ }
+
+ public static ServiceAEndBuilder getServiceAEndBuild() {
+ return new ServiceAEndBuilder()
+ .setClli("NodeSA").setServiceFormat(ServiceFormat.Ethernet).setServiceRate(Uint32.valueOf(10))
+ .setNodeId(new NodeIdType("SPDR-SA1"))
+ .setTxDirection(getTxDirection())
+ .setRxDirection(getRxDirection());
+ }
+
+ public static ServiceZEndBuilder getServiceZEndBuild() {
+ return new ServiceZEndBuilder()
+ .setClli("NodeSC").setServiceFormat(ServiceFormat.Ethernet).setServiceRate(Uint32.valueOf(10))
+ .setNodeId(new NodeIdType("SPDR-SC1"))
+ .setTxDirection(getTxDirection())
+ .setRxDirection(getRxDirection());
+ }
+
+ private static TxDirection getTxDirection() {
+ return new TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
+ .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
+ .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
+ .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
+ .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
+ .build();
+ }
+
+ private static RxDirection getRxDirection() {
+ return new RxDirectionBuilder()
+ .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
+ .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
+ .setPortSubSlot("port subslot").setPortType("port type").build())
+ .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
+ .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
+ .setLgxPortShelf("lgx port shelf").build())
+ .build();
+ }
+
+ public static Map<ConnectivityServiceKey, ConnectivityService> createConnService() {
+ EndPoint endPoint1 = getEndPoint1Builder().build();
+ EndPoint endPoint2 = getEndPoint2Builder().build();
+
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPoint
+ endPoint11 = new org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPointBuilder(endPoint1).build();
+
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPoint
+ endPoint12 = new org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPointBuilder(endPoint2).build();
+
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPointKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPoint>
+ endPointMap = new HashMap<>();
+ endPointMap.put(endPoint11.key(), endPoint11);
+ endPointMap.put(endPoint12.key(), endPoint12);
+
+ Map<ConnectionKey, Connection> connectionMap = new HashMap<>();
+ Connection connection = new ConnectionBuilder().setConnectionUuid(new Uuid(UUID.randomUUID().toString()))
+ .build();
+ connectionMap.put(connection.key(), connection);
+
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name name =
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder()
+ .setValueName("Connectivity Service Name").setValue("service 1")
+ .build();
+ ConnectivityService connServ = new ConnectivityServiceBuilder()
+ .setAdministrativeState(AdministrativeState.LOCKED)
+ .setOperationalState(OperationalState.DISABLED)
+ .setLifecycleState(LifecycleState.PLANNED)
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes("service 1".getBytes(StandardCharsets.UTF_8)).toString()))
+ .setServiceLayer(LayerProtocolName.DSR)
+ .setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY)
+ .setConnectivityDirection(ForwardingDirection.BIDIRECTIONAL)
+ .setName(Map.of(name.key(), name))
+ .setConnection(connectionMap)
+ .setEndPoint(endPointMap)
+ .build();
+ Map<ConnectivityServiceKey, ConnectivityService> connMap = new HashMap<>();
+ connMap.put(connServ.key(), connServ);
+ return connMap;
+ }
+
+ public static DeleteConnectivityServiceInput buildConnServiceDeleteInput1() {
+ return new DeleteConnectivityServiceInputBuilder()
+ .setServiceIdOrName("random-service").build();
+ }
+
+ private TapiConnectivityDataUtils() {
+ }
+}
package org.opendaylight.transportpce.tapi.utils;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointDetailsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointListInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.GetServiceInterfacePointListInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetLinkDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetLinkDetailsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeDetailsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeEdgePointDetailsInput;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetNodeEdgePointDetailsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetTopologyDetailsInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.GetTopologyDetailsInputBuilder;
return builtInput.build();
}
- private TapiTopologyDataUtils() {
+ public static GetNodeDetailsInput buildGetNodeDetailsInput(String topoName, String nodeName) {
+ GetNodeDetailsInputBuilder builtInput = new GetNodeDetailsInputBuilder();
+ builtInput.setTopologyIdOrName(topoName);
+ builtInput.setNodeIdOrName(nodeName);
+ return builtInput.build();
+ }
+
+ public static GetLinkDetailsInput buildGetLinkDetailsInput(String topoName, String linkName) {
+ GetLinkDetailsInputBuilder builtInput = new GetLinkDetailsInputBuilder();
+ builtInput.setTopologyIdOrName(topoName);
+ builtInput.setLinkIdOrName(linkName);
+ return builtInput.build();
+ }
+
+ public static GetServiceInterfacePointListInput buildServiceInterfacePointListInput() {
+ return new GetServiceInterfacePointListInputBuilder().build();
}
+ public static GetServiceInterfacePointDetailsInput buildGetServiceInterfacePointDetailsInput(Uuid sipUuid) {
+ GetServiceInterfacePointDetailsInputBuilder builtInput = new GetServiceInterfacePointDetailsInputBuilder();
+ builtInput.setSipIdOrName(sipUuid.getValue());
+ return builtInput.build();
+ }
+
+ public static GetNodeEdgePointDetailsInput buildGetNodeEdgePointDetailsInput(String topoName,
+ String nodeName, String onepName) {
+ GetNodeEdgePointDetailsInputBuilder builtInput = new GetNodeEdgePointDetailsInputBuilder();
+ builtInput.setTopologyIdOrName(topoName);
+ builtInput.setNodeIdOrName(nodeName);
+ builtInput.setEpIdOrName(onepName);
+ return builtInput.build();
+ }
+
+ private TapiTopologyDataUtils() {
+ }
}
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.5</version>
+ <version>8.0.7</version>
<relativePath />
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.5</version>
+ <version>2.0.7</version>
<scope>import</scope>
<type>pom</type>
</dependency>
#!/bin/sh
+if [ "$USE_LIGHTY" = "True" ]; then
+ echo "USE_LIGHTY set to True - no need to build karaf"
+ exit
+fi
+
if [ -z "$USE_ODL_ALT_KARAF_INSTALL_DIR" ]; then
exit
fi
cd $(dirname $0)
-if [ -f ../"$USE_ODL_ALT_KARAF_INSTALL_DIR"/target/assembly/bin/karaf_ ]; then
+if [ -z "$USE_ODL_ALT_KARAF_ENV" ]; then
exit
fi
+. $USE_ODL_ALT_KARAF_ENV
. ./reflectwarn.sh
cd ../$USE_ODL_ALT_KARAF_INSTALL_DIR
mvn clean install -B -q -s ../tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true
--- /dev/null
+export USE_ODL_ALT_WEBSOCKET_PORT=8186
+export USE_ODL_ALT_AKKA_PORT=2551
+export USE_ODL_ALT_AKKA_MGT_PORT=8559
+export USE_ODL_ALT_SHELL_PORT=8102
+export USE_ODL_ALT_RMI_REGISTRY_PORT=1100
+export USE_ODL_ALT_RMI_SERVER_PORT=44445
+export USE_ODL_ALT_RESTCONF_PORT=8182
--- /dev/null
+export USE_ODL_ALT_WEBSOCKET_PORT=8187
+export USE_ODL_ALT_AKKA_PORT=2552
+export USE_ODL_ALT_AKKA_MGT_PORT=8560
+export USE_ODL_ALT_SHELL_PORT=8103
+export USE_ODL_ALT_RMI_REGISTRY_PORT=1101
+export USE_ODL_ALT_RMI_SERVER_PORT=44446
+export USE_ODL_ALT_RESTCONF_PORT=8183
--- /dev/null
+export USE_ODL_ALT_WEBSOCKET_PORT=8188
+export USE_ODL_ALT_AKKA_PORT=2553
+export USE_ODL_ALT_AKKA_MGT_PORT=8561
+export USE_ODL_ALT_SHELL_PORT=8104
+export USE_ODL_ALT_RMI_REGISTRY_PORT=1102
+export USE_ODL_ALT_RMI_SERVER_PORT=44447
+export USE_ODL_ALT_RESTCONF_PORT=8184
#!/bin/sh
-if [ "$USE_LIGHTY" != "True" ]; then
- ./build_karaf_for_tests.sh
+if [ -n "$USE_ODL_ALT_KARAF_ENV" ]; then
+ echo "using environment variables from $USE_ODL_ALT_KARAF_ENV"
+ . $USE_ODL_ALT_KARAF_ENV
fi
for arg in $@; do
sys.path.append('transportpce_tests/common/')
import test_utils
+
class TransportPCERendererTesting(unittest.TestCase):
processes = None
res['errors']['error'])
def test_17_service_path_delete_rdm_check(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP7-TXRX-DEG1-TTP-TXRX-713:720")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP7-TXRX-DEG1-TTP-TXRX-713:720")
self.assertEqual(response.status_code, requests.codes.conflict)
res = response.json()
self.assertIn(
"dest-tp": "SRG1-PP1-TXRX", "src-tp": "DEG2-TTP-TXRX"},
{"node-id": "XPDRC01",
"dest-tp": "XPDR1-CLIENT1", "src-tp": "XPDR1-NETWORK1"}],
- 196.1, 40, 196.075, 196.125, 761,
- 768)
+ 196.1, 40, 196.075, 196.125, 761,
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
"src-tp": "DEG1-TTP-TXRX", "dest-tp": "SRG1-PP1-TXRX"},
{"node-id": "XPDRA01",
"src-tp": "XPDR1-NETWORK1", "dest-tp": "XPDR1-CLIENT1"}],
- 196.1, 40, 196.075, 196.125, 761,
- 768)
+ 196.1, 40, 196.075, 196.125, 761,
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
self.assertEqual(1, res['org-openroadm-optical-channel-interfaces:och']['wavelength-number'])
def test_21_get_roadmconnection_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(-3.3, res['roadm-connections'][0]['target-output-power'])
def test_22_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADMC01", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMC01", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("power", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(1, res['org-openroadm-optical-channel-interfaces:och']['wavelength-number'])
def test_25_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
self.assertIn('Success', res["output"]["result"])
def test_27_get_roadmconnection_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(-60, res['roadm-connections'][0]['target-output-power'])
def test_28_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADMC01", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMC01", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
"dest-tp": "SRG1-PP1-TXRX", "src-tp": "DEG2-TTP-TXRX"},
{"node-id": "XPDRC01",
"dest-tp": "XPDR1-CLIENT1", "src-tp": "XPDR1-NETWORK1"}],
- 196.1, 40, 196.075, 196.125, 761,
- 768)
+ 196.1, 40, 196.075, 196.125, 761,
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
"src-tp": "DEG1-TTP-TXRX", "dest-tp": "SRG1-PP1-TXRX"},
{"node-id": "XPDRA01",
"src-tp": "XPDR1-NETWORK1", "dest-tp": "XPDR1-CLIENT1"}],
- 196.1, 40, 196.075, 196.125, 761,
- 768)
+ 196.1, 40, 196.075, 196.125, 761,
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
"dest-tp": "XPDR1-NETWORK2", "src-tp": "XPDR1-CLIENT2"},
{"node-id": "ROADMA01",
"dest-tp": "DEG1-TTP-TXRX", "src-tp": "SRG1-PP2-TXRX"}],
- 196.05, 40, 196.025, 196.075, 753,
- 760)
+ 196.05, 40, 196.025, 196.075, 753,
+ 760)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
"dest-tp": "XPDR1-NETWORK2", "src-tp": "XPDR1-CLIENT2"},
{"node-id": "ROADMA01",
"dest-tp": "DEG1-TTP-TXRX", "src-tp": "SRG1-PP2-TXRX"}],
- 196.1, 40, 196.075, 196.125, 761,
- 768)
+ 196.1, 40, 196.075, 196.125, 761,
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
sys.path.append('transportpce_tests/common/')
import test_utils
+
class TransportPCEFulltesting(unittest.TestCase):
cr_serv_sample_data = {"input": {
"sdnc-request-header": {
time.sleep(2)
def test_13_check_xc1_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(5)
def test_14_check_xc1_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
freq_map_array = [int(x) for x in freq_map]
self.assertEqual(freq_map_array[95], 0, "Lambda 1 should not be available")
if ele['tp-id'] == 'DEG2-TTP-TXRX':
- freq_map = base64.b64decode(
- ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
- freq_map_array = [int(x) for x in freq_map]
- self.assertEqual(freq_map_array[95], 0, "Lambda 1 should not be available")
+ freq_map = base64.b64decode(
+ ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
+ freq_map_array = [int(x) for x in freq_map]
+ self.assertEqual(freq_map_array[95], 0, "Lambda 1 should not be available")
time.sleep(3)
def test_18_connect_xprdA_N2_to_roadmA_PP2(self):
time.sleep(1)
def test_24_check_xc2_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP2-TXRX-753:760")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP2-TXRX-753:760")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(1)
def test_38_check_xc1_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(7)
def test_39_check_xc1_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADMC01", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(2)
def test_42_check_xc2_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADMA01", "roadm-connections/SRG1-PP2-TXRX-DEG1-TTP-TXRX-753:760")
+ response = test_utils.check_netconf_node_request(
+ "ROADMA01", "roadm-connections/SRG1-PP2-TXRX-DEG1-TTP-TXRX-753:760")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
if tpType == 'XPONDER-CLIENT':
client += 1
print("tpId = {}".format(tpId))
- print("tp= {}".format(res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]))
+ print("tp= {}".format(res['network'][0]['node'][i]
+ ['ietf-network-topology:termination-point'][j]))
nbIfCapType = len(res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]
- ['org-openroadm-otn-network-topology:tp-supported-interfaces']
- ['supported-interface-capability'][0])
+ ['org-openroadm-otn-network-topology:tp-supported-interfaces']
+ ['supported-interface-capability'][0])
for k in range(0, nbIfCapType):
self.assertIn((res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]
- ['org-openroadm-otn-network-topology:tp-supported-interfaces']
- ['supported-interface-capability'][0]['if-cap-type']),
- CHECK_LIST[nodeId]['port-types'])
+ ['org-openroadm-otn-network-topology:tp-supported-interfaces']
+ ['supported-interface-capability'][0]['if-cap-type']),
+ CHECK_LIST[nodeId]['port-types'])
elif tpType == 'XPONDER-NETWORK':
network += 1
self.assertEqual((res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]
res = response.json()
self.assertEqual(
{
- "mc-capabilities": [
- {
- "mc-node-name": "DEG1-TTP",
- "center-freq-granularity": 6.25,
- "slot-width-granularity": 12.5
- }
- ]
+ "mc-capabilities": [
+ {
+ "mc-node-name": "DEG1-TTP",
+ "center-freq-granularity": 6.25,
+ "slot-width-granularity": 12.5
+ }
+ ]
}, res)
time.sleep(3)
res = response.json()
self.assertEqual(
{
- "mc-capabilities": [
- {
- "mc-node-name": "DEG2-TTP",
- "center-freq-granularity": 6.25,
- "slot-width-granularity": 12.5
- }
- ]
+ "mc-capabilities": [
+ {
+ "mc-node-name": "DEG2-TTP",
+ "center-freq-granularity": 6.25,
+ "slot-width-granularity": 12.5
+ }
+ ]
}, res)
time.sleep(3)
res = response.json()
self.assertEqual(
{
- "mc-capabilities": [
- {
- "mc-node-name": "SRG1-PP",
- "center-freq-granularity": 6.25,
- "slot-width-granularity": 12.5
- }
- ]
+ "mc-capabilities": [
+ {
+ "mc-node-name": "SRG1-PP",
+ "center-freq-granularity": 6.25,
+ "slot-width-granularity": 12.5
+ }
+ ]
}, res)
time.sleep(3)
def test_07_device_renderer(self):
data = {
"transportpce-device-renderer:input": {
- "transportpce-device-renderer:modulation-format": "dp-qpsk",
- "transportpce-device-renderer:operation": "create",
- "transportpce-device-renderer:service-name": "testNMC-MC",
- "transportpce-device-renderer:wave-number": "0",
- "transportpce-device-renderer:center-freq": "196.05",
- "transportpce-device-renderer:width": "80",
- "transportpce-device-renderer:nodes": [
- {
- "transportpce-device-renderer:node-id": "ROADM-D1",
- "transportpce-device-renderer:src-tp": "SRG1-PP1-TXRX",
- "transportpce-device-renderer:dest-tp": "DEG1-TTP-TXRX"
- }
- ],
- "transportpce-device-renderer:min-freq": 196.00625,
- "transportpce-device-renderer:max-freq": 196.09375,
- "transportpce-device-renderer:lower-spectral-slot-number": 749,
- "transportpce-device-renderer:higher-spectral-slot-number": 763
- }
+ "transportpce-device-renderer:modulation-format": "dp-qpsk",
+ "transportpce-device-renderer:operation": "create",
+ "transportpce-device-renderer:service-name": "testNMC-MC",
+ "transportpce-device-renderer:wave-number": "0",
+ "transportpce-device-renderer:center-freq": "196.05",
+ "transportpce-device-renderer:width": "80",
+ "transportpce-device-renderer:nodes": [
+ {
+ "transportpce-device-renderer:node-id": "ROADM-D1",
+ "transportpce-device-renderer:src-tp": "SRG1-PP1-TXRX",
+ "transportpce-device-renderer:dest-tp": "DEG1-TTP-TXRX"
+ }
+ ],
+ "transportpce-device-renderer:min-freq": 196.00625,
+ "transportpce-device-renderer:max-freq": 196.09375,
+ "transportpce-device-renderer:lower-spectral-slot-number": 749,
+ "transportpce-device-renderer:higher-spectral-slot-number": 763
+ }
}
url = test_utils.RESTCONF_BASE_URL + \
- "/operations/transportpce-device-renderer:service-path"
+ "/operations/transportpce-device-renderer:service-path"
response = test_utils.post_request(url, data)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
"description": "TBD",
"supporting-port": "L1",
"type": "org-openroadm-interfaces:mediaChannelTrailTerminationPoint"},
- **res['interface'][0]),
+ **res['interface'][0]),
res['interface'][0])
# Check the mc-ttp max and min-freq
self.assertEqual({
- "min-freq": 196.00625,
- "max-freq": 196.09375
- },
+ "min-freq": 196.00625,
+ "max-freq": 196.09375
+ },
res['interface'][0]['org-openroadm-media-channel-interfaces:mc-ttp'])
time.sleep(3)
# Check the mc-ttp max and min-freq
self.assertEqual({
- "frequency": 196.05,
- "width": 80
+ "frequency": 196.05,
+ "width": 80
},
- res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
+ res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp'])
time.sleep(3)
# get SRG-NMC interface
# Create ROADM-connection
def test_11_roadm_connection(self):
response = test_utils.check_netconf_node_request("ROADM-D1",
- "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-749:763")
+ "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-749:763")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("SRG1-PP1-TXRX-DEG1-TTP-TXRX-749:763",
# delete ROADM connection
def test_12_delete_roadm_connection(self):
response = test_utils.delete_request(test_utils.URL_CONFIG_NETCONF_TOPO +
- "node/ROADM-D1/yang-ext:mount/" +
- "org-openroadm-device:org-openroadm-device/" +
- "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-749:763")
+ "node/ROADM-D1/yang-ext:mount/" +
+ "org-openroadm-device:org-openroadm-device/" +
+ "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-749:763")
self.assertEqual(response.status_code, requests.codes.ok)
time.sleep(3)
# Delete NMC SRG interface
def test_13_delete_srg_interface(self):
response = test_utils.delete_request(test_utils.URL_CONFIG_NETCONF_TOPO +
- "node/ROADM-D1/yang-ext:mount/" +
- "org-openroadm-device:org-openroadm-device/" +
- "interface/SRG1-PP1-TXRX-nmc-749:763")
+ "node/ROADM-D1/yang-ext:mount/" +
+ "org-openroadm-device:org-openroadm-device/" +
+ "interface/SRG1-PP1-TXRX-nmc-749:763")
self.assertEqual(response.status_code, requests.codes.ok)
time.sleep(3)
res['errors']['error'])
def test_10_service_path_create_rdm_check(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP3-TXRX-DEG1-TTP-TXRX-713:720")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP3-TXRX-DEG1-TTP-TXRX-713:720")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
{"node-id": "XPDR-C1",
"dest-tp": "XPDR1-CLIENT1", "src-tp": "XPDR1-NETWORK1"}],
196.1, 40, 196.075, 196.125, 761,
- 768)
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
{"node-id": "XPDR-A1",
"src-tp": "XPDR1-NETWORK1", "dest-tp": "XPDR1-CLIENT1"}],
196.1, 40, 196.075, 196.125, 761,
- 768)
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
self.assertEqual(196.1, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
def test_21_get_roadmconnection_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(2.0, res['roadm-connections'][0]['target-output-power'])
def test_22_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADM-C1", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP1-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-C1", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP1-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("power", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(196.1, res['org-openroadm-optical-channel-interfaces:och']['frequency'])
def test_25_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("gainLoss", res['roadm-connections'][0]['opticalControlMode'])
self.assertIn('Success', res["output"]["result"])
def test_27_get_roadmconnection_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
self.assertEqual(-60, res['roadm-connections'][0]['target-output-power'])
def test_28_get_roadmconnection_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADM-C1", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP1-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-C1", "roadm-connections/DEG1-TTP-TXRX-SRG1-PP1-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual("off", res['roadm-connections'][0]['opticalControlMode'])
{"node-id": "XPDR-C1",
"dest-tp": "XPDR1-CLIENT1", "src-tp": "XPDR1-NETWORK1"}],
196.1, 40, 196.075, 196.125, 761,
- 768)
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
{"node-id": "XPDR-A1",
"src-tp": "XPDR1-NETWORK1", "dest-tp": "XPDR1-CLIENT1"}],
196.053125, 40, 196.025, 196.08125, 761,
- 768)
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
{"node-id": "ROADM-A1",
"dest-tp": "DEG2-TTP-TXRX", "src-tp": "SRG1-PP2-TXRX"}],
196.1, 40, 196.075, 196.125, 753,
- 760)
+ 760)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
{"node-id": "ROADM-A1",
"dest-tp": "DEG2-TTP-TXRX", "src-tp": "SRG1-PP2-TXRX"}],
196.053125, 40, 196.025, 196.08125, 761,
- 768)
+ 768)
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Request processed', res["output"]["result"])
CREATED_SUCCESSFULLY = 'Result message should contain Xponder Roadm Link created successfully'
+
class TransportTapitesting(unittest.TestCase):
processes = None
self.assertEqual("Tpdr100g over WDM node", res["output"]["topology"]["node"][0]["name"][0]["value"],
'node name should be: Tpdr100g over WDM node')
self.assertIn("ETH", res["output"]["topology"]["node"][0]["layer-protocol-name"],
- 'Node layer protocol should contain ETH')
+ 'Node layer protocol should contain ETH')
self.assertEqual(1, len(res["output"]["topology"]["node"][0]["node-rule-group"]),
'node should contain 1 node rule group')
self.assertEqual("ROADM-infra", res["output"]["topology"]["node"][0]["name"][0]["value"],
'node name should be: ROADM-infra')
self.assertIn("PHOTONIC_MEDIA", res["output"]["topology"]["node"][0]["layer-protocol-name"],
- 'Node layer protocol should contain PHOTONIC_MEDIA')
+ 'Node layer protocol should contain PHOTONIC_MEDIA')
self.assertEqual(1, len(res["output"]["topology"]["node"][0]["node-rule-group"]),
'node should contain 1 node rule group')
for link in links:
if link["name"][0]["value"] == "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1":
self.assertEqual(100000, link["available-capacity"]["total-size"]["value"],
- 'OTU4 link should have an available capacity of 100 000 Mbps')
+ 'OTU4 link should have an available capacity of 100 000 Mbps')
elif link["name"][0]["value-name"] == "transitional link name":
self.assertEqual(100, link["available-capacity"]["total-size"]["value"],
- 'link should have an available capacity of 100 Gbps')
+ 'link should have an available capacity of 100 Gbps')
self.assertEqual(2, len(link["node-edge-point"]), 'link should have 2 neps')
def test_33_create_ODU4_service(self):
for link in links:
if link["name"][0]["value"] == "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1":
self.assertEqual(0, link["available-capacity"]["total-size"]["value"],
- 'OTU4 link should have an available capacity of 0 Mbps')
+ 'OTU4 link should have an available capacity of 0 Mbps')
elif link["name"][0]["value"] == "ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1":
self.assertEqual(100000, link["available-capacity"]["total-size"]["value"],
- 'ODU4 link should have an available capacity of 100 000 Mbps')
+ 'ODU4 link should have an available capacity of 100 000 Mbps')
elif link["name"][0]["value-name"] == "transitional link name":
self.assertEqual(100, link["available-capacity"]["total-size"]["value"],
- 'link should have an available capacity of 100 Gbps')
+ 'link should have an available capacity of 100 Gbps')
self.assertEqual(2, len(link["node-edge-point"]), 'link should have 2 neps')
def test_35_connect_sprda_2_n2_to_roadma_pp3(self):
links = res['network'][0]['ietf-network-topology:link']
for link in links:
if (link["org-openroadm-common-network:link-type"] == "XPONDER-OUTPUT" or
- link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT"):
- link_name = link["link-id"]
- response = test_utils.delete_request(url+link_name)
- self.assertEqual(response.status_code, requests.codes.ok)
+ link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT"):
+ link_name = link["link-id"]
+ response = test_utils.delete_request(url+link_name)
+ self.assertEqual(response.status_code, requests.codes.ok)
def test_42_check_tapi_topology_T0(self):
url = "{}/operations/tapi-topology:get-topology-details"
return dict_
return None
+
def count_object_with_double_key(list_dicts, key1, key2, value):
nb = 0
for dict in list_dicts:
if __name__ == "__main__":
- unittest.main(verbosity=2)
\ No newline at end of file
+ unittest.main(verbosity=2)
# pylint: disable=no-member
# pylint: disable=too-many-public-methods
+
import base64
import unittest
import time
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportPCEFulltesting(unittest.TestCase):
processes = None
time.sleep(2)
def test_13_check_xc1_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(5)
def test_14_check_xc1_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
freq_map_array = [int(x) for x in freq_map]
self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
if ele['tp-id'] == 'DEG2-TTP-TXRX':
- freq_map = base64.b64decode(
- ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
- freq_map_array = [int(x) for x in freq_map]
- self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
+ freq_map = base64.b64decode(
+ ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
+ freq_map_array = [int(x) for x in freq_map]
+ self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
time.sleep(3)
def test_18_connect_xprdA_N2_to_roadmA_PP2(self):
time.sleep(1)
def test_24_check_xc2_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP2-TXRX-753:760")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/DEG2-TTP-TXRX-SRG1-PP2-TXRX-753:760")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(1)
def test_38_check_xc1_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(7)
def test_39_check_xc1_ROADMC(self):
- response = test_utils.check_netconf_node_request("ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-C1", "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
time.sleep(2)
def test_42_check_xc2_ROADMA(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP2-TXRX-DEG2-TTP-TXRX-753:760")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP2-TXRX-DEG2-TTP-TXRX-753:760")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
--- /dev/null
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2021 Orange, Inc. and others. All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# pylint: disable=no-member
+# pylint: disable=too-many-public-methods
+
+import os
+import unittest
+import time
+import requests
+import sys
+sys.path.append('transportpce_tests/common/')
+import test_utils
+
+
+class TransportPCEtesting(unittest.TestCase):
+
+ processes = None
+ WAITING = 20 # nominal value is 300
+ NODE_VERSION = '2.2.1'
+
+ cr_serv_sample_data = {
+ "input": {
+ "end-point": [
+ {
+ "layer-protocol-name": "PHOTONIC_MEDIA",
+ "service-interface-point": {
+ "service-interface-point-uuid": "b1a0d883-32b8-3b0b-93d6-7ed074f6f107"
+ },
+ "administrative-state": "UNLOCKED",
+ "operational-state": "ENABLED",
+ "direction": "BIDIRECTIONAL",
+ "role": "SYMMETRIC",
+ "protection-role": "WORK",
+ "local-id": "SPDR-SA1-XPDR1",
+ "name": [
+ {
+ "value-name": "OpenROADM node id",
+ "value": "SPDR-SA1-XPDR1"
+ }
+ ]
+ },
+ {
+ "layer-protocol-name": "PHOTONIC_MEDIA",
+ "service-interface-point": {
+ "service-interface-point-uuid": "d1d6305e-179b-346f-b02d-8260aebe1ce8"
+ },
+ "administrative-state": "UNLOCKED",
+ "operational-state": "ENABLED",
+ "direction": "BIDIRECTIONAL",
+ "role": "SYMMETRIC",
+ "protection-role": "WORK",
+ "local-id": "SPDR-SC1-XPDR1",
+ "name": [
+ {
+ "value-name": "OpenROADM node id",
+ "value": "SPDR-SC1-XPDR1"
+ }
+ ]
+ }
+ ],
+ "connectivity-constraint": {
+ "service-layer": "PHOTONIC_MEDIA",
+ "service-type": "POINT_TO_POINT_CONNECTIVITY",
+ "service-level": "Some service-level",
+ "requested-capacity": {
+ "total-size": {
+ "value": "100",
+ "unit": "GB"
+ }
+ }
+ },
+ "state": "Some state"}}
+
+ @classmethod
+ def setUpClass(cls):
+ cls.init_failed = False
+ os.environ['JAVA_MIN_MEM'] = '1024M'
+ os.environ['JAVA_MAX_MEM'] = '4096M'
+ cls.processes = test_utils.start_tpce()
+ # TAPI feature is not installed by default in Karaf
+ if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True':
+ print("installing tapi feature...")
+ result = test_utils.install_karaf_feature("odl-transportpce-tapi")
+ if result.returncode != 0:
+ cls.init_failed = True
+ print("Restarting OpenDaylight...")
+ test_utils.shutdown_process(cls.processes[0])
+ cls.processes[0] = test_utils.start_karaf()
+ test_utils.process_list[0] = cls.processes[0]
+ cls.init_failed = not test_utils.wait_until_log_contains(
+ test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60)
+ if cls.init_failed:
+ print("tapi installation feature failed...")
+ test_utils.shutdown_process(cls.processes[0])
+ sys.exit(2)
+ cls.processes = test_utils.start_sims([('spdra', cls.NODE_VERSION),
+ ('roadma', cls.NODE_VERSION),
+ ('roadmc', cls.NODE_VERSION),
+ ('spdrc', cls.NODE_VERSION)])
+
+ @classmethod
+ def tearDownClass(cls):
+ # pylint: disable=not-an-iterable
+ for process in cls.processes:
+ test_utils.shutdown_process(process)
+ print("all processes killed")
+
+ def setUp(self):
+ time.sleep(5)
+
+ def test_01_connect_spdrA(self):
+ response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION))
+ self.assertEqual(response.status_code,
+ requests.codes.created, test_utils.CODE_SHOULD_BE_201)
+
+ def test_02_connect_spdrC(self):
+ response = test_utils.mount_device("SPDR-SC1", ('spdrc', self.NODE_VERSION))
+ self.assertEqual(response.status_code,
+ requests.codes.created, test_utils.CODE_SHOULD_BE_201)
+
+ def test_03_connect_rdmA(self):
+ response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION))
+ self.assertEqual(response.status_code,
+ requests.codes.created, test_utils.CODE_SHOULD_BE_201)
+
+ def test_04_connect_rdmC(self):
+ response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION))
+ self.assertEqual(response.status_code,
+ requests.codes.created, test_utils.CODE_SHOULD_BE_201)
+
+ def test_05_connect_sprdA_1_N1_to_roadmA_PP1(self):
+ response = test_utils.connect_xpdr_to_rdm_request("SPDR-SA1", "1", "1",
+ "ROADM-A1", "1", "SRG1-PP1-TXRX")
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Xponder Roadm Link created successfully',
+ res["output"]["result"])
+ time.sleep(2)
+
+ def test_06_connect_roadmA_PP1_to_spdrA_1_N1(self):
+ response = test_utils.connect_rdm_to_xpdr_request("SPDR-SA1", "1", "1",
+ "ROADM-A1", "1", "SRG1-PP1-TXRX")
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Roadm Xponder links created successfully',
+ res["output"]["result"])
+ time.sleep(2)
+
+ def test_07_connect_sprdC_1_N1_to_roadmC_PP1(self):
+ response = test_utils.connect_xpdr_to_rdm_request("SPDR-SC1", "1", "1",
+ "ROADM-C1", "1", "SRG1-PP1-TXRX")
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Xponder Roadm Link created successfully',
+ res["output"]["result"])
+ time.sleep(2)
+
+ def test_08_connect_roadmC_PP1_to_spdrC_1_N1(self):
+ response = test_utils.connect_rdm_to_xpdr_request("SPDR-SC1", "1", "1",
+ "ROADM-C1", "1", "SRG1-PP1-TXRX")
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertIn('Roadm Xponder links created successfully',
+ res["output"]["result"])
+ time.sleep(2)
+
+ def test_09_add_omsAttributes_ROADMA_ROADMC(self):
+ # Config ROADMA-ROADMC oms-attributes
+ data = {"span": {
+ "auto-spanloss": "true",
+ "spanloss-base": 11.4,
+ "spanloss-current": 12,
+ "engineered-spanloss": 12.2,
+ "link-concatenation": [{
+ "SRLG-Id": 0,
+ "fiber-type": "smf",
+ "SRLG-length": 100000,
+ "pmd": 0.5}]}}
+ response = test_utils.add_oms_attr_request(
+ "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data)
+ self.assertEqual(response.status_code, requests.codes.created)
+ time.sleep(2)
+
+ def test_10_add_omsAttributes_ROADMC_ROADMA(self):
+ # Config ROADMC-ROADMA oms-attributes
+ data = {"span": {
+ "auto-spanloss": "true",
+ "spanloss-base": 11.4,
+ "spanloss-current": 12,
+ "engineered-spanloss": 12.2,
+ "link-concatenation": [{
+ "SRLG-Id": 0,
+ "fiber-type": "smf",
+ "SRLG-length": 100000,
+ "pmd": 0.5}]}}
+ response = test_utils.add_oms_attr_request(
+ "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data)
+ self.assertEqual(response.status_code, requests.codes.created)
+ time.sleep(2)
+
+ def test_11_check_otn_topology(self):
+ response = test_utils.get_otn_topo_request()
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ nbNode = len(res['network'][0]['node'])
+ self.assertEqual(nbNode, 6, 'There should be 6 otn nodes')
+ self.assertNotIn('ietf-network-topology:link', res['network'][0])
+ time.sleep(2)
+
+ def test_12_check_openroadm_topology(self):
+ response = test_utils.get_ordm_topo_request("")
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ nbNode = len(res['network'][0]['node'])
+ nbLink = len(res['network'][0]['ietf-network-topology:link'])
+ self.assertEqual(nbNode, 13, 'There should be 13 openroadm nodes')
+ self.assertEqual(nbLink, 22, 'There should be 22 openroadm links')
+ time.sleep(2)
+
+ def test_13_get_tapi_topology_details(self):
+ response = test_utils.tapi_get_topology_details_request(
+ "T0 - Full Multi-layer topology")
+ time.sleep(2)
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ nbNode = len(res['output']['topology']['node'])
+ nbLink = len(res['output']['topology']['link'])
+ self.assertEqual(nbNode, 14, 'There should be 14 TAPI nodes')
+ self.assertEqual(nbLink, 13, 'There should be 13 TAPI links')
+ time.sleep(2)
+
+ def test_14_check_sip_details(self):
+ response = test_utils.tapi_get_sip_details_request()
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ nbSip = len(res['output']['sip'])
+ self.assertEqual(nbSip, 60, 'There should be 60 service interface point')
+ time.sleep(2)
+
+# test create connectivity service from spdrA to spdrC for Photonic_media
+ def test_15_create_connectivity_service_PhotonicMedia(self):
+ response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data)
+ time.sleep(self.WAITING)
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ global service_pm_uuid
+ service_pm_uuid = res['output']['service']['uuid']
+ print("photonic media service uuid : {}".format(res['output']['service']['uuid']))
+
+ input_dict_1 = {'administrative-state': 'LOCKED',
+ 'lifecycle-state': 'PLANNED',
+ 'operational-state': 'DISABLED',
+ 'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+ 'service-layer': 'PHOTONIC_MEDIA',
+ 'connectivity-direction': 'BIDIRECTIONAL'
+ }
+ input_dict_2 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SC1-XPDR1'}
+ input_dict_3 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SA1-XPDR1'}
+
+ self.assertDictEqual(dict(input_dict_1, **res['output']['service']),
+ res['output']['service'])
+ self.assertDictEqual(dict(input_dict_2, **res['output']['service']['end-point'][0]['name'][0]),
+ res['output']['service']['end-point'][0]['name'][0])
+ self.assertDictEqual(dict(input_dict_3, **res['output']['service']['end-point'][1]['name'][0]),
+ res['output']['service']['end-point'][1]['name'][0])
+ time.sleep(self.WAITING)
+
+ def test_16_get_service_PhotonicMedia(self):
+ response = test_utils.get_service_list_request(
+ "services/"+ str(service_pm_uuid))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['administrative-state'], 'inService')
+ self.assertEqual(
+ res['services'][0]['service-name'], service_pm_uuid)
+ self.assertEqual(
+ res['services'][0]['connection-type'], 'infrastructure')
+ self.assertEqual(
+ res['services'][0]['lifecycle-state'], 'planned')
+ time.sleep(2)
+
+# test create connectivity service from spdrA to spdrC for odu
+ def test_17_create_connectivity_service_ODU(self):
+ self.cr_serv_sample_data["input"]["end-point"][0]["layer-protocol-name"] = "ODU"
+ self.cr_serv_sample_data["input"]["end-point"][0]["service-interface-point"]["service-interface-point-uuid"] = "eecbfa6e-57ab-3651-9606-c22c8ce73f18"
+ self.cr_serv_sample_data["input"]["end-point"][1]["layer-protocol-name"] = "ODU"
+ self.cr_serv_sample_data["input"]["end-point"][1]["service-interface-point"]["service-interface-point-uuid"] = "31f83b1f-29b2-3a8e-af9b-6423dbc5aa22"
+ self.cr_serv_sample_data["input"]["connectivity-constraint"]["service-layer"] = "ODU"
+
+ response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data)
+ time.sleep(self.WAITING)
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ global service_odu_uuid
+ service_odu_uuid = res['output']['service']['uuid']
+ print("odu service uuid : {}".format(res['output']['service']['uuid']))
+
+ input_dict_1 = {'administrative-state': 'LOCKED',
+ 'lifecycle-state': 'PLANNED',
+ 'operational-state': 'DISABLED',
+ 'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+ 'service-layer': 'ODU',
+ 'connectivity-direction': 'BIDIRECTIONAL'
+ }
+ input_dict_2 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SC1-XPDR1'}
+ input_dict_3 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SA1-XPDR1'}
+
+ self.assertDictEqual(dict(input_dict_1, **res['output']['service']),
+ res['output']['service'])
+ self.assertDictEqual(dict(input_dict_2, **res['output']['service']['end-point'][0]['name'][0]),
+ res['output']['service']['end-point'][0]['name'][0])
+ self.assertDictEqual(dict(input_dict_3, **res['output']['service']['end-point'][1]['name'][0]),
+ res['output']['service']['end-point'][1]['name'][0])
+ time.sleep(self.WAITING)
+
+ def test_18_get_service_ODU(self):
+ response = test_utils.get_service_list_request(
+ "services/"+ str(service_odu_uuid))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['administrative-state'], 'inService')
+ self.assertEqual(
+ res['services'][0]['service-name'], service_odu_uuid)
+ self.assertEqual(
+ res['services'][0]['connection-type'], 'infrastructure')
+ self.assertEqual(
+ res['services'][0]['lifecycle-state'], 'planned')
+ time.sleep(2)
+
+# test create connectivity service from spdrA to spdrC for dsr
+ def test_19_create_connectivity_service_DSR(self):
+ self.cr_serv_sample_data["input"]["end-point"][0]["layer-protocol-name"] = "DSR"
+ self.cr_serv_sample_data["input"]["end-point"][0]["service-interface-point"]["service-interface-point-uuid"] = "c14797a0-adcc-3875-a1fe-df8949d1a2d7"
+ self.cr_serv_sample_data["input"]["end-point"][1]["layer-protocol-name"] = "DSR"
+ self.cr_serv_sample_data["input"]["end-point"][1]["service-interface-point"]["service-interface-point-uuid"] = "25812ef2-625d-3bf8-af55-5e93946d1c22"
+ self.cr_serv_sample_data["input"]["connectivity-constraint"]["service-layer"] = "DSR"
+ self.cr_serv_sample_data["input"]["connectivity-constraint"]["requested-capacity"]["total-size"]["value"] = "10"
+
+ response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data)
+ time.sleep(self.WAITING)
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ global service_dsr_uuid
+ service_dsr_uuid = res['output']['service']['uuid']
+ print("dsr service uuid : {}".format(res['output']['service']['uuid']))
+
+ input_dict_1 = {'administrative-state': 'LOCKED',
+ 'lifecycle-state': 'PLANNED',
+ 'operational-state': 'DISABLED',
+ 'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+ 'service-layer': 'DSR',
+ 'connectivity-direction': 'BIDIRECTIONAL'
+ }
+ input_dict_2 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SC1-XPDR1'}
+ input_dict_3 = {'value-name': 'OpenROADM node id',
+ 'value': 'SPDR-SA1-XPDR1'}
+
+ self.assertDictEqual(dict(input_dict_1,
+ **res['output']['service']),
+ res['output']['service'])
+ self.assertDictEqual(dict(input_dict_2,
+ **res['output']['service']['end-point'][0]['name'][0]),
+ res['output']['service']['end-point'][0]['name'][0])
+ self.assertDictEqual(dict(input_dict_3,
+ **res['output']['service']['end-point'][1]['name'][0]),
+ res['output']['service']['end-point'][1]['name'][0])
+ time.sleep(self.WAITING)
+
+ def test_20_get_service_DSR(self):
+ response = test_utils.get_service_list_request(
+ "services/"+ str(service_dsr_uuid))
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ self.assertEqual(
+ res['services'][0]['administrative-state'], 'inService')
+ self.assertEqual(
+ res['services'][0]['service-name'], service_dsr_uuid)
+ self.assertEqual(
+ res['services'][0]['connection-type'], 'service')
+ self.assertEqual(
+ res['services'][0]['lifecycle-state'], 'planned')
+ time.sleep(2)
+
+ def test_21_get_connectivity_service_list(self):
+ response = test_utils.tapi_get_service_list_request()
+ self.assertEqual(response.status_code, requests.codes.ok)
+ res = response.json()
+ liste_service = res['output']['service']
+ for ele in liste_service:
+ if ele['uuid'] == service_pm_uuid:
+ self.assertEqual(ele['operational-state'], 'ENABLED')
+ self.assertEqual(ele['service-layer'], 'PHOTONIC_MEDIA')
+ nbconnection = len(ele['connection'])
+ self.assertEqual(nbconnection, 9, 'There should be 9 connections')
+ elif ele['uuid'] == service_odu_uuid:
+ self.assertEqual(ele['operational-state'], 'ENABLED')
+ self.assertEqual(ele['service-layer'], 'ODU')
+ nbconnection = len(ele['connection'])
+ self.assertEqual(nbconnection, 3, 'There should be 3 connections')
+ elif ele['uuid'] == service_dsr_uuid:
+ self.assertEqual(ele['operational-state'], 'ENABLED')
+ self.assertEqual(ele['service-layer'], 'DSR')
+ nbconnection = len(ele['connection'])
+ self.assertEqual(nbconnection, 1, 'There should be 1 connection')
+ else:
+ self.fail("get connectivity service failed")
+ time.sleep(2)
+
+ def test_22_delete_connectivity_service_DSR(self):
+ response = test_utils.tapi_delete_connectivity_request(service_dsr_uuid)
+ self.assertEqual(response.status_code, requests.codes.no_content)
+ time.sleep(self.WAITING)
+
+ def test_23_delete_connectivity_service_ODU(self):
+ response = test_utils.tapi_delete_connectivity_request(service_odu_uuid)
+ self.assertEqual(response.status_code, requests.codes.no_content)
+ time.sleep(self.WAITING)
+
+ def test_24_delete_connectivity_service_PhotonicMedia(self):
+ response = test_utils.tapi_delete_connectivity_request(service_pm_uuid)
+ self.assertEqual(response.status_code, requests.codes.no_content)
+ time.sleep(self.WAITING)
+
+ def test_25_get_no_tapi_services(self):
+ response = test_utils.tapi_get_service_list_request()
+ res = response.json()
+ self.assertIn(
+ {"error-type": "rpc", "error-tag": "operation-failed",
+ "error-message": "No services exist in datastore",
+ "error-info": "<severity>error</severity>"},
+ res['errors']['error'])
+ time.sleep(2)
+
+ def test_26_get_no_openroadm_services(self):
+ response = test_utils.get_service_list_request("")
+ self.assertEqual(response.status_code, requests.codes.conflict)
+ res = response.json()
+ self.assertIn(
+ {"error-type": "application", "error-tag": "data-missing",
+ "error-message": "Request could not be completed because the relevant data model content does not exist"},
+ res['errors']['error'])
+ time.sleep(2)
+
+ def test_27_disconnect_spdrA(self):
+ response = test_utils.unmount_device("SPDR-SA1")
+ self.assertEqual(response.status_code, requests.codes.ok,
+ test_utils.CODE_SHOULD_BE_200)
+
+ def test_28_disconnect_spdrC(self):
+ response = test_utils.unmount_device("SPDR-SC1")
+ self.assertEqual(response.status_code, requests.codes.ok,
+ test_utils.CODE_SHOULD_BE_200)
+
+ def test_29_disconnect_roadmA(self):
+ response = test_utils.unmount_device("ROADM-A1")
+ self.assertEqual(response.status_code, requests.codes.ok,
+ test_utils.CODE_SHOULD_BE_200)
+
+ def test_30_disconnect_roadmC(self):
+ response = test_utils.unmount_device("ROADM-C1")
+ self.assertEqual(response.status_code, requests.codes.ok,
+ test_utils.CODE_SHOULD_BE_200)
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
res = response.json()
self.assertIn(
{'supported-interface-capability':
- ['org-openroadm-port-types:if-otsi-otsigroup'],
+ ['org-openroadm-port-types:if-otsi-otsigroup'],
'supporting-port': 'L1',
'supporting-circuit-pack-name': '1/1/2-PLUG-NET',
'logical-connection-point': 'XPDR1-NETWORK1',
res = response.json()
self.assertIn(
{'supported-interface-capability':
- ['org-openroadm-port-types:if-otsi-otsigroup'],
+ ['org-openroadm-port-types:if-otsi-otsigroup'],
'supporting-port': 'L1',
'supporting-circuit-pack-name': '1/2/2-PLUG-NET',
'logical-connection-point': 'XPDR2-NETWORK1',
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('org-openroadm-port-types:if-100GE-ODU4',
- res['mapping'][0]['supported-interface-capability'])
+ res['mapping'][0]['supported-interface-capability'])
self.assertIn('org-openroadm-port-types:if-OCH-OTU4-ODU4',
- res['mapping'][0]['supported-interface-capability'])
+ res['mapping'][0]['supported-interface-capability'])
self.assertEqual('C1', res['mapping'][0]['supporting-port'])
self.assertEqual('1/2/1/1-PLUG-CLIENT', res['mapping'][0]['supporting-circuit-pack-name'])
self.assertEqual('XPDR2-CLIENT1', res['mapping'][0]['logical-connection-point'])
self.assertEqual('InService', res['mapping'][0]['port-admin-state'])
self.assertEqual('InService', res['mapping'][0]['port-oper-state'])
self.assertEqual({
- "min-trib-slot": "1.1",
- "max-trib-slot": "1.20"
- }, res['mapping'][0]['mpdr-restrictions'])
+ "min-trib-slot": "1.1",
+ "max-trib-slot": "1.20"
+ }, res['mapping'][0]['mpdr-restrictions'])
# Added test to check mc-capability-profile for a transponder
def test_08_check_mccapprofile(self):
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ unittest.main(verbosity=2)
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import os
-
SIMS = {
('xpdra', '1.2.1'): {'port': '17830', 'configfile': 'oper-XPDRA.xml', 'logfile': 'xpdra-121.log'},
('roadma', '1.2.1'): {'port': '17831', 'configfile': 'oper-ROADMA.xml', 'logfile': 'roadma-121.log'},
('xpdrc', '7.1'): {'port': '17854', 'configfile': 'oper-XPDRC.xml', 'logfile': 'xpdrc-71.log'},
('xpdra2', '7.1'): {'port': '17857', 'configfile': 'oper-XPDRA2.xml', 'logfile': 'xpdra2-71.log'},
('xpdrc2', '7.1'): {'port': '17858', 'configfile': 'oper-XPDRC2.xml', 'logfile': 'xpdrc2-71.log'}
-}
\ No newline at end of file
+}
URL_SERV_DELETE = "{}/operations/org-openroadm-service:service-delete"
URL_SERVICE_PATH = "{}/operations/transportpce-device-renderer:service-path"
URL_OTN_SERVICE_PATH = "{}/operations/transportpce-device-renderer:otn-service-path"
+URL_TAPI_CREATE_CONNECTIVITY = "{}/operations/tapi-connectivity:create-connectivity-service"
+URL_TAPI_DELETE_CONNECTIVITY = "{}/operations/tapi-connectivity:delete-connectivity-service"
URL_CREATE_OTS_OMS = "{}/operations/transportpce-device-renderer:create-ots-oms"
URL_PATH_COMPUTATION_REQUEST = "{}/operations/transportpce-pce:path-computation-request"
URL_FULL_PORTMAPPING = "{}/config/transportpce-portmapping:network"
+URL_TAPI_TOPOLOGY_DETAILS = "{}/operations/tapi-topology:get-topology-details"
+URL_TAPI_NODE_DETAILS = "{}/operations/tapi-topology:get-node-details"
+URL_TAPI_SIP_LIST = "{}/operations/tapi-common:get-service-interface-point-list"
+URL_TAPI_SERVICE_LIST = "{}/operations/tapi-connectivity:get-connectivity-service-list"
TYPE_APPLICATION_JSON = {'Content-Type': 'application/json', 'Accept': 'application/json'}
TYPE_APPLICATION_XML = {'Content-Type': 'application/xml', 'Accept': 'application/xml'}
headers=TYPE_APPLICATION_XML,
auth=(ODL_LOGIN, ODL_PWD))
+
def put_jsonrequest(url, data):
return requests.request(
"PUT", url.format(RESTCONF_BASE_URL),
headers=TYPE_APPLICATION_JSON,
auth=(ODL_LOGIN, ODL_PWD))
+
def rawput_request(url, data):
return requests.request(
"PUT", url.format(RESTCONF_BASE_URL),
headers=TYPE_APPLICATION_JSON,
auth=(ODL_LOGIN, ODL_PWD))
+
def rawpost_request(url, data):
return requests.request(
"POST", url.format(RESTCONF_BASE_URL),
"tail-retention": "no"}}}
return post_request(URL_SERV_DELETE, attr)
-
def service_path_request(operation: str, servicename: str, wavenumber: str, nodes, centerfreq: str,
slotwidth: int, minfreq: float, maxfreq: float, lowerslotnumber: int,
higherslotnumber: int):
attr.update(other_attr)
return post_request(URL_PATH_COMPUTATION_REQUEST, {"input": attr})
+def tapi_create_connectivity_request(topologyidorname):
+ return post_request(URL_TAPI_CREATE_CONNECTIVITY, topologyidorname)
+
+def tapi_delete_connectivity_request(serviceidorname):
+ attr = {
+ "input": {
+ "service-id-or-name": serviceidorname}}
+ return post_request(URL_TAPI_DELETE_CONNECTIVITY , attr)
+
+def tapi_get_topology_details_request(topologyidorname):
+ attr = {
+ "input": {
+ "topology-id-or-name": topologyidorname}}
+ return post_request(URL_TAPI_TOPOLOGY_DETAILS , attr)
+
+def tapi_get_node_details_request(topologyidorname, nodeidorname):
+ attr = {
+ "input": {
+ "topology-id-or-name": topologyidorname,
+ "node-id-or-name": nodeidorname}}
+ return post_request(URL_TAPI_NODE_DETAILS, attr)
+
+def tapi_get_sip_details_request():
+ return post_request(URL_TAPI_SIP_LIST, "")
+
+def tapi_get_service_list_request():
+ return post_request(URL_TAPI_SERVICE_LIST, "")
def shutdown_process(process):
if process is not None:
# pylint: disable=no-member
# pylint: disable=too-many-public-methods
import json
-import base64
import unittest
import time
import requests
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportPCEFulltesting(unittest.TestCase):
processes = None
def test_13_change_status_line_port_xpdra(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1"
body = {"ports": [{
- "port-name": "1",
- "logical-connection-point": "XPDR1-NETWORK1",
- "port-type": "CFP2",
- "circuit-id": "XPDRA-NETWORK",
- "administrative-state": "outOfService",
- "port-qual": "xpdr-network"}]}
+ "port-name": "1",
+ "logical-connection-point": "XPDR1-NETWORK1",
+ "port-type": "CFP2",
+ "circuit-id": "XPDRA-NETWORK",
+ "administrative-state": "outOfService",
+ "port-qual": "xpdr-network"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8130/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_17_restore_status_line_port_xpdra(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1"
body = {"ports": [{
- "port-name": "1",
- "logical-connection-point": "XPDR1-NETWORK1",
- "port-type": "CFP2",
- "circuit-id": "XPDRA-NETWORK",
- "administrative-state": "inService",
- "port-qual": "xpdr-network"}]}
+ "port-name": "1",
+ "logical-connection-point": "XPDR1-NETWORK1",
+ "port-type": "CFP2",
+ "circuit-id": "XPDRA-NETWORK",
+ "administrative-state": "inService",
+ "port-qual": "xpdr-network"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8130/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_21_change_status_port_roadma_srg(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1"
body = {"ports": [{
- "port-name": "C1",
- "logical-connection-point": "SRG1-PP1",
- "port-type": "client",
- "circuit-id": "SRG1",
- "administrative-state": "outOfService",
- "port-qual": "roadm-external"}]}
+ "port-name": "C1",
+ "logical-connection-point": "SRG1-PP1",
+ "port-type": "client",
+ "circuit-id": "SRG1",
+ "administrative-state": "outOfService",
+ "port-qual": "roadm-external"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_24_restore_status_port_roadma_srg(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1"
body = {"ports": [{
- "port-name": "C1",
- "logical-connection-point": "SRG1-PP1",
- "port-type": "client",
- "circuit-id": "SRG1",
- "administrative-state": "inService",
- "port-qual": "roadm-external"}]}
+ "port-name": "C1",
+ "logical-connection-point": "SRG1-PP1",
+ "port-type": "client",
+ "circuit-id": "SRG1",
+ "administrative-state": "inService",
+ "port-qual": "roadm-external"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_28_change_status_line_port_roadma_deg(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/2%2F0/ports/L1"
body = {"ports": [{
- "port-name": "L1",
- "logical-connection-point": "DEG2-TTP-TXRX",
- "port-type": "LINE",
- "circuit-id": "1",
- "administrative-state": "outOfService",
- "port-qual": "roadm-external"}]}
+ "port-name": "L1",
+ "logical-connection-point": "DEG2-TTP-TXRX",
+ "port-type": "LINE",
+ "circuit-id": "1",
+ "administrative-state": "outOfService",
+ "port-qual": "roadm-external"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_31_restore_status_line_port_roadma_srg(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/2%2F0/ports/L1"
body = {"ports": [{
- "port-name": "L1",
- "logical-connection-point": "DEG2-TTP-TXRX",
- "port-type": "LINE",
- "circuit-id": "1",
- "administrative-state": "inService",
- "port-qual": "roadm-external"}]}
+ "port-name": "L1",
+ "logical-connection-point": "DEG2-TTP-TXRX",
+ "port-type": "LINE",
+ "circuit-id": "1",
+ "administrative-state": "inService",
+ "port-qual": "roadm-external"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_35_change_status_line_port_xpdrc(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1"
body = {"ports": [{
- "port-name": "1",
- "port-type": "CFP2",
- "administrative-state": "outOfService",
- "port-qual": "xpdr-network"}]}
+ "port-name": "1",
+ "port-type": "CFP2",
+ "administrative-state": "outOfService",
+ "port-qual": "xpdr-network"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8154/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_38_restore_status_line_port_xpdrc(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1"
body = {"ports": [{
- "port-name": "1",
- "port-type": "CFP2",
- "administrative-state": "inService",
- "port-qual": "xpdr-network"}]}
+ "port-name": "1",
+ "port-type": "CFP2",
+ "administrative-state": "inService",
+ "port-qual": "xpdr-network"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8154/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
def test_42_change_status_port_roadma_srg(self):
url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C2"
body = {"ports": [{
- "port-name": "C2",
- "logical-connection-point": "SRG1-PP2",
- "port-type": "client",
- "circuit-id": "SRG1",
- "administrative-state": "outOfService",
- "port-qual": "roadm-external"}]}
+ "port-name": "C2",
+ "logical-connection-point": "SRG1-PP2",
+ "port-type": "client",
+ "circuit-id": "SRG1",
+ "administrative-state": "outOfService",
+ "port-qual": "roadm-external"}]}
response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportPCEtesting(unittest.TestCase):
processes = None
self.assertDictEqual(
dict({u'frequency': 196.0812, u'otsi-rate': u'org-openroadm-common-optical-channel-types:R400G-otsi',
- u'transmit-power': -5, u'modulation-format': 'dp-qam16'},
- **res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi']),
+ u'transmit-power': -5, u'modulation-format': 'dp-qam16'},
+ **res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi']),
res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi'])
def test_15_check_interface_OTSI_GROUP_xpdra2(self):
self.assertDictEqual(
dict({u'frequency': 196.0812, u'otsi-rate': u'org-openroadm-common-optical-channel-types:R400G-otsi',
- u'transmit-power': -5, u'modulation-format': 'dp-qam16'},
- **res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi']),
+ u'transmit-power': -5, u'modulation-format': 'dp-qam16'},
+ **res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi']),
res['interface'][0]['org-openroadm-optical-tributary-signal-interfaces:otsi'])
def test_18_check_interface_OTSI_GROUP_xpdrc2(self):
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
input_dict_1 = {'name': 'XPDR2-CLIENT1-ETHERNET100G',
- 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/2/1/1-PLUG-CLIENT',
- 'type': 'org-openroadm-interfaces:ethernetCsmacd',
- 'supporting-port': 'C1'
- }
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/2/1/1-PLUG-CLIENT',
+ 'type': 'org-openroadm-interfaces:ethernetCsmacd',
+ 'supporting-port': 'C1'
+ }
input_dict_2 = {u'speed': 100000}
self.assertDictEqual(dict(input_dict_1, **res['interface'][0]),
res['interface'][0])
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
input_dict_1 = {'name': 'XPDR2-CLIENT1-ETHERNET100G',
- 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/2/1/1-PLUG-CLIENT',
- 'type': 'org-openroadm-interfaces:ethernetCsmacd',
- 'supporting-port': 'C1'
- }
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/2/1/1-PLUG-CLIENT',
+ 'type': 'org-openroadm-interfaces:ethernetCsmacd',
+ 'supporting-port': 'C1'
+ }
input_dict_2 = {u'speed': 100000}
self.assertDictEqual(dict(input_dict_1, **res['interface'][0]),
res['interface'][0])
self.assertDictEqual(dict(input_dict_2, **res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet']),
- res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
+ res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
def test_36_check_interface_ODU4_CLIENT_xpdrc2(self):
response = test_utils.check_netconf_node_request(
for tp in tpList:
if tp['tp-id'] == 'XPDR2-NETWORK1':
self.assertNotIn('org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes',
- dict.keys(tp))
+ dict.keys(tp))
def test_60_delete_OTUC4_service(self):
response = test_utils.service_delete_request("service1-OTUC4")
time.sleep(2)
def test_74_check_xc1_roadma(self):
- response = test_utils.check_netconf_node_request("ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-755:768")
+ response = test_utils.check_netconf_node_request(
+ "ROADM-A1", "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-755:768")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
# the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
freq_map_array = [int(x) for x in freq_map]
self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
if ele['tp-id'] == 'DEG2-TTP-TXRX':
- freq_map = base64.b64decode(
- ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
- freq_map_array = [int(x) for x in freq_map]
- self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
+ freq_map = base64.b64decode(
+ ele['org-openroadm-network-topology:tx-ttp-attributes']['avail-freq-maps'][0]['freq-map'])
+ freq_map_array = [int(x) for x in freq_map]
+ self.assertEqual(freq_map_array[95], 0, "Index 1 should not be available")
time.sleep(3)
-
def test_78_check_interface_100GE_CLIENT_xpdra2(self):
response = test_utils.check_netconf_node_request(
"XPDR-A2", "interface/XPDR1-CLIENT1-ETHERNET")
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
input_dict_1 = {'name': 'XPDR1-CLIENT1-ETHERNET',
- 'administrative-state': 'inService',
- 'supporting-circuit-pack-name': '1/1/1-PLUG-CLIENT',
- 'type': 'org-openroadm-interfaces:ethernetCsmacd',
- 'supporting-port': 'C1'
- }
+ 'administrative-state': 'inService',
+ 'supporting-circuit-pack-name': '1/1/1-PLUG-CLIENT',
+ 'type': 'org-openroadm-interfaces:ethernetCsmacd',
+ 'supporting-port': 'C1'
+ }
input_dict_2 = {u'speed': 400000}
self.assertDictEqual(dict(input_dict_1, **res['interface'][0]),
res['interface'][0])
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportPCEtesting(unittest.TestCase):
simple_topo_bi_dir_data = None
with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r') as topo_uni_dir_complex:
cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read()
PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "pce_portmapping_121.json")
+ "..", "..", "sample_configs", "pce_portmapping_121.json")
with open(PORT_MAPPING_FILE, 'r') as port_mapping:
cls.port_mapping_data = port_mapping.read()
sample_files_parsed = True
nbElmPath = len(res['output']['response-parameters']['path-description']
['aToZ-direction']['aToZ'])
self.assertEqual(31, nbElmPath)
- link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state":"inService"}
+ link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state": "inService"}
find = False
for i in range(0, nbElmPath):
resource_i = (res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ'][i]
nbElmPath = len(res['output']['response-parameters']['path-description']
['aToZ-direction']['aToZ'])
self.assertEqual(47, nbElmPath)
- link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state":"inService"}
+ link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state": "inService"}
find = False
for i in range(0, nbElmPath):
resource_i = (res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ'][i]
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportPCE400Gtesting(unittest.TestCase):
simple_topo_bi_dir_data = None
cls.topo_bi_dir_data = topo_bi_dir.read()
OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "honeynode-otntopo400G.json")
+ "..", "..", "sample_configs", "honeynode-otntopo400G.json")
with open(OTN_TOPO_BI_DIR_FILE, 'r') as otn_topo_bi_dir:
cls.otn_topo_bi_dir_data = otn_topo_bi_dir.read()
OTUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "honeynode-otntopo400GwithOTUC4.json")
+ "..", "..", "sample_configs", "honeynode-otntopo400GwithOTUC4.json")
with open(OTUC4_OTN_TOPO_BI_DIR_FILE, 'r') as otuc4_otn_topo_bi_dir:
cls.otuc4_otn_topo_bi_dir_data = otuc4_otn_topo_bi_dir.read()
ODUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "honeynode-otntopo400GwithODUC4.json")
+ "..", "..", "sample_configs", "honeynode-otntopo400GwithODUC4.json")
with open(ODUC4_OTN_TOPO_BI_DIR_FILE, 'r') as oduc4_otn_topo_bi_dir:
cls.oduc4_otn_topo_bi_dir_data = oduc4_otn_topo_bi_dir.read()
PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "pce_portmapping_71.json")
+ "..", "..", "sample_configs", "pce_portmapping_71.json")
with open(PORT_MAPPING_FILE, 'r') as port_mapping:
cls.port_mapping_data = port_mapping.read()
sample_files_parsed = True
{"service-rate": "400", "clli": "NodeA",
"service-format": "OTU", "node-id": "XPDR-A2",
"rx-direction": {"port": {"port-device-name": "XPDR-A2-XPDR2"}}
- },
+ },
{"service-rate": "400", "clli": "NodeC",
"service-format": "OTU", "node-id": "XPDR-C2",
"rx-direction": {"port": {"port-device-name": "XPDR-C2-XPDR2"}}
- })
+ })
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Path is calculated',
{"service-rate": "400", "clli": "NodeA", "service-format": "ODU",
"node-id": "XPDR-A2",
"tx-direction": {"port": {"port-device-name": "XPDR-A2-XPDR2"}}
- },
+ },
{"service-rate": "400", "clli": "NodeC", "service-format": "ODU",
"node-id": "XPDR-C2",
"tx-direction": {"port": {"port-device-name": "XPDR-C2-XPDR2"}}
- })
+ })
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertIn('Path is calculated',
{"service-rate": "100", "clli": "NodeA", "service-format": "Ethernet",
"node-id": "XPDR-A2",
"tx-direction": {"port": {"port-device-name": "XPDR-A2-XPDR2",
- "port-name": "XPDR2-CLIENT1"}}},
+ "port-name": "XPDR2-CLIENT1"}}},
{"service-rate": "100", "clli": "NodeC", "service-format": "Ethernet",
"node-id": "XPDR-C2",
"tx-direction": {"port": {"port-device-name": "XPDR-C2-XPDR2",
- "port-name": "XPDR2-CLIENT1"}}})
+ "port-name": "XPDR2-CLIENT1"}}})
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
['zToA-direction']['modulation-format'])
time.sleep(5)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportGNPYtesting(unittest.TestCase):
topo_cllinet_data = None
with open(TOPO_ORDTOPO_FILE, 'r') as topo_ordtopo:
cls.topo_ordtopo_data = topo_ordtopo.read()
PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "sample_configs", "gnpy", "gnpy_portmapping_121.json")
+ "..", "..", "sample_configs", "gnpy", "gnpy_portmapping_121.json")
with open(PORT_MAPPING_FILE, 'r') as port_mapping:
cls.port_mapping_data = port_mapping.read()
sample_files_parsed = True
self.assertEqual(response.status_code, requests.codes.ok)
time.sleep(2)
+
if __name__ == "__main__":
# logging.basicConfig(filename='./transportpce_tests/log/response.log',filemode='w',level=logging.DEBUG)
unittest.main(verbosity=2)
sys.path.append('transportpce_tests/common/')
import test_utils
-
class TransportNbiNotificationstesting(unittest.TestCase):
processes = None
cr_serv_sample_data = {"input": {
[tox]
minversion = 3.7.0
-envlist = buildcontroller,testsPCE,sims121,tests121,sims221,tests221,sims71,tests71,tests_hybrid
+envlist = buildcontroller,testsPCE,
+ sims121,build_karaf_tests121,tests121,
+ sims221,build_karaf_tests221,tests221,
+ sims71,build_karaf_tests71,tests71,
+ build_karaf_tests_hybrid,tests_hybrid,
docs
docs-linkcheck
checkbashisms
commands =
./launch_tests.sh pce {posargs:}
+[testenv:build_karaf_tests121]
+depends = buildcontroller
+# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
+whitelist_externals = launch_tests.sh
+passenv = LAUNCHER USE_LIGHTY
+setenv =
+# USE_LIGHTY=True
+ USE_ODL_ALT_KARAF_ENV=./karaf121.env
+ USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
+commands =
+ ./build_karaf_for_tests.sh
+
[testenv:tests121]
-depends = buildcontroller,sims121,testsPCE
+depends = buildcontroller,build_karaf_tests121,sims121,testsPCE
# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
# USE_LIGHTY=True
- USE_ODL_ALT_WEBSOCKET_PORT=8186
- USE_ODL_ALT_AKKA_PORT=2551
- USE_ODL_ALT_AKKA_MGT_PORT=8559
- USE_ODL_ALT_SHELL_PORT=8102
- USE_ODL_ALT_RMI_REGISTRY_PORT=1100
- USE_ODL_ALT_RMI_SERVER_PORT=44445
- USE_ODL_ALT_RESTCONF_PORT=8182
+ USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
commands =
./launch_tests.sh 1.2.1 {posargs:}
# which is more verbose than nose or 'export LAUNCHER="ls -l"' to only list script
# files attributes.
+[testenv:build_karaf_tests221]
+depends = buildcontroller
+# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
+whitelist_externals = launch_tests.sh
+passenv = LAUNCHER USE_LIGHTY
+setenv =
+# USE_LIGHTY=True
+ USE_ODL_ALT_KARAF_ENV=./karaf221.env
+ USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
+commands =
+ ./build_karaf_for_tests.sh
+
[testenv:tests221]
-depends = buildcontroller,sims221,tests71
+depends = buildcontroller,build_karaf_tests221,sims221,tests71
# tests71 dependency is only here to chain tests in the gate and avoid ressources starvation
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
# USE_LIGHTY=True
- USE_ODL_ALT_WEBSOCKET_PORT=8187
- USE_ODL_ALT_AKKA_PORT=2552
- USE_ODL_ALT_AKKA_MGT_PORT=8560
- USE_ODL_ALT_SHELL_PORT=8103
- USE_ODL_ALT_RMI_REGISTRY_PORT=1101
- USE_ODL_ALT_RMI_SERVER_PORT=44446
- USE_ODL_ALT_RESTCONF_PORT=8183
+ USE_ODL_ALT_KARAF_ENV=./karaf221.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
commands =
./launch_tests.sh 2.2.1 {posargs:}
+[testenv:build_karaf_tests71]
+depends = buildcontroller
+# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
+whitelist_externals = launch_tests.sh
+passenv = LAUNCHER USE_LIGHTY
+setenv =
+# USE_LIGHTY=True
+ USE_ODL_ALT_KARAF_ENV=./karaf71.env
+ USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
+commands =
+ ./build_karaf_for_tests.sh
+
[testenv:tests71]
-depends = buildcontroller,sims71
+depends = buildcontroller,build_karaf_tests71,sims71
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
# USE_LIGHTY=True
- USE_ODL_ALT_WEBSOCKET_PORT=8188
- USE_ODL_ALT_AKKA_PORT=2553
- USE_ODL_ALT_AKKA_MGT_PORT=8561
- USE_ODL_ALT_SHELL_PORT=8104
- USE_ODL_ALT_RMI_REGISTRY_PORT=1102
- USE_ODL_ALT_RMI_SERVER_PORT=44447
- USE_ODL_ALT_RESTCONF_PORT=8184
+ USE_ODL_ALT_KARAF_ENV=./karaf71.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
commands =
./launch_tests.sh 7.1 {posargs:}
+[testenv:build_karaf_tests_hybrid]
+depends = buildcontroller
+# testsPCE dependency is only here to chain tests in the gate and avoid resources starvation
+whitelist_externals = launch_tests.sh
+passenv = LAUNCHER USE_LIGHTY
+setenv =
+# USE_LIGHTY=True
+ USE_ODL_ALT_KARAF_ENV=./karaf121.env
+ USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
+commands =
+ ./build_karaf_for_tests.sh
+
[testenv:tests_hybrid]
depends = buildcontroller,sims121,sims221,sims71,tests121,tests221,tests71
#the last dependency is to avoid temporarily concurrent ressources problem in parallel mode
passenv = LAUNCHER USE_LIGHTY
setenv =
# USE_LIGHTY=True
- USE_ODL_ALT_WEBSOCKET_PORT=8186
- USE_ODL_ALT_AKKA_PORT=2551
- USE_ODL_ALT_AKKA_MGT_PORT=8559
- USE_ODL_ALT_SHELL_PORT=8102
- USE_ODL_ALT_RMI_REGISTRY_PORT=1100
- USE_ODL_ALT_RMI_SERVER_PORT=44445
- USE_ODL_ALT_RESTCONF_PORT=8182
+ USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
commands =
# nosetests --with-xunit transportpce_tests/hybrid/test01_device_change_notifications.py