本文整理汇总了Java中org.opendaylight.controller.sal.core.Tier.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Tier.getValue方法的具体用法?Java Tier.getValue怎么用?Java Tier.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.controller.sal.core.Tier
的用法示例。
在下文中一共展示了Tier.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: switchNeedsTieringUpdate
import org.opendaylight.controller.sal.core.Tier; //导入方法依赖的package包/类
/**
* Internal convenience routine to check the eligibility of a Switch for a
* Tier update. Any Node with Tier=0 or a Tier value that is greater than
* the new Tier Value is eligible for the update.
*
* @param n
* Node for which the Tier update eligibility is checked
* @param tier
* new Tier Value
* @return <code>true</code> if the Node is eligible for Tier Update
* <code>false</code> otherwise
*/
private boolean switchNeedsTieringUpdate(Node n, int tier) {
if (n == null) {
logger.error("switchNeedsTieringUpdate(): Null node for tier: {}", tier);
return false;
}
/*
* Node could have gone down
*/
if (!switchManager.getNodes().contains(n)) {
return false;
}
// This is the case where Tier was never set for this node
Tier t = (Tier) switchManager.getNodeProp(n, Tier.TierPropName);
if (t == null)
return true;
if (t.getValue() == 0)
return true;
else if (t.getValue() > tier)
return true;
return false;
}
示例2: updateCurrentHierarchy
import org.opendaylight.controller.sal.core.Tier; //导入方法依赖的package包/类
/**
* A convenient recursive routine to obtain the Hierarchy of Switches.
*
* @param node
* Current Node in the Recursive routine.
* @param currHierarchy
* Array of Nodes that make this hierarchy on which the Current
* Switch belong
* @param fullHierarchy
* Array of multiple Hierarchies that represent a given host.
*/
@SuppressWarnings("unchecked")
private void updateCurrentHierarchy(Node node, ArrayList<String> currHierarchy, List<List<String>> fullHierarchy) {
// currHierarchy.add(String.format("%x", currSw.getId()));
currHierarchy.add(dpidToHostNameHack((Long) node.getID()));
ArrayList<String> currHierarchyClone = (ArrayList<String>) currHierarchy.clone(); // Shallow
// copy
// as
// required
Map<Node, Set<Edge>> ndlinks = topologyManager.getNodeEdges();
if (ndlinks == null) {
logger.debug("updateCurrentHierarchy(): topologyManager returned null ndlinks for node: {}", node);
return;
}
Node n = NodeCreator.createOFNode((Long) node.getID());
Set<Edge> links = ndlinks.get(n);
if (links == null) {
logger.debug("updateCurrentHierarchy(): Null links for ndlinks");
return;
}
for (Edge lt : links) {
if (!lt.getHeadNodeConnector().getType().equals(NodeConnector.NodeConnectorIDType.OPENFLOW)) {
// We don't want to work on Node that are not openflow
// for now
continue;
}
Node dstNode = lt.getHeadNodeConnector().getNode();
Tier nodeTier = (Tier) switchManager.getNodeProp(node, Tier.TierPropName);
Tier dstNodeTier = (Tier) switchManager.getNodeProp(dstNode, Tier.TierPropName);
if (dstNodeTier.getValue() > nodeTier.getValue()) {
ArrayList<String> buildHierarchy = currHierarchy;
if (currHierarchy.size() > currHierarchyClone.size()) {
buildHierarchy = (ArrayList<String>) currHierarchyClone.clone(); // Shallow
// copy
// as
// required
fullHierarchy.add(buildHierarchy);
}
updateCurrentHierarchy(dstNode, buildHierarchy, fullHierarchy);
}
}
}