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


Java OFStatsReplyFlags类代码示例

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


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

示例1: processOFMultipartReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private void processOFMultipartReply(OFStatsReply stats) {
    log.debug("Received message {} during switch-driver " +
               "subhandshake " + "from switch {} ... " +
               stats,
               getStringId());

     if (stats.getStatsType() == OFStatsType.EXPERIMENTER) {
         try {
           OFExpPortDescReply expPortDescReply =  (OFExpPortDescReply) stats;
           expPortDes.addAll(expPortDescReply.getEntries());
           if (!expPortDescReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
               driverHandshakeComplete.set(true);
               return;
           }
          } catch (ClassCastException e) {
              log.error("Unexspected Experimenter Multipart message type {} ",
                      stats.getClass().getName());
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OFOpticalSwitch13.java

示例2: processOFStatsReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
@Override
/**
 * Accumulate a list of the OFTableFeaturesStatsReply's until there 
 * are no more remaining. Then, pass the list to the switch for 
 * parsing and configuration.
 * 
 * The assumption is that the OFMessage dispatcher will call this each
 * time, which it does. We don't loop and receive here.
 * 
 * @param m, The potential OFTableFeaturesStatsReply message we want to include
 */
void processOFStatsReply(OFStatsReply m) {
	if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
		replies.add((OFTableFeaturesStatsReply) m);
		if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
			handleTableFeaturesMessage(replies, false);
			nextState();
		} 
	} else {
		/* should only receive TABLE_FEATURES here */
		log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
	}

}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:OFSwitchHandshakeHandler.java

示例3: processOFStatsReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
@Override
/**
 * Accumulate a list of the OFTableFeaturesStatsReply's until there
 * are no more remaining. Then, pass the list to the switch for
 * parsing and configuration.
 *
 * The assumption is that the OFMessage dispatcher will call this each
 * time, which it does. We don't loop and receive here.
 *
 * @param m, The potential OFTableFeaturesStatsReply message we want to include
 */
void processOFStatsReply(OFStatsReply m) {
	if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
		replies.add((OFTableFeaturesStatsReply) m);
		if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
			handleTableFeaturesMessage(replies, false);
			nextState();
		}
	} else {
		/* should only receive TABLE_FEATURES here */
		log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
	}

}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:25,代码来源:OFSwitchHandshakeHandler.java

示例4: processOFStatisticsReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
        throws SwitchStateException {
    // Read port description
    if (m.getStatsType() != OFStatsType.PORT_DESC) {
        log.warn("Expecting port description stats but received stats "
                + "type {} from {}. Ignoring ...", m.getStatsType(),
                h.channel.getRemoteAddress());
        return;
    }
    if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        log.warn("Stats reply indicates more stats from sw {} for "
                + "port description - not currently handled",
                h.getSwitchInfoString());
    }
    h.portDescReply = (OFPortDescStatsReply) m; // temp store
    log.info("Received port desc reply for switch at {}",
            h.getSwitchInfoString());
    try {
        h.sendHandshakeSetConfig();
    } catch (IOException e) {
        log.error("Unable to send setConfig after PortDescReply. "
                + "Error: {}", e.getMessage());
    }
    h.setState(WAIT_CONFIG_REPLY);
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:27,代码来源:OFChannelHandler.java

