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


Java OFFeaturesReply类代码示例

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


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

示例1: processOFFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply  m)
        throws IOException {
    h.thisdpid = m.getDatapathId().getLong();
    log.debug("Received features reply for switch at {} with dpid {}",
            h.getSwitchInfoString(), h.thisdpid);

    h.featuresReply = m; //temp store
    if (h.ofVersion == OFVersion.OF_10) {
        h.sendHandshakeSetConfig();
        h.setState(WAIT_CONFIG_REPLY);
    } else {
        //version is 1.3, must get switchport information
        h.sendHandshakeOFPortDescRequest();
        h.setState(WAIT_PORT_DESC_REPLY);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OFChannelHandler.java

示例2: getSwitchFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(DatapathId switchId) {
	IOFSwitchService switchService =
			(IOFSwitchService) getContext().getAttributes().
			get(IOFSwitchService.class.getCanonicalName());

	IOFSwitch sw = switchService.getSwitch(switchId);
	Future<OFFeaturesReply> future;
	OFFeaturesReply featuresReply = null;
	OFFeaturesRequest featuresRequest = sw.getOFFactory().buildFeaturesRequest().build();
	if (sw != null) {
		try {
			future = sw.writeRequest(featuresRequest);
			featuresReply = future.get(10, TimeUnit.SECONDS);
		} catch (Exception e) {
			log.error("Failure getting features reply from switch" + sw, e);
		}
	}

	return featuresReply;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:SwitchResourceBase.java

示例3: serializeFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
	/* Common to All OF Versions */			
	jGen.writeStringField("capabilities", fr.getCapabilities().toString());
	jGen.writeStringField("dpid", fr.getDatapathId().toString());
	jGen.writeNumberField("buffers", fr.getNBuffers());
	jGen.writeNumberField("tables", fr.getNTables());
	jGen.writeStringField("version", fr.getVersion().toString());

	if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
		serializePortDesc(fr.getPorts(), jGen);
	}
	if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
		String actions = "[";
		for (OFActionType action : fr.getActions()) {
			actions =  actions + action.toString() + ", ";
		}
		actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
		actions = actions + "]";
		jGen.writeStringField("actions", actions);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:22,代码来源:StatsReplySerializer.java

示例4: getFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@JsonIgnore
public OFFeaturesReply getFeaturesReply(OFFactory factory) {
	/**
     * FIXME Icky work around; if a null actions got written to storage
     * then fake up an empty one so the builder() doesn't throw
     * a NPE.  Need to root cause why someone would write a null actions.
     * This code will all be removed shortly -- needed to unblock BVS team.
     */
    Set<OFActionType> workAroundActions;
    if (actions != null)
        workAroundActions = actions;
    else
        workAroundActions = Collections.<OFActionType> emptySet();

    OFFeaturesReply featuresReply = factory.buildFeaturesReply()
            .setXid(0)
            .setDatapathId(dpid)
            .setNBuffers(buffers)
            .setNTables(tables)
            .setCapabilities(capabilities)
            .setActions(workAroundActions)
            .setPorts(toOFPortDescList(factory, ports))
            .build();
    return featuresReply;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:26,代码来源:SwitchSyncRepresentation.java

示例5: setFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
	if (portManager.getPorts().isEmpty() && featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) {
		/* ports are updated via port status message, so we
		 * only fill in ports on initial connection.
		 */
		List<OFPortDesc> OFPortDescs = featuresReply.getPorts();
		portManager.updatePorts(OFPortDescs);
	}
	this.capabilities = featuresReply.getCapabilities();
	this.buffers = featuresReply.getNBuffers();

	if (featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0 ) {
		/* OF1.3+ Per-table actions are set later in the OFTableFeaturesRequest/Reply */
		this.actions = featuresReply.getActions();
	}

	this.nTables = featuresReply.getNTables();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:OFSwitch.java

示例6: doActivateSwitchInt

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
 * Create and activate a switch, either completely new or reconnected
 * The mocked switch instance will be returned. It will be reset.
 */
private IOFSwitchBackend doActivateSwitchInt(DatapathId datapathId,
                                      SwitchDescription description,
                                      OFFeaturesReply featuresReply,
                                      boolean clearFlows)
                                      throws Exception {

    IOFSwitchBackend sw = createMock(IOFSwitchBackend.class);
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply(datapathId);
    }
    if (description == null) {
        description = createSwitchDescription();
    }
    setupSwitchForAddSwitch(sw, datapathId, description, featuresReply);
    replay(sw);
    switchManager.switchAdded(sw);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.MASTER);
    verify(sw);
    assertEquals(sw, switchManager.getSwitch(datapathId));
    // drain updates and ignore
    controller.processUpdateQueueForTesting();

    reset(sw);
    return sw;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:30,代码来源:OFSwitchManagerTest.java

示例7: setFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
	if (portManager.getPorts().isEmpty() && featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) {
		/* ports are updated via port status message, so we
		 * only fill in ports on initial connection.
		 */
		List<OFPortDesc> OFPortDescs = featuresReply.getPorts();
		portManager.updatePorts(OFPortDescs);
	}
	this.capabilities = featuresReply.getCapabilities();
	this.buffers = featuresReply.getNBuffers();

	if (featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0 ) {
		// FIXME:LOJI: OF1.3 has per table actions. This needs to be modeled / handled here
		this.actions = featuresReply.getActions();
	}
	this.tables = featuresReply.getNTables();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:19,代码来源:OFSwitch.java

示例8: serializeFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
	/* Common to All OF Versions */			
	jGen.writeStringField("capabilities", fr.getCapabilities().toString());
	jGen.writeStringField("dpid", fr.getDatapathId().toString());
	jGen.writeNumberField("buffers", fr.getNBuffers());
	jGen.writeNumberField("tables", fr.getNTables());
	jGen.writeStringField("version", fr.getVersion().toString());
	
	if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
		serializePortDesc(fr.getPorts(), jGen);
	}
	if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
		String actions = "[";
		for (OFActionType action : fr.getActions()) {
			actions =  actions + action.toString() + ", ";
		}
		actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
		actions = actions + "]";
		jGen.writeStringField("actions", actions);
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:22,代码来源:StatsReplySerializer.java

示例9: serializeFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public static void serializeFeaturesReply(OFFeaturesReply fr, JsonGenerator jGen) throws IOException, JsonProcessingException {
	/* Common to All OF Versions */
	jGen.writeStringField("capabilities", fr.getCapabilities().toString());
	jGen.writeStringField("dpid", fr.getDatapathId().toString());
	jGen.writeNumberField("buffers", fr.getNBuffers());
	jGen.writeNumberField("tables", fr.getNTables());
	jGen.writeStringField("version", fr.getVersion().toString());

	if (fr.getVersion().compareTo(OFVersion.OF_13) < 0) { // OF1.3+ break this out into port_config
		serializePortDesc(fr.getPorts(), jGen);
	}
	if (fr.getVersion().compareTo(OFVersion.OF_10) == 0) {
		String actions = "[";
		for (OFActionType action : fr.getActions()) {
			actions =  actions + action.toString() + ", ";
		}
		actions = actions.substring(0, actions.length() - 2); // remove ending space+comma
		actions = actions + "]";
		jGen.writeStringField("actions", actions);
	}
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:22,代码来源:StatsReplySerializer.java

示例10: SwitchSyncRepresentation

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
public SwitchSyncRepresentation(OFFeaturesReply fr,
                                SwitchDescription d) {
    this.dpid = fr.getDatapathId();
    this.buffers = fr.getNBuffers();
    this.tables = fr.getNTables();
    this.capabilities = fr.getCapabilities();
    this.actions = fr.getActions();
    this.ports = toSyncedPortList(fr.getPorts());

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

示例11: OFSwitchHandshakeHandler

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
/**
 * Create a new unconnected OFChannelHandler.
 * @param controller
 * @param broker
 * @throws SwitchHandshakeHandlerException
 */
OFSwitchHandshakeHandler(@Nonnull IOFConnectionBackend connection,
		@Nonnull OFFeaturesReply featuresReply,
		@Nonnull IOFSwitchManager switchManager,
		@Nonnull RoleManager roleManager,
		@Nonnull Timer timer) {
	Preconditions.checkNotNull(connection, "connection");
	Preconditions.checkNotNull(featuresReply, "featuresReply");
	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(roleManager, "roleManager");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkArgument(connection.getAuxId().equals(OFAuxId.MAIN),
			"connection must be MAIN connection but is %s", connection);

	this.switchManager = switchManager;
	this.roleManager = roleManager;
	this.mainConnection = connection;
	this.auxConnections = new ConcurrentHashMap<OFAuxId, IOFConnectionBackend>();
	this.featuresReply = featuresReply;
	this.timer = timer;
	this.switchManagerCounters = switchManager.getCounters();
	this.factory = OFFactories.getFactory(featuresReply.getVersion());
	this.roleChanger = new RoleChanger(DEFAULT_ROLE_TIMEOUT_NS);
	setState(new InitState());
	this.pendingPortStatusMsg = new ArrayList<OFPortStatus>();

	connection.setListener(this);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:34,代码来源:OFSwitchHandshakeHandler.java

示例12: processOFFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
@Override
void processOFFeaturesReply(OFFeaturesReply  m)
		throws IOException {
	featuresReply = m;

	featuresLatency = (System.currentTimeMillis() - featuresLatency) / 2;

	// Mark handshake as completed
	setState(new CompleteState());

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

示例13: createOFFeaturesReply

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的package包/类
private OFFeaturesReply createOFFeaturesReply(DatapathId datapathId) {
    OFFeaturesReply fr = factory.buildFeaturesReply()
            .setXid(0)
            .setDatapathId(datapathId)
            .setPorts(ImmutableList.<OFPortDesc>of())
            .build();
    return fr;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:OFSwitchManagerTest.java

示例14: setupSwitchForAddSwitch

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的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, DatapathId datapathId,
        SwitchDescription description, OFFeaturesReply featuresReply) {
    if (description == null) {
        description = createSwitchDescription();
    }
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply(datapathId);
    }
    List<OFPortDesc> ports = featuresReply.getPorts();

    expect(sw.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_10)).anyTimes();
    expect(sw.getStatus()).andReturn(SwitchStatus.MASTER).anyTimes();
    expect(sw.getId()).andReturn(datapathId).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(description).anyTimes();
    expect(sw.getBuffers())
            .andReturn(featuresReply.getNBuffers()).anyTimes();
    expect(sw.getNumTables())
            .andReturn(featuresReply.getNTables()).anyTimes();
    expect(sw.getCapabilities())
            .andReturn(featuresReply.getCapabilities()).anyTimes();
    expect(sw.getActions())
            .andReturn(featuresReply.getActions()).anyTimes();
    expect(sw.getPorts())
            .andReturn(ports).anyTimes();
    expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true))
            .andReturn(false).anyTimes();
    expect(sw.getInetAddress()).andReturn(null).anyTimes();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:32,代码来源:OFSwitchManagerTest.java

示例15: doActivateNewSwitch

import org.projectfloodlight.openflow.protocol.OFFeaturesReply; //导入依赖的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 IOFSwitchBackend doActivateNewSwitch(DatapathId dpid,
                                      SwitchDescription description,
                                      OFFeaturesReply featuresReply)
                                      throws Exception {
    return doActivateSwitchInt(dpid, description, featuresReply, true);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:13,代码来源:OFSwitchManagerTest.java


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