Java 类org.projectfloodlight.openflow.protocol.oxm.OFOxmEthType 实例源码

项目:spring-open    文件:OFSwitchImplDellOSR.java   
@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;
}
项目:SDN-Multicast    文件:MulticastTree.java   
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;       
}
项目:spring-open    文件:OFSwitchImplSpringOpenTTP.java   
protected OFOxmList getIPEntryMatchList(OFFactory ofFactory, Match match) {
    Ipv4Match ipm = (Ipv4Match) match;

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

    return oxmList;
}
项目:ravikumaran201504    文件:OFSwitchImplCPqD13.java   
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);
}
项目:spring-open    文件:OFSwitchImplSpringOpenTTP.java   
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);
}