本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType.OTU2属性的典型用法代码示例。如果您正苦于以下问题:Java OFPortOpticalTransportSignalType.OTU2属性的具体用法?Java OFPortOpticalTransportSignalType.OTU2怎么用?Java OFPortOpticalTransportSignalType.OTU2使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.projectfloodlight.openflow.protocol.OFPortOpticalTransportSignalType
的用法示例。
在下文中一共展示了OFPortOpticalTransportSignalType.OTU2属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPortDescription
/**
* Build a portDescription from a given a port description describing some
* Optical port.
*
* @param ptype description property type.
* @param port the port to build from.
* @return portDescription for the port.
*/
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFExpPort port) {
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());
OFExpPortDescPropOpticalTransport firstProp = port.getProperties().get(0);
OFPortOpticalTransportSignalType sigType = firstProp.getPortSignalType();
PortDescription portDes = null;
switch (sigType) {
case OMSN:
portDes = omsPortDescription(portNo, enabled,
FREQ191_7, FREQ191_7.add(FREQ4_4), FREQ50, annotations);
break;
case OCH:
OFExpPortOpticalTransportLayerEntry entry = firstProp.getFeatures().get(0).getValue().get(0);
OFPortOpticalTransportLayerClass layerClass = entry.getLayerClass();
if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
LOG.error("Unsupported layer Class {} ", layerClass);
return null;
}
// convert to ONOS OduSignalType
OduSignalType oduSignalType = OpenFlowDeviceValueMapper.
lookupOduSignalType((byte) entry.getSignalType());
//OchSignal is needed for OchPortDescription constructor,
//yet not relevant for tunable OCH port, creating with default parameters
OchSignal signalId = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 1, 1);
portDes = ochPortDescription(portNo, enabled,
oduSignalType, true,
signalId, annotations);
break;
case OTU2:
case OTU4:
entry = firstProp.getFeatures().get(0).getValue().get(0);
layerClass = entry.getLayerClass();
if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
LOG.error("Unsupported layer Class {} ", layerClass);
return null;
}
// convert to ONOS OduSignalType
OduSignalType oduSignalTypeOtuPort = OpenFlowDeviceValueMapper.
lookupOduSignalType((byte) entry.getSignalType());
if (!matchingOtuPortSignalTypes(sigType, oduSignalTypeOtuPort)) {
LOG.error("Wrong oduSignalType {} for OTU Port sigType {} ", oduSignalTypeOtuPort, sigType);
return null;
}
OtuSignalType otuSignalType =
((sigType == OFPortOpticalTransportSignalType.OTU2) ? OtuSignalType.OTU2 :
OtuSignalType.OTU4);
portDes = otuPortDescription(portNo, enabled, otuSignalType, annotations);
break;
default:
break;
}
return portDes;
}
示例2: buildPortDescription
/**
* Build a portDescription from a given a port description describing some
* Optical port.
*
* @param ptype description property type.
* @param port the port to build from.
* @return portDescription for the port.
*/
private PortDescription buildPortDescription(PortDescPropertyType ptype, OFExpPort port) {
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();
OFExpPortDescPropOpticalTransport firstProp = port.getProperties().get(0);
OFPortOpticalTransportSignalType sigType = firstProp.getPortSignalType();
PortDescription portDes = null;
switch (sigType) {
case OMSN:
portDes = omsPortDescription(portNo, enabled,
FREQ191_7, FREQ191_7.add(FREQ4_4), FREQ50, annotations);
break;
case OCH:
OFExpPortOpticalTransportLayerEntry entry = firstProp.getFeatures().get(0).getValue().get(0);
OFPortOpticalTransportLayerClass layerClass = entry.getLayerClass();
if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
LOG.error("Unsupported layer Class {} ", layerClass);
return null;
}
// convert to ONOS OduSignalType
OduSignalType oduSignalType = OpenFlowDeviceValueMapper.
lookupOduSignalType((byte) entry.getSignalType());
//OchSignal is needed for OchPortDescription constructor,
//yet not relevant for tunable OCH port, creating with default parameters
OchSignal signalId = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 1, 1);
portDes = ochPortDescription(portNo, enabled,
oduSignalType, true,
signalId, annotations);
break;
case OTU2:
case OTU4:
entry = firstProp.getFeatures().get(0).getValue().get(0);
layerClass = entry.getLayerClass();
if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) {
LOG.error("Unsupported layer Class {} ", layerClass);
return null;
}
// convert to ONOS OduSignalType
OduSignalType oduSignalTypeOtuPort = OpenFlowDeviceValueMapper.
lookupOduSignalType((byte) entry.getSignalType());
if (!matchingOtuPortSignalTypes(sigType, oduSignalTypeOtuPort)) {
LOG.error("Wrong oduSignalType {} for OTU Port sigType {} ", oduSignalTypeOtuPort, sigType);
return null;
}
OtuSignalType otuSignalType =
((sigType == OFPortOpticalTransportSignalType.OTU2) ? OtuSignalType.OTU2 :
OtuSignalType.OTU4);
portDes = otuPortDescription(portNo, enabled, otuSignalType, annotations);
break;
default:
break;
}
return portDes;
}