本文整理汇总了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;
}