public CreatePhysicalPortCommand(NbiPort nbiPort, String defaultTopologyName) { setNmsPortId(nbiPort.getNmsPortId()); setNocLabel(nbiPort.getSuggestedNocLabel()); setBodPortId(nbiPort.getNmsNeId()); this.allowedVlan = nbiPort.getVlan().map(Vlan::toRangeString).orElse(""); this.topologyName = defaultTopologyName; }
private List<InterfaceType> availableInterfaceTypes(NbiPort nbiPort) { List<PhysicalPort> allocatedPorts = physicalPortService.findAllocatedByNmsPortId(nbiPort.getNmsPortId()); Set<InterfaceType> allocatedInterfaceTypes = allocatedPorts.stream().map(PhysicalPort::getInterfaceType).collect(Collectors.toSet()); if (allocatedInterfaceTypes.contains(InterfaceType.E_NNI)) { return Arrays.asList(InterfaceType.E_NNI); } else if (allocatedInterfaceTypes.contains(InterfaceType.UNI)) { return Arrays.asList(InterfaceType.UNI); } else { return Arrays.asList(InterfaceType.values()); } }