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


Java U32类代码示例

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


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

示例1: sendHandshakeHelloMessage

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Send hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHandshakeHelloMessage() throws IOException {
    // The OF protocol requires us to start things off by sending the highest
    // version of the protocol supported.

    // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3 (ofp_version=0x04)
    // see Sec. 7.5.1 of the OF1.3.4 spec
    U32 bitmap = U32.ofRaw(0x00000012);
    OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
            .setBitmaps(Collections.singletonList(bitmap))
            .build();
    OFMessage.Builder mb = factory13.buildHello()
            .setXid(this.handshakeTransactionIds--)
            .setElements(Collections.singletonList(hem));
    log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
    channel.write(Collections.singletonList(mb.build()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:OFChannelHandler.java

示例2: OFChannelInitializer

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
public OFChannelInitializer(IOFSwitchManager switchManager,
		INewOFConnectionListener connectionListener,
		IDebugCounterService debugCounters,
		Timer timer,
		List<U32> ofBitmaps,
		OFFactory defaultFactory,
		String keyStore, 
		String keyStorePassword) {
	super();
	this.switchManager = switchManager;
	this.connectionListener = connectionListener;
	this.timer = timer;
	this.debugCounters = debugCounters;
	this.defaultFactory = defaultFactory;
	this.ofBitmaps = ofBitmaps;
	this.keyStore = keyStore;
	this.keyStorePassword = keyStorePassword;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:19,代码来源:OFChannelInitializer.java

示例3: OFChannelHandler

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Creates a handler for interacting with the switch channel
 *
 * @param controller
 *            the controller
 * @param newConnectionListener
 *            the class that listens for new OF connections (switchManager)
 * @param pipeline
 *            the channel pipeline
 * @param threadPool
 *            the thread pool
 * @param idleTimer
 *            the hash wheeled timer used to send idle messages (echo).
 *            passed to constructor to modify in case of aux connection.
 * @param debugCounters
 */
OFChannelHandler(@Nonnull IOFSwitchManager switchManager,
		@Nonnull INewOFConnectionListener newConnectionListener,
		@Nonnull ChannelPipeline pipeline,
		@Nonnull IDebugCounterService debugCounters,
		@Nonnull Timer timer,
		@Nonnull List<U32> ofBitmaps,
		@Nonnull OFFactory defaultFactory) {

	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(newConnectionListener, "connectionOpenedListener");
	Preconditions.checkNotNull(pipeline, "pipeline");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkNotNull(debugCounters, "debugCounters");

	this.pipeline = pipeline;
	this.debugCounters = debugCounters;
	this.newConnectionListener = newConnectionListener;
	this.counters = switchManager.getCounters();
	this.state = new InitState();
	this.timer = timer;
	this.ofBitmaps = ofBitmaps;
	this.factory = defaultFactory;

	log.debug("constructor on OFChannelHandler {}", String.format("%08x", System.identityHashCode(this)));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:42,代码来源:OFChannelHandler.java

示例4: computeOFVersionFromBitmap

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Determine the highest supported version of OpenFlow in common
 * between both our OFVersion bitmap and the switch's.
 * 
 * @param theirs, the version bitmaps of the switch
 * @return the highest OFVersion in common b/t the two
 */
private OFVersion computeOFVersionFromBitmap(List<U32> theirs) {		
	Iterator<U32> theirsItr = theirs.iterator();
	Iterator<U32> oursItr = ofBitmaps.iterator();
	OFVersion version = null;
	int pos = 0;
	int size = 32;
	while (theirsItr.hasNext() && oursItr.hasNext()) {
		int t = theirsItr.next().getRaw();
		int o = oursItr.next().getRaw();

		int common = t & o; /* Narrow down the results to the common bits */
		for (int i = 0; i < size; i++) { /* Iterate over and locate the 1's */
			int tmp = common & (1 << i); /* Select the bit of interest, 0-31 */
			if (tmp != 0) { /* Is the version of this bit in common? */
				for (OFVersion v : OFVersion.values()) { /* Which version does this bit represent? */
					if (v.getWireVersion() == i + (size * pos)) {
						version = v;
					}
				}
			}
		}
		pos++; /* OFVersion position. 1-31 = 1, 32 - 63 = 2, etc. Inc at end so it starts at 0. */
	}
	return version;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:33,代码来源:OFChannelHandler.java

示例5: createTableFeaturesStatsReply

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
protected OFTableFeaturesStatsReply createTableFeaturesStatsReply() {
	OFTableFeaturesStatsReply statsReply = factory.buildTableFeaturesStatsReply()
			.setEntries(Collections.singletonList(factory.buildTableFeatures()
					.setConfig(0)
					.setMaxEntries(100)
					.setMetadataMatch(U64.NO_MASK)
					.setMetadataWrite(U64.NO_MASK)
					.setName("MyTable")
					.setTableId(TableId.of(1))
					.setProperties(Collections.singletonList((OFTableFeatureProp)factory.buildTableFeaturePropMatch()
							.setOxmIds(Collections.singletonList(U32.of(100)))
							.build())
							).build()
					)

					).build();
	return statsReply;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:19,代码来源:OFSwitchHandlerTestBase.java

示例6: computeOFVersionFromBitmap

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Determine the highest supported version of OpenFlow in common
 * between both our OFVersion bitmap and the switch's.
 *
 * @param theirs, the version bitmaps of the switch
 * @return the highest OFVersion in common b/t the two
 */
private OFVersion computeOFVersionFromBitmap(List<U32> theirs) {
	Iterator<U32> theirsItr = theirs.iterator();
	Iterator<U32> oursItr = ofBitmaps.iterator();
	OFVersion version = null;
	int pos = 0;
	int size = 32;
	while (theirsItr.hasNext() && oursItr.hasNext()) {
		int t = theirsItr.next().getRaw();
		int o = oursItr.next().getRaw();

		int common = t & o; /* Narrow down the results to the common bits */
		for (int i = 0; i < size; i++) { /* Iterate over and locate the 1's */
			int tmp = common & (1 << i); /* Select the bit of interest, 0-31 */
			if (tmp != 0) { /* Is the version of this bit in common? */
				for (OFVersion v : OFVersion.values()) { /* Which version does this bit represent? */
					if (v.getWireVersion() == i + (size * pos)) {
						version = v;
					}
				}
			}
		}
		pos++; /* OFVersion position. 1-31 = 1, 32 - 63 = 2, etc. Inc at end so it starts at 0. */
	}
	return version;
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:33,代码来源:OFChannelHandler.java

示例7: mapSelector

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
@Override
public OFOxm<?> mapSelector(OFFactory factory, ExtensionSelector extensionSelector) {
    ExtensionSelectorType type = extensionSelector.type();

    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SPI.type())) {
        NiciraMatchNshSpi niciraNshSpi = (NiciraMatchNshSpi) extensionSelector;
        return factory.oxms().nsp(U32.of(niciraNshSpi.nshSpi().servicePathId()));
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SI.type())) {
        NiciraMatchNshSi niciraNshSi = (NiciraMatchNshSi) extensionSelector;
        return factory.oxms().nsi(U8.of(niciraNshSi.nshSi().serviceIndex()));
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_ENCAP_ETH_TYPE.type())) {
        NiciraMatchEncapEthType niciraEncapEthType = (NiciraMatchEncapEthType) extensionSelector;
        return factory.oxms().encapEthType(U16.of(niciraEncapEthType.encapEthType()));
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH1.type())) {
        // TODO
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH2.type())) {
        // TODO
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH3.type())) {
        // TODO
    }
    if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_CH4.type())) {
        // TODO
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:NiciraExtensionSelectorInterpreter.java

示例8: computeOurVersionBitmaps

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Based on the list of OFVersions provided as input (or from Loxi),
 * create a list of bitmaps for use in version negotiation during a
 * cross-version OpenFlow handshake where both parties support 
 * OpenFlow versions >= 1.3.1.
 * 
 * Type Set is used as input to guarantee all unique versions.
 * 
 * @param ofVersions, the list of bitmaps. Supply to an OFHello message.
 * @return list of bitmaps for the versions of OpenFlow we support
 */
private List<U32> computeOurVersionBitmaps(Set<OFVersion> ofVersions) {
	/* This should NEVER happen. Double-checking. */
	if (ofVersions == null || ofVersions.isEmpty()) {
		throw new IllegalStateException("OpenFlow version list should never be null or empty at this point. Make sure it's set in the OFSwitchManager.");
	}

	int pos = 1; /* initial bitmap in list */
	int size = 32; /* size of a U32 */
	int tempBitmap = 0; /* maintain the current bitmap we're working on */
	List<U32> bitmaps = new ArrayList<U32>();
	ArrayList<OFVersion> sortedVersions = new ArrayList<OFVersion>(ofVersions);
	Collections.sort(sortedVersions);
	for (OFVersion v : sortedVersions) {
		/* Move on to another bitmap */
		if (v.getWireVersion() > pos * size - 1 ) {
			bitmaps.add(U32.ofRaw(tempBitmap));
			tempBitmap = 0;
			pos++;
		}
		tempBitmap = tempBitmap | (1 << (v.getWireVersion() % size));
	}
	if (tempBitmap != 0) {
		bitmaps.add(U32.ofRaw(tempBitmap));
	}
	log.info("Computed OpenFlow version bitmap as {}", Arrays.asList(tempBitmap));
	return bitmaps;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:39,代码来源:OFSwitchManager.java

示例9: OFChannelHandler

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Creates a handler for interacting with the switch channel
 *
 * @param controller
 *            the controller
 * @param newConnectionListener
 *            the class that listens for new OF connections (switchManager)
 * @param pipeline
 *            the channel pipeline
 * @param threadPool
 *            the thread pool
 * @param idleTimer
 *            the hash wheeled timer used to send idle messages (echo).
 *            passed to constructor to modify in case of aux connection.
 * @param debugCounters
 */

OFChannelHandler(@Nonnull IOFSwitchManager switchManager,
		@Nonnull INewOFConnectionListener newConnectionListener,
		@Nonnull ChannelPipeline pipeline,
		@Nonnull IDebugCounterService debugCounters,
		@Nonnull Timer timer,
		@Nonnull List<U32> ofBitmaps,
		@Nonnull OFFactory defaultFactory) {

	Preconditions.checkNotNull(switchManager, "switchManager");
	Preconditions.checkNotNull(newConnectionListener, "connectionOpenedListener");
	Preconditions.checkNotNull(pipeline, "pipeline");
	Preconditions.checkNotNull(timer, "timer");
	Preconditions.checkNotNull(debugCounters, "debugCounters");

	this.pipeline = pipeline;
	this.debugCounters = debugCounters;
	this.newConnectionListener = newConnectionListener;
	this.counters = switchManager.getCounters();
	this.state = new InitState();
	this.timer = timer;
	this.ofBitmaps = ofBitmaps;
	this.factory = defaultFactory;
	
	log.debug("constructor on OFChannelHandler {}", String.format("%08x", System.identityHashCode(this)));
}
 
开发者ID:wangxinyuanUESTC,项目名称:floodlight1.2-delay,代码行数:43,代码来源:OFChannelHandler.java

示例10: computeOurVersionBitmaps

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Based on the list of OFVersions provided as input (or from Loxi),
 * create a list of bitmaps for use in version negotiation during a
 * cross-version OpenFlow handshake where both parties support
 * OpenFlow versions >= 1.3.1.
 *
 * Type Set is used as input to guarantee all unique versions.
 *
 * @param ofVersions, the list of bitmaps. Supply to an OFHello message.
 * @return list of bitmaps for the versions of OpenFlow we support
 */
private List<U32> computeOurVersionBitmaps(Set<OFVersion> ofVersions) {
	/* This should NEVER happen. Double-checking. */
	if (ofVersions == null || ofVersions.isEmpty()) {
		throw new IllegalStateException("OpenFlow version list should never be null or empty at this point. Make sure it's set in the OFSwitchManager.");
	}

	int pos = 1; /* initial bitmap in list */
	int size = 32; /* size of a U32 */
	int tempBitmap = 0; /* maintain the current bitmap we're working on */
	List<U32> bitmaps = new ArrayList<U32>();
	ArrayList<OFVersion> sortedVersions = new ArrayList<OFVersion>(ofVersions);
	Collections.sort(sortedVersions);
	for (OFVersion v : sortedVersions) {
		/* Move on to another bitmap */
		if (v.getWireVersion() > pos * size - 1 ) {
			bitmaps.add(U32.ofRaw(tempBitmap));
			tempBitmap = 0;
			pos++;
		}
		tempBitmap = tempBitmap | (1 << (v.getWireVersion() % size));
	}
	if (tempBitmap != 0) {
		bitmaps.add(U32.ofRaw(tempBitmap));
	}
	log.info("Computed OpenFlow version bitmap as {}", Arrays.asList(tempBitmap));
	return bitmaps;
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:39,代码来源:OFSwitchManager.java

示例11: buildL2Modification

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
private OFAction buildL2Modification(Instruction i) {
    L2ModificationInstruction l2m = (L2ModificationInstruction) i;
    L2ModificationInstruction.ModEtherInstruction eth;
    OFOxm<?> oxm = null;
    switch (l2m.subtype()) {
        case ETH_DST:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethDst(MacAddress.of(eth.mac().toLong()));
            break;
        case ETH_SRC:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethSrc(MacAddress.of(eth.mac().toLong()));
            break;
        case VLAN_ID:
            L2ModificationInstruction.ModVlanIdInstruction vlanId =
                    (L2ModificationInstruction.ModVlanIdInstruction) l2m;
            oxm = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort()));
            break;
        case VLAN_PCP:
            L2ModificationInstruction.ModVlanPcpInstruction vlanPcp =
                    (L2ModificationInstruction.ModVlanPcpInstruction) l2m;
            oxm = factory.oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
            break;
        case VLAN_POP:
            return factory.actions().popVlan();
        case VLAN_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushVlanInstruction
                    = (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushVlan(
                    EthType.of(pushVlanInstruction.ethernetType().toShort()));
        case MPLS_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
                                                         .ethernetType().toShort()));
        case MPLS_POP:
            L2ModificationInstruction.PushHeaderInstructions popHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().popMpls(EthType.of(popHeaderInstructions
                                                        .ethernetType().toShort()));
        case MPLS_LABEL:
            L2ModificationInstruction.ModMplsLabelInstruction mplsLabel =
                    (L2ModificationInstruction.ModMplsLabelInstruction) l2m;
            oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label().toInt()));
            break;
        case MPLS_BOS:
            L2ModificationInstruction.ModMplsBosInstruction mplsBos =
                    (L2ModificationInstruction.ModMplsBosInstruction) l2m;
            oxm = factory.oxms()
                    .mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE
                                               : OFBooleanValue.FALSE);
            break;
        case DEC_MPLS_TTL:
            return factory.actions().decMplsTtl();
        case TUNNEL_ID:
            L2ModificationInstruction.ModTunnelIdInstruction tunnelId =
                    (L2ModificationInstruction.ModTunnelIdInstruction) l2m;
            oxm = factory.oxms().tunnelId(U64.of(tunnelId.tunnelId()));
            break;
        default:
            log.warn("Unimplemented action type {}.", l2m.subtype());
            break;
    }

    if (oxm != null) {
        return factory.actions().buildSetField().setField(oxm).build();
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:70,代码来源:GroupModBuilder.java

示例12: createMPLSInterfaceLabel

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Only bits 0-23 of index are used. Bits 24-31 are ignored.
 * @param index
 * @return
 */
public static OFGroup createMPLSInterfaceLabel(U32 index) { //9
	return OFGroup.of(0 | (index.getRaw() & 0x00ffFFff) 
			| (MPLSSubType.MPLS_INTERFACE << 24)
			| (OFDPAGroupType.MPLS_LABEL << 28));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:OFDPAUtils.java

示例13: createMPLSL2VPNLabel

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Only bits 0-23 of index are used. Bits 24-31 are ignored.
 * @param index
 * @return
 */
public static OFGroup createMPLSL2VPNLabel(U32 index) { //9
	return OFGroup.of(0 | (index.getRaw() & 0x00ffFFff) 
			| (MPLSSubType.MPLS_L2_VPN_LABEL << 24)
			| (OFDPAGroupType.MPLS_LABEL << 28));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:OFDPAUtils.java

示例14: createMPLSL3VPNLabel

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Only bits 0-23 of index are used. Bits 24-31 are ignored.
 * @param index
 * @return
 */
public static OFGroup createMPLSL3VPNLabel(U32 index) { //9
	return OFGroup.of(0 | (index.getRaw() & 0x00ffFFff) 
			| (MPLSSubType.MPLS_L3_VPN_LABEL << 24)
			| (OFDPAGroupType.MPLS_LABEL << 28));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:OFDPAUtils.java

示例15: createMPLSTunnelLable1

import org.projectfloodlight.openflow.types.U32; //导入依赖的package包/类
/**
 * Only bits 0-23 of index are used. Bits 24-31 are ignored.
 * @param index
 * @return
 */
public static OFGroup createMPLSTunnelLable1(U32 index) { //9
	return OFGroup.of(0 | (index.getRaw() & 0x00ffFFff) 
			| (MPLSSubType.MPLS_TUNNEL_LABEL_1 << 24)
			| (OFDPAGroupType.MPLS_LABEL << 28));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:OFDPAUtils.java


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