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


Java SwitchPort.getSwitchDPID方法代码示例

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


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

示例1: makeHostSwitchLinkPair

import net.floodlightcontroller.devicemanager.SwitchPort; //导入方法依赖的package包/类
/**
 * Construct a link between a host and a switch
 * @param topoNodes
 * @param device
 * @param ap
 * @param switchMap
 * @param switchPortMap
 * @return the link which connects given device and access point
 */
public ArrayList<FlowLink> makeHostSwitchLinkPair(ArrayList<Node> topoNodes, IDevice device, SwitchPort ap, Map<DatapathId, IOFSwitch> switchMap, 
		HashMap<IOFSwitch, ArrayList<OFPortDesc>> switchPortMap){
	
	String deviceName = device.getMACAddressString();
			
	DatapathId switchId = ap.getSwitchDPID();
	String switchName = switchId.toString();
	
	IOFSwitch connectingSwitch = switchMap.get(switchId);
	ArrayList<OFPortDesc> ports = switchPortMap.get(connectingSwitch);
	
	OFPort portOnSwitch = ap.getPort();
	int switchPortNum = portOnSwitch.getPortNumber();
	
	String hostSwitchLinkName = "(" + deviceName + ", " + switchName + ")";
	String switchHostLinkName = "(" + switchName + ", " + deviceName + ")";
	

	Node src = getNodeWithName(topoNodes, deviceName);
	Node dst = getNodeWithName(topoNodes, switchName);
	
	Port srcP = src.getPortByID(1);
	Port dstP = dst.getPortByID(switchPortNum);
	
	long bandWidth = 0;
	
	for(OFPortDesc portDesc : ports){
		if(portDesc.getPortNo().equals(portOnSwitch)){
			bandWidth = convertBandwidth(portDesc.getCurrSpeed());
		}
	}
	
	ArrayList<FlowLink> hostSwitchLinks = new ArrayList<FlowLink>();
	hostSwitchLinks.add(new FlowLink(hostSwitchLinkName, src, dst, srcP, dstP, bandWidth));
	hostSwitchLinks.add(new FlowLink(switchHostLinkName, dst, src, dstP, srcP, bandWidth));
	
	return hostSwitchLinks;
}
 
开发者ID:DylanAPDavis,项目名称:arscheduler,代码行数:48,代码来源:TopologyBuilder.java

示例2: getSwitchPortVlanIds

import net.floodlightcontroller.devicemanager.SwitchPort; //导入方法依赖的package包/类
@Override
public Short[] getSwitchPortVlanIds(SwitchPort swp) {
    TreeSet<Short> vals = new TreeSet<Short>();
    for (Entity e : entities) {
        if (e.switchDPID == swp.getSwitchDPID()
                && e.switchPort == swp.getPort()) {
            if (e.getVlan() == null)
                vals.add(Ethernet.VLAN_UNTAGGED);
            else
                vals.add(e.getVlan());
        }
    }
    return vals.toArray(new Short[vals.size()]);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:15,代码来源:Device.java

示例3: matches

import net.floodlightcontroller.devicemanager.SwitchPort; //导入方法依赖的package包/类
@Override
protected boolean matches(Device value) {
    boolean match;
    if (entityClasses != null) {
        IEntityClass clazz = value.getEntityClass();
        if (clazz == null) return false;

        match = false;
        for (IEntityClass entityClass : entityClasses) {
            if (clazz.equals(entityClass)) {
                match = true;
                break;
            }
        }
        if (!match) return false;                
    }
    if (macAddress != null) {
        if (macAddress.longValue() != value.getMACAddress())
            return false;
    }
    if (vlan != null) {
        Short[] vlans = value.getVlanId();
        if (Arrays.binarySearch(vlans, vlan) < 0) 
            return false;
    }
    if (ipv4Address != null) {
        Integer[] ipv4Addresses = value.getIPv4Addresses();
        if (Arrays.binarySearch(ipv4Addresses, ipv4Address) < 0) 
            return false;
    }
    if (switchDPID != null || switchPort != null) {
        SwitchPort[] sps = value.getAttachmentPoints();
        if (sps == null) return false;
        
        match = false;
        for (SwitchPort sp : sps) {
            if (switchDPID != null) {
                if (switchDPID.longValue() != sp.getSwitchDPID())
                    return false;
            }
            if (switchPort != null) {
                if (switchPort.intValue() != sp.getPort())
                    return false;
            }
            match = true;
            break;
        }
        if (!match) return false;
    }
    return true;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:52,代码来源:DeviceIterator.java


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