+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ }
+ String interfaceOchOtsiOtsigroup = null;
+ if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+ // create OCH interface
+ interfaceOchOtsiOtsigroup = createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
+ } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+ // Create OTSi and OTSi-group and concat the names of the interface
+ String interfaceOtsiName = createOpenRoadmOtsiInterface(nodeId, logicalConnPoint, spectrumInformation);
+ // Concat the two names for this interface
+ interfaceOchOtsiOtsigroup = interfaceOtsiName
+ + "#" + createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint, interfaceOtsiName,
+ spectrumInformation);
+ }
+
+ return interfaceOchOtsiOtsigroup;
+ }
+
+ public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
+ AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
+
+ Mapping mapping = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ if (mapping == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ }
+ InterfaceBuilder
+ otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+ logicalConnPoint + "-OTU4");
+ // Supporting interface list
+ List<String> listSupportingOChInterface = new ArrayList<>();
+ listSupportingOChInterface.add(supportOchInterface);
+ otuInterfaceBldr.setSupportingInterfaceList(listSupportingOChInterface);
+
+ // OTU interface specific data
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.otu.container.OtuBuilder
+ otuIfBuilder = new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu
+ .interfaces.rev200529.otu.container.OtuBuilder()
+ .setFec(Scfec.class)
+ .setRate(OTU4.class);
+ if (apiInfoA != null) {
+ otuIfBuilder.setTxSapi(apiInfoA.getSapi())
+ .setTxDapi(apiInfoA.getDapi())
+ .setExpectedSapi(apiInfoA.getExpectedSapi())
+ .setExpectedDapi(apiInfoA.getExpectedDapi());
+ }
+ if (apiInfoZ != null) {
+ otuIfBuilder.setTxSapi(apiInfoZ.getSapi())
+ .setTxDapi(apiInfoZ.getDapi())
+ .setExpectedSapi(apiInfoZ.getExpectedSapi())
+ .setExpectedDapi(apiInfoZ.getExpectedDapi());
+ }
+
+ // Create Interface1 type object required for adding as augmentation
+ // TODO look at imports of different versions of class
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder otuIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder();
+ otuInterfaceBldr.addAugmentation(otuIf1Builder.setOtu(otuIfBuilder.build()).build());
+
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, otuInterfaceBldr);
+ this.portMapping.updateMapping(nodeId, mapping);
+ return otuInterfaceBldr.getName();
+ }
+
+
+ public String createOpenRoadmOtucnInterface(String nodeId, String logicalConnPoint,
+ String supportingOtsiGroupInterface, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
+ throws OpenRoadmInterfaceException {
+ Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
+ if (mapping == null) {