Examples of OFStatisticsRequest


Examples of org.openflow.protocol.OFStatisticsRequest

        statsReply = new ArrayList<OFFlowStatisticsReply>();
        List<OFStatistics> values = null;
        Future<List<OFStatistics>> future;

        // Statistics request object for getting flows
        OFStatisticsRequest req = new OFStatisticsRequest();
        req.setStatisticType(OFStatisticsType.FLOW);
        int requestLength = req.getLengthU();
        OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
        specificReq.setMatch(new OFMatch().setWildcards(0xffffffff));
        specificReq.setOutPort(outPort);
        specificReq.setTableId((byte) 0xff);
        req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
        requestLength += specificReq.getLength();
        req.setLengthU(requestLength);

        try {
            // System.out.println(sw.getStatistics(req));
            future = sw.queryStatistics(req);
            values = future.get(10, TimeUnit.SECONDS);
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

     * send a description state request
     * @throws IOException
     */
    private void sendHandshakeDescriptionStatsRequest() throws IOException {
        // Get Description to set switch-specific flags
        OFStatisticsRequest req = new OFStatisticsRequest();
        req.setStatisticType(OFStatisticsType.DESC);
        req.setXid(handshakeTransactionIds--);

        channel.write(Collections.singletonList(req));
    }
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

        IOFSwitch sw = floodlightProvider.getSwitch(switchId);
        Future<List<OFStatistics>> future;
        List<OFStatistics> values = null;
        if (sw != null) {
            OFStatisticsRequest req = new OFStatisticsRequest();
            req.setStatisticType(statType);
            int requestLength = req.getLengthU();
            if (statType == OFStatisticsType.FLOW) {
                OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
                OFMatch match = new OFMatch();
                match.setWildcards(0xffffffff);
                specificReq.setMatch(match);
                specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                specificReq.setTableId((byte) 0xff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.AGGREGATE) {
                OFAggregateStatisticsRequest specificReq = new OFAggregateStatisticsRequest();
                OFMatch match = new OFMatch();
                match.setWildcards(0xffffffff);
                specificReq.setMatch(match);
                specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                specificReq.setTableId((byte) 0xff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.PORT) {
                OFPortStatisticsRequest specificReq = new OFPortStatisticsRequest();
                specificReq.setPortNumber(OFPort.OFPP_NONE.getValue());
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.QUEUE) {
                OFQueueStatisticsRequest specificReq = new OFQueueStatisticsRequest();
                specificReq.setPortNumber(OFPort.OFPP_ALL.getValue());
                // LOOK! openflowj does not define OFPQ_ALL! pulled this from openflow.h
                // note that I haven't seen this work yet though...
                specificReq.setQueueId(0xffffffff);
                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
                requestLength += specificReq.getLength();
            } else if (statType == OFStatisticsType.DESC ||
                       statType == OFStatisticsType.TABLE) {
                // pass - nothing todo besides set the type above
            }
            req.setLengthU(requestLength);
            try {
                future = sw.queryStatistics(req);
                values = future.get(10, TimeUnit.SECONDS);
            } catch (Exception e) {
                log.error("Failure retrieving statistics from switch " + sw, e);
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

        entityClassifier.startUp(fmc);
        getMockFloodlightProvider().startUp(fmc);
        pdr.startUp(fmc);

        // The STATS_REQUEST object used when querying the switches for flows
        OFStatisticsRequest req = new OFStatisticsRequest();
        req.setStatisticType(OFStatisticsType.FLOW);
        int requestLength = req.getLengthU();
        OFFlowStatisticsRequest specificReq = new OFFlowStatisticsRequest();
        specificReq.setMatch(new OFMatch().setWildcards(0xffffffff));
        specificReq.setOutPort((short) 3);
        specificReq.setTableId((byte) 0xff);
        req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
        requestLength += specificReq.getLength();
        req.setLengthU(requestLength);

        // Actions for the STATS_REPLY object
        OFActionOutput action = new OFActionOutput((short) 3, (short) 0xffff);
        List<OFAction> actions = new ArrayList<OFAction>();
        actions.add(action);
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

        sendMessageToHandlerWithControllerReset(Collections.<OFMessage>singletonList(cr));

        List<OFMessage> msgs = getMessagesFromCapture();
        assertEquals(1, msgs.size());
        assertEquals(OFType.STATS_REQUEST, msgs.get(0).getType());
        OFStatisticsRequest sr = (OFStatisticsRequest)msgs.get(0);
        assertEquals(OFStatisticsType.DESC, sr.getStatisticType());
        // no idea why an  OFStatisticsRequest even /has/ a getStatistics()
        // methods. It really shouldn't
        assertNull(sr.getStatistics());
        verifyUniqueXids(msgs);
        assertEquals(OFChannelHandler.ChannelState.WAIT_DESCRIPTION_STAT_REPLY,
                     handler.getStateForTesting());
    }
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

  public List<OFStatistics> getFlowStatisticsForLoader()
      throws NoSwitchException, IOException, InterruptedException,
      ExecutionException, TimeoutException {
    IOFSwitch iofSwitch = this.openFlowSwitch;
    Future<List<OFStatistics>> future;
    OFStatisticsRequest req = new OFStatisticsRequest();
    OFFlowStatisticsRequest fsr = new OFFlowStatisticsRequest();
    OFMatch match = new OFMatch();
    match.setWildcards(0xffffffff);
    fsr.setMatch(match);
    fsr.setOutPort(OFPort.OFPP_NONE.getValue());
    fsr.setTableId((byte) 0xff);
    req.setStatisticType(OFStatisticsType.FLOW);
    req.setStatistics(Collections.singletonList((OFStatistics) fsr));
    req.setLengthU(req.getLengthU() + fsr.getLength());

    if (iofSwitch == null) {
      throw new NoSwitchException();

    }
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

    Future<List<OFStatistics>> future;
    IOFSwitch iofSwitch = this.openFlowSwitch;
    if(iofSwitch == null){
      throw new NoSwitchException(HexString.toHexString(this.datapathId));
    }
    OFStatisticsRequest req = new OFStatisticsRequest();
    OFPortStatisticsRequest fsr = new OFPortStatisticsRequest();
    fsr.setPortNumber(OFPort.OFPP_NONE.getValue());
    req.setStatisticType(OFStatisticsType.PORT);
    req.setStatistics(Collections.singletonList((OFStatistics) fsr));
    req.setLengthU(fsr.getLength() + req.getLength());
    List<OFStatistics> values = null;
 

        future = iofSwitch.getStatistics(req);
       
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

    Future<List<OFStatistics>> futureTable;
    IOFSwitch iofSwitch = this.openFlowSwitch;
    if(iofSwitch == null){
      throw new NoSwitchException(HexString.toHexString(this.datapathId));
    }
    OFStatisticsRequest reqTable = new OFStatisticsRequest();

    reqTable.setStatisticType(OFStatisticsType.TABLE);
    reqTable.setLengthU(reqTable.getLengthU());

 
   
        futureTable = iofSwitch.getStatistics(reqTable);
        List<OFStatistics> values = null;
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

    Future<List<OFStatistics>> future;
    IOFSwitch iofSwitch = this.openFlowSwitch;
    if(iofSwitch == null){
      throw new NoSwitchException(HexString.toHexString(this.datapathId));
    }
    OFStatisticsRequest req = new OFStatisticsRequest();
    OFFlowStatisticsRequest fsr = new OFFlowStatisticsRequest();
    OFMatch match = new OFMatch();
    match.setWildcards(0xffffffff);
    fsr.setMatch(match);
    fsr.setOutPort(OFPort.OFPP_NONE.getValue());
    fsr.setTableId((byte) 0xff);
    req.setStatisticType(OFStatisticsType.FLOW);
    req.setStatistics(Collections.singletonList((OFStatistics) fsr));
    req.setLengthU(req.getLengthU() + fsr.getLength());

 
      future = iofSwitch.getStatistics(req);
      List<OFStatistics> futureValues = null;
View Full Code Here

Examples of org.openflow.protocol.OFStatisticsRequest

    IOFSwitch iofSwitch = this.openFlowSwitch;
    if(iofSwitch == null){
     
    }

    OFStatisticsRequest req = new OFStatisticsRequest();
    OFAggregateStatisticsRequest fsr = new OFAggregateStatisticsRequest();

    req.setStatisticType(OFStatisticsType.AGGREGATE);
    req.setStatistics(Collections.singletonList((OFStatistics) fsr));
    req.setLengthU(fsr.getLength() + req.getLength());

   
      future = iofSwitch.getStatistics(req);
      List<OFStatistics> values = null;
      values = future.get(10, TimeUnit.SECONDS);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.