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


Java OFDescriptionStatistics类代码示例

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


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

示例1: SwitchSyncRepresentation

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
public SwitchSyncRepresentation(OFFeaturesReply fr,
                                OFDescriptionStatistics d) {
    this.dpid = fr.getDatapathId();
    this.buffers = fr.getBuffers();
    this.tables = fr.getTables();
    this.capabilities = fr.getCapabilities();
    this.actions = fr.getActions();
    this.ports = toSyncedPortList(
            ImmutablePort.immutablePortListOf(fr.getPorts()));

    this.manufacturerDescription = d.getManufacturerDescription();
    this.hardwareDescription = d.getHardwareDescription();
    this.softwareDescription = d.getSoftwareDescription();
    this.serialNumber = d.getSerialNumber();
    this.datapathDescription = d.getDatapathDescription();
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:17,代码来源:SwitchSyncRepresentation.java

示例2: doAddSwitchToStore

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/**
 * Create a switch sync representation and add it to the store and
 * notify the store listener.
 * If the description and/or features reply are null, we'll allocate
 * the default one
 */
public void doAddSwitchToStore(long dpid,
                               OFDescriptionStatistics desc,
                               OFFeaturesReply featuresReply)
                               throws Exception {
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply();
        featuresReply.setDatapathId(dpid);
    }
    if (desc == null) {
        desc = createOFDescriptionStatistics();
    }

    SwitchSyncRepresentation ssr =
            new SwitchSyncRepresentation(featuresReply, desc);
    storeClient.put(dpid, ssr);

    Iterator<Long> keysToNotify = Collections.singletonList(dpid).iterator();
    controller.getStoreListener().keysModified(keysToNotify,
                                               UpdateType.REMOTE);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:27,代码来源:ControllerTest.java

示例3: setSwitchProperties

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
@JsonIgnore
@Override
public void setSwitchProperties(OFDescriptionStatistics description) {
    setAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA, 
            description.getDatapathDescription());       
    // Supports Nicira role request
    setAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true);
    setAttribute(IBetterOFSwitch.SUPPORTS_OVSDB_TUNNEL_SETUP, true);
    
    SimpleVersion minVersion = 
            new SimpleVersion(MIN_VERSION_TTL_DECREMENT);
    try {
        SimpleVersion ovsVersion = 
                new SimpleVersion(description.getSoftwareDescription());
        if (ovsVersion.compareTo(minVersion) >= 0) {
            setAttribute(IBetterOFSwitch.SUPPORTS_NX_TTL_DECREMENT, true);
        }
    } catch (IllegalArgumentException e) {
        // ignore. We didn't understand the version
        if (log.isTraceEnabled()) {
            log.trace("Could not parse version number for switch {} from" +
                    " SoftwareDescription {}", this, description);
        }
        removeAttribute(IBetterOFSwitch.SUPPORTS_NX_TTL_DECREMENT);
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:27,代码来源:BetterOFSwitchOVS.java

示例4: processSwitchDescReply

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/**
 * Process the request for the switch description
 */
@LogMessageDoc(level="ERROR",
        message="Exception in reading description " +
                " during handshake {exception}",
        explanation="Could not process the switch description string",
        recommendation=LogMessageDoc.CHECK_SWITCH)
void processSwitchDescReply(OFStatisticsReply m) {
    try {
        // Read description, if it has been updated
        OFDescriptionStatistics description =
                new OFDescriptionStatistics();
        ChannelBuffer data =
                ChannelBuffers.buffer(description.getLength());
        OFStatistics f = m.getFirstStatistics();
        f.writeTo(data);
        description.readFrom(data);
        state.description = description;
        state.hasDescription = true;
        checkSwitchReady();
    }
    catch (Exception ex) {
        log.error("Exception in reading description " +
                  " during handshake", ex);
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:28,代码来源:Controller.java

示例5: testSetSwitchProperties

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
@Test
public void testSetSwitchProperties() {
    OFDescriptionStatistics desc = new OFDescriptionStatistics();

    desc.setDatapathDescription("My Data Path");
    desc.setSerialNumber("");
    desc.setManufacturerDescription("Big Switch Networks");
    desc.setHardwareDescription("Xenon");
    desc.setSoftwareDescription("Indigo 2");

    IOFSwitch sw = new BetterOFSwitchXenon();
    sw.setSwitchProperties(desc);
    assertEquals(desc.getDatapathDescription(),
                 sw.getAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA));
    assertEquals(true,
                 sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE));
    assertNull(sw.getAttribute(IBetterOFSwitch.SUPPORTS_OVSDB_TUNNEL_SETUP));
    assertEquals(true,
                 sw.getAttribute(IBetterOFSwitch.SUPPORTS_NX_TTL_DECREMENT));
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:21,代码来源:BetterOFSwitchXenonTest.java

示例6: getOFSwitchImpl

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
@Override
public IOFSwitch getOFSwitchImpl(String regis_desc,
        OFDescriptionStatistics description) {
    // If testing bind order, just record registered desc string
    if (test_bind_order) {
        if (bind_order == null) {
            bind_order = new ArrayList<String>();
        }
        bind_order.add(regis_desc);
        return null;
    }
    String hw_desc = description.getHardwareDescription();
    if (hw_desc.equals("version 1.1")) {
        return new Test11SwitchClass();
    }
    if (hw_desc.equals("version 1.0")) {
        return new TestSwitchClass();
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:21,代码来源:ControllerTest.java

示例7: testStatsDesc

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
@Test
public void testStatsDesc() {
	//TODO: NEED A SAMPLE OF A DESCRIPTION REPLY TO TEST AGAINST
	String message = "[\"flow_stats_reply\", 3, [{\"packet_count\": 1, \"hard_timeout\": 0, \"byte_count\": 4, \"idle_timeout\": 5, \"actions\": \"[{'output': 65533}]\", " + 
			 "\"duration_nsec\": 27000000, \"priority\": 6, \"duration_sec\": 0, \"table_id\": 25, \"cookie\": 2, \"match\": \"{}\"}]]";
	MessageParser mp = new MessageParser();
	OFStatisticsReply reply = mp.parseStatsReply(OFStatisticsType.DESC, message);
	//TESTS
	OFStatistics stat = reply.getStatistics().get(0);
	assertTrue("Returned stat is not a FlowStat class", (stat instanceof OFDescriptionStatistics));
	OFDescriptionStatistics desc = (OFDescriptionStatistics) stat;
	
	assertEquals("Datapath Description not set correctly", "A", desc.getDatapathDescription());
	assertEquals("Hardware Description not set correctly", "B", desc.getHardwareDescription());
	assertEquals("Manufacturer Description not set correctly", "C", desc.getManufacturerDescription());
	assertEquals("Serial Number not set correctly", "D", desc.getSerialNumber());
	assertEquals("Software Description not set correctly", "E", desc.getSoftwareDescription());
}
 
开发者ID:fp7-netide,项目名称:Engine,代码行数:19,代码来源:TestOFMessageParsing.java

示例8: handleDescrStatsRequest

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
private void handleDescrStatsRequest(OFMessage msg){
	OFDescriptionStatistics descrStats = mySwitch.getDescriptionStatistics();
	OFStatisticsReply reply = new OFStatisticsReply();
	reply.setStatisticType(OFStatisticsType.DESC);
	List<OFStatistics> stats = new ArrayList<OFStatistics>();
	descrStats.setHardwareDescription("FSFW: " + descrStats.getHardwareDescription());
	descrStats.setManufacturerDescription("FSFW: " + descrStats.getManufacturerDescription());
	descrStats.setSoftwareDescription("FSFW: " + descrStats.getSoftwareDescription());
	stats.add(descrStats);
	reply.setStatistics(stats);
	reply.setXid(msg.getXid());
	reply.setFlags((short)0x0000);
	reply.setLengthU(descrStats.getLength() + reply.getLength());
	try {
		ofcch.sendMessage(reply);
	} catch (IOException e1) {
		e1.printStackTrace();
	}
	return;
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:21,代码来源:Proxy.java

示例9: OFSwitchBase

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
public OFSwitchBase() {
    this.stringId = null;
    this.attributes = new ConcurrentHashMap<Object, Object>();
    this.connectedSince = null;
    this.transactionIdSource = new AtomicInteger();
    this.connected = false;
    this.statsFutureMap = new ConcurrentHashMap<Integer,OFStatisticsFuture>();
    this.featuresFutureMap = new ConcurrentHashMap<Integer,OFFeaturesReplyFuture>();
    this.iofMsgListenersMap = new ConcurrentHashMap<Integer,IOFMessageListener>();
    this.role = null;
    this.timedCache = new TimedCache<Long>(100, 5*1000 );  // 5 seconds interval
    this.portBroadcastCacheHitMap = new ConcurrentHashMap<Short, AtomicLong>();
    this.description = new OFDescriptionStatistics();
    this.lastMessageTime = System.currentTimeMillis();

    this.portManager = new PortManager();

    // Defaults properties for an ideal switch
    this.setAttribute(PROP_FASTWILDCARDS, OFMatch.OFPFW_ALL);
    this.setAttribute(PROP_SUPPORTS_OFPP_FLOOD, Boolean.valueOf(true));
    this.setAttribute(PROP_SUPPORTS_OFPP_TABLE, Boolean.valueOf(true));
    if (packetInRateThresholdHigh == 0) {
        packetInRateThresholdHigh = Integer.MAX_VALUE;
    } else {
        packetInRateThresholdLow = packetInRateThresholdHigh / 2;
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:28,代码来源:OFSwitchBase.java

示例10: getDescription

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
@JsonIgnore
public OFDescriptionStatistics getDescription() {
    OFDescriptionStatistics desc = new OFDescriptionStatistics();
    desc.setManufacturerDescription(manufacturerDescription);
    desc.setHardwareDescription(hardwareDescription);
    desc.setSoftwareDescription(softwareDescription);
    desc.setSerialNumber(serialNumber);
    desc.setDatapathDescription(datapathDescription);
    return desc;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:11,代码来源:SwitchSyncRepresentation.java

示例11: createOFDescriptionStatistics

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
private static OFDescriptionStatistics createOFDescriptionStatistics() {
    OFDescriptionStatistics desc = new OFDescriptionStatistics();
    desc.setDatapathDescription("");
    desc.setHardwareDescription("");
    desc.setManufacturerDescription("");
    desc.setSerialNumber("");
    desc.setSoftwareDescription("");
    return desc;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:10,代码来源:ControllerTest.java

示例12: setupSwitchForAddSwitch

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/** Set the mock expectations for sw when sw is passed to addSwitch
 * The same expectations can be used when a new SwitchSyncRepresentation
 * is created from the given mocked switch */
protected void setupSwitchForAddSwitch(IOFSwitch sw, long dpid,
                                       OFDescriptionStatistics desc,
                                       OFFeaturesReply featuresReply) {
    String dpidString = HexString.toHexString(dpid);

    if (desc == null) {
        desc = createOFDescriptionStatistics();
    }
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply();
        featuresReply.setDatapathId(dpid);
    }
    List<ImmutablePort> ports =
            ImmutablePort.immutablePortListOf(featuresReply.getPorts());

    expect(sw.getId()).andReturn(dpid).anyTimes();
    expect(sw.getStringId()).andReturn(dpidString).anyTimes();
    expect(sw.getDescriptionStatistics()) .andReturn(desc).atLeastOnce();
    expect(sw.getBuffers())
            .andReturn(featuresReply.getBuffers()).atLeastOnce();
    expect(sw.getTables())
            .andReturn(featuresReply.getTables()).atLeastOnce();
    expect(sw.getCapabilities())
            .andReturn(featuresReply.getCapabilities()).atLeastOnce();
    expect(sw.getActions())
            .andReturn(featuresReply.getActions()).atLeastOnce();
    expect(sw.getPorts())
            .andReturn(ports).atLeastOnce();
    expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true))
            .andReturn(false).anyTimes();
    expect(sw.getInetAddress()).andReturn(null).anyTimes();
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:36,代码来源:ControllerTest.java

示例13: doActivateSwitchInt

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/**
 * Create and activate a switch, either completely new or reconnected
 * The mocked switch instance will be returned. It wil be reset.
 */
private IOFSwitch doActivateSwitchInt(long dpid,
                                      OFDescriptionStatistics desc,
                                      OFFeaturesReply featuresReply,
                                      boolean clearFlows)
                                      throws Exception {
    controller.setAlwaysClearFlowsOnSwActivate(true);

    IOFSwitch sw = createMock(IOFSwitch.class);
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply();
        featuresReply.setDatapathId(dpid);
    }
    if (desc == null) {
        desc = createOFDescriptionStatistics();
    }
    setupSwitchForAddSwitch(sw, dpid, desc, featuresReply);
    if (clearFlows) {
        sw.clearAllFlowMods();
        expectLastCall().once();
    }

    replay(sw);
    controller.switchActivated(sw);
    verify(sw);
    assertEquals(sw, controller.getSwitch(dpid));
    // drain updates and ignore
    controller.processUpdateQueueForTesting();

    SwitchSyncRepresentation storedSwitch = storeClient.getValue(dpid);
    assertEquals(featuresReply, storedSwitch.getFeaturesReply());
    assertEquals(desc, storedSwitch.getDescription());
    reset(sw);
    return sw;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:39,代码来源:ControllerTest.java

示例14: doActivateNewSwitch

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/**
 * Create and activate a new switch with the given dpid, features reply
 * and description. If description and/or features reply are null we'll
 * allocate the default one
 * The mocked switch instance will be returned. It wil be reset.
 */
private IOFSwitch doActivateNewSwitch(long dpid,
                                      OFDescriptionStatistics desc,
                                      OFFeaturesReply featuresReply)
                                      throws Exception {
    return doActivateSwitchInt(dpid, desc, featuresReply, true);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:ControllerTest.java

示例15: doActivateOldSwitch

import org.openflow.protocol.statistics.OFDescriptionStatistics; //导入依赖的package包/类
/**
 * Create and activate a switch that's just been disconnected.
 * The mocked switch instance will be returned. It wil be reset.
 */
private IOFSwitch doActivateOldSwitch(long dpid,
                                      OFDescriptionStatistics desc,
                                      OFFeaturesReply featuresReply)
                                      throws Exception {
    return doActivateSwitchInt(dpid, desc, featuresReply, false);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:11,代码来源:ControllerTest.java


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