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


Java DeviceField类代码示例

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


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

示例1: hasNonZeroOrNonNullKeys

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
/**
 * Check whether this entity has non-'zero' values in any of its key fields
 * @return true if any key fields have a non-null value
 */
public boolean hasNonZeroOrNonNullKeys() {
    for (DeviceField f : keyFields) {
        switch (f) {
            case MAC: /* We assume operation over Ethernet, thus all devices must have a MAC */
                return true;
            case IPv4:
                if (!entity.ipv4Address.equals(IPv4Address.NONE)) return true;
                break;
            case IPv6:
            	if (!entity.ipv6Address.equals(IPv6Address.NONE)) return true;
                break;
            case SWITCH:
                if (!entity.switchDPID.equals(DatapathId.NONE)) return true;
                break;
            case PORT:
                if (!entity.switchPort.equals(OFPort.ZERO)) return true;
                break;
            case VLAN: /* VLAN can still be null, meaning 'don't care'. VlanVid.ZERO means 'untagged' */
                if (entity.vlan != null) return true;
                break;
        }
    }
    return false;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:29,代码来源:IndexedEntity.java

示例2: testDeviceIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceIndex() throws Exception {
	EnumSet<IDeviceService.DeviceField> indexFields =
			EnumSet.noneOf(IDeviceService.DeviceField.class);
	indexFields.add(IDeviceService.DeviceField.IPv4);
	indexFields.add(IDeviceService.DeviceField.VLAN);
	deviceManager.addIndex(false, indexFields);

	indexFields = EnumSet.noneOf(IDeviceService.DeviceField.class);
	deviceManager.addIndex(false, indexFields);

	ITopologyService mockTopology = createMock(ITopologyService.class);
	deviceManager.topology = mockTopology;
	expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort()))).
			andReturn(true).anyTimes();
	expect(mockTopology.getOpenflowDomainId(DatapathId.of(EasyMock.anyLong()))).andReturn(DatapathId.of(1L)).anyTimes();
	replay(mockTopology);
	doTestDeviceQuery();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:DeviceManagerImplTest.java

示例3: testDeviceClassIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceClassIndex() throws Exception {
	EnumSet<IDeviceService.DeviceField> indexFields =
			EnumSet.noneOf(IDeviceService.DeviceField.class);
	indexFields.add(IDeviceService.DeviceField.IPv4);
	indexFields.add(IDeviceService.DeviceField.VLAN);
	deviceManager.addIndex(true, indexFields);

	ITopologyService mockTopology = createMock(ITopologyService.class);
	deviceManager.topology = mockTopology;
	expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort()))).
			andReturn(true).anyTimes();
	expect(mockTopology.getOpenflowDomainId(DatapathId.of(EasyMock.anyLong()))).andReturn(DatapathId.of(1L)).anyTimes();
	replay(mockTopology);

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

示例4: hasNonNullKeys

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
/**
 * Check whether this entity has non-null values in any of its key fields
 * @return true if any key fields have a non-null value
 */
public boolean hasNonNullKeys() {
    for (DeviceField f : keyFields) {
        switch (f) {
            case MAC:
                return true;
            case IPV4:
                if (entity.ipv4Address != null) return true;
                break;
            case SWITCH:
                if (entity.switchDPID != null) return true;
                break;
            case PORT:
                if (entity.switchPort != null) return true;
                break;
            case VLAN:
                if (entity.vlan != null) return true;
                break;
        }
    }
    return false;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:26,代码来源:IndexedEntity.java

示例5: computeKey

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
static String computeKey(Device d) {
    StringBuilder bld = new StringBuilder(d.getEntityClass().getName());
    bld.append("::");
    EnumSet<DeviceField> keyFields = d.getEntityClass().getKeyFields();
    if (keyFields.contains(DeviceField.MAC)) {
        bld.append(d.getMACAddressString());
        bld.append("::");
    }
    if (keyFields.contains(DeviceField.VLAN)) {
        if (d.getVlanId() != null)
            bld.append(Arrays.toString(d.getVlanId()));
        bld.append("::");
    }
    if (keyFields.contains(DeviceField.SWITCH) ||
            keyFields.contains(DeviceField.PORT) ) {
        if (d.getAttachmentPoints(true) != null)
            bld.append(Arrays.toString(d.getAttachmentPoints(true)));
        bld.append("::");
    }
    if (keyFields.contains(DeviceField.IPV4)) {
        if (d.getIPv4Addresses() != null)
            bld.append(Arrays.toString(d.getIPv4Addresses()));
        bld.append("::");
    }
    return bld.toString();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:27,代码来源:DeviceSyncRepresentation.java

示例6: testDeviceIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceIndex() throws Exception {
	EnumSet<IDeviceService.DeviceField> indexFields =
			EnumSet.noneOf(IDeviceService.DeviceField.class);
	indexFields.add(IDeviceService.DeviceField.IPV4);
	indexFields.add(IDeviceService.DeviceField.VLAN);
	deviceManager.addIndex(false, indexFields);

	indexFields = EnumSet.noneOf(IDeviceService.DeviceField.class);
	deviceManager.addIndex(false, indexFields);

	ITopologyService mockTopology = createMock(ITopologyService.class);
	deviceManager.topology = mockTopology;
	expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort()))).
			andReturn(true).anyTimes();
	expect(mockTopology.getL2DomainId(DatapathId.of(EasyMock.anyLong()))).andReturn(DatapathId.of(1L)).anyTimes();
	replay(mockTopology);
	doTestDeviceQuery();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:21,代码来源:DeviceManagerImplTest.java

