本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport.getPortSignalType方法的典型用法代码示例。如果您正苦于以下问题:Java OFPortDescPropOpticalTransport.getPortSignalType方法的具体用法?Java OFPortDescPropOpticalTransport.getPortSignalType怎么用?Java OFPortDescPropOpticalTransport.getPortSignalType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport
的用法示例。
在下文中一共展示了OFPortDescPropOpticalTransport.getPortSignalType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPortDescription
import org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport; //导入方法依赖的package包/类
/**
* Build a portDescription from a given a port description describing some
* Optical port.
*
* @param port description property type.
* @param port the port to build from.
* @return portDescription for the port.
*/
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFPortOptical port) {
checkArgument(port.getDesc().size() >= 1);
// Minimally functional fixture. This needs to be fixed as we add better support.
PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN)
&& !port.getConfig().contains(OFPortConfig.PORT_DOWN);
SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
if (port.getVersion() == OFVersion.OF_13
&& ptype == PortDescPropertyType.OPTICAL_TRANSPORT) {
// At this point, not much is carried in the optical port message.
LOG.debug("Optical transport port message {}", port.toString());
} else {
// removable once 1.4+ support complete.
LOG.debug("Unsupported optical port properties");
}
OFPortDescPropOpticalTransport desc = port.getDesc().get(0);
switch (desc.getPortSignalType()) {
// FIXME: use constants once loxi has full optical extensions
case 2: // OMS port
// Assume complete optical spectrum and 50 GHz grid
// LINC-OE is only supported optical OF device for now
return omsPortDescription(portNo, enabled,
Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(50), annotations);
case 5: // OCH port
OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
return ochPortDescription(portNo, enabled, OduSignalType.ODU4,
true, signal, annotations);
default:
break;
}
return new DefaultPortDescription(portNo, enabled, FIBER, 0, annotations);
}
示例2: buildPortDescription
import org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport; //导入方法依赖的package包/类
/**
* Build a portDescription from a given a port description describing some
* Optical port.
*
* @param port description property type.
* @param port the port to build from.
* @return portDescription for the port.
*/
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFPortOptical port,
OpenFlowOpticalSwitch opsw) {
checkArgument(!port.getDesc().isEmpty());
// Minimally functional fixture. This needs to be fixed as we add better support.
PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN)
&& !port.getConfig().contains(OFPortConfig.PORT_DOWN);
boolean adminDown = port.getConfig().contains(OFPortConfig.PORT_DOWN);
SparseAnnotations annotations = makePortAnnotation(port.getName(),
port.getHwAddr().toString(),
adminDown).build();
if (port.getVersion() == OFVersion.OF_13
&& ptype == PortDescPropertyType.OPTICAL_TRANSPORT) {
// At this point, not much is carried in the optical port message.
LOG.debug("Optical transport port message {}", port.toString());
} else {
// removable once 1.4+ support complete.
LOG.debug("Unsupported optical port properties");
}
OFPortDescPropOpticalTransport desc = port.getDesc().get(0);
switch (desc.getPortSignalType()) {
// FIXME: use constants once loxi has full optical extensions
case 2: // OMS port
// Assume complete optical spectrum and 50 GHz grid
Set<OchSignal> signals = null;
if (opsw instanceof HandlerBehaviour) {
DriverHandler driverHandler = ((HandlerBehaviour) opsw).handler();
if (driverHandler != null && driverHandler.hasBehaviour(LambdaQuery.class)) {
try {
signals = driverHandler.behaviour(LambdaQuery.class).queryLambdas(portNo);
} catch (NullPointerException e) {
signals = null;
}
}
}
Frequency minFreq;
Frequency maxFreq;
Frequency channelSpacing;
if (signals == null || signals.isEmpty()) {
minFreq = Spectrum.U_BAND_MIN;
maxFreq = Spectrum.O_BAND_MAX;
channelSpacing = Frequency.ofGHz(50);
} else {
Comparator<OchSignal> compare =
(OchSignal a, OchSignal b) -> a.spacingMultiplier() - b.spacingMultiplier();
OchSignal minOch = Collections.min(signals, compare);
OchSignal maxOch = Collections.max(signals, compare);
minFreq = minOch.centralFrequency();
maxFreq = maxOch.centralFrequency();
channelSpacing = minOch.channelSpacing().frequency();
}
return omsPortDescription(portNo, enabled, minFreq,
maxFreq, channelSpacing, annotations);
case 5: // OCH port
OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
return ochPortDescription(portNo, enabled, OduSignalType.ODU4,
true, signal, annotations);
default:
break;
}
return new DefaultPortDescription(portNo, enabled, FIBER, 0, annotations);
}