本文整理汇总了Java中org.projectfloodlight.openflow.types.OFVlanVidMatch.ofRawVid方法的典型用法代码示例。如果您正苦于以下问题:Java OFVlanVidMatch.ofRawVid方法的具体用法?Java OFVlanVidMatch.ofRawVid怎么用?Java OFVlanVidMatch.ofRawVid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.projectfloodlight.openflow.types.OFVlanVidMatch
的用法示例。
在下文中一共展示了OFVlanVidMatch.ofRawVid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapSelector
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入方法依赖的package包/类
@Override
public OFOxm<?> mapSelector(OFFactory factory, ExtensionSelector extensionSelector) {
ExtensionSelectorType type = extensionSelector.type();
if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId();
// Special VLAN 0x0000/0x1FFF required by OFDPA
if (vlanId.equals(VlanId.NONE)) {
OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid((short) 0x0000);
OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF);
return factory.oxms().vlanVidMasked(vid, mask);
// Normal case
} else if (vlanId.equals(VlanId.ANY)) {
return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
} else {
return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
}
}
throw new UnsupportedOperationException(
"Unexpected ExtensionSelector: " + extensionSelector.toString());
}
示例2: mapInstruction
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入方法依赖的package包/类
@Override
public OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment) {
ExtensionTreatmentType type = extensionTreatment.type();
if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_SET_VLAN_ID.type())) {
VlanId vlanId = ((OfdpaSetVlanVid) extensionTreatment).vlanId();
// NOTE: OFDPA requires isPresent bit set to zero.
OFVlanVidMatch match = OFVlanVidMatch.ofRawVid(vlanId.toShort());
return factory.actions().setField(factory.oxms().vlanVid(match));
}
throw new UnsupportedOperationException(
"Unexpected ExtensionTreatment: " + extensionTreatment.toString());
}