本文整理汇总了Java中org.onosproject.vtnrsc.PortChain.portPairGroups方法的典型用法代码示例。如果您正苦于以下问题:Java PortChain.portPairGroups方法的具体用法?Java PortChain.portPairGroups怎么用?Java PortChain.portPairGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.vtnrsc.PortChain
的用法示例。
在下文中一共展示了PortChain.portPairGroups方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getServiceFunctions
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的package包/类
@Override
public List<ServiceFunctionGroup> getServiceFunctions(PortChainId portChainId) {
List<ServiceFunctionGroup> serviceFunctionGroupList = Lists.newArrayList();
PortChain portChain = portChainService.getPortChain(portChainId);
// Go through the port pair group list
List<PortPairGroupId> portPairGrpList = portChain.portPairGroups();
ListIterator<PortPairGroupId> listGrpIterator = portPairGrpList.listIterator();
while (listGrpIterator.hasNext()) {
PortPairGroupId portPairGroupId = listGrpIterator.next();
PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId);
ServiceFunctionGroup sfg = new ServiceFunctionGroup(portPairGroup.name(), portPairGroup.description(),
portPairGroup.portPairLoadMap());
serviceFunctionGroupList.add(sfg);
}
return ImmutableList.copyOf(serviceFunctionGroupList);
}
示例2: sfcPorts
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
PortPairGroupService ppgs = get(PortPairGroupService.class);
PortPairService pps = get(PortPairService.class);
VirtualPortService vps = get(VirtualPortService.class);
List<VirtualPort> vpList = new ArrayList<VirtualPort>();
if (portPairGroupList != null) {
portPairGroupList.stream().forEach(ppgid -> {
PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
List<PortPairId> portPairList = ppg.portPairs();
if (portPairList != null) {
portPairList.stream().forEach(ppid -> {
PortPair pp = pps.getPortPair(ppid);
VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
vpList.add(vp);
});
}
});
}
return vpList;
}
示例3: installFlowClassifier
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的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);
}
示例4: unInstallFlowClassifier
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的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);
}
示例5: sfcPorts
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
PortPairGroupService ppgs = get(PortPairGroupService.class);
PortPairService pps = get(PortPairService.class);
VirtualPortService vps = get(VirtualPortService.class);
List<VirtualPort> vpList = new ArrayList<VirtualPort>();
if (portPairGroupList != null) {
portPairGroupList.forEach(ppgid -> {
PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
List<PortPairId> portPairList = ppg.portPairs();
if (portPairList != null) {
portPairList.forEach(ppid -> {
PortPair pp = pps.getPortPair(ppid);
VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
vpList.add(vp);
});
}
});
}
return vpList;
}
示例6: onPortChainDeleted
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的package包/类
@Override
public void onPortChainDeleted(PortChain portChain) {
log.info("onPortChainDeleted");
if (!nshSpiPortChainMap.containsKey(portChain.portChainId())) {
throw new ItemNotFoundException("Unable to find NSH SPI");
}
int nshSpiId = nshSpiPortChainMap.get(portChain.portChainId());
// Uninstall classifier rules
SfcFlowRuleInstallerImpl flowRuleInstaller = new SfcFlowRuleInstallerImpl(appId);
flowRuleInstaller.unInstallFlowClassifier(portChain, NshServicePathId.of(nshSpiId));
// remove from nshSpiPortChainMap and add to nshSpiIdFreeList
nshSpiPortChainMap.remove(portChain.portChainId());
nshSpiIdFreeList.add(nshSpiId);
// Uninstall load balanced classifier and forwarding rules.
NshServicePathId nshSpi;
LoadBalanceId id;
List<LoadBalanceId> processedIdList = Lists.newArrayList();
Set<FiveTuple> fiveTupleSet = portChain.getLoadBalanceIdMapKeys();
for (FiveTuple fiveTuple : fiveTupleSet) {
id = portChain.getLoadBalanceId(fiveTuple);
nshSpi = NshServicePathId.of(getNshServicePathId(id, nshSpiId));
if (processedIdList.contains(id)) {
// Multiple five tuple can have single path. In this case only
// the classifier rule need to delete
flowRuleInstaller.unInstallLoadBalancedClassifierRules(portChain, fiveTuple, nshSpi);
continue;
} else {
processedIdList.add(id);
}
flowRuleInstaller.unInstallLoadBalancedFlowRules(portChain, fiveTuple, nshSpi);
}
// Reset load for all the port pairs
List<PortPairGroupId> ppgIdlist = portChain.portPairGroups();
ListIterator<PortPairGroupId> ppgIdListIterator = ppgIdlist.listIterator();
while (ppgIdListIterator.hasNext()) {
PortPairGroupId portPairGroupId = ppgIdListIterator.next();
PortPairGroup ppg = portPairGroupService.getPortPairGroup(portPairGroupId);
ppg.resetLoad();
}
}
示例7: loadBalanceSfc
import org.onosproject.vtnrsc.PortChain; //导入方法依赖的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;
}