本文整理匯總了Java中org.onosproject.vtnrsc.PortPairGroup.portPairs方法的典型用法代碼示例。如果您正苦於以下問題:Java PortPairGroup.portPairs方法的具體用法?Java PortPairGroup.portPairs怎麽用?Java PortPairGroup.portPairs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.onosproject.vtnrsc.PortPairGroup
的用法示例。
在下文中一共展示了PortPairGroup.portPairs方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installFlowClassifier
import org.onosproject.vtnrsc.PortPairGroup; //導入方法依賴的package包/類
@Override
public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) {
checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
// Get the portPairGroup
List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups();
ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator();
PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next();
PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
List<PortPairId> llPortPairIdList = portPairGroup.portPairs();
// Get port pair
ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator();
PortPairId portPairId = portPairListIterator.next();
PortPair portPair = portPairService.getPortPair(portPairId);
return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD);
}
示例2: unInstallFlowClassifier
import org.onosproject.vtnrsc.PortPairGroup; //導入方法依賴的package包/類
@Override
public ConnectPoint unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) {
checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
// Get the portPairGroup
List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups();
ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator();
PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next();
PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
List<PortPairId> llPortPairIdList = portPairGroup.portPairs();
// Get port pair
ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator();
PortPairId portPairId = portPairListIterator.next();
PortPair portPair = portPairService.getPortPair(portPairId);
return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.REMOVE);
}
示例3: loadBalanceSfc
import org.onosproject.vtnrsc.PortPairGroup; //導入方法依賴的package包/類
/**
* Find the load balanced path set it to port chain for the given five
* tuple.
*
* @param portChainId port chain id
* @param fiveTuple five tuple info
* @return load balance id
*/
private LoadBalanceId loadBalanceSfc(PortChainId portChainId, FiveTuple fiveTuple) {
// Get the port chain
PortChain portChain = portChainService.getPortChain(portChainId);
List<PortPairId> loadBalancePath = Lists.newArrayList();
LoadBalanceId id;
int paths = portChain.getLoadBalancePathSize();
if (paths >= MAX_LOAD_BALANCE_ID) {
log.info("Max limit reached for load balance paths. "
+ "Reusing the created path for port chain {} with five tuple {}", portChainId, fiveTuple);
id = LoadBalanceId.of((byte) ((paths + 1) % MAX_LOAD_BALANCE_ID));
portChain.addLoadBalancePath(fiveTuple, id, portChain.getLoadBalancePath(id));
}
// Get the list of port pair groups from port chain
Iterable<PortPairGroupId> portPairGroups = portChain.portPairGroups();
for (final PortPairGroupId portPairGroupId : portPairGroups) {
PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
// Get the list of port pair ids from port pair group.
Iterable<PortPairId> portPairs = portPairGroup.portPairs();
int minLoad = 0xFFF;
PortPairId minLoadPortPairId = null;
for (final PortPairId portPairId : portPairs) {
int load = portPairGroup.getLoad(portPairId);
if (load == 0) {
minLoadPortPairId = portPairId;
break;
} else {
// Check the port pair which has min load.
if (load < minLoad) {
minLoad = load;
minLoadPortPairId = portPairId;
}
}
}
if (minLoadPortPairId != null) {
loadBalancePath.add(minLoadPortPairId);
portPairGroup.addLoad(minLoadPortPairId);
}
}
// Check if the path already exists, if not create a new id
id = portChain.matchPath(loadBalancePath);
if (id == null) {
id = LoadBalanceId.of((byte) (paths + 1));
}
portChain.addLoadBalancePath(fiveTuple, id, loadBalancePath);
return id;
}