当前位置: 首页>>代码示例>>Java>>正文


Java OFOxmEthDst类代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst的典型用法代码示例。如果您正苦于以下问题:Java OFOxmEthDst类的具体用法?Java OFOxmEthDst怎么用?Java OFOxmEthDst使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFOxmEthDst类属于org.projectfloodlight.openflow.protocol.oxm包,在下文中一共展示了OFOxmEthDst类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDestAction

import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst; //导入依赖的package包/类
private OFAction getDestAction(int portnum) {
    OFAction setDA = null;
    MacAddress dAddr = null;
    if (getId() == 0x1 && portnum == 6) { // connected to switch 2
        dAddr = MacAddress.of("00:00:02:02:02:80");
    }
    if (getId() == 0x2) {
        if (portnum == 1) { // connected to sw 1
            dAddr = MacAddress.of("00:00:01:01:01:80");
        } else if (portnum == 2) { // connected to sw 3
            dAddr = MacAddress.of("00:00:07:07:07:80");
        }
    }
    if (getId() == 0x3) {
        if (portnum == 2) { // connected to switch 2
            dAddr = MacAddress.of("00:00:02:02:02:80");
        }
    }

    if (dAddr != null) {
        OFOxmEthDst dstAddr = factory.oxms().ethDst(dAddr);
        setDA = factory.actions().buildSetField()
                .setField(dstAddr).build();
    }
    return setDA;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:27,代码来源:OFSwitchImplCPqD13.java

示例2: getIPEntryMatchList

import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst; //导入依赖的package包/类
@Override
protected OFOxmList getIPEntryMatchList(OFFactory ofFactory, Match match) {
    /* For Dell Switches, the IP entry match list shall
     * also include destination mac matching rule
     */
    Ipv4Match ipm = (Ipv4Match) match;

    IPv4Net ipdst = ipm.getDestination();
    OFOxmEthType ethTypeIp = ofFactory.oxms()
            .ethType(EthType.IPv4);
    OFOxmEthDst dmac = ofFactory.oxms().ethDst(getRouterMacAddr());
    OFOxmIpv4DstMasked ipPrefix = ofFactory.oxms()
            .ipv4DstMasked(
                    IPv4Address.of(ipdst.address().value()),
                    IPv4Address.ofCidrMaskLength(ipdst.prefixLen())
            );
    OFOxmList oxmList = OFOxmList.of(ethTypeIp, dmac, ipPrefix);

    return oxmList;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:21,代码来源:OFSwitchImplDellOSR.java

示例3: populateTableTMac

import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst; //导入依赖的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


注:本文中的org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。