本文整理匯總了Java中org.opendaylight.controller.switchmanager.Switch.getNode方法的典型用法代碼示例。如果您正苦於以下問題:Java Switch.getNode方法的具體用法?Java Switch.getNode怎麽用?Java Switch.getNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.opendaylight.controller.switchmanager.Switch
的用法示例。
在下文中一共展示了Switch.getNode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addSingleNodes
import org.opendaylight.controller.switchmanager.Switch; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void addSingleNodes(List<Switch> nodes, ISwitchManager switchManager, String containerName) {
if (nodes == null) {
return;
}
for (Switch sw : nodes) {
Node n = sw.getNode();
// skip production node
if (nodeIgnore(n)) {
continue;
}
String description = getNodeDesc(n, switchManager);
if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) {
continue;
}
NodeBean node = createNodeBean(description, n);
// FIXME still doesn't display standalone node when last remaining link is removed
if (metaCache.get(containerName).containsKey(node.id()) && !stagedNodes.containsKey(node.id())) {
Map<String, Object> nodeEntry = metaCache.get(containerName).get(node.id());
Map<String, String> data = (Map<String, String>) nodeEntry.get("data");
data.put("$desc", description);
nodeEntry.put("data", data);
// clear adjacencies since this is now a single node
nodeEntry.put("adjacencies", new LinkedList<Map<String, Object>>());
stagedNodes.put(node.id(), nodeEntry);
} else {
newNodes.put(node.id(), node.out());
}
}
}
示例2: getNodeFlows
import org.opendaylight.controller.switchmanager.Switch; //導入方法依賴的package包/類
@RequestMapping(value = "/node-flows")
@ResponseBody
public Map<String, Object> getNodeFlows(HttpServletRequest request, @RequestParam(required = false) String container) {
String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;
// Derive the privilege this user has on the current container
String userName = request.getUserPrincipal().getName();
if (DaylightWebUtil.getContainerPrivilege(userName, containerName, this) == Privilege.NONE) {
return null;
}
ISwitchManager switchManager = (ISwitchManager) ServiceHelper
.getInstance(ISwitchManager.class, containerName, this);
if (switchManager == null) {
return null;
}
IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper
.getInstance(IForwardingRulesManager.class, containerName, this);
if (frm == null) {
return null;
}
Map<String, Object> nodes = new HashMap<String, Object>();
for (Switch sw : switchManager.getNetworkDevices()) {
Node node = sw.getNode();
List<FlowConfig> flows = frm.getStaticFlows(node);
String nodeDesc = node.toString();
SwitchConfig config = switchManager.getSwitchConfig(node
.toString());
if ((config != null) && (config.getProperty(Description.propertyName) != null)) {
nodeDesc = ((Description) config.getProperty(Description.propertyName)).getValue();
}
nodes.put(nodeDesc, flows.size());
}
return nodes;
}