本文整理汇总了Java中net.floodlightcontroller.routing.Route.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java Route.getPath方法的具体用法?Java Route.getPath怎么用?Java Route.getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.routing.Route
的用法示例。
在下文中一共展示了Route.getPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeMemberFromTheTree
import net.floodlightcontroller.routing.Route; //导入方法依赖的package包/类
public void removeMemberFromTheTree(AttachmentPoint ap) {
/* Remove flow from edge switch */
DatapathId dSWId = ap.getSw();
IOFSwitch dSW = switchService.getSwitch(dSWId);
HashSet<OFPort> nps;
Route r = pathsForDestinations.get(ap.getSw().getLong());
if (r == null)
return;
NodePortTuple from = null;
List<NodePortTuple> path = r.getPath();
ListIterator<NodePortTuple> it = path.listIterator(path.size());
while (it.hasPrevious()) {
from = it.previous();
dSWId = from.getNodeId();
dSW = switchService.getSwitch(dSWId);
nps = memberPorts.get(dSWId.getLong());
if (nps == null) {
logger.info("RemoveMemberFromTheTree: unexpected null nps");
return;
}
nps.remove(from.getPortId());
if (nps.size() != 0) {
sendOFGroupModDelMemberMsg(dSW, from.getPortId());
/* switch has downstream member other than one removed*/
break;
}
memberPorts.remove(dSWId.getLong());
if (dSWId.getLong() == sourceAP.getSw().getLong())
sendOFFlowModDropMulticastStream(dSW, false);
else
sendOFFlowModDelForGroup(dSW);
pushOFDeleteGroup(dSW);
if (it.hasPrevious())
from = it.previous();
}
pathsForDestinations.remove(ap.getSw().getLong());
}
示例2: AddFlowsDirectedToDevice
import net.floodlightcontroller.routing.Route; //导入方法依赖的package包/类
private void AddFlowsDirectedToDevice(AttachmentPoint destAP,
IDevice destDevice, long bandwidth) {
NodePortTuple to = null;
DatapathId toNodeId = null;
OFPort toOFPort = null;
HashSet <OFPort> members = null;
String pathStr = "SPT route added - [";
int strLen = multicastGroup.srcAP.getSw().toString().length();
Route r = routingService.getRoute(multicastGroup.srcAP.getSw(), multicastGroup.srcAP.getPort()
,destAP.getSw(), destAP.getPort(), U64.ZERO);
// logger.info("Group:"+this.multicastGroup.groupIP + " Route for: Src Datapath :"
// +multicastGroup.srcAP.getSw().toString().substring(strLen-2)
// +", port "+multicastGroup.srcAP.getPort().toString()
// +" to Dst Datapath "+destAP.getSw().toString().substring(strLen-2)
// +" port "+destAP.getPort().toString()+" ");
// logger.info(r.toString());
pathsForDestinations.put(destAP.getSw().getLong(), r);
List<NodePortTuple> path = r.getPath();
// logger.info("Group:"+this.multicastGroup.groupIP+" Route path= "+path.toString());;
ListIterator<NodePortTuple> it = path.listIterator(path.size());
for (int i = path.size(); i > 0; i-=2) {
to = it.previous();
toNodeId = to.getNodeId();
toOFPort = to.getPortId();
// logger.info(" to = " + to.toString());
members = memberPorts.get(toNodeId.getLong());
if (members == null) {
members = new HashSet<OFPort>();
memberPorts.put(toNodeId.getLong(), members);
members.add(toOFPort);
// logger.info("Group:"+this.multicastGroup.groupIP+" sendOFGroupAddMsg: "
// + toNodeId.toString().substring(strLen-2)+" "+toOFPort.toString());
pathStr += toNodeId.toString().substring(strLen-2) + ",";
sendOFGroupAddMsg(toNodeId, toOFPort, bandwidth);
} else {
members.add(toOFPort);
sendOFGroupModAddMemberMsg(toNodeId, toOFPort, bandwidth);
// logger.info("Group:"+this.multicastGroup.groupIP+" sendOFGroupModAddMemberMsg: "
// + toNodeId.toString().substring(strLen-2)+" "+toOFPort.toString());
pathStr += toNodeId.toString().substring(strLen-2) + "]";
logger.info("Group:"+this.multicastGroup.groupIP + " SPT path added - "+ pathStr);
return;
}
to = it.previous();
}
logger.info("Group:"+this.multicastGroup.groupIP + " SPT path added - "+ pathStr);
}
示例3: createGroupByRoute
import net.floodlightcontroller.routing.Route; //导入方法依赖的package包/类
/**
* ��������·��·����ȡԴĿ��������grouptable���bucket��Ȼ���·�OFGroupAdd��Ϣ����Ӧ������
* @param firstRoute ����··��
* @param secondRoute ����··��
* @param isSrcSide Ϊtrueʱ��Ӧ·��·��Դ��Ͱ����Ϣ�·���������elseΪĿ�Ķ�
* @author ZX Peng
*/
private void createGroupByRoute(Route firstRoute, Route secondRoute, boolean isSrcSide) {
ArrayList<OFBucket> buckets = new ArrayList<OFBucket>(2);
IOFSwitch sw;
List<NodePortTuple> firstNptList = firstRoute.getPath();
List<NodePortTuple> secondNptList = secondRoute.getPath();
int firstIndex = 0, secondIndex = 0;
if(isSrcSide == true) {
firstIndex = 1;
secondIndex = 1;
sw = switchService.getSwitch(firstRoute.getId().getSrc());
} else {
firstIndex = firstNptList.size() - 2;
secondIndex = secondNptList.size() - 2;
sw = switchService.getSwitch(firstRoute.getId().getDst());
}
NodePortTuple firstWatchNpt = firstNptList.get(firstIndex);
NodePortTuple secondWatchNpt = secondNptList.get(secondIndex);
buckets.add(sw.getOFFactory().buildBucket()
.setWatchPort(firstWatchNpt.getPortId())
.setWatchGroup(OFGroup.ZERO)
.setActions(Collections.singletonList((OFAction) sw.getOFFactory().actions().buildOutput()
.setMaxLen(0x0fFFffFF)
.setPort(firstWatchNpt.getPortId())
.build()))
.build());
buckets.add(sw.getOFFactory().buildBucket()
.setWatchPort(secondWatchNpt.getPortId())
.setWatchGroup(OFGroup.ZERO)
.setActions(Collections.singletonList((OFAction) sw.getOFFactory().actions().buildOutput()
.setMaxLen(0x0fFFffFF)
.setPort(secondWatchNpt.getPortId())
.build()))
.build());
//push OFGroupAdd message to the switch
//TODO: group number has to be distinct from each other
OFGroupAdd groupAdd = sw.getOFFactory().buildGroupAdd()
.setGroup(OFGroup.of(GROUP_NUM))
.setGroupType(OFGroupType.FF)
.setBuckets(buckets)
.build();
sw.write(groupAdd);
}