- Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
- if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format("Unable to get mapping from PortMapping for node %s and"
- + " logical connection port %s", nodeId, logicalConnPoint));
- }
- // Create generic interface
- InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.class,
- logicalConnPoint + "-OTU");
- otuInterfaceBldr.setSupportingInterface(supportOchInterface);
-
- // OTU interface specific data
- OtuBuilder otuIfBuilder = new OtuBuilder();
- otuIfBuilder.setFec(OtuAttributes.Fec.Scfec);
- otuIfBuilder.setRate(OTU4.class);
-
- // 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.rev161014.Interface1Builder otuIf1Builder =
- new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder();
- otuInterfaceBldr.addAugmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class,
- otuIf1Builder.setOtu(otuIfBuilder.build()).build());
-
- // Post interface on the device
- this.openRoadmInterfaces.postInterface(nodeId, otuInterfaceBldr);
- return otuInterfaceBldr.getName();
- }
-
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
- String key) {
- InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
- interfaceBuilder.setDescription(" TBD ");
- interfaceBuilder.setCircuitId(" TBD ");
- interfaceBuilder.setSupportingCircuitPackName(portMap.getSupportingCircuitPackName());
- interfaceBuilder.setSupportingPort(portMap.getSupportingPort());
- interfaceBuilder.setAdministrativeState(AdminStates.InService);
- interfaceBuilder.setType(type);
- interfaceBuilder.setName(key);
- interfaceBuilder.withKey(new InterfaceKey(key));
- return interfaceBuilder;
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmEth10GInterface(String nodeId, String logicalConnPoint)
+ throws OpenRoadmInterfaceException {
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmEth100GInterface(String nodeId, String logicalConnPoint)
+ throws OpenRoadmInterfaceException {
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G");
+ return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
+ case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
+ return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
+ boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
+ String payLoadType)
+ throws OpenRoadmInterfaceException {
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface221.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint,
+ isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint,
+ boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
+ String payLoadType)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface221.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint,
+ isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint,
+ boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
+ String payLoadType)
+ throws OpenRoadmInterfaceException {
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint,
+ isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint, String serviceName,
+ String payLoad, boolean isNetworkPort, OpucnTribSlotDef minTribSlotNumber,
+ OpucnTribSlotDef maxTribSlotNumber)
+ throws OpenRoadmInterfaceException {
+
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
+ return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
+ payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber);
+ default:
+ return null;
+ }
+ }
+
+
+ public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
+ String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221
+ .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
+ znodeId, zlogicalConnPoint);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint,
+ String supportingOtuInterface)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
+ return openRoadmInterface710
+ .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
+ String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
+ return openRoadmInterface710
+ .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface,
+ znodeId, zlogicalConnPoint);
+ default:
+ return null;
+ }