@Override
public boolean setPowerLevel(String nodeId, String mode, Decimal64 powerValue, String connectionNumber) {
String openRoadmVersion = mappingUtils.getOpenRoadmVersion(nodeId);
- if (OPENROADM_DEVICE_VERSION_1_2_1.equals(openRoadmVersion) && OpticalControlMode.forName(mode).isPresent()) {
- return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode).get(), powerValue,
+ if (OPENROADM_DEVICE_VERSION_1_2_1.equals(openRoadmVersion) && OpticalControlMode.forName(mode) != null) {
+ return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode), powerValue,
connectionNumber);
}
else if (OPENROADM_DEVICE_VERSION_2_2_1.equals(openRoadmVersion)
- && org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
- .isPresent()) {
+ && org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode
+ .forName(mode) != null) {
return crossConnectImpl221.setPowerLevel(nodeId,
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
- .get(), powerValue, connectionNumber);
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode),
+ powerValue, connectionNumber);
}
return false;
}
*/
package org.opendaylight.transportpce.common.mapping;
+import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GE;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2e;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If1GE;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If1GEODU0;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If400GE;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCH;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU2EODU2E;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU2ODU2;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOTU4ODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOTUCnODUCn;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOtsiOtsigroup;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
public class MappingUtilsImpl implements MappingUtils {
private static final Logger LOG = LoggerFactory.getLogger(MappingUtilsImpl.class);
private final DataBroker dataBroker;
- private static Map<String, Class<? extends SupportedIfCapability>> capTypeClassMap = new HashMap<>() {
- {
- put("IfOtsiOtsigroup", IfOtsiOtsigroup.class);
- put("IfOTUCnODUCn", IfOTUCnODUCn.class);
- put("IfOCHOTU4ODU4", IfOCHOTU4ODU4.class);
- put("IfOTU4ODU4", IfOTU4ODU4.class);
- put("IfOCH", IfOCH.class);
- put("If100GEODU4", If100GEODU4.class);
- put("If10GEODU2e", If10GEODU2e.class);
- put("If10GEODU2", If10GEODU2.class);
- put("If1GEODU0", If1GEODU0.class);
- put("If400GE", If400GE.class);
- put("If100GE", If100GE.class);
- put("If10GE", If10GE.class);
- put("If1GE", If1GE.class);
- put("IfOCHOTU2EODU2E", IfOCHOTU2EODU2E.class);
- put("IfOCHOTU2ODU2", IfOCHOTU2ODU2.class);
- }
- };
+ private static final ImmutableMap<String, SupportedIfCapability> CAP_TYPE_MAP =
+ ImmutableMap.<String, SupportedIfCapability>builder()
+ .put("If400GE{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-400GE}", If400GE.VALUE)
+ .put("IfOtsiOtsigroup{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-otsi-otsigroup}",
+ IfOtsiOtsigroup.VALUE)
+ .put("IfOCH{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-OCH}", IfOCH.VALUE)
+ .put("IfOCHOTU4ODU4{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-OCH-OTU4-ODU4}",
+ IfOCHOTU4ODU4.VALUE)
+ .put("IfOCHOTU4ODU4{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-OCH-OTU4-ODU4}",
+ IfOCHOTU4ODU4.VALUE)
+ .put("If1GEODU0{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-1GE-ODU0}", If1GEODU0.VALUE)
+ .put("If10GE{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE}", If10GE.VALUE)
+ .put("If10GEODU2{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE-ODU2}",
+ If10GEODU2.VALUE)
+ .put("If10GEODU2e{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE-ODU2e}",
+ If10GEODU2e.VALUE)
+ .put("If100GE{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-100GE}", If100GE.VALUE)
+ .put("If100GE{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-100GE}", If100GE.VALUE)
+ .put("If100GEODU4{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-100GE-ODU4}",
+ If100GEODU4.VALUE)
+ .put("If100GEODU4{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-100GE-ODU4}",
+ If100GEODU4.VALUE)
+ .build();
public MappingUtilsImpl(DataBroker dataBroker) {
return mcCapabilities;
}
- public static Class<? extends SupportedIfCapability> convertSupIfCapa(String ifCapType) {
- if (!capTypeClassMap.containsKey(ifCapType)) {
+ public static SupportedIfCapability convertSupIfCapa(String ifCapType) {
+ if (!CAP_TYPE_MAP.containsKey(ifCapType)) {
LOG.error("supported-if-capability {} not supported", ifCapType);
return null;
}
- return capTypeClassMap.get(ifCapType);
+ return CAP_TYPE_MAP.get(ifCapType);
}
}
}
LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
- Class<? extends InterfaceType> interfaceType
- = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+ InterfaceType interfaceType = openRoadmInterface.get().getType();
// Check if interface type is OMS or OTS
- if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+ if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
mpBldr.setSupportingOms(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OpticalTransport.class)) {
+ if (interfaceType.equals(OpticalTransport.VALUE)) {
mpBldr.setSupportingOts(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OtnOtu.class)) {
+ if (interfaceType.equals(OtnOtu.VALUE)) {
mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OtnOdu.class)) {
+ if (interfaceType.equals(OtnOdu.VALUE)) {
mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
}
- if (interfaceType.equals(EthernetCsmacd.class)) {
+ if (interfaceType.equals(EthernetCsmacd.VALUE)) {
mpBldr.setSupportingEthernet(interfaces.getInterfaceName());
}
}
private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint, String partnerLcp) {
- Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new HashSet<>();
+ Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability> supportedIntf =
+ new HashSet<>();
for (String sup: getSupIfCapList(port)) {
if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
}
private List<String> getSupIfCapList(Ports port) {
- Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+ Set<SupportedIfCapability> supIfCapClassList = port.getSupportedInterfaceCapability();
return
supIfCapClassList == null
? Collections.emptyList()
: supIfCapClassList
- .stream().map(e -> e.getSimpleName())
+ .stream().map(e -> e.toString())
.collect(Collectors.toList());
}
}
LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
- Class<? extends InterfaceType> interfaceType
- = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+ InterfaceType interfaceType = openRoadmInterface.get().getType();
// Check if interface type is OMS or OTS
- if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+ if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
mpBldr.setSupportingOms(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OpticalTransport.class)) {
+ if (interfaceType.equals(OpticalTransport.VALUE)) {
mpBldr.setSupportingOts(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OtnOtu.class)) {
+ if (interfaceType.equals(OtnOtu.VALUE)) {
mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OtnOdu.class)) {
+ if (interfaceType.equals(OtnOdu.VALUE)) {
mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
}
- if (interfaceType.equals(EthernetCsmacd.class)) {
+ if (interfaceType.equals(EthernetCsmacd.VALUE)) {
mpBldr.setSupportingEthernet(interfaces.getInterfaceName());
}
}
private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint, String partnerLcp, XpdrNodeTypes xpdrNodeType) {
- Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new HashSet<>();
+ Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability> supportedIntf =
+ new HashSet<>();
for (String sup: getSupIfCapList(port)) {
if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
}
private List<String> getSupIfCapList(Ports port) {
- Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+ Set<SupportedIfCapability> supIfCapClassList = port.getSupportedInterfaceCapability();
if (supIfCapClassList != null) {
return supIfCapClassList
- .stream().map(e -> e.getSimpleName())
+ .stream().map(e -> e.toString())
.collect(Collectors.toList());
}
Ports1 ports1 = port.augmentation(Ports1.class);
if (ports1 != null && ports1.getPortCapabilities() != null) {
return ports1.getPortCapabilities().getSupportedInterfaceCapability()
- .values().stream().map(e -> e.getIfCapType().getSimpleName())
+ .values().stream().map(e -> e.getIfCapType().toString())
.collect(Collectors.toList());
}
return Collections.emptyList();
}
LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
- Class<? extends InterfaceType> interfaceType
- = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+ InterfaceType interfaceType = openRoadmInterface.get().getType();
// Check if interface type is OMS or OTS
- if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+ if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
mpBldr.setSupportingOms(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OpticalTransport.class)) {
+ if (interfaceType.equals(OpticalTransport.VALUE)) {
mpBldr.setSupportingOts(interfaces.getInterfaceName());
}
String interfaceName = interfaces.getInterfaceName();
- if (interfaceType.equals(OtnOtu.class)
+ if (interfaceType.equals(OtnOtu.VALUE)
&& (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
.equals("OTU4"))) {
mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
}
- if ((interfaceType.equals(OtnOtu.class))
+ if ((interfaceType.equals(OtnOtu.VALUE))
&& (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
.contains("OTUC"))) {
mpBldr.setSupportingOtucn(interfaces.getInterfaceName());
}
- if (interfaceType.equals(OtnOdu.class)
+ if (interfaceType.equals(OtnOdu.VALUE)
&& (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
.equals("ODU4"))) {
mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
}
- if ((interfaceType.equals(OtnOdu.class))
+ if ((interfaceType.equals(OtnOdu.VALUE))
&& (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
.contains("ODUC"))) {
mpBldr.setSupportingOducn(interfaces.getInterfaceName());
}
Collection<SupportedInterfaceCapability> supIntfCapaList = getSupIntfCapaList(port);
if (supIntfCapaList != null) {
- Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new HashSet<>();
+ Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability>
+ supportedIntf = new HashSet<>();
SupportedInterfaceCapability sic1 = null;
for (SupportedInterfaceCapability sic : supIntfCapaList) {
- supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().getSimpleName()));
+ supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().toString()));
sic1 = sic;
}
mpBldr.setSupportedInterfaceCapability(supportedIntf);
-{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000.0,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100.0,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
+{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000.0,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100.0,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
String name = deviceInterface.getName();
String description = deviceInterface.getDescription();
- String type = deviceInterface.getType().getTypeName();
+ String type = deviceInterface.getType().toString();
String administrativeStateEnu = deviceInterface.getAdministrativeState().getName();
int operationalState = deviceInterface.getOperationalState().getIntValue();
String circuitId = deviceInterface.getCircuitId();
org.opendaylight.yang.gen.v1
.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
.getOch());
- ochRate = ochIfBuilder.getRate().getName();
+ ochRate = ochIfBuilder.getRate().toString();
ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
new OtuBuilder(deviceInterface.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
.getOtu());
- otuRate = otuIfBuilder.getRate().getName();
+ otuRate = otuIfBuilder.getRate().toString();
otuFecEnu = otuIfBuilder.getFec().getName();
otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().getEnabled().toString();
otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getName();
private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
String tribSlot = txMsi.getTribSlot().toString();
- String odtuType = txMsi.getOdtuType().getTypeName();
+ String odtuType = txMsi.getOdtuType().toString();
String tribPort = txMsi.getTribPort().toString();
String tribPortPayload = txMsi.getTribPortPayload();
private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
String tribSlot = rxMsi.getTribSlot().toString();
- String odtuType = rxMsi.getOdtuType().getTypeName();
+ String odtuType = rxMsi.getOdtuType().toString();
String tribPort = rxMsi.getTribPort().toString();
String tribPortPayload = rxMsi.getTribPortPayload();
ExpMsi expMsi) {
String tribSlot = expMsi.getTribSlot().toString();
- String odtuType = expMsi.getOdtuType().getTypeName();
+ String odtuType = expMsi.getOdtuType().toString();
String tribPort = expMsi.getTribPort().toString();
String tribPortPayload = expMsi.getTribPortPayload();
//int otsFiberTypeEnu = -1;
String name = deviceInterface.getName();
String description = deviceInterface.getDescription();
- String type = deviceInterface.getType().getTypeName();
+ String type = deviceInterface.getType().toString();
String circuitId = deviceInterface.getCircuitId();
String supportingInterface = deviceInterface.getSupportingInterface();
String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
org.opendaylight.yang.gen.v1
.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
.getOch());
- ochRate = ochIfBuilder.getRate().getName();
+ ochRate = ochIfBuilder.getRate().toString();
//ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
OtuBuilder otuIfBuilder = new OtuBuilder(deviceInterface.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
.getOtu());
- otuRate = otuIfBuilder.getRate().getName();
+ otuRate = otuIfBuilder.getRate().toString();
otuFecEnu = otuIfBuilder.getFec().getIntValue();
otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().getEnabled().toString();
otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getIntValue();
private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
String tribSlot = txMsi.getTribSlot().toString();
- String odtuType = txMsi.getOdtuType().getTypeName();
+ String odtuType = txMsi.getOdtuType().toString();
String tribPort = txMsi.getTribPort().toString();
String tribPortPayload = txMsi.getTribPortPayload();
private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
String tribSlot = rxMsi.getTribSlot().toString();
- String odtuType = rxMsi.getOdtuType().getTypeName();
+ String odtuType = rxMsi.getOdtuType().toString();
String tribPort = rxMsi.getTribPort().toString();
String tribPortPayload = rxMsi.getTribPortPayload();
ExpMsi expMsi) {
String tribSlot = expMsi.getTribSlot().toString();
- String odtuType = expMsi.getOdtuType().getTypeName();
+ String odtuType = expMsi.getOdtuType().toString();
String tribPort = expMsi.getTribPort().toString();
String tribPortPayload = expMsi.getTribPortPayload();
List<NodeIdPair> atozTpIds = getAToZTpList(atoZDirection);
Decimal64 atozMinFrequency = atoZDirection.getAToZMinFrequency().getValue();
Decimal64 atozMaxFrequency = atoZDirection.getAToZMaxFrequency().getValue();
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(atoZDirection.getModulationFormat());
- if (!optionalModulationFormat.isPresent()) {
+ ModulationFormat modulationFormat = ModulationFormat.forName(atoZDirection.getModulationFormat());
+ if (modulationFormat == null) {
LOG.error("Unknown modulation format {} for a to z direction, frequencies not updated",
atoZDirection.getModulationFormat());
return;
}
- setFrequencies4Tps(atozMinFrequency, atozMaxFrequency, atoZDirection.getRate(),
- optionalModulationFormat.get(), atozTpIds, used);
- setFrequencies4Nodes(atozMinFrequency,
- atozMaxFrequency,
+ setFrequencies4Tps(atozMinFrequency, atozMaxFrequency, atoZDirection.getRate(), modulationFormat, atozTpIds,
+ used);
+ setFrequencies4Nodes(atozMinFrequency, atozMaxFrequency,
atozTpIds.stream().map(NodeIdPair::getNodeID).distinct().collect(Collectors.toList()),
used);
}
List<NodeIdPair> ztoaTpIds = getZToATpList(ztoADirection);
Decimal64 ztoaMinFrequency = ztoADirection.getZToAMinFrequency().getValue();
Decimal64 ztoaMaxFrequency = ztoADirection.getZToAMaxFrequency().getValue();
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(ztoADirection.getModulationFormat());
- if (!optionalModulationFormat.isPresent()) {
+ ModulationFormat modulationFormat = ModulationFormat.forName(ztoADirection.getModulationFormat());
+ if (modulationFormat == null) {
LOG.error("Unknown modulation format {} for z to a direction, frequencies not updated",
ztoADirection.getModulationFormat());
return;
}
- setFrequencies4Tps(ztoaMinFrequency, ztoaMaxFrequency, ztoADirection.getRate(),
- optionalModulationFormat.get(), ztoaTpIds, used);
+ setFrequencies4Tps(ztoaMinFrequency, ztoaMaxFrequency, ztoADirection.getRate(), modulationFormat, ztoaTpIds,
+ used);
setFrequencies4Nodes(ztoaMinFrequency,
ztoaMaxFrequency,
ztoaTpIds.stream().map(NodeIdPair::getNodeID).distinct().collect(Collectors.toList()),
private static final int NB_TRIB_PORTS = 80;
private static final int NB_TRIB_SLOTS = 80;
- private static final Map<String, Class<? extends OduRateIdentity>> RATE_MAP = Map.of(
- "If100GEODU4", ODU4.class,
- "IfOCHOTU4ODU4", ODU4.class,
- "If1GEODU0", ODU0.class,
- "If10GEODU2", ODU2.class,
- "If10GEODU2e", ODU2e.class);
+ private static final Map<String, OduRateIdentity> RATE_MAP = Map.of(
+ "If100GEODU4", ODU4.VALUE,
+ "IfOCHOTU4ODU4", ODU4.VALUE,
+ "If1GEODU0", ODU0.VALUE,
+ "If10GEODU2", ODU2.VALUE,
+ "If10GEODU2e", ODU2e.VALUE);
private static final Map<OtnLinkType, Long> OTNLINKTYPE_BW_MAP = Map.of(
OtnLinkType.ODTU4, 100000L,
OtnLinkType.ODUC4, 400000L,
Uint32.valueOf(1), 1000L,
Uint32.valueOf(10), 10000L,
Uint32.valueOf(100), 100000L);
- private static final Map<Uint32, Class<? extends OdtuTypeIdentity>> SERVICERATE_ODTUTYPECLASS_MAP = Map.of(
- Uint32.valueOf(1), ODTU4TsAllocated.class,
- Uint32.valueOf(10), ODTU4TsAllocated.class,
- Uint32.valueOf(100), ODTUCnTs.class);
+ private static final Map<Uint32, OdtuTypeIdentity> SERVICERATE_ODTUTYPECLASS_MAP = Map.of(
+ Uint32.valueOf(1), ODTU4TsAllocated.VALUE,
+ Uint32.valueOf(10), ODTU4TsAllocated.VALUE,
+ Uint32.valueOf(100), ODTUCnTs.VALUE);
private OpenRoadmOtnTopology() {
}
tpnPool.add(Uint16.valueOf(i));
}
OdtuTpnPool oduTpnPool = new OdtuTpnPoolBuilder()
- .setOdtuType(ODTU4TsAllocated.class)
+ .setOdtuType(ODTU4TsAllocated.VALUE)
.setTpnPool(tpnPool)
.build();
xtpcaBldr.setOdtuTpnPool(ImmutableMap.of(oduTpnPool.key(),oduTpnPool));
tpnPool.remove(Uint16.valueOf(tribPortNb));
}
}
- Class<? extends OdtuTypeIdentity> odtuType;
+ OdtuTypeIdentity odtuType;
if (SERVICERATE_ODTUTYPECLASS_MAP.containsKey(serviceRate)) {
odtuType = SERVICERATE_ODTUTYPECLASS_MAP.get(serviceRate);
} else {
mapping.getLogicalConnectionPoint(), node.getNodeId());
} else {
XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder();
- for (Class<? extends SupportedIfCapability> supInterCapa : mapping.getSupportedInterfaceCapability()) {
+ for (SupportedIfCapability supInterCapa : mapping.getSupportedInterfaceCapability()) {
SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
.withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
.setIfCapType(supInterCapa)
}
}
- private static Class<? extends OduRateIdentity> fixRate(Set<Class<? extends SupportedIfCapability>> list) {
-
- for (Class<? extends SupportedIfCapability> class1 : list) {
- if (RATE_MAP.containsKey(class1.getSimpleName())) {
- return RATE_MAP.get(class1.getSimpleName());
+ private static OduRateIdentity fixRate(Set<SupportedIfCapability> list) {
+ for (SupportedIfCapability supIfCap: list) {
+ String simpleName = supIfCap.toString().split("\\{")[0];
+ if (RATE_MAP.containsKey(simpleName)) {
+ return RATE_MAP.get(simpleName);
}
}
return null;
? nodeName
: new StringBuilder(nodeName).append("-").append(tpName.split("-")[0]).toString();
}
+
}
.getSupportedInterfaceCapability()
.size());
assertEquals(
- If100GE.class.getName(),
+ If100GE.VALUE,
tps.get(0).augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
.TerminationPoint1.class)
.getTpSupportedInterfaces().nonnullSupportedInterfaceCapability()
.values().stream().findFirst()
- .get().getIfCapType().getName());
+ .get().getIfCapType());
assertEquals(
"first TP must be of type client",
OpenroadmTpType.XPONDERCLIENT,
.getSupportedInterfaceCapability()
.size());
assertEquals(
- IfOCH.class.getName(),
+ IfOCH.VALUE,
tps.get(2).augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
.TerminationPoint1.class)
.getSupportedInterfaceCapability()
.values().stream().findFirst()
.get()
- .getIfCapType()
- .getName());
+ .getIfCapType());
assertNull(
"the rate should be null",
tps.get(2).augmentation(
LOG.info("tpList = {}", tpList);
assertEquals(
"only IfOCHOTU4ODU4 interface capabitily expected",
- IfOCHOTU4ODU4.class,
+ IfOCHOTU4ODU4.VALUE,
tpList.get(4)
.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
.getIfCapType());
assertEquals(
"the rate should be ODU4",
- ODU4.class,
+ ODU4.VALUE,
tpList.get(4)
.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient1) {
assertThat("tp should have 2 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2",
String.valueOf(supportedInterfaceCapability.getIfCapType()),
- either(containsString(String.valueOf(If10GEODU2e.class)))
- .or(containsString(String.valueOf(If10GEODU2.class))));
+ either(containsString(String.valueOf(If10GEODU2e.VALUE)))
+ .or(containsString(String.valueOf(If10GEODU2.VALUE))));
}
List<SupportedInterfaceCapability> sicListClient3 = tpList.get(3)
.augmentation(
for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
assertThat("tp should have 3 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2, if-10GE",
String.valueOf(supportedInterfaceCapability.getIfCapType()),
- either(containsString(String.valueOf(If10GEODU2e.class)))
- .or(containsString(String.valueOf(If10GEODU2.class)))
- .or(containsString(String.valueOf(If10GE.class))));
+ either(containsString(String.valueOf(If10GEODU2e.VALUE)))
+ .or(containsString(String.valueOf(If10GEODU2.VALUE)))
+ .or(containsString(String.valueOf(If10GE.VALUE))));
}
assertThat("the rate should be ODU2 or ODU2e",
String.valueOf(tpList.get(2)
.TerminationPoint1.class)
.getXpdrTpPortConnectionAttributes()
.getRate()),
- either(containsString(String.valueOf(ODU2e.class)))
- .or(containsString(String.valueOf(ODU2.class))));
+ either(containsString(String.valueOf(ODU2e.VALUE)))
+ .or(containsString(String.valueOf(ODU2.VALUE))));
assertEquals(
"TP should be of type client",
OpenroadmTpType.XPONDERCLIENT,
assertEquals("XPDR2-NETWORK2", tpList.get(5).getTpId().getValue());
assertEquals(
"only IfOCHOTU4ODU4 interface capabitily expected",
- IfOCHOTU4ODU4.class,
+ IfOCHOTU4ODU4.VALUE,
tpList.get(5)
.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
assertThat("tp should have 2 if-cap-type: if-100GE-ODU4, if-100GE",
String.valueOf(supportedInterfaceCapability.getIfCapType()),
- either(containsString(String.valueOf(If100GEODU4.class)))
- .or(containsString(String.valueOf(If100GE.class))));
+ either(containsString(String.valueOf(If100GEODU4.VALUE)))
+ .or(containsString(String.valueOf(If100GE.VALUE))));
}
assertEquals(
"TP should be of type client", OpenroadmTpType.XPONDERCLIENT,
public static List<TerminationPoint> createTpList(boolean withTpnTsPool) {
SupportedInterfaceCapability supCapa = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(IfOCHOTU4ODU4.class)
+ .setIfCapType(IfOCHOTU4ODU4.VALUE)
.build();
Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supInterCapaList =
new HashMap<>();
.setSupportedInterfaceCapability(supInterCapaList)
.build();
XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder()
- .setRate(ODU4.class);
+ .setRate(ODU4.VALUE);
if (withTpnTsPool) {
Set<Uint16> tsPool = new HashSet<>();
for (int i = 0; i < 80; i++) {
tpnPool.add(Uint16.valueOf(i));
}
OdtuTpnPool odtuTpn = new OdtuTpnPoolBuilder()
- .setOdtuType(ODTU4TsAllocated.class)
+ .setOdtuType(ODTU4TsAllocated.VALUE)
.setTpnPool(tpnPool).build();
xtpcaBldr.setOdtuTpnPool(ImmutableMap.of(odtuTpn.key(),odtuTpn));
}
int networkPortNb, int clientPortNb,
XpdrNodeTypes xpdrNodeType) {
for (int i = 1; i <= networkPortNb; i++) {
- Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
- supportedIntf.add(IfOCH.class);
+ Set<SupportedIfCapability> supportedIntf = new HashSet<>();
+ supportedIntf.add(IfOCH.VALUE);
MappingBuilder mappingBldr = new MappingBuilder()
.setLogicalConnectionPoint("XPDR1-NETWORK" + i)
.setPortDirection("bidirectional")
mappingMap.put(mapping.key(),mapping);
}
for (int i = 1; i <= clientPortNb; i++) {
- Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
- supportedIntf.add(If100GE.class);
+ Set<SupportedIfCapability> supportedIntf = new HashSet<>();
+ supportedIntf.add(If100GE.VALUE);
Mapping mapping = new MappingBuilder()
.setLogicalConnectionPoint("XPDR1-CLIENT" + i)
.setPortDirection("bidirectional")
.setSpanLossReceive(new RatioDB(Decimal64.valueOf("25")))
.build();
Interface1 ots = new Interface1Builder().setOts(otsValue).build();
- Interface interA = new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").setType(OpticalTransport.class)
+ Interface interA = new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").setType(OpticalTransport.VALUE)
.addAugmentation(ots).build();
- Interface interC = new InterfaceBuilder().setName("OTS-DEG1-TTP-TXRX").setType(OpticalTransport.class)
+ Interface interC = new InterfaceBuilder().setName("OTS-DEG1-TTP-TXRX").setType(OpticalTransport.VALUE)
.addAugmentation(ots).build();
Optional<Interface> interOptA = Optional.of(interA);
Optional<Interface> interOptC = Optional.of(interC);
.getPathProperties().nonnullPathMetric().values();
LOG.info("GNPy : path is not feasible : {}", noPathType);
for (PathMetric pathMetric : pathMetricList) {
- String metricType = pathMetric.getMetricType().getSimpleName();
+ String metricType = pathMetric.getMetricType().toString();
Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
}
.getPathProperties().nonnullPathMetric().values();
// Path metrics
for (PathMetric pathMetric : pathMetricList) {
- String metricType = pathMetric.getMetricType().getSimpleName();
+ String metricType = pathMetric.getMetricType().toString();
Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
}
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
Type type1 = new NumUnnumHopBuilder().setNumUnnumHop(numUnnumHop).build();
// Create routeObjectIncludeExclude element
return new RouteObjectIncludeExcludeBuilder()
- .setIndex(Uint32.valueOf(index)).setExplicitRouteUsage(RouteIncludeEro.class).setType(type1).build();
+ .setIndex(Uint32.valueOf(index)).setExplicitRouteUsage(RouteIncludeEro.VALUE).setType(type1).build();
}
//Create the path constraints
if (minFrequency != null && maxFrequency != null && modulationFormat != null) {
LOG.info("Creating path constraints for rate {}, modulationFormat {}, min freq {}, max freq {}", rate,
modulationFormat, minFrequency, maxFrequency);
- ModulationFormat mformat = ModulationFormat.DpQpsk;
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat.forName(modulationFormat);
- if (optionalModulationFormat.isPresent()) {
- mformat = optionalModulationFormat.get();
+ ModulationFormat mformat = ModulationFormat.forName(modulationFormat);
+ if (mformat == null) {
+ mformat = ModulationFormat.DpQpsk;
}
spacing = GridConstant.FREQUENCY_SLOT_WIDTH_TABLE.get(Uint32.valueOf(rate), mformat);
FrequencyTHz centralFrequency = GridUtils.getCentralFrequency(
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
Fiber fiber = new FiberBuilder()
.setLength(Decimal64.valueOf(String.valueOf(length)))
- .setLengthUnits(Km.class)
+ .setLengthUnits(Km.VALUE)
.setAttIn(Decimal64.valueOf(String.valueOf(attIn)))
.setLossCoef(Decimal64.valueOf(String.valueOf(lossCoef)).scaleTo(5, RoundingMode.CEILING))
.setConIn(Decimal64.valueOf(String.valueOf(connIn)))
.build();
Params params1 = new ParamsBuilder().setFiberroadmfused(fiber).build();
return new ElementsBuilder().setUid(uidFiber)
- .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Fiber.class)
+ .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Fiber.VALUE)
.setTypeVariety(typeVariety).setMetadata(metadata1)
.setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
}
Edfa edfa = new EdfaBuilder()
.setOperational(operational).build();
return new ElementsBuilder().setUid(uidEdfa)
- .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Edfa.class)
+ .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Edfa.VALUE)
.setMetadata(metadata1).setElementType(edfa).setTypeVariety(typeVariety).build();
}
.build();
Params params1 = new ParamsBuilder().setFiberroadmfused(roadm).build();
return new ElementsBuilder().setUid(uidRoadm)
- .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Roadm.class)
+ .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Roadm.VALUE)
.setMetadata(metadata1).setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
}
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
Transceiver transceiver = new TransceiverBuilder().build();
return new ElementsBuilder().setUid(uidTrans)
- .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Transceiver.class)
+ .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Transceiver.VALUE)
.setMetadata(metadata1).setElementType(transceiver).build();
}
LOG.error("readMdSal: Error reading topology {}", nwInstanceIdentifier);
networkTransactionService.close();
returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
- throw new RuntimeException(
- "readMdSal: Error reading from operational store, topology : " + nwInstanceIdentifier + " :" + e);
+// throw new RuntimeException(
+// "readMdSal: Error reading from operational store, topology : " + nwInstanceIdentifier + " :" + e);
}
return nw;
}
}
switch (this.serviceType) {
case "400GE":
- for (Class<? extends SupportedIfCapability> ifCap : mapping.getSupportedInterfaceCapability()) {
- if (ifCap.equals(IfOtsiOtsigroup.class)) {
+ for (SupportedIfCapability ifCap : mapping.getSupportedInterfaceCapability()) {
+ if (ifCap.equals(IfOtsiOtsigroup.VALUE)) {
return true;
}
}
return false;
case "100GE":
- return mapping.getSupportedInterfaceCapability().contains(IfOCH.class)
- || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class);
+ return mapping.getSupportedInterfaceCapability().contains(IfOCH.VALUE)
+ || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE);
default:
return true;
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmNodeType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmTpType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODTU4TsAllocated;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODTUCnTs;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODTU4TsAllocated;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODTUCnTs;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Node1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.networks.network.node.termination.point.XpdrTpPortConnectionAttributes;
OpenroadmNodeType.MUXPDR,
OpenroadmNodeType.SWITCH,
OpenroadmNodeType.TPDR);
- private static final Map<String, Class<? extends SupportedIfCapability>> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
- StringConstants.SERVICE_TYPE_1GE, If1GEODU0.class,
- StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.class,
- StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.class,
- StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.class);
+ private static final Map<String, SupportedIfCapability> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
+ StringConstants.SERVICE_TYPE_1GE, If1GEODU0.VALUE,
+ StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.VALUE,
+ StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.VALUE,
+ StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.VALUE);
private static final Map<String, Integer> SERVICE_TYPE_ETH_TS_NB_MAP = Map.of(
StringConstants.SERVICE_TYPE_1GE, 1,
StringConstants.SERVICE_TYPE_10GE, 10,
for (SupportedInterfaceCapability sic :
ontTp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()) {
LOG.debug("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
- if ((sic.getIfCapType().equals(IfOCHOTU4ODU4.class)
- || sic.getIfCapType().equals(IfOtsiOtsigroup.class))
+ if ((sic.getIfCapType().equals(IfOCHOTU4ODU4.VALUE)
+ || sic.getIfCapType().equals(IfOtsiOtsigroup.VALUE))
&& (ontTp1.getXpdrTpPortConnectionAttributes() == null
|| ontTp1.getXpdrTpPortConnectionAttributes().getTsPool() == null)) {
return true;
}
private boolean checkFirstOdtuTpn(OdtuTpnPool otPool) {
- return (otPool.getOdtuType().getSimpleName().equals(ODTU4TsAllocated.class.getSimpleName())
- || otPool.getOdtuType().getSimpleName().equals(ODTUCnTs.class.getSimpleName()))
+ return (otPool.getOdtuType().equals(ODTU4TsAllocated.VALUE))
+ || otPool.getOdtuType().equals(ODTUCnTs.VALUE)
&& !otPool.getTpnPool().isEmpty();
}
ontTp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()) {
LOG.debug("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
// we could also check the administrative status of the tp
- if (SERVICE_TYPE_ETH_CLASS_MAP.get(otnServiceType).getSimpleName()
- .equals(sic.getIfCapType().getSimpleName())) {
+ if (SERVICE_TYPE_ETH_CLASS_MAP.get(otnServiceType).equals(sic.getIfCapType())) {
return true;
}
}
.TerminationPoint1Builder createOTNTerminationPoint(OpenroadmTpType openroadmTpType) {
SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(IfOCHOTU4ODU4.class)
+ .setIfCapType(IfOCHOTU4ODU4.VALUE)
.build();
SupportedInterfaceCapability supIfCapa1 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If100GEODU4.class)
+ .setIfCapType(If100GEODU4.VALUE)
.build();
SupportedInterfaceCapability supIfCapa2 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If10GEODU2e.class)
+ .setIfCapType(If10GEODU2e.VALUE)
.build();
SupportedInterfaceCapability supIfCapa3 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If1GEODU0.class)
+ .setIfCapType(If1GEODU0.VALUE)
.build();
Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supIfCapaList = new HashMap<>();
public void testPathComputationRequestPathCase() {
PathMetric pathMetric = new PathMetricBuilder()
.setAccumulativeValue(Decimal64.valueOf("21"))
- .setMetricType(PathBandwidth.class).build();
+ .setMetricType(PathBandwidth.VALUE).build();
Response response = new ResponseBuilder()
.withKey(new ResponseKey("responseId")).setResponseType(new PathCaseBuilder()
.setPathProperties(new PathPropertiesBuilder().setPathMetric(Map.of(pathMetric.key(),pathMetric))
.TerminationPoint1Builder createOTNTerminationPoint(OpenroadmTpType openroadmTpType) {
SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(IfOCHOTU4ODU4.class)
+ .setIfCapType(IfOCHOTU4ODU4.VALUE)
.build();
SupportedInterfaceCapability supIfCapa1 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If100GEODU4.class)
+ .setIfCapType(If100GEODU4.VALUE)
.build();
SupportedInterfaceCapability supIfCapa2 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If10GEODU2e.class)
+ .setIfCapType(If10GEODU2e.VALUE)
.build();
SupportedInterfaceCapability supIfCapa3 = new SupportedInterfaceCapabilityBuilder()
- .setIfCapType(If1GEODU0.class)
+ .setIfCapType(If1GEODU0.VALUE)
.build();
Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supIfCapaList = new HashMap<>();
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
scale));
}
if (atoZDirection.getRate() != null && atoZDirection.getModulationFormat() != null) {
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(atoZDirection.getModulationFormat());
- if (optionalModulationFormat.isPresent()
+ ModulationFormat modulationFormat = ModulationFormat.forName(atoZDirection.getModulationFormat());
+ if (modulationFormat != null
&& GridConstant.FREQUENCY_WIDTH_TABLE
- .contains(atoZDirection.getRate(), optionalModulationFormat.get())) {
+ .contains(atoZDirection.getRate(), modulationFormat)) {
servicePathInputBuilder
.setNmcWidth(FrequencyGHz
.getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(atoZDirection.getRate(),
- optionalModulationFormat.get())));
+ modulationFormat)));
}
}
servicePathInputBuilder.setModulationFormat(atoZDirection.getModulationFormat())
scale));
}
if (ztoADirection.getRate() != null && ztoADirection.getModulationFormat() != null) {
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(ztoADirection.getModulationFormat());
- if (optionalModulationFormat.isPresent()
+ ModulationFormat modulationFormat = ModulationFormat.forName(ztoADirection.getModulationFormat());
+ if (modulationFormat != null
&& GridConstant.FREQUENCY_WIDTH_TABLE
- .contains(ztoADirection.getRate(), optionalModulationFormat.get())) {
+ .contains(ztoADirection.getRate(), modulationFormat)) {
servicePathInputBuilder.setNmcWidth(FrequencyGHz
.getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(ztoADirection.getRate(),
- optionalModulationFormat.get())));
+ modulationFormat)));
}
}
servicePathInputBuilder.setModulationFormat(ztoADirection.getModulationFormat())
import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOdu;
import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOtu;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes.ModulationFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.R100G;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.OtsAttributes;
.setSpeed(Uint32.valueOf(100000))
.setMtu(Uint32.valueOf(9000));
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET");
// Create Interface1 type object required for adding as augmentation
return ethInterfaceBldr.getName();
}
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
String key) {
return new InterfaceBuilder()
.setDescription(" TBD ")
throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
}
// Create generic interface
- InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.class, logicalConnPoint
+ InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.VALUE, logicalConnPoint
+ "-OTU");
otuInterfaceBldr.setSupportingInterface(supportOchInterface);
// OTU interface specific data
OtuBuilder otuIfBuilder = new OtuBuilder()
.setFec(OtuAttributes.Fec.Scfec)
- .setRate(OTU4.class);
+ .setRate(OTU4.VALUE);
// Create Interface1 type object required for adding as augmentation
// TODO look at imports of different versions of class
if (portMap == null) {
throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint
+ "-ODU");
if (portMap.getSupportingOtu4() != null) {
oduInterfaceBldr.setSupportingInterface(portMap.getSupportingOtu4());
.setPayloadType("07")
.setExpPayloadType("07");
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
.setOpu(opuBldr.build());
nodeId, logicalConnPoint));
}
// Create generic interface
- InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+ InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint));
// OCH interface specific data
"Unable to get mapping from PortMapping for node %s and logical connection port %s",
nodeId, logicalConnPoint));
}
- OchAttributes.ModulationFormat modulationFormat = OchAttributes.ModulationFormat.DpQpsk;
- Optional<OchAttributes.ModulationFormat> optionalModulationFormat = OchAttributes.ModulationFormat
+ ModulationFormat modulationFormat = OchAttributes.ModulationFormat
.forName(spectrumInformation.getModulationFormat());
- if (optionalModulationFormat.isPresent()) {
- modulationFormat = optionalModulationFormat.get();
+ if (modulationFormat == null) {
+ modulationFormat = OchAttributes.ModulationFormat.DpQpsk;
}
// OCH interface specific data
OchBuilder ocIfBuilder = new OchBuilder()
.setWavelengthNumber(spectrumInformation.getWaveLength())
.setModulationFormat(modulationFormat)
- .setRate(R100G.class)
+ .setRate(R100G.VALUE)
.setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")));
// Create Interface1 type object required for adding as augmentation
.Interface1Builder ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel
.interfaces.rev161014.Interface1Builder();
// Create generic interface
- InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+ InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint));
ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
if (mapping.getSupportingOms() == null) {
// Create generic interface
- InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.class,
+ InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
"OMS-" + mapping.getLogicalConnectionPoint());
if (mapping.getSupportingOts() != null) {
omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
if (mapping.getSupportingOts() == null) {
// Create generic interface
- InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.class, "OTS-"
+ InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
+ mapping.getLogicalConnectionPoint());
// OTS interface augmentation specific data
OtsBuilder otsIfBuilder = new OtsBuilder();
.setFec(EthAttributes.Fec.Off)
.setSpeed(Uint32.valueOf(100000));
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(mapping, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(mapping, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET");
// Create Interface1 type object required for adding as augmentation
Interface1Builder ethIf1Builder = new Interface1Builder();
spectrumInformation.getMinFrequency(), spectrumInformation.getMaxFrequency(),
spectrumInformation.getCenterFrequency());
InterfaceBuilder mcInterfaceBldr = createGenericInterfaceBuilder(portMap,
- MediaChannelTrailTerminationPoint.class,
+ MediaChannelTrailTerminationPoint.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint, "mc"))
.setSupportingInterface(portMap.getSupportingOms());
McTtpBuilder mcTtpBuilder = new McTtpBuilder()
//TODO : Check this method
String nmcName = spectrumInformation.getIdentifierFromParams(logicalConnPoint, "nmc");
InterfaceBuilder nmcInterfaceBldr = createGenericInterfaceBuilder(portMap,
- NetworkMediaChannelConnectionTerminationPoint.class, nmcName);
+ NetworkMediaChannelConnectionTerminationPoint.VALUE, nmcName);
if (logicalConnPoint.contains("DEG")) {
nmcInterfaceBldr.setSupportingInterface(mcName);
}
SpectrumInformation spectrumInformation)
throws OpenRoadmInterfaceException {
// TODO : Check this method
- ModulationFormat modulationFormat = ModulationFormat.DpQpsk;
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(spectrumInformation.getModulationFormat());
- if (optionalModulationFormat.isPresent()) {
- modulationFormat = optionalModulationFormat.get();
+ ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+ if (modulationFormat == null) {
+ modulationFormat = ModulationFormat.DpQpsk;
}
// OCH interface specific data
OchBuilder ocIfBuilder = new OchBuilder()
.setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
- .setRate(R100G.class)
+ .setRate(R100G.VALUE)
.setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setModulationFormat(modulationFormat);
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
nodeId, logicalConnPoint));
}
// Create generic interface
- InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+ InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint));
// Create Interface1 type object required for adding as augmentation
// TODO look at imports of different versions of class
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODU4");
if (mapping.getSupportingOtu4() != null) {
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOtu4());
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
}
// ODU interface specific data
- Class<? extends OduFunctionIdentity> oduFunction;
+ OduFunctionIdentity oduFunction;
MonitoringMode monitoringMode;
Opu opu = null;
if (isCTP) {
- oduFunction = ODUCTP.class;
+ oduFunction = ODUCTP.VALUE;
monitoringMode = MonitoringMode.Monitored;
} else {
// For TPDR it can be both CTP and TTP
if (mapping.getXponderType() == XpdrNodeTypes.Tpdr) {
- oduFunction = ODUTTPCTP.class;
+ oduFunction = ODUTTPCTP.VALUE;
// For switch-ponder we still use TTP
} else {
- oduFunction = ODUTTP.class;
+ oduFunction = ODUTTP.VALUE;
}
monitoringMode = MonitoringMode.Terminated;
opu = new OpuBuilder()
.build();
}
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setOduFunction(oduFunction)
.setMonitoringMode(monitoringMode)
.setOpu(opu);
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
logicalConnPoint + "-ODU");
oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
.setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
.setOpu(opuBldr.build());
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
alogicalConnPoint + "-ODU");
oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
.setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
.setOpu(opuBldr.build())
.setTxSapi(portMapA.getLcpHashVal())
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+ InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
logicalConnPoint + "-OTU");
otuInterfaceBldr.setSupportingInterface(supportOchInterface);
// OTU interface specific data
OtuBuilder otuIfBuilder = new OtuBuilder()
.setFec(OtuAttributes.Fec.Scfec)
- .setRate(OTU4.class);
+ .setRate(OTU4.VALUE);
if (apiInfoA != null) {
otuIfBuilder.setTxSapi(apiInfoA.getSapi())
.setTxDapi(apiInfoA.getDapi())
return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotName);
}
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
String key) {
return new InterfaceBuilder()
.setDescription(" TBD ")
public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
if (mapping.getSupportingOms() == null) {
// Create generic interface
- InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.class,
+ InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
"OMS-" + mapping.getLogicalConnectionPoint());
if (mapping.getSupportingOts() != null) {
omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
if (mapping.getSupportingOts() == null) {
// Create generic interface
- InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.class, "OTS-"
+ InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
+ mapping.getLogicalConnectionPoint());
// OTS interface augmentation specific data
OtsBuilder otsIfBuilder = new OtsBuilder();
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
logicalConnPoint + "-ODU4");
oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
// ODU interface specific data
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setMonitoringMode(OduAttributes.MonitoringMode.Terminated);
// Set Opu attributes
OpuBuilder opuBldr = new OpuBuilder()
.setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
.setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"));
- oduIfBuilder.setOduFunction(ODUTTP.class)
+ oduIfBuilder.setOduFunction(ODUTTP.VALUE)
.setOpu(opuBldr.build());
// Create Interface1 type object required for adding as augmentation
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
alogicalConnPoint + "-ODU4");
oduInterfaceBldr.setSupportingInterface(asupportingOtuInterface);
// ODU interface specific data
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU4.class)
+ .setRate(ODU4.VALUE)
.setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
.setTxSapi(portMapA.getLcpHashVal())
.setTxDapi(portMapZ.getLcpHashVal())
OpuBuilder opuBldr = new OpuBuilder()
.setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
.setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"));
- oduIfBuilder.setOduFunction(ODUTTP.class)
+ oduIfBuilder.setOduFunction(ODUTTP.VALUE)
.setOpu(opuBldr.build());
// Create Interface1 type object required for adding as augmentation
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.IntStream;
import org.opendaylight.transportpce.common.StringConstants;
}
// Ethernet interface specific data
EthernetBuilder ethIfBuilder = new EthernetBuilder()
- .setFec(Rsfec.class)
+ .setFec(Rsfec.VALUE)
// Default set to 400G
.setSpeed(Uint32.valueOf(400000));
// We have to differentiate if-100GE vs if-400GE
- if (portMap.getSupportedInterfaceCapability().contains(If100GE.class)) {
+ if (portMap.getSupportedInterfaceCapability().contains(If100GE.VALUE)) {
ethIfBuilder
// There could be different client pluggables on either side QSFP28-LR4 or QSFP28-FR4
// LR4-requires FEC to off, while FR4 can accept even when FEC is off
- .setFec(Off.class) // For 100G OFec mode, the fec is off
+ .setFec(Off.VALUE) // For 100G OFec mode, the fec is off
.setSpeed(Uint32.valueOf(100000));
}
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET");
// Create Interface1 type object required for adding as augmentation
SpectrumInformation spectrumInformation)
throws OpenRoadmInterfaceException {
- ModulationFormat modulationFormat = ModulationFormat.DpQpsk;
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(spectrumInformation.getModulationFormat());
- if (optionalModulationFormat.isPresent()) {
- modulationFormat = optionalModulationFormat.get();
+ ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+ if (modulationFormat == null) {
+ modulationFormat = ModulationFormat.DpQpsk;
}
// OCH interface specific data
OchBuilder ocIfBuilder = new OchBuilder()
.setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
- .setRate(R100G.class)
+ .setRate(R100G.VALUE)
.setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setModulationFormat(modulationFormat);
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
}
// Create generic interface
InterfaceBuilder
- ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+ ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint));
// Create Interface1 type object required for adding as augmentation
// TODO look at imports of different versions of class
SpectrumInformation spectrumInformation)
throws OpenRoadmInterfaceException {
- ModulationFormat modulationFormat;
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(spectrumInformation.getModulationFormat());
- if (optionalModulationFormat.isPresent()) {
- modulationFormat = optionalModulationFormat.get();
- } else {
- throw new OpenRoadmInterfaceException(
- String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+ ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+ if (modulationFormat == null) {
+ throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
}
// OTSI interface specific data
.setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
.setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setProvisionMode(ProvisionModeType.Explicit)
- .setFec(Ofec.class)
+ .setFec(Ofec.VALUE)
.setModulationFormat(modulationFormat);
// Set the Flexo values
LOG.info("Given modulation format and spectral width 50GHz {} and thus rate is 100G",
modulationFormat);
LOG.info("FOIC is 1.4 for 31.6 Gbaud and rate is 100");
- flexoBuilder.setFoicType(Foic14.class)
+ flexoBuilder.setFoicType(Foic14.VALUE)
.setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1))));
- otsiBuilder.setOtsiRate(R100GOtsi.class)
+ otsiBuilder.setOtsiRate(R100GOtsi.VALUE)
.setFlexo(flexoBuilder.build());
break;
case 200:
if (modulationFormat == ModulationFormat.DpQam16) {
LOG.info("FOIC is 2.8 for 31.6 Gbaud and rate is 200");
// FOIC rate is different
- flexoBuilder.setFoicType(Foic28.class)
+ flexoBuilder.setFoicType(Foic28.VALUE)
.setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
} else {
// default is dp-qpsk for 200G under 63.1 GBaud
- flexoBuilder.setFoicType(Foic24.class)
+ flexoBuilder.setFoicType(Foic24.VALUE)
.setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
}
- otsiBuilder.setOtsiRate(R200GOtsi.class)
+ otsiBuilder.setOtsiRate(R200GOtsi.VALUE)
.setFlexo(flexoBuilder.build());
break;
case 300:
LOG.info("Given modulation format is {} and thus rate is 300G", modulationFormat);
- flexoBuilder.setFoicType(Foic36.class)
+ flexoBuilder.setFoicType(Foic36.VALUE)
.setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
Uint8.valueOf(3))));
- otsiBuilder.setOtsiRate(R300GOtsi.class)
+ otsiBuilder.setOtsiRate(R300GOtsi.VALUE)
.setFlexo(flexoBuilder.build());
break;
case 400:
// Default baud-rate is 63.1 Gbaud
LOG.info("Given modulation format is {} and thus rate is 400G", modulationFormat);
- flexoBuilder.setFoicType(Foic48.class)
+ flexoBuilder.setFoicType(Foic48.VALUE)
.setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
Uint8.valueOf(3), Uint8.valueOf(4))));
otsiBuilder.setModulationFormat(modulationFormat)
- .setOtsiRate(R400GOtsi.class)
+ .setOtsiRate(R400GOtsi.VALUE)
.setFlexo(flexoBuilder.build());
break;
default:
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
// Create generic interface
- InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.class,
+ InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.VALUE,
spectrumInformation.getIdentifierFromParams(logicalConnPoint));
// Create Interface1 type object required for adding as augmentation
org.opendaylight.yang.gen.v1.http
nodeId, logicalConnPoint));
}
// Check the modulation format
- ModulationFormat modulationFormat;
- Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
- .forName(spectrumInformation.getModulationFormat());
- if (optionalModulationFormat.isPresent()) {
- modulationFormat = optionalModulationFormat.get();
- } else {
- throw new OpenRoadmInterfaceException(
- String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+ ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+ if (modulationFormat == null) {
+ throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
}
int serviceRate = getServiceRate(modulationFormat, spectrumInformation);
// Create an OTSI group object
boolean rateNotFound = false;
switch (serviceRate) {
case 100:
- otsiGroupBuilder.setGroupRate(R100GOtsi.class);
+ otsiGroupBuilder.setGroupRate(R100GOtsi.VALUE);
break;
case 200:
- otsiGroupBuilder.setGroupRate(R200GOtsi.class);
+ otsiGroupBuilder.setGroupRate(R200GOtsi.VALUE);
break;
case 300:
- otsiGroupBuilder.setGroupRate(R300GOtsi.class);
+ otsiGroupBuilder.setGroupRate(R300GOtsi.VALUE);
break;
case 400:
- otsiGroupBuilder.setGroupRate(R400GOtsi.class);
+ otsiGroupBuilder.setGroupRate(R400GOtsi.VALUE);
break;
default:
LOG.error("Rate {} is not supported", serviceRate);
}
// Create generic interface
- InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.class,
+ InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.VALUE,
logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"));
// Create a list
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
String interfaceOchOtsiOtsigroup = null;
- if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+ if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OCH interface
interfaceOchOtsiOtsigroup = createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+ } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// 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
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
InterfaceBuilder
- otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+ otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
logicalConnPoint + "-OTU4");
// Supporting interface list
Set<String> listSupportingOChInterface = new HashSet<>();
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);
+ .setFec(Scfec.VALUE)
+ .setRate(OTU4.VALUE);
if (apiInfoA != null) {
otuIfBuilder.setTxSapi(apiInfoA.getSapi())
.setTxDapi(apiInfoA.getDapi())
}
// Create an OTUCn object
OtuBuilder otuBuilder = new OtuBuilder()
- .setRate(OTUCn.class)
+ .setRate(OTUCn.VALUE)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
.setDegmIntervals(Uint8.valueOf(2))
String.format(RATE_EXCEPTION_MESSAGE));
}
- InterfaceBuilder otuInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+ InterfaceBuilder otuInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
logicalConnPoint + "-OTUC" + otucnrate);
// Create a list
// Depending on OCH-OTU4-ODU4 interface or OTSi-OTSi-group, supporting interface should
// reflect that
String interfaceOtu4Otucn = null;
- if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+ if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OTU4 interface
interfaceOtu4Otucn = createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportingInterface,
apiInfoA, apiInfoZ);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+ } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// Create OTUCn
interfaceOtu4Otucn = createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, supportingInterface,
apiInfoA, apiInfoZ);
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODU4");
Set<String> listSupportingOtu4Interface = new HashSet<>();
if (mapping.getSupportingOtu4() != null) {
// Create an ODU4 object
OduBuilder oduBuilder = new OduBuilder()
- .setRate(ODU4.class)
- .setOduFunction(ODUTTP.class)
+ .setRate(ODU4.VALUE)
+ .setOduFunction(ODUTTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setOpu(opuBuilder.build());
// Create an ODUCn object
OduBuilder oduBuilder = new OduBuilder()
- .setRate(ODUCn.class)
- .setOduFunction(ODUTTP.class)
+ .setRate(ODUCn.VALUE)
+ .setOduFunction(ODUTTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
- InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODUC" + oducnrate);
oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
// Create an ODUC4 object
OduBuilder oduBuilder = new OduBuilder()
- .setRate(ODUCn.class)
- .setOduFunction(ODUTTP.class)
+ .setRate(ODUCn.VALUE)
+ .setOduFunction(ODUTTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
- InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
alogicalConnPoint + ODUC + oducnrate);
// Create a list
// Create an ODUFlex object
OduBuilder oduBuilder = new OduBuilder()
- .setOduFunction(ODUTTPCTP.class)
+ .setOduFunction(ODUTTPCTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
if (rate.equals("1")) {
opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
.setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
- oduBuilder.setRate(ODU4.class);
+ oduBuilder.setRate(ODU4.VALUE);
logicalConnPoint += "-ODU4";
} else if (rate.equals("4")) {
opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
.setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
- oduBuilder.setRate(ODUflexCbr.class).setOduflexCbrService(ODUflexCbr400G.class);
+ oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
logicalConnPoint += "-ODUFLEX";
}
// Build the OPU container to the ODU builder
oduBuilder.setOpu(opuBuilder.build());
- InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+ InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
logicalConnPoint);
Set<String> listSupportingOtucnInterface = new HashSet<>();
// Create an ODUFlex object
OduBuilder oduBuilder = new OduBuilder()
- .setOduFunction(ODUTTPCTP.class)
+ .setOduFunction(ODUTTPCTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
if (rate.equals("1")) {
opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
.setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
- oduBuilder.setRate(ODU4.class);
+ oduBuilder.setRate(ODU4.VALUE);
alogicalConnPoint += "-ODU4";
} else if (rate.equals("4")) {
opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
.setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
- oduBuilder.setRate(ODUflexCbr.class).setOduflexCbrService(ODUflexCbr400G.class);
+ oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
alogicalConnPoint += "-ODUFLEX";
}
- InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
alogicalConnPoint);
// reflect that
String interfaceOdu4OducnOduflex = null;
// Depending on OTU4 or OTUCn, supporting interface should reflect that
- if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+ if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OTU4 interface
interfaceOdu4OducnOduflex = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+ } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// Create ODUCn and ODUFlex interface.
String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
interfaceOdu4OducnOduflex = interfaceOducn + "#"
// Create an ODUC4 object
OduBuilder oduBuilder = new OduBuilder()
- .setRate(ODUCn.class)
- .setOduFunction(ODUTTP.class)
+ .setRate(ODUCn.VALUE)
+ .setOduFunction(ODUTTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
- InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
logicalConnPoint + ODUC + oducnrate);
// Create a list
// Create an ODUCn object
OduBuilder oduBuilder = new OduBuilder()
- .setRate(ODUCn.class)
- .setOduFunction(ODUTTP.class)
+ .setRate(ODUCn.VALUE)
+ .setOduFunction(ODUTTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
- InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
alogicalConnPoint + ODUC + oducnrate);
// Create a list
return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, logicalConnectionPoint, spectralSlotName);
}
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
String key) {
return new org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.interfaces.grp.InterfaceBuilder()
.setDescription(" TBD ")
// Ethernet interface specific data
EthernetBuilder ethIfBuilder = new EthernetBuilder()
.setSpeed(Uint32.valueOf(1000));
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(
- portMap, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET1G");
// Create Interface1 type object required for adding as augmentation
Interface1Builder ethIf1Builder = new Interface1Builder();
nodeId, logicalConnPoint));
}
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap,
- Class<? extends InterfaceType> type, String key) {
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type, String key) {
return new InterfaceBuilder()
// .setDescription(" TBD ")
// .setCircuitId(" TBD ")
.setSpeed(Uint32.valueOf(10000));
// Create Interface1 type object required for adding as augmentation
Interface1Builder ethIf1Builder = new Interface1Builder();
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET10G").addAugmentation(ethIf1Builder.setEthernet(ethIfBuilder.build())
.build());
// Post interface on the device
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODU2e");
if (mapping.getSupportingOdu4() != null) {
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
}
- Class<? extends OduFunctionIdentity> oduFunction;
+ OduFunctionIdentity oduFunction;
MonitoringMode monitoringMode;
Opu opu = null;
ParentOduAllocation parentOduAllocation = null;
if (isCTP) {
- oduFunction = ODUCTP.class;
+ oduFunction = ODUCTP.VALUE;
monitoringMode = MonitoringMode.Monitored;
Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
.setTribSlots(tribSlots)
.build();
} else {
- oduFunction = ODUTTPCTP.class;
+ oduFunction = ODUTTPCTP.VALUE;
monitoringMode = MonitoringMode.Terminated;
opu = new OpuBuilder()
.setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
.build();
}
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU2e.class)
+ .setRate(ODU2e.VALUE)
.setOduFunction(oduFunction)
.setMonitoringMode(monitoringMode)
.setOpu(opu)
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODU0");
if (mapping.getSupportingOdu4() != null) {
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
}
- Class<? extends OduFunctionIdentity> oduFunction;
+ OduFunctionIdentity oduFunction;
MonitoringMode monitoringMode;
Opu opu = null;
ParentOduAllocation parentOduAllocation = null;
if (isCTP) {
- oduFunction = ODUCTP.class;
+ oduFunction = ODUCTP.VALUE;
monitoringMode = MonitoringMode.Monitored;
Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
.setTribSlots(tribSlots)
.build();
} else {
- oduFunction = ODUTTPCTP.class;
+ oduFunction = ODUTTPCTP.VALUE;
monitoringMode = MonitoringMode.Terminated;
opu = new OpuBuilder()
.setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
.build();
}
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU0.class)
+ .setRate(ODU0.VALUE)
.setOduFunction(oduFunction)
.setMonitoringMode(monitoringMode)
.setOpu(opu)
throw new OpenRoadmInterfaceException(
String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
}
- InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
logicalConnPoint + "-ODU2");
if (mapping.getSupportingOdu4() != null) {
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
}
- Class<? extends OduFunctionIdentity> oduFunction;
+ OduFunctionIdentity oduFunction;
MonitoringMode monitoringMode;
Opu opu = null;
ParentOduAllocation parentOduAllocation = null;
if (isCTP) {
- oduFunction = ODUCTP.class;
+ oduFunction = ODUCTP.VALUE;
monitoringMode = MonitoringMode.Monitored;
Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
.setTribSlots(tribSlots)
.build();
} else {
- oduFunction = ODUTTPCTP.class;
+ oduFunction = ODUTTPCTP.VALUE;
monitoringMode = MonitoringMode.Terminated;
opu = new OpuBuilder()
.setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
.build();
}
OduBuilder oduIfBuilder = new OduBuilder()
- .setRate(ODU2.class)
+ .setRate(ODU2.VALUE)
.setOduFunction(oduFunction)
.setMonitoringMode(monitoringMode)
.setOpu(opu)
// Ethernet interface specific data
EthernetBuilder ethIfBuilder = new EthernetBuilder()
- .setFec(Off.class)
+ .setFec(Off.VALUE)
.setSpeed(Uint32.valueOf(100000));
- InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(
- portMap, EthernetCsmacd.class,
+ InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
logicalConnPoint + "-ETHERNET-100G");
// Create Interface1 type object required for adding as augmentation
Interface1Builder ethIf1Builder = new Interface1Builder();
// Supporting interface is a list for B100G (7.1) device models
supportingInterfaceList.add(supportingInterface);
- InterfaceBuilder oduIfBuilder = createGenericInterfaceBuilder(
- portMap, OtnOdu.class, logicalConnPoint + "-ODU4")
+ InterfaceBuilder oduIfBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU4")
.setSupportingInterfaceList(supportingInterfaceList);
// Agument ODU4 specific interface data
- OduBuilder oduBuilder = new OduBuilder().setRate(ODU4.class)
- .setOduFunction(ODUTTPCTP.class)
+ OduBuilder oduBuilder = new OduBuilder().setRate(ODU4.VALUE)
+ .setOduFunction(ODUTTPCTP.VALUE)
.setMonitoringMode(MonitoringMode.Terminated);
LOG.debug("Inside the ODU4 creation {} {} {}", isNetworkPort, minTribSlotNumber.getValue(),
maxTribSlotNumber.getValue());
.setTribPortNumber(tribPortNumber)
.setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(opucnTribSlotDefList).build());
// reset the ODU function as ODUCTP and the monitoring moode
- oduBuilder.setOduFunction(ODUCTP.class)
+ oduBuilder.setOduFunction(ODUCTP.VALUE)
.setMonitoringMode(MonitoringMode.NotTerminated)
.setParentOduAllocation(parentOduAllocationBuilder.build());
}
return oduIfBuilder.getName();
}
- private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap,
- Class<? extends InterfaceType> type, String key) {
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type, String key) {
return new InterfaceBuilder()
// .setDescription(" TBD ")
// .setCircuitId(" TBD ")
}
String serviceName =
ServiceFormat.OTU.getName().equals(input.getServiceAEnd().getServiceFormat().getName())
- ? input.getServiceAEnd().getOtuServiceRate().getSimpleName()
- : input.getServiceAEnd().getOduServiceRate().getSimpleName();
+ ? input.getServiceAEnd().getOtuServiceRate().toString().split("\\{")[0]
+ : input.getServiceAEnd().getOduServiceRate().toString().split("\\{")[0];
if (!formatRateMap.get(input.getServiceAEnd().getServiceFormat()).containsKey(serviceName)) {
LOG.warn("Unable to get service-rate for service {} - unsupported service name {}",
input.getServiceName(), serviceName);
*/
package org.opendaylight.transportpce.servicehandler;
+import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.path.computation.request.input.ServiceAEnd;
public final class ModelMappingUtils {
private static final Logger LOG = LoggerFactory.getLogger(ModelMappingUtils.class);
+ private static final ImmutableMap<String, OduRateIdentity> ODU_RATE_MAP =
+ ImmutableMap.<String, OduRateIdentity>builder()
+ .put("ODU0", ODU0.VALUE)
+ .put("ODU1", ODU1.VALUE)
+ .put("ODU2", ODU2.VALUE)
+ .put("ODU2e", ODU2e.VALUE)
+ .put("ODU3", ODU3.VALUE)
+ .put("ODU4", ODU4.VALUE)
+ .put("ODUCn", ODUCn.VALUE)
+ .put("ODUflexCbr", ODUflexCbr.VALUE)
+ .put("ODUflexFlexe", ODUflexFlexe.VALUE)
+ .put("ODUflexGfp", ODUflexGfp.VALUE)
+ .put("ODUflexImp", ODUflexImp.VALUE)
+ .build();
+
+ private static final ImmutableMap<String, OtuRateIdentity> OTU_RATE_MAP =
+ ImmutableMap.<String, OtuRateIdentity>builder()
+ .put("OTU0", OTU0.VALUE)
+ .put("OTU1", OTU1.VALUE)
+ .put("OTU2", OTU2.VALUE)
+ .put("OTU2e", OTU2e.VALUE)
+ .put("OTU3", OTU3.VALUE)
+ .put("OTU4", OTU4.VALUE)
+ .put("OTUCn", OTUCn.VALUE)
+ .put("OTUflex", OTUflex.VALUE)
+ .build();
+
private ModelMappingUtils() {
}
.build();
}
- private static Class<? extends OduRateIdentity> getOduServiceRate(
- Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OduRateIdentity>
- oduServiceRate) {
- if (oduServiceRate == null) {
+ private static OduRateIdentity getOduServiceRate(OduRateIdentity oduServiceRate) {
+ if (oduServiceRate == null || !ODU_RATE_MAP.containsKey(oduServiceRate.toString())) {
+ LOG.error("ODU rate {} not recognized", oduServiceRate);
return null;
}
- String oduRate = oduServiceRate.getSimpleName();
- LOG.info("ODU rate = {}", oduRate);
- //TODO a Map would probably be more indicated here
- switch (oduRate) {
- case "ODU0":
- return ODU0.class;
- case "ODU1":
- return ODU1.class;
- case "ODU2":
- return ODU2.class;
- case "ODU2e":
- return ODU2e.class;
- case "ODU3":
- return ODU3.class;
- case "ODU4":
- return ODU4.class;
- case "ODUCn":
- return ODUCn.class;
- case "ODUflexCbr":
- return ODUflexCbr.class;
- case "ODUflexFlexe":
- return ODUflexFlexe.class;
- case "ODUflexGfp":
- return ODUflexGfp.class;
- case "ODUflexImp":
- return ODUflexImp.class;
- default:
- LOG.error("OTU rate {} not recognized", oduRate);
- }
- return null;
+ return ODU_RATE_MAP.get(oduServiceRate.toString());
}
- private static Class<? extends OtuRateIdentity> getOtuServiceRate(
- Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OtuRateIdentity>
- otuServiceRate) {
- if (otuServiceRate == null) {
+ private static OtuRateIdentity getOtuServiceRate(OtuRateIdentity otuServiceRate) {
+ if (otuServiceRate == null || !OTU_RATE_MAP.containsKey(otuServiceRate.toString())) {
+ LOG.error("OTU rate {} not recognized", otuServiceRate);
return null;
}
- String otuRate = otuServiceRate.getSimpleName();
- LOG.info("OTU rate = {}", otuRate);
- //TODO a Map would probably be more indicated here
- switch (otuRate) {
- case "OTU0":
- return OTU0.class;
- case "OTU1":
- return OTU1.class;
- case "OTU2":
- return OTU2.class;
- case "OTU2e":
- return OTU2e.class;
- case "OTU3":
- return OTU3.class;
- case "OTU4":
- return OTU4.class;
- case "OTUCn":
- return OTUCn.class;
- case "OTUflex":
- return OTUflex.class;
- default:
- LOG.error("OTU rate {} not recognized", otuRate);
- }
- return null;
+ return OTU_RATE_MAP.get(otuServiceRate.toString());
}
public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
if (inputAfter.getAdministrativeState() == AdminStates.InService
&& inputAfter.getServiceResiliency() != null
&& inputAfter.getServiceResiliency().getResiliency() != null
- && inputAfter.getServiceResiliency().getResiliency().equals(Restorable.class)) {
+ && inputAfter.getServiceResiliency().getResiliency().equals(Restorable.VALUE)) {
LOG.info("Attempting to reroute the service '{}'...", serviceInputName);
// It is used for hold off time purposes
mapServiceInputReroute.put(serviceInputName, null);
* <code> false </code> otherwise
*/
public static ComplianceCheckResult check(ServiceResiliency serviceResiliency) {
- if (serviceResiliency.getResiliency() != null) {
- switch (serviceResiliency.getResiliency().getSimpleName()) {
- case "Unprotected":
- return checkUnprotectedResiliency(serviceResiliency);
-
- case "UnprotectedDiverselyRouted":
- return checkUnprotectedDiverselyRoutedResiliency(serviceResiliency);
-
- case "Protected":
- return checkProtectedResiliency(serviceResiliency);
-
- case "Restorable":
- case "ExternalTriggerRestorable":
- return checkRestorableAndExternalTriggerRestorableResiliency(serviceResiliency);
-
- default:
- LOG.warn(LOG_RESILIENCY_TYPE_UNMANAGED);
- return new ComplianceCheckResult(false, LOG_RESILIENCY_TYPE_UNMANAGED);
- }
- } else {
+ if (serviceResiliency.getResiliency() == null) {
LOG.warn(LOG_RESILIENCY_NULL);
return new ComplianceCheckResult(false, LOG_RESILIENCY_NULL);
}
+ String serviceResiliencyType = serviceResiliency.getResiliency().toString().split("\\{")[0];
+ switch (serviceResiliencyType) {
+ case "Unprotected":
+ return checkUnprotectedResiliency(serviceResiliency);
+ case "UnprotectedDiverselyRouted":
+ return checkUnprotectedDiverselyRoutedResiliency(serviceResiliency);
+ case "Protected":
+ return checkProtectedResiliency(serviceResiliency);
+ case "Restorable":
+ case "ExternalTriggerRestorable":
+ return checkRestorableAndExternalTriggerRestorableResiliency(serviceResiliency);
+ default:
+ LOG.warn(LOG_RESILIENCY_TYPE_UNMANAGED);
+ return new ComplianceCheckResult(false, LOG_RESILIENCY_TYPE_UNMANAGED);
+ }
}
private static ComplianceCheckResult checkUnprotectedResiliency(ServiceResiliency serviceResiliency) {
changes.add(ch);
when(ch.getRootNode()).thenReturn(service);
- ServiceResiliency serviceResiliency = new ServiceResiliencyBuilder().setResiliency(Restorable.class).build();
+ ServiceResiliency serviceResiliency = new ServiceResiliencyBuilder().setResiliency(Restorable.VALUE).build();
Services serviceAfter = new ServicesBuilder(buildService(State.OutOfService, AdminStates.InService))
.setServiceResiliency(serviceResiliency)
.build();
@Test
public void testCheckWhenUnprotectedResiliencyWithWrongAttributes() {
- ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Unprotected.class);
+ ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Unprotected.VALUE);
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
public void testCheckWhenUnprotectedResiliencyWithCorrectAttributes() {
Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
new ServiceResiliencyBuilder()
- .setResiliency(Unprotected.class)
+ .setResiliency(Unprotected.VALUE)
.build())
.hasPassed());
}
@Test
public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithWrongAttributes() {
- ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.class);
+ ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE);
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
@Test
public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithCorrectAttributes() {
Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.class)
+ new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE)
.setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
}
@Test
public void testCheckWhenProtectedResiliencyWithWrongAttributes() {
- ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Protected.class);
+ ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Protected.VALUE);
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
public void testCheckWhenProtectedResiliencyWithCorrectAttributes() {
Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
new ServiceResiliencyBuilder()
- .setResiliency(Protected.class)
+ .setResiliency(Protected.VALUE)
.setRevertive(true)
.setWaitToRestore(Uint64.valueOf(1))
.setHoldoffTime(Uint64.valueOf(1))
@Test
public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithWrongAttributes() {
- ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Restorable.class);
+ ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Restorable.VALUE);
Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithCorrectAttributes() {
Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
new ServiceResiliencyBuilder()
- .setResiliency(Restorable.class)
+ .setResiliency(Restorable.VALUE)
.setRevertive(true)
.setWaitToRestore(Uint64.valueOf(1))
.setHoldoffTime(Uint64.valueOf(1))
= this.tapiContext.getTapiNode(this.tapiTopoUuid, nodeUuid);
if (tapiNode != null) {
return OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type"))
- .getValue()).get();
+ .getValue());
}
return null;
}
.setIndex(Uint8.ZERO)
.build()));
if (serviceFormat.equals(ServiceFormat.ODU)) {
- serviceZEndBuilder.setOduServiceRate(ODU4.class);
+ serviceZEndBuilder.setOduServiceRate(ODU4.VALUE);
}
if (serviceFormat.equals(ServiceFormat.OTU)) {
- serviceZEndBuilder.setOtuServiceRate(OTU4.class);
+ serviceZEndBuilder.setOtuServiceRate(OTU4.VALUE);
}
if (!serviceLayer.equals(LayerProtocolName.ETH)) {
serviceZEndBuilder
.setIndex(Uint8.ZERO)
.build()));
if (serviceFormat.equals(ServiceFormat.ODU)) {
- serviceAEndBuilder.setOduServiceRate(ODU4.class);
+ serviceAEndBuilder.setOduServiceRate(ODU4.VALUE);
}
if (serviceFormat.equals(ServiceFormat.OTU)) {
- serviceAEndBuilder.setOtuServiceRate(OTU4.class);
+ serviceAEndBuilder.setOtuServiceRate(OTU4.VALUE);
}
if (!serviceLayer.equals(LayerProtocolName.ETH)) {
serviceAEndBuilder
return null;
}
OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.get().getName().get(
- new NameKey("Node Type")).getValue()).get();
+ new NameKey("Node Type")).getValue());
if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
openroadmNodeTypeList.add(openroadmNodeType);
}
return null;
}
OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.get().getName().get(
- new NameKey("Node Type")).getValue()).get();
+ new NameKey("Node Type")).getValue());
if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
openroadmNodeTypeList.add(openroadmNodeType);
}
.getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
TapiStringConstants.MC, tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName1.key(), nepName1))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
.toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
.build();
}
- private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
- LayerProtocolName lpn) {
- Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
+ private Set<LAYERPROTOCOLQUALIFIER> createSupportedLayerProtocolQualifier(TerminationPoint tp,
+ LayerProtocolName lpn) {
+ Set<LAYERPROTOCOLQUALIFIER> sclpqSet = new HashSet<>();
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1 tp1 =
tp.augmentation(org.opendaylight.yang.gen.v1.http
.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class);
Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
.getSupportedInterfaceCapability().values();
for (SupportedInterfaceCapability sic : sicList) {
+ String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
switch (lpn.getName()) {
case "DSR":
- switch (sic.getIfCapType().getSimpleName()) {
+ switch (ifCapType) {
// 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);
+ sclpqSet.add(ODUTYPEODU0.VALUE);
+ sclpqSet.add(DIGITALSIGNALTYPEGigE.VALUE);
break;
case "If10GEODU2e":
- sclpqSet.add(ODUTYPEODU2E.class);
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(ODUTYPEODU2E.VALUE);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GEODU2":
- sclpqSet.add(ODUTYPEODU2.class);
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(ODUTYPEODU2.VALUE);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GE":
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If100GEODU4":
- sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
- sclpqSet.add(ODUTYPEODU4.class);
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
+ sclpqSet.add(ODUTYPEODU4.VALUE);
break;
case "If100GE":
- sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
break;
case "IfOCHOTU4ODU4":
case "IfOCH":
- sclpqSet.add(ODUTYPEODU4.class);
+ sclpqSet.add(ODUTYPEODU4.VALUE);
break;
default:
LOG.error("IfCapability type not managed");
}
break;
case "ODU":
- switch (sic.getIfCapType().getSimpleName()) {
+ switch (ifCapType) {
// 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(ODUTYPEODU0.VALUE);
break;
case "If10GEODU2e":
- sclpqSet.add(ODUTYPEODU2E.class);
+ sclpqSet.add(ODUTYPEODU2E.VALUE);
break;
case "If10GEODU2":
case "If10GE":
- sclpqSet.add(ODUTYPEODU2.class);
+ sclpqSet.add(ODUTYPEODU2.VALUE);
break;
case "If100GEODU4":
case "If100GE":
case "IfOCHOTU4ODU4":
case "IfOCH":
- sclpqSet.add(ODUTYPEODU4.class);
+ sclpqSet.add(ODUTYPEODU4.VALUE);
break;
default:
LOG.error("IfCapability type not managed");
}
break;
case "PHOTONIC_MEDIA":
- if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
- || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
- sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
- sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
+ if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
}
break;
default:
.setUuid(nepUuid)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
return msipl;
}
- private Set<Class<? extends LAYERPROTOCOLQUALIFIER>>
+ private Set<LAYERPROTOCOLQUALIFIER>
createSupportedCepLayerProtocolQualifier(TerminationPoint tp, LayerProtocolName lpn) {
- Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
+ Set<LAYERPROTOCOLQUALIFIER> sclpqSet = new HashSet<>();
Collection<SupportedInterfaceCapability> sicList = tp.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class)
.getTpSupportedInterfaces()
.getSupportedInterfaceCapability().values();
for (SupportedInterfaceCapability sic : sicList) {
+ String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
switch (lpn.getName()) {
case "DSR":
- switch (sic.getIfCapType().getSimpleName()) {
+ switch (ifCapType) {
case "If10GEODU2e":
- sclpqSet.add(ODUTYPEODU2E.class);
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(ODUTYPEODU2E.VALUE);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GEODU2":
- sclpqSet.add(ODUTYPEODU2.class);
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(ODUTYPEODU2.VALUE);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GE":
- sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If100GEODU4":
- sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
- sclpqSet.add(ODUTYPEODU4.class);
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
+ sclpqSet.add(ODUTYPEODU4.VALUE);
break;
case "If100GE":
- sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
break;
case "IfOCHOTU4ODU4":
case "IfOCH":
- sclpqSet.add(ODUTYPEODU4.class);
+ sclpqSet.add(ODUTYPEODU4.VALUE);
break;
default:
LOG.error("IfCapability type not managed");
}
break;
case "PHOTONIC_MEDIA":
- if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
- || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
- sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
- sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
+ if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
}
break;
default:
xpdrNetMaps.get(i).getLogicalConnectionPoint()))
.build();
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+ List<SupportedIfCapability> newSupIfCapList =
new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
xpdrNetMaps.get(i).getLogicalConnectionPoint()))
.build();
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+ List<SupportedIfCapability> newSupIfCapList =
+ new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
xpdrNetMaps.get(i).getLogicalConnectionPoint()))
.build();
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+ List<SupportedIfCapability> newSupIfCapList =
new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
name = nameBldr.setValueName("NodeEdgePoint_C").build();
}
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+ List<SupportedIfCapability> newSupIfCapList =
new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
xpdrNetMaps.get(i).getLogicalConnectionPoint()))
.build();
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+ List<SupportedIfCapability> newSupIfCapList =
new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
xpdrClMaps.get(i).getLogicalConnectionPoint()))
.build();
- List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+ List<SupportedIfCapability> newSupIfCapList =
new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
String keyword,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+ List<SupportedIfCapability> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
.setUuid(nepUuid)
.setUuid(nepUuid)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setUuid(nepUuid1)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName1.key(), nepName1))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setUuid(nepUuid2)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+ List<SupportedIfCapability> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
for (int i = 0; i < nb; i++) {
}
private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
- List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+ List<SupportedIfCapability> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
// TODO: what value should be set in total capacity and available capacity
LOG.info("SIP name = {}", String.join("+", nodeid, tpid));
return nodeRuleGroupMap;
}
- private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
- List<Class<? extends SupportedIfCapability>> sicList, LayerProtocolName lpn) {
+ private Set<LAYERPROTOCOLQUALIFIER> createSupportedLayerProtocolQualifier(
+ List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
if (sicList == null) {
- return Set.of(PHOTONICLAYERQUALIFIEROMS.class);
+ return Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE);
}
Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
LOG.info("SIC list = {}", sicList);
- for (Class<? extends SupportedIfCapability> supInterCapa : sicList) {
+ for (SupportedIfCapability supInterCapa : sicList) {
SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
.withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
.setIfCapType(supInterCapa)
.build();
supIfMap.put(supIfCapa.key(), supIfCapa);
}
- Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new HashSet<>();
+ Set<LAYERPROTOCOLQUALIFIER> sclpqList = new HashSet<>();
for (SupportedInterfaceCapability sic : supIfMap.values()) {
+ String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
switch (lpn.getName()) {
case "DSR":
- switch (sic.getIfCapType().getSimpleName()) {
+ switch (ifCapType) {
// 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);
+ sclpqList.add(ODUTYPEODU0.VALUE);
+ sclpqList.add(DIGITALSIGNALTYPEGigE.VALUE);
break;
case "If10GEODU2e":
- sclpqList.add(ODUTYPEODU2E.class);
- sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqList.add(ODUTYPEODU2E.VALUE);
+ sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GEODU2":
- sclpqList.add(ODUTYPEODU2.class);
- sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqList.add(ODUTYPEODU2.VALUE);
+ sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If10GE":
- sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+ sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
break;
case "If100GEODU4":
- sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
- sclpqList.add(ODUTYPEODU4.class);
+ sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE);
+ sclpqList.add(ODUTYPEODU4.VALUE);
break;
case "If100GE":
- sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
+ sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE);
break;
case "IfOCHOTU4ODU4":
case "IfOCH":
- sclpqList.add(ODUTYPEODU4.class);
+ sclpqList.add(ODUTYPEODU4.VALUE);
break;
default:
LOG.error("IfCapability type not managed");
}
break;
case "ODU":
- switch (sic.getIfCapType().getSimpleName()) {
+ switch (ifCapType) {
// 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(ODUTYPEODU0.VALUE);
break;
case "If10GEODU2e":
- sclpqList.add(ODUTYPEODU2E.class);
+ sclpqList.add(ODUTYPEODU2E.VALUE);
break;
case "If10GEODU2":
case "If10GE":
- sclpqList.add(ODUTYPEODU2.class);
+ sclpqList.add(ODUTYPEODU2.VALUE);
break;
case "If100GEODU4":
case "If100GE":
case "IfOCHOTU4ODU4":
case "IfOCH":
- sclpqList.add(ODUTYPEODU4.class);
+ sclpqList.add(ODUTYPEODU4.VALUE);
break;
default:
LOG.error("IfCapability type not managed");
}
break;
case "PHOTONIC_MEDIA":
- if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
- || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
- sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class);
- sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class);
+ if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+ sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+ sclpqList.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
}
break;
default:
3, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 3 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
+ hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
}
assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
assertTrue("eODU nep should support 1 kind of cep",
- nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.class)
- || splc.equals(ODUTYPEODU2.class) || splc.equals(ODUTYPEODU2E.class)
- || splc.equals(ODUTYPEODU4.class)));
+ nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
+ || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
+ || splc.equals(ODUTYPEODU4.VALUE)));
assertEquals("eODU nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, withSip);
}
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("network nep should support 1 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItem(ODUTYPEODU4.class));
+ hasItem(ODUTYPEODU4.VALUE));
assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, withSip);
}
2, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
+ hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
}
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(DIGITALSIGNALTYPE100GigE.class));
+ hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
}
2, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("OTSi nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
+ hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, withSip);
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("OTSi nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(PHOTONICLAYERQUALIFIEROMS.class));
+ hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, withSip);
3, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 3 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
+ hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("network nep should support 1 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItem(ODUTYPEODU4.class));
+ hasItem(ODUTYPEODU4.VALUE));
assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
2, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
+ hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("client nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(DIGITALSIGNALTYPE100GigE.class));
+ hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
checkCommonPartOfNep(nep, false);
checkSIP(nep, portName, nodeId, extension);
2, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("OTSi nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
+ hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
1, nep.getSupportedCepLayerProtocolQualifier().size());
assertThat("OTSi nep should support 2 kind of cep",
nep.getSupportedCepLayerProtocolQualifier(),
- hasItems(PHOTONICLAYERQUALIFIEROMS.class));
+ hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
assertEquals("OTSi nep of RDM infra should support no SIP", 0, nep.nonnullMappedServiceInterfacePoint().size());
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)
- time.sleep(10)
+ time.sleep(5)
response = test_utils.check_device_connection("SPDR-SA1")
self.assertEqual(response['status_code'], requests.codes.ok)
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)
- time.sleep(10)
+ time.sleep(5)
response = test_utils.check_device_connection("SPDR-SC1")
self.assertEqual(response['status_code'], requests.codes.ok)