本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFMatchV3类的典型用法代码示例。如果您正苦于以下问题:Java OFMatchV3类的具体用法?Java OFMatchV3怎么用?Java OFMatchV3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OFMatchV3类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFMatchV3类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildOFMatchV3
import org.projectfloodlight.openflow.protocol.OFMatchV3; //导入依赖的package包/类
private OFMatchV3 buildOFMatchV3() {
OFFactory of13Factory = OFFactories.getFactory(OFVersion.OF_13);
OFOxms oxms = of13Factory.oxms();
OFOxmEthType ofOxmEthType = oxms.buildEthType().setValue(EthType.IPv4).build();
OFOxmIpv4Src ofOxmIpv4Src = oxms.buildIpv4Src().setValue(IPv4Address.of(multicastGroup.sourceIP)).build();
OFOxmIpProto ofOxmIpProto = oxms.buildIpProto().setValue(IpProtocol.UDP).build();
OFOxmIpv4Dst ofOxmIpv4Dst = oxms.buildIpv4Dst().setValue(IPv4Address.of(multicastGroup.groupIP)).build();
OFOxmList oxmList = OFOxmList.of(ofOxmEthType, ofOxmIpv4Src, ofOxmIpv4Dst, ofOxmIpProto);
OFMatchV3 of13Match = of13Factory.buildMatchV3().setOxmList(oxmList).build();
return of13Match;
}
开发者ID:hksoni,项目名称:SDN-Multicast,代码行数:13,代码来源:MulticastTree.java
示例2: populateTableTMac
import org.projectfloodlight.openflow.protocol.OFMatchV3; //导入依赖的package包/类
private void populateTableTMac() throws IOException {
// match for ip packets
OFOxmEthType oxe = factory.oxms().ethType(EthType.IPv4);
OFOxmList oxmListIp = OFOxmList.of(oxe);
OFMatchV3 matchIp = factory.buildMatchV3()
.setOxmList(oxmListIp).build();
OFInstruction gotoTblIp = factory.instructions().buildGotoTable()
.setTableId(TableId.of(TABLE_IPV4_UNICAST)).build();
List<OFInstruction> instructionsIp = Collections.singletonList(gotoTblIp);
OFMessage ipEntry = factory.buildFlowAdd()
.setTableId(TableId.of(TABLE_TMAC))
.setMatch(matchIp)
.setInstructions(instructionsIp)
.setPriority(1000) // strict priority required lower than
// multicastMac
.setBufferId(OFBufferId.NO_BUFFER)
.setIdleTimeout(0)
.setHardTimeout(0)
.setXid(getNextTransactionId())
.build();
// match for mpls packets
OFOxmEthType oxmpls = factory.oxms().ethType(EthType.MPLS_UNICAST);
OFOxmList oxmListMpls = OFOxmList.of(oxmpls);
OFMatchV3 matchMpls = factory.buildMatchV3()
.setOxmList(oxmListMpls).build();
OFInstruction gotoTblMpls = factory.instructions().buildGotoTable()
.setTableId(TableId.of(TABLE_MPLS)).build();
List<OFInstruction> instructionsMpls = Collections.singletonList(gotoTblMpls);
OFMessage mplsEntry = factory.buildFlowAdd()
.setTableId(TableId.of(TABLE_TMAC))
.setMatch(matchMpls)
.setInstructions(instructionsMpls)
.setPriority(1001) // strict priority required lower than
// multicastMac
.setBufferId(OFBufferId.NO_BUFFER)
.setIdleTimeout(0)
.setHardTimeout(0)
.setXid(getNextTransactionId())
.build();
// match for everything else to send to controller. Essentially
// the table miss flow entry
populateTableMissEntry(TABLE_TMAC, true, false, false, -1);
log.debug("Adding termination-mac-rules in sw {}", getStringId());
List<OFMessage> msglist = new ArrayList<OFMessage>(2);
msglist.add(ipEntry);
msglist.add(mplsEntry);
sendMsg(msglist);
}
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:51,代码来源:OFSwitchImplCPqD13.java
示例3: populateTableTMac
import org.projectfloodlight.openflow.protocol.OFMatchV3; //导入依赖的package包/类
private void populateTableTMac() throws IOException {
// match for router-mac and ip-packets
OFOxmEthType oxe = factory.oxms().ethType(EthType.IPv4);
OFOxmEthDst dmac = factory.oxms().ethDst(getRouterMacAddr());
OFOxmList oxmListIp = OFOxmList.of(dmac, oxe);
OFMatchV3 matchIp = factory.buildMatchV3()
.setOxmList(oxmListIp).build();
OFInstruction gotoTblIp = factory.instructions().buildGotoTable()
.setTableId(TableId.of(ipv4UnicastTableId)).build();
List<OFInstruction> instructionsIp = Collections.singletonList(gotoTblIp);
OFMessage ipEntry = factory.buildFlowAdd()
.setTableId(TableId.of(tmacTableId))
.setMatch(matchIp)
.setInstructions(instructionsIp)
.setPriority(1000) // strict priority required lower than
// multicastMac
.setBufferId(OFBufferId.NO_BUFFER)
.setIdleTimeout(0)
.setHardTimeout(0)
.setXid(getNextTransactionId())
.build();
// match for router-mac and mpls packets
OFOxmEthType oxmpls = factory.oxms().ethType(EthType.MPLS_UNICAST);
OFOxmList oxmListMpls = OFOxmList.of(dmac, oxmpls);
OFMatchV3 matchMpls = factory.buildMatchV3()
.setOxmList(oxmListMpls).build();
OFInstruction gotoTblMpls = factory.instructions().buildGotoTable()
.setTableId(TableId.of(mplsTableId)).build();
List<OFInstruction> instructionsMpls = Collections.singletonList(gotoTblMpls);
OFMessage mplsEntry = factory.buildFlowAdd()
.setTableId(TableId.of(tmacTableId))
.setMatch(matchMpls)
.setInstructions(instructionsMpls)
.setPriority(1001) // strict priority required lower than
// multicastMac
.setBufferId(OFBufferId.NO_BUFFER)
.setIdleTimeout(0)
.setHardTimeout(0)
.setXid(getNextTransactionId())
.build();
log.debug("Adding termination-mac-rules in sw {}", getStringId());
List<OFMessage> msglist = new ArrayList<OFMessage>(2);
msglist.add(ipEntry);
msglist.add(mplsEntry);
write(msglist);
}
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:49,代码来源:OFSwitchImplSpringOpenTTP.java
示例4: getSwitchStatisticsForTable
import org.projectfloodlight.openflow.protocol.OFMatchV3; //导入依赖的package包/类
protected List<?> getSwitchStatisticsForTable(long switchId,
OFStatsType statType, String tableType) {
IFloodlightProviderService floodlightProvider =
(IFloodlightProviderService) getContext().getAttributes().
get(IFloodlightProviderService.class.getCanonicalName());
IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
Future<List<OFStatsReply>> future;
List<OFStatsReply> values = null;
//getting tableId from CPqD driver
TableId tableId;
if (sw != null) {
if ((tableId = ((OFSwitchImplSpringOpenTTP) sw).getTableId(tableType)) == null) {
log.error("Invalid tableType {} " + tableType);
return null;
}
OFStatsRequest<?> req = null;
if (statType == OFStatsType.FLOW) {
log.debug("Switch Flow Stats req for table {} sent to switch {}",
tableType,sw.getStringId());
OFMatchV3 match = sw.getFactory().buildMatchV3()
.setOxmList(OFOxmList.EMPTY).build();
req = sw.getFactory()
.buildFlowStatsRequest()
.setMatch(match)
.setOutPort(OFPort.ANY)
.setTableId(tableId)
.setXid(sw.getNextTransactionId()).build();
List<OFFlowStatsEntryMod> flowStats = new ArrayList<OFFlowStatsEntryMod>();
try {
future = sw.getStatistics(req);
values = future.get(10, TimeUnit.SECONDS);
for(OFStatsReply value : values){
for (OFFlowStatsEntry entry : ((OFFlowStatsReply)value).getEntries()) {
OFFlowStatsEntryMod entryMod = new OFFlowStatsEntryMod(entry, sw);
flowStats.add(entryMod);
}
}
log.debug("Switch flow Stats Entries for table {} from switch {} are {}",
tableType, sw.getStringId(), flowStats);
} catch (Exception e) {
log.error("Failure retrieving per table statistics from switch " + sw, e);
}
return flowStats;
}
}
//should never get to this point
log.error("Failure retrieving {} table statistics from switch {}",tableType, sw);
return null;
}
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:50,代码来源:SwitchResourceBase.java
注:本文中的org.projectfloodlight.openflow.protocol.OFMatchV3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论