示例5: getStatisticsReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private OFStatsReply getStatisticsReply(int transactionId,
        int count, boolean moreReplies, OFVersion version) {
    OFFactory factory = OFFactories.getFactory(version);

    List<OFFlowStatsEntry> statistics = new ArrayList<OFFlowStatsEntry>();
    for (int i = 0; i < count; ++i) {
        statistics.add(factory.buildFlowStatsEntry().build());
    }
    assertEquals(statistics.size(), count);

    org.projectfloodlight.openflow.protocol.OFStatsReply.Builder
            statsReplyBuilder = factory.buildFlowStatsReply()
                .setXid(transactionId)
                .setEntries(statistics);

    if (moreReplies) {
        statsReplyBuilder.setFlags(
                Collections.singleton(OFStatsReplyFlags.REPLY_MORE));
    }

    return statsReplyBuilder.build();
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:23,代码来源:ControllerTest.java

示例6: publishFlowStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFFlowStatsEntry> publishFlowStats(Dpid dpid,
                                                                   OFFlowStatsReply reply) {
    //TODO: Get rid of synchronized
    fullFlowStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullFlowStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OpenFlowControllerImpl.java

示例7: publishTableStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFTableStatsEntry> publishTableStats(Dpid dpid,
                                                                     OFTableStatsReply reply) {
    //TODO: Get rid of synchronized
    fullTableStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullTableStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OpenFlowControllerImpl.java

示例8: publishGroupStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFGroupStatsEntry> publishGroupStats(Dpid dpid,
                                                                     OFGroupStatsReply reply) {
    //TODO: Get rid of synchronized
    fullGroupStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullGroupStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OpenFlowControllerImpl.java

示例9: publishGroupDescStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFGroupDescStatsEntry> publishGroupDescStats(Dpid dpid,
                                                                             OFGroupDescStatsReply reply) {
    //TODO: Get rid of synchronized
    fullGroupDescStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullGroupDescStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OpenFlowControllerImpl.java

示例10: publishPortStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFPortStatsEntry> publishPortStats(Dpid dpid,
                                                                   OFPortStatsReply reply) {
    fullPortStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullPortStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:OpenFlowControllerImpl.java

示例11: processOFStatisticsReply

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
        throws SwitchStateException {
    // Read port description
    if (m.getStatsType() != OFStatsType.PORT_DESC) {
        log.warn("Expecting port description stats but received stats "
                + "type {} from {}. Ignoring ...", m.getStatsType(),
                h.channel.getRemoteAddress());
        return;
    }
    if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        log.debug("Stats reply indicates more stats from sw {} for "
                + "port description",
                h.getSwitchInfoString());
        h.portDescReplies.add((OFPortDescStatsReply)m);
        return;
    }
    else {
        h.portDescReplies.add((OFPortDescStatsReply)m);
    }
    //h.portDescReply = (OFPortDescStatsReply) m; // temp store
    log.info("Received port desc reply for switch at {}",
            h.getSwitchInfoString());
    try {
        h.sendHandshakeSetConfig();
    } catch (IOException e) {
        log.error("Unable to send setConfig after PortDescReply. "
                + "Error: {}", e.getMessage());
    }
    h.setState(WAIT_CONFIG_REPLY);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:OFChannelHandler.java

示例12: handleMessage

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
    if (isDisabled) {
        return;
    }

    try {
        switch (msg.getType()) {
            case STATS_REPLY:
                if (((OFStatsReply) msg).getStatsType() == OFStatsType.PORT) {
                    OFPortStatsReply portStatsReply = (OFPortStatsReply) msg;
                    List<OFPortStatsEntry> portStatsReplyList = portStatsReplies.get(dpid);
                    if (portStatsReplyList == null) {
                        portStatsReplyList = Lists.newCopyOnWriteArrayList();
                    }
                    portStatsReplyList.addAll(portStatsReply.getEntries());
                    portStatsReplies.put(dpid, portStatsReplyList);
                    if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
                        List<OFPortStatsEntry> statsEntries = portStatsReplies.get(dpid);
                        if (statsEntries != null) {
                            pushPortMetrics(dpid, statsEntries);
                            statsEntries.clear();
                        }
                    }
                }
                break;
            case ERROR:
                if (((OFErrorMsg) msg).getErrType() == OFErrorType.PORT_MOD_FAILED) {
                    LOG.error("port mod failed");
                }
            default:
                break;
        }
    } catch (IllegalStateException e) {
        // system is shutting down and the providerService is no longer
        // valid. Messages cannot be processed.
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:OpenFlowDeviceProvider.java

示例13: testWriteStatsRequestSuccess

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
/** write a stats request message that triggers two responses */
@Test(timeout = 5000)
public void testWriteStatsRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFFlowStatsRequest flowStatsRequest = factory.buildFlowStatsRequest().build();
    ListenableFuture<List<OFFlowStatsReply>> future = conn.writeStatsRequest(flowStatsRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));
    
    eventLoop.runTasks();
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(flowStatsRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFFlowStatsReply statsReply1 = factory.buildFlowStatsReply()
            .setXid(flowStatsRequest.getXid())
            .setFlags(Sets.immutableEnumSet(OFStatsReplyFlags.REPLY_MORE))
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(statsReply1),
            equalTo(true));
    assertThat("Future should not be complete ", future.isDone(), equalTo(false));

    OFFlowStatsReply statsReply2 = factory.buildFlowStatsReply()
            .setXid(flowStatsRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(statsReply2),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));

    assertThat(future.get(), Matchers.contains(statsReply1, statsReply2));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:40,代码来源:OFConnectionTest.java

示例14: testWriteStatsRequestSuccess

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
/** write a stats request message that triggers two responses */
@Test(timeout = 5000)
public void testWriteStatsRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFFlowStatsRequest flowStatsRequest = factory.buildFlowStatsRequest().build();
    ListenableFuture<List<OFFlowStatsReply>> future = conn.writeStatsRequest(flowStatsRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(flowStatsRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFFlowStatsReply statsReply1 = factory.buildFlowStatsReply()
            .setXid(flowStatsRequest.getXid())
            .setFlags(Sets.immutableEnumSet(OFStatsReplyFlags.REPLY_MORE))
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(statsReply1),
            equalTo(true));
    assertThat("Future should not be complete ", future.isDone(), equalTo(false));

    OFFlowStatsReply statsReply2 = factory.buildFlowStatsReply()
            .setXid(flowStatsRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(statsReply2),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));

    assertThat(future.get(), Matchers.contains(statsReply1, statsReply2));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:39,代码来源:OFConnectionTest.java

示例15: publishGroupStats

import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags; //导入依赖的package包/类
private synchronized Collection<OFGroupStatsEntry> publishGroupStats(Dpid dpid,
                                                                  OFGroupStatsReply reply) {
    //TODO: Get rid of synchronized
    fullGroupStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullGroupStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:10,代码来源:OpenFlowControllerImpl.java


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