本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport类的典型用法代码示例。如果您正苦于以下问题:Java OFPortDescPropOpticalTransport类的具体用法?Java OFPortDescPropOpticalTransport怎么用?Java OFPortDescPropOpticalTransport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFPortDescPropOpticalTransport类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFPortDescPropOpticalTransport类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOpticalPort
import org.projectfloodlight.openflow.protocol.OFPortDescPropOpticalTransport; //导入依赖的package包/类
/**
* Creates an OpenFlow optical port based on the given port and transport type.
*
* @param port OpenFlow optical port
* @param type transport type
* @return OpenFlow optical port
*/
private OFPortOptical createOpticalPort(OFPortOptical port, short type) {
List<OFPortDescPropOpticalTransport> descList = new ArrayList<>(port.getDesc().size());
for (OFPortDescPropOpticalTransport desc : port.getDesc()) {
OFPortDescPropOpticalTransport newDesc = desc.createBuilder()
.setType(desc.getType())
.setPortSignalType(type)
.setPortType(desc.getPortType())
.setReserved(desc.getReserved())
.build();
descList.add(newDesc);
}
OFPortOptical newPort = port.createBuilder()
.setConfig(port.getConfig())
.setDesc(descList)
.setHwAddr(port.getHwAddr())
.setName(port.getName())
.setPortNo(port.getPortNo())
.setState(port.getState())
.build();
return newPort;
}
示例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) {
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);
}
示例3: 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);
}