+ public String createOpenRoadmOdu4OducnOduflex(String nodeId, String logicalConnPoint,
+ AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
+
+ Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ }
+ // Depending on OTU4 or OTUCn, supporting interface should
+ // reflect that
+ String interfaceOdu4OducnOduflex = null;
+ if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+ // create OTU4 interface
+ interfaceOdu4OducnOduflex = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
+ } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+ // Create ODUCn and ODUFlex interface.
+ String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
+ // Here we concat the two interfaces
+ interfaceOdu4OducnOduflex = interfaceOducn + "#"
+ + createOpenRoadmOduflexInterface(nodeId, logicalConnPoint, interfaceOducn);
+ }
+
+ return interfaceOdu4OducnOduflex;
+ }
+
+ public String createOpenRoadmOtnOducnInterface(String nodeId, String logicalConnPoint,
+ String supportingOtucn)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
+ nodeId, logicalConnPoint));
+ }
+ // Create ODUcn object
+ // Start with OPU object
+ // OPU payload
+ OpuBuilder opuBuilder = new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
+
+ // Create an ODUC4 object
+ OduBuilder oduBuilder = new OduBuilder()
+ .setRate(ODUCn.class)
+ .setOduFunction(ODUTTP.class)
+ .setMonitoringMode(MonitoringMode.Terminated)
+ .setTimActEnabled(false)
+ .setTimDetectMode(TimDetectMode.Disabled)
+ .setDegmIntervals(Uint8.valueOf(2))
+ .setDegthrPercentage(Uint16.valueOf(100))
+ .setOpu(opuBuilder.build());
+
+ // Set the ODUCn rate from OTUCn interface naming convention
+ String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
+
+ // check if the oducnrate is a valid value and if it is invalid, then throw error
+ if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
+ throw new OpenRoadmInterfaceException(
+ String.format(RATE_EXCEPTION_MESSAGE));
+ }
+
+ oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
+
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+ logicalConnPoint + ODUC + oducnrate);
+
+ // Create a list
+ List<String> listSupportingOtucnInterface = new ArrayList<>();
+ listSupportingOtucnInterface.add(supportingOtucn);
+
+ oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
+
+ oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
+
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, oduInterfaceBuilder);
+ // Post the equipment-state change on the device circuit-pack if xpdr node
+ if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
+ this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
+ }
+ // Update the port-mapping with the interface information
+ this.portMapping.updateMapping(nodeId, portMap);
+ return oduInterfaceBuilder.getName();
+ }
+
+
+ // With SAPI and DAPI information
+ public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
+ String supportingOtucn, String znodeId, String zlogicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
+ Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
+ if (portMapA == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
+ anodeId, alogicalConnPoint));
+ }
+ // On the Zside
+ if (portMapZ == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
+ znodeId, zlogicalConnPoint));
+
+ }
+ // Create ODUcn object
+ // Start with OPU object
+ // OPU payload
+ OpuBuilder opuBuilder = new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
+
+ // Create an ODUCn object
+ OduBuilder oduBuilder = new OduBuilder()
+ .setRate(ODUCn.class)
+ .setOduFunction(ODUTTP.class)
+ .setMonitoringMode(MonitoringMode.Terminated)
+ .setTimActEnabled(false)
+ .setTimDetectMode(TimDetectMode.Disabled)
+ .setDegmIntervals(Uint8.valueOf(2))
+ .setDegthrPercentage(Uint16.valueOf(100))
+ .setOpu(opuBuilder.build())
+ .setTxSapi(portMapA.getLcpHashVal())
+ .setTxDapi(portMapZ.getLcpHashVal())
+ .setExpectedSapi(portMapZ.getLcpHashVal())
+ .setExpectedDapi(portMapZ.getLcpHashVal());
+
+ // Set the ODUCn rate from OTUCn interface naming convention
+ String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
+
+ // check if the oducnrate is a valid value and if it is invalid, then throw error
+ if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
+ throw new OpenRoadmInterfaceException(
+ String.format(RATE_EXCEPTION_MESSAGE));
+ }
+
+ oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
+
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ alogicalConnPoint + ODUC + oducnrate);
+
+ // Create a list
+ List<String> listSupportingOtucnInterface = new ArrayList<>();
+ listSupportingOtucnInterface.add(supportingOtucn);
+
+ oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
+
+ oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
+
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(anodeId, oduInterfaceBuilder);
+ // Post the equipment-state change on the device circuit-pack if xpdr node
+ if (portMapA.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
+ this.openRoadmInterfaces.postEquipmentState(anodeId, portMapA.getSupportingCircuitPackName(), true);
+ }
+ // Update the port-mapping with the interface information
+ this.portMapping.updateMapping(anodeId, portMapA);
+ return oduInterfaceBuilder.getName();
+ }
+