From: Ed Warnicke Date: Wed, 12 Feb 2014 15:29:27 +0000 (+0000) Subject: Merge "Remove unused DefaultNetconfOperation marker" X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~475 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7e0134f593f1920b98c262d8a24a5d3436aafb3a;hp=a5c571df79212de5c8a1b3939d0d8d5a436a55f1 Merge "Remove unused DefaultNetconfOperation marker" --- diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index fb548d4acd..93845a356d 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -799,11 +799,6 @@ clustering.stub ${clustering.stub.version} - - org.opendaylight.controller - configuration - ${controller.version} - org.opendaylight.controller configuration.implementation @@ -1442,7 +1437,6 @@ netty-timer-config ${config.version} - org.opendaylight.controller configuration diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend index d997af5912..a7dcf80e8d 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend @@ -23,8 +23,10 @@ import org.opendaylight.yangtools.yang.binding.Notification import org.slf4j.LoggerFactory import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder import com.google.common.collect.Multimaps import org.opendaylight.yangtools.concepts.util.ListenerRegistry -import org.opendaylight.controller.sal.binding.api.NotificationProviderService.NotificationInterestListener - +import org.opendaylight.controller.sal.binding.api.NotificationProviderService.NotificationInterestListener import java.util.Set +import com.google.common.collect.ImmutableSet +import java.util.concurrent.Future + class NotificationBrokerImpl implements NotificationProviderService, AutoCloseable { val ListenerRegistry interestListeners = ListenerRegistry.create; @@ -100,7 +102,15 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab listenerToNotify = listenerToNotify + listeners.get(type as Class) } val tasks = listenerToNotify.map[new NotifyTask(it, notification)].toSet; - executor.invokeAll(tasks); + submitAll(executor,tasks); + } + + def submitAll(ExecutorService service, Set tasks) { + val ret = ImmutableSet.>builder(); + for(task : tasks) { + ret.add(service.submit(task)); + } + return ret.build(); } override registerNotificationListener(Class notificationType, diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java index 3e6a8252b7..b32d906d1e 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java @@ -7,6 +7,8 @@ */ package org.opendaylight.controller.sal.dom.broker.impl; +import static com.google.common.base.Preconditions.checkState; + import java.util.ArrayList; import java.util.Comparator; import java.util.Map.Entry; @@ -18,8 +20,8 @@ import org.opendaylight.controller.md.sal.common.api.data.DataReader; import org.opendaylight.controller.md.sal.common.impl.AbstractDataModification; import org.opendaylight.controller.md.sal.common.impl.util.AbstractLockableDelegator; import org.opendaylight.controller.sal.core.api.data.DataStore; +import org.opendaylight.controller.sal.dom.broker.util.YangDataOperations; import org.opendaylight.controller.sal.dom.broker.util.YangSchemaUtils; -import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @@ -28,14 +30,13 @@ import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.controller.sal.dom.broker.util.YangDataOperations; +import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Predicate; import com.google.common.collect.FluentIterable; - -import static com.google.common.base.Preconditions.*; +import com.google.common.collect.ImmutableSet; public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator implements // DataStore, // @@ -46,7 +47,7 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator reader = new MergeFirstLevelReader(); + private final DataReader reader = new MergeFirstLevelReader(); @Override public boolean containsConfigurationPath(InstanceIdentifier path) { @@ -164,7 +165,6 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator original) { - // NOOP for now NormalizedDataModification normalized = new NormalizedDataModification(original); for (Entry entry : original.getUpdatedConfigurationData().entrySet()) { normalized.putConfigurationData(entry.getKey(), entry.getValue()); @@ -173,14 +173,40 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator getConfigurationSubpaths(InstanceIdentifier entry) { + // FIXME: This should be replaced by index + Iterable paths = getStoredConfigurationPaths(); + + return getChildrenPaths(entry, paths); + + } + + public Iterable getOperationalSubpaths(InstanceIdentifier entry) { + // FIXME: This should be indexed + Iterable paths = getStoredOperationalPaths(); + + return getChildrenPaths(entry, paths); + } + + private static final Iterable getChildrenPaths(InstanceIdentifier entry, + Iterable paths) { + ImmutableSet.Builder children = ImmutableSet.builder(); + for (InstanceIdentifier potential : paths) { + if (entry.contains(potential)) { + children.add(entry); + } + } + return children.build(); + } + private final Comparator> preparationComparator = new Comparator>() { @Override public int compare(Entry o1, Entry o2) { @@ -282,7 +308,7 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator { - private Object identifier; + private final Object identifier; private TransactionStatus status; public NormalizedDataModification(DataModification original) { @@ -291,6 +317,29 @@ public class SchemaAwareDataStoreAdapter extends AbstractLockableDelegator paths = getOperationalSubpaths(entry); + removeOperationalData(entry); + for (InstanceIdentifier potential : paths) { + removeOperationalData(potential); + } + } + + public void deepRemoveConfigurationData(InstanceIdentifier entry) { + Iterable paths = getConfigurationSubpaths(entry); + removeConfigurationData(entry); + for (InstanceIdentifier potential : paths) { + removeConfigurationData(potential); + } + } + @Override public Object getIdentifier() { return this.identifier; diff --git a/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthenticatedUser.java b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthenticatedUser.java index 94200e66e0..809ca134f7 100644 --- a/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthenticatedUser.java +++ b/opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthenticatedUser.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.usermanager; import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -47,7 +48,7 @@ public class AuthenticatedUser implements Serializable { } public List getUserRoles() { - return userRoles; + return userRoles == null ? Collections. emptyList() : new ArrayList(userRoles); } public void addUserRole(String string) { diff --git a/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthenticatedUserTest.java b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthenticatedUserTest.java index b8a1a98769..d32799e3eb 100644 --- a/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthenticatedUserTest.java +++ b/opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthenticatedUserTest.java @@ -8,15 +8,15 @@ package org.opendaylight.controller.usermanager; +import java.util.Arrays; +import java.util.List; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.sal.authorization.UserLevel; import org.springframework.security.core.GrantedAuthority; -import java.util.Arrays; -import java.util.List; - public class AuthenticatedUserTest { static String[] roleArray; @@ -33,7 +33,7 @@ public class AuthenticatedUserTest { user = new AuthenticatedUser("auser"); Assert.assertFalse(user.getAccessDate().isEmpty()); - Assert.assertNull(user.getUserRoles()); + Assert.assertNotNull(user.getUserRoles()); } @Test diff --git a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java index 36b5043dd9..04fbf846b7 100644 --- a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java +++ b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java @@ -41,6 +41,7 @@ import org.opendaylight.controller.sal.match.Match; import org.opendaylight.controller.sal.match.MatchType; import org.opendaylight.controller.sal.reader.FlowOnNode; import org.opendaylight.controller.sal.reader.NodeConnectorStatistics; +import org.opendaylight.controller.sal.reader.NodeDescription; import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.GlobalConstants; import org.opendaylight.controller.sal.utils.HexEncode; @@ -101,6 +102,30 @@ public class Troubleshoot implements IDaylightWeb { return userLevel.ordinal() <= AUTH_LEVEL.ordinal(); } + @RequestMapping(value = "/nodeInfo", method = RequestMethod.GET) + @ResponseBody + public NodeDescription getNodeInfo(HttpServletRequest request, @RequestParam(required = false) String container, + @RequestParam(required = true) String nodeId) { + List> lines = new ArrayList>(); + String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container; + + // Derive the privilege this user has on the current container + String userName = request.getUserPrincipal().getName(); + Privilege privilege = DaylightWebUtil.getContainerPrivilege(userName, containerName, this); + + if (privilege != Privilege.NONE) { + IStatisticsManager statisticsManager = (IStatisticsManager) ServiceHelper + .getInstance(IStatisticsManager.class, containerName, this); + if(statisticsManager != null){ + Node node = Node.fromString(nodeId); + NodeDescription nodeDesc = statisticsManager.getNodeDescription(node); + return nodeDesc; + } + } + + return new NodeDescription(); + } + @RequestMapping(value = "/existingNodes", method = RequestMethod.GET) @ResponseBody public TroubleshootingJsonBean getExistingNodes(HttpServletRequest request, @RequestParam(required = false) String container) { diff --git a/opendaylight/web/troubleshoot/src/main/resources/js/page.js b/opendaylight/web/troubleshoot/src/main/resources/js/page.js index 4bc4c76fc4..09c4666d44 100644 --- a/opendaylight/web/troubleshoot/src/main/resources/js/page.js +++ b/opendaylight/web/troubleshoot/src/main/resources/js/page.js @@ -1,8 +1,8 @@ -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * */ @@ -63,13 +63,13 @@ $(one.f.menu.right.bottom).each(function(index, value) { /**Troubleshoot modules*/ one.f.troubleshooting = { rootUrl: "/controller/web/troubleshoot", - rightBottomDashlet: { + rightBottomDashlet: { get: function() { var $rightBottomDashlet = $("#right-bottom").find(".dashlet"); return $rightBottomDashlet; }, setDashletHeader: function(label) { - $("#right-bottom li a")[0].innerHTML = label; + $("#right-bottom li a")[0].innerHTML = label; } }, createTable: function(columnNames, body) { @@ -92,8 +92,11 @@ one.f.troubleshooting.existingNodes = { portsDataGrid: "one_f_troubleshooting_existingNodes_id_portsDataGrid", flowsDataGrid: "one_f_troubleshooting_existingNodes_id_flowsDataGrid", refreshFlowsButton:"one_f_troubleshooting_existingNodes_id_refreshFlowsButton", - refreshPortsButton:"one_f_troubleshooting_existingNodes_id_refreshPortsButton" - + refreshPortsButton:"one_f_troubleshooting_existingNodes_id_refreshPortsButton", + modal : { + nodeInfo : "one_f_troubleshooting_existingNodes_id_modal_nodeInfo", + cancelButton : "one_f_troubleshooting_existingNodes_id_modal_cancelButton", + } }, load: { main: function($dashlet) { @@ -171,7 +174,7 @@ one.f.troubleshooting.existingNodes = { $("#" + one.f.troubleshooting.existingNodes.id.portsDataGrid).datagrid({dataSource: dataSource}); }); } catch(e) {} - } + } }, ajax : function(url, callback) { $.getJSON(url, function(data) { @@ -204,7 +207,9 @@ one.f.troubleshooting.existingNodes = { data: data.nodeData, formatter: function(items) { $.each(items, function(index, item) { - item["statistics"] = "Flows" + + item.nodeName = "" + item.nodeName + "" + item["statistics"] = "Flows" + " Ports"; }); }, @@ -461,6 +466,46 @@ one.f.troubleshooting.existingNodes = { result.push(tr); }); return result; + }, + nodeInfo : function(nodeId){ + $.getJSON(one.main.constants.address.prefix + "/troubleshoot/nodeInfo?nodeId=" + nodeId, function(content) { + var h3 = 'Node Information' + + var headers = [ 'Description','Specification']; + + var attributes = ['table-striped', 'table-bordered', 'table-condensed']; + var $table = one.lib.dashlet.table.table(attributes); + var $thead = one.lib.dashlet.table.header(headers); + $table.append($thead); + + var footer = []; + + var cancelButton = one.lib.dashlet.button.single("Cancel", + one.f.troubleshooting.existingNodes.id.modal.nodeInfo, "", ""); + var $cancelButton = one.lib.dashlet.button.button(cancelButton); + footer.push($cancelButton); + + var body = [] + $.each(content, function(key, value) { + var tr = {}; + var entry = []; + + entry.push(key); + entry.push(value); + + tr.entry = entry; + body.push(tr); + }); + var $tbody = one.lib.dashlet.table.body(body); + $table.append($tbody); + + var $modal = one.lib.modal.spawn(one.f.troubleshooting.existingNodes.id.modal.nodeInfo, h3, $table , footer); + $modal.modal(); + + $('#'+one.f.troubleshooting.existingNodes.id.modal.nodeInfo, $modal).click(function() { + $modal.modal('hide'); + }); + }); } } }; @@ -488,7 +533,7 @@ one.f.troubleshooting.uptime = { $("#" + one.f.troubleshooting.uptime.id.datagrid).datagrid({dataSource: dataSource}); }); }, - + ajax : { main : function(url, requestData, callback) { $.getJSON(url, requestData, function(data) { @@ -496,7 +541,7 @@ one.f.troubleshooting.uptime = { }); } }, - + data: { uptimeDataGrid: function(data) { var source = new StaticDataSource({ @@ -548,7 +593,7 @@ one.f.troubleshooting.statistics = { var $p = $(document.createElement('p')); $p.text('Please select a Flow or Ports statistics'); $p.addClass('text-center').addClass('text-info'); - + $dashlet.append($none) .append($p); }