本文整理汇总了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;
}
示例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()]);
}
示例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;
}