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


Java VlanVid.getVlan方法代码示例

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


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

示例1: findDevice

import org.projectfloodlight.openflow.types.VlanVid; //导入方法依赖的package包/类
@Override
public IDevice findDevice(MacAddress macAddress, VlanVid vlan,
		IPv4Address ipv4Address, DatapathId switchDPID,
		OFPort switchPort)
				throws IllegalArgumentException {
	if (vlan != null && vlan.getVlan() <= 0)
		vlan = null;
	if (ipv4Address != null && ipv4Address.getInt() == 0)
		ipv4Address = null;
	Entity e = new Entity(macAddress, vlan, ipv4Address, switchDPID,
			switchPort, null);
	if (!allKeyFieldsPresent(e, entityClassifier.getKeyFields())) {
		throw new IllegalArgumentException("Not all key fields specified."
				+ " Required fields: " + entityClassifier.getKeyFields());
	}
	return findDeviceByEntity(e);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:18,代码来源:DeviceManagerImpl.java

示例2: findClassDevice

import org.projectfloodlight.openflow.types.VlanVid; //导入方法依赖的package包/类
@Override
public IDevice findClassDevice(IEntityClass entityClass, MacAddress macAddress,
		VlanVid vlan, IPv4Address ipv4Address)
				throws IllegalArgumentException {
	if (vlan != null && vlan.getVlan() <= 0)
		vlan = null;
	if (ipv4Address != null && ipv4Address.getInt() == 0)
		ipv4Address = null;
	Entity e = new Entity(macAddress, vlan, ipv4Address,
			null, null, null);
	if (entityClass == null ||
			!allKeyFieldsPresent(e, entityClass.getKeyFields())) {
		throw new IllegalArgumentException("Not all key fields and/or "
				+ " no source device specified. Required fields: " +
				entityClassifier.getKeyFields());
	}
	return findDestByEntity(entityClass, e);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:19,代码来源:DeviceManagerImpl.java

示例3: serialize

import org.projectfloodlight.openflow.types.VlanVid; //导入方法依赖的package包/类
@Override
public void serialize(Device device, JsonGenerator jGen,
                      SerializerProvider serializer) throws IOException,
        JsonProcessingException {
    jGen.writeStartObject();
    
    jGen.writeStringField("entityClass", device.getEntityClass().getName());
    
    jGen.writeArrayFieldStart("mac");
    jGen.writeString(device.getMACAddress().toString());
    jGen.writeEndArray();

    jGen.writeArrayFieldStart("ipv4");
    for (IPv4Address ip : device.getIPv4Addresses())
        jGen.writeString(ip.toString());
    jGen.writeEndArray();

    jGen.writeArrayFieldStart("vlan");
    for (VlanVid vlan : device.getVlanId())
        if (vlan.getVlan() >= 0)
            jGen.writeString(vlan.toString());
    jGen.writeEndArray();
    jGen.writeArrayFieldStart("attachmentPoint");
    for (SwitchPort ap : device.getAttachmentPoints(true)) {
        serializer.defaultSerializeValue(ap, jGen);
    }
    jGen.writeEndArray();

    jGen.writeNumberField("lastSeen", device.getLastSeen().getTime());
    
    String dhcpClientName = device.getDHCPClientName();
    if (dhcpClientName != null) {
        jGen.writeStringField("dhcpClientName", dhcpClientName);
    }

    jGen.writeEndObject();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:38,代码来源:DeviceSerializer.java

示例4: learnDeviceFromArpResponseData

import org.projectfloodlight.openflow.types.VlanVid; //导入方法依赖的package包/类
/**
 * Learn device from ARP data in scenarios where the
 * Ethernet source MAC is different from the sender hardware
 * address in ARP data.
 */
protected void learnDeviceFromArpResponseData(Ethernet eth,
		DatapathId swdpid,
		OFPort port) {

	if (!(eth.getPayload() instanceof ARP)) return;
	ARP arp = (ARP) eth.getPayload();

	MacAddress dlAddr = eth.getSourceMACAddress();

	MacAddress senderAddr = MacAddress.of(arp.getSenderHardwareAddress());

	if (dlAddr.equals(senderAddr)) return; // arp request

	// Ignore broadcast/multicast source
	if (senderAddr.isBroadcast() || senderAddr.isMulticast())
		return;
	// Ignore zero sender mac
	if (senderAddr.getLong() == 0)
		return;

	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address nwSrc = IPv4Address.of(arp.getSenderProtocolAddress());

	Entity e =  new Entity(senderAddr,
			((vlan.getVlan() >= 0) ? vlan : null),
			((nwSrc.getInt() != 0) ? nwSrc : null),
			swdpid,
			port,
			new Date());

	learnDeviceByEntity(e);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:38,代码来源:DeviceManagerImpl.java


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