示例7: testDeviceClassIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceClassIndex() throws Exception {
	EnumSet<IDeviceService.DeviceField> indexFields =
			EnumSet.noneOf(IDeviceService.DeviceField.class);
	indexFields.add(IDeviceService.DeviceField.IPV4);
	indexFields.add(IDeviceService.DeviceField.VLAN);
	deviceManager.addIndex(true, indexFields);

	ITopologyService mockTopology = createMock(ITopologyService.class);
	deviceManager.topology = mockTopology;
	expect(mockTopology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort()))).
			andReturn(true).anyTimes();
	expect(mockTopology.getL2DomainId(DatapathId.of(EasyMock.anyLong()))).andReturn(DatapathId.of(1L)).anyTimes();
	replay(mockTopology);

	doTestDeviceClassQuery();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:19,代码来源:DeviceManagerImplTest.java

示例8: testDeviceIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceIndex() throws Exception {
    EnumSet<IDeviceService.DeviceField> indexFields =
            EnumSet.noneOf(IDeviceService.DeviceField.class);
    indexFields.add(IDeviceService.DeviceField.IPV4);
    indexFields.add(IDeviceService.DeviceField.VLAN);
    deviceManager.addIndex(false, indexFields);

    indexFields = EnumSet.noneOf(IDeviceService.DeviceField.class);
    deviceManager.addIndex(false, indexFields);

    ITopologyService mockTopology = createMock(ITopologyService.class);
    deviceManager.topology = mockTopology;
    expect(mockTopology.isAttachmentPointPort(anyLong(),
                                              anyShort())).
                                              andReturn(true).anyTimes();
    expect(mockTopology.getL2DomainId(EasyMock.anyLong())).andReturn(1L).anyTimes();
    replay(mockTopology);
    doTestDeviceQuery();
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:21,代码来源:DeviceManagerImplTest.java

示例9: testDeviceClassIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Test
public void testDeviceClassIndex() throws Exception {
    EnumSet<IDeviceService.DeviceField> indexFields =
            EnumSet.noneOf(IDeviceService.DeviceField.class);
    indexFields.add(IDeviceService.DeviceField.IPV4);
    indexFields.add(IDeviceService.DeviceField.VLAN);
    deviceManager.addIndex(true, indexFields);

    ITopologyService mockTopology = createMock(ITopologyService.class);
    deviceManager.topology = mockTopology;
    expect(mockTopology.isAttachmentPointPort(anyLong(),
                                              anyShort())).
                                              andReturn(true).anyTimes();
    expect(mockTopology.getL2DomainId(EasyMock.anyLong())).andReturn(1L).anyTimes();
    replay(mockTopology);

    doTestDeviceClassQuery();
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:19,代码来源:DeviceManagerImplTest.java

示例10: computeKey

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
static String computeKey(Device d) {
	StringBuilder bld = new StringBuilder(d.getEntityClass().getName());
	bld.append("::");
	EnumSet<DeviceField> keyFields = d.getEntityClass().getKeyFields();
	if (keyFields.contains(DeviceField.MAC)) {
		bld.append(d.getMACAddressString());
		bld.append("::");
	}
	if (keyFields.contains(DeviceField.VLAN)) {
		if (d.getVlanId() != null)
			bld.append(Arrays.toString(d.getVlanId()));
		bld.append("::");
	}
	if (keyFields.contains(DeviceField.SWITCH) ||
			keyFields.contains(DeviceField.PORT) ) {
		if (d.getAttachmentPoints(true) != null)
			bld.append(Arrays.toString(d.getAttachmentPoints(true)));
		bld.append("::");
	}
	if (keyFields.contains(DeviceField.IPv4)) {
		if (d.getIPv4Addresses() != null)
			bld.append(Arrays.toString(d.getIPv4Addresses()));
		bld.append("::");
	}
	if (keyFields.contains(DeviceField.IPv6)) {
		if (d.getIPv6Addresses() != null)
			bld.append(Arrays.toString(d.getIPv6Addresses()));
		bld.append("::");
	}
	return bld.toString();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:32,代码来源:DeviceSyncRepresentation.java

示例11: hashCode

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Override
public int hashCode() {
	
    if (hashCode != 0) {
    	return hashCode;
    }

    final int prime = 31;
    hashCode = 1;
    for (DeviceField f : keyFields) {
        switch (f) {
            case MAC:
                hashCode = prime * hashCode
                    + (int) (entity.macAddress.getLong() ^ 
                            (entity.macAddress.getLong() >>> 32));
                break;
            case IPv4:
                hashCode = prime * hashCode
                    + ((entity.ipv4Address == null) 
                        ? 0 
                        : entity.ipv4Address.hashCode());
                break;
            case IPv6:
                hashCode = prime * hashCode
                    + ((entity.ipv6Address == null) 
                        ? 0 
                        : entity.ipv6Address.hashCode());
                break;
            case SWITCH:
                hashCode = prime * hashCode
                    + ((entity.switchDPID == null) 
                        ? 0 
                        : entity.switchDPID.hashCode());
                break;
            case PORT:
                hashCode = prime * hashCode
                    + ((entity.switchPort == null) 
                        ? 0 
                        : entity.switchPort.hashCode());
                break;
            case VLAN:
                hashCode = prime * hashCode 
                    + ((entity.vlan == null) 
                        ? 0 
                        : entity.vlan.hashCode());
                break;
        }
    }
    return hashCode;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:51,代码来源:IndexedEntity.java

示例12: equals

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
   if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    IndexedEntity other = (IndexedEntity) obj;
    
    if (!keyFields.equals(other.keyFields))
        return false;

    for (IDeviceService.DeviceField f : keyFields) {
        switch (f) {
            case MAC:
                if (!entity.macAddress.equals(other.entity.macAddress))
                    return false;
                break;
            case IPv4:
                if (entity.ipv4Address == null) {
                    if (other.entity.ipv4Address != null) return false;
                } else if (!entity.ipv4Address.equals(other.entity.ipv4Address)) return false;
                break;
            case IPv6:
                if (entity.ipv6Address == null) {
                    if (other.entity.ipv6Address != null) return false;
                } else if (!entity.ipv6Address.equals(other.entity.ipv6Address)) return false;
                break;
            case SWITCH:
                if (entity.switchDPID == null) {
                    if (other.entity.switchDPID != null) return false;
                } else if (!entity.switchDPID.equals(other.entity.switchDPID)) return false;
                break;
            case PORT:
                if (entity.switchPort == null) {
                    if (other.entity.switchPort != null) return false;
                } else if (!entity.switchPort.equals(other.entity.switchPort)) return false;
                break;
            case VLAN:
                if (entity.vlan == null) {
                    if (other.entity.vlan != null) return false;
                } else if (!entity.vlan.equals(other.entity.vlan)) return false;
                break;
        }
    }  
    return true;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:46,代码来源:IndexedEntity.java

示例13: getKeyFields

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
@Override
public EnumSet<IDeviceService.DeviceField> getKeyFields() {
    return keyFields;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:5,代码来源:DefaultEntityClassifier.java

示例14: DeviceMultiIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
/**
 * @param keyFields
 */
public DeviceMultiIndex(EnumSet<DeviceField> keyFields) {
    super(keyFields);
    index = new ConcurrentHashMap<IndexedEntity, Collection<Long>>();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:8,代码来源:DeviceMultiIndex.java

示例15: DeviceIndex

import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; //导入依赖的package包/类
/**
 * Construct a new device index using the provided key fields
 * @param keyFields the key fields to use
 */
public DeviceIndex(EnumSet<DeviceField> keyFields) {
    super();
    this.keyFields = keyFields;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:DeviceIndex.java


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