From: Alessandro Boch Date: Mon, 9 Sep 2013 23:30:59 +0000 (+0000) Subject: Merge "Fix for exceptions seen in FlowProgrammer NB, when get/put is done for invalid... X-Git-Tag: releasepom-0.1.0~120 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=60e4c72f627ee42ef6fe06a39f217e9bd40165ec;hp=d1e1be5cc112a427312442f43294e5de76fece7b;p=controller.git Merge "Fix for exceptions seen in FlowProgrammer NB, when get/put is done for invalid flow" --- diff --git a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml index d9b4720503..b84346514f 100644 --- a/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml +++ b/opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml @@ -139,6 +139,12 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + opendaylight.snapshot @@ -166,11 +172,23 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + central central http://repo1.maven.org/maven2 + + false + + + true + diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 7c6a618a31..f6282d86a2 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -125,7 +125,6 @@ com.google.guava guava ${guava.version} - jar org.javassist @@ -210,11 +209,23 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + central central http://repo1.maven.org/maven2 + + false + + + true + @@ -407,10 +418,19 @@ + failsafe-integration-tests + integration-test integration-test + + failsafe-verify + verify + + verify + + diff --git a/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java b/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java index 956028b73c..a2f2297325 100644 --- a/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java +++ b/opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java @@ -16,7 +16,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.opendaylight.controller.clustering.services.IClusterServices; import org.opendaylight.controller.configuration.IConfigurationService; import org.opendaylight.controller.sal.utils.GlobalConstants; import org.opendaylight.controller.sal.utils.Status; @@ -38,7 +37,6 @@ public class ConfigurationIT { // get the OSGI bundle context @Inject private BundleContext bc; - private IClusterServices clusterService = null; private IConfigurationService configService = null; // Configure the OSGi container @@ -53,59 +51,34 @@ public class ConfigurationIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", - "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", - "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", - "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", - "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", - "0.8.0.v201110170705"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), // List logger bundles - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), - mavenBundle("org.jboss.spec.javax.transaction", - "jboss-transaction-api_1.1_spec", "1.0.1.Final"), + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), + mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(), mavenBundle("eclipselink", "javax.resource").versionAsInProject(), - mavenBundle("org.apache.felix", - "org.apache.felix.dependencymanager", "3.1.0"), + mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(), // List all the bundles on which the test case depends - mavenBundle("org.opendaylight.controller", "sal", - "0.5.0-SNAPSHOT"), // SAL connects the protocols - // plug-ins to other stuff - mavenBundle("org.opendaylight.controller", - "sal.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "protocol_plugins.stub", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "protocol_plugins.stub").versionAsInProject(), // needed bundles by switchmanager - mavenBundle("org.opendaylight.controller", "containermanager", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "containermanager.implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "containermanager.implementation").versionAsInProject(), // needed bundles by configuration - mavenBundle("org.opendaylight.controller", - "clustering.services", "0.4.0-SNAPSHOT"), // what are - // the - // clustering - // services - // for - mavenBundle("org.opendaylight.controller", "clustering.stub", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "clustering.services-implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration", - "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", - "configuration.implementation", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(), junitBundles()); } @@ -143,14 +116,6 @@ public class ConfigurationIT { // Assert if true, if false we are good to go! assertFalse(debugit); - ServiceReference r = bc.getServiceReference(IClusterServices.class - .getName()); - if (r != null) { - this.clusterService = (IClusterServices) bc.getService(r); - } - // If StatisticsManager is null, cannot run tests. - assertNotNull(this.clusterService); - } @Before diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini index 5501be46b2..ba1a54b662 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini @@ -70,8 +70,8 @@ org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml # of.discoveryTimeoutMultiple=2 # For newly added ports, allow one more retry if the elapsed time exceeds this threshold (default 30 sec) # of.discoveryThreshold=30 -# The maximum number of ports handled in one discovery batch (default 1024) -# of.discoveryBatchMaxPorts=1024 +# The maximum number of ports handled in one discovery batch (default 512) +# of.discoveryBatchMaxPorts=512 # TLS configuration # To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. diff --git a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java index 67377c1cca..4fc3afc726 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java +++ b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java @@ -63,20 +63,13 @@ public class ForwardingRulesManagerIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", - "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", - "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", - "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", - "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", - "0.8.0.v201110170705"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), // List logger bundles mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), mavenBundle("org.slf4j", "log4j-over-slf4j") diff --git a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java index 995ee57515..2451e196f2 100644 --- a/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java +++ b/opendaylight/hosttracker/api/src/main/java/org/opendaylight/controller/hosttracker/IfIptoHost.java @@ -120,7 +120,7 @@ public interface IfIptoHost { * @param nc * NodeConnector to which the host is attached * @param vlan - * VLAN the host belongs to + * VLAN the host belongs to (null or empty for no vlan) * @return The status object as described in {@code Status} indicating the * result of this action. */ diff --git a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java index e4704d3048..9f0cd893b0 100644 --- a/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java +++ b/opendaylight/hosttracker/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/HostTracker.java @@ -307,7 +307,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw @Override public Future discoverHost(InetAddress networkAddress) { if (executor == null) { - logger.error("discoverHost: Null executor"); + logger.debug("discoverHost: Null executor"); return null; } Callable worker = new HostTrackerCallable(this, networkAddress); @@ -348,12 +348,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw @Override public Set getAllHosts() { - Set allHosts = new HashSet(); - for (Entry entry : hostsDB.entrySet()) { - HostNodeConnector host = entry.getValue(); - allHosts.add(host); - } - logger.debug("Exiting getAllHosts, Found {} Hosts", allHosts.size()); + Set allHosts = new HashSet(hostsDB.values()); return allHosts; } @@ -366,17 +361,12 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw list.add(host); } } - logger.debug("getActiveStaticHosts(): Found {} Hosts", list.size()); return list; } @Override public Set getInactiveStaticHosts() { - Set list = new HashSet(); - for (Entry entry : inactiveStaticHosts.entrySet()) { - list.add(entry.getValue()); - } - logger.debug("getInactiveStaticHosts(): Found {} Hosts", list.size()); + Set list = new HashSet(inactiveStaticHosts.values()); return list; } @@ -549,7 +539,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw ta.notifyHTClientHostRemoved(host); } } catch (Exception e) { - logger.error("Exception on callback", e); + logger.error("Exception on new host notification", e); } } } @@ -1034,7 +1024,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw * probe. However, continue the age out the hosts since * we don't know if the host is indeed out there or not. */ - logger.warn("ARPHandler is not avaialable, can't send the probe"); + logger.trace("ARPHandler is not avaialable, can't send the probe"); continue; } hostFinder.probe(host); @@ -1062,7 +1052,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw * indicating the result of this action. */ - public Status addStaticHostReq(InetAddress networkAddr, byte[] dataLayerAddress, NodeConnector nc, short vlan) { + protected Status addStaticHostReq(InetAddress networkAddr, byte[] dataLayerAddress, NodeConnector nc, short vlan) { if (dataLayerAddress.length != NetUtils.MACAddrLengthInBytes) { return new Status(StatusCode.BADREQUEST, "Invalid MAC address"); } @@ -1078,13 +1068,13 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw // northbound request HostNodeConnector transHost = hostsDB.get(networkAddr); transHost.setStaticHost(true); - return new Status(StatusCode.SUCCESS, null); + return new Status(StatusCode.SUCCESS); } if (hostsDB.get(networkAddr) != null) { // There is already a host with this IP address (but behind // a different (switch, port, vlan) tuple. Return an error - return new Status(StatusCode.CONFLICT, "Existing IP, Use PUT to update"); + return new Status(StatusCode.CONFLICT, "Host with this IP already exists."); } host.setStaticHost(true); /* @@ -1108,7 +1098,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw logger.debug("Switch or switchport is not up, adding host {} to inactive list", networkAddr.getHostName()); } - return new Status(StatusCode.SUCCESS, null); + return new Status(StatusCode.SUCCESS); } catch (ConstructionException e) { logger.error("", e); return new Status(StatusCode.INTERNALERROR, "Host could not be created"); @@ -1291,25 +1281,33 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw public Status addStaticHost(String networkAddress, String dataLayerAddress, NodeConnector nc, String vlan) { try { InetAddress ip = InetAddress.getByName(networkAddress); - if (nc == null) { - return new Status(StatusCode.BADREQUEST, "Invalid NodeId"); + short vl = 0; + if (vlan != null && !vlan.isEmpty()) { + vl = Short.decode(vlan); + if (vl < 1 || vl > 4095) { + return new Status(StatusCode.BADREQUEST, "Host vlan out of range [1 - 4095]"); + } } - return addStaticHostReq(ip, HexEncode.bytesFromHexString(dataLayerAddress), nc, Short.valueOf(vlan)); + + return addStaticHostReq(ip, HexEncode.bytesFromHexString(dataLayerAddress), nc, vl); + } catch (UnknownHostException e) { - logger.error("", e); - return new Status(StatusCode.BADREQUEST, "Invalid Address"); + logger.debug("Invalid host IP specified when adding static host", e); + return new Status(StatusCode.BADREQUEST, "Invalid Host IP Address"); + } catch (NumberFormatException nfe) { + logger.debug("Invalid host vlan or MAC specified when adding static host", nfe); + return new Status(StatusCode.BADREQUEST, "Invalid Host vLan/MAC"); } } @Override public Status removeStaticHost(String networkAddress) { - InetAddress address; try { - address = InetAddress.getByName(networkAddress); + InetAddress address = InetAddress.getByName(networkAddress); return removeStaticHostReq(address); } catch (UnknownHostException e) { - logger.error("", e); - return new Status(StatusCode.BADREQUEST, "Invalid Address"); + logger.debug("Invalid IP Address when trying to remove host", e); + return new Status(StatusCode.BADREQUEST, "Invalid IP Address when trying to remove host"); } } @@ -1317,11 +1315,11 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw ARPPending arphost; HostNodeConnector host = null; - logger.debug("handleNodeConnectorStatusUp {}", nodeConnector); + logger.trace("handleNodeConnectorStatusUp {}", nodeConnector); for (Entry entry : failedARPReqList.entrySet()) { arphost = entry.getValue(); - logger.debug("Sending the ARP from FailedARPReqList fors IP: {}", arphost.getHostIP().getHostAddress()); + logger.trace("Sending the ARP from FailedARPReqList fors IP: {}", arphost.getHostIP().getHostAddress()); if (hostFinder == null) { logger.warn("ARPHandler is not available at interface up"); logger.warn("Since this event is missed, host(s) connected to interface {} may not be discovered", @@ -1340,7 +1338,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw arphost.getHostIP(), nodeConnector); logger.error("", e); } - logger.debug("Done. handleNodeConnectorStatusUp {}", nodeConnector); } host = inactiveStaticHosts.get(nodeConnector); @@ -1353,7 +1350,7 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw } private void handleNodeConnectorStatusDown(NodeConnector nodeConnector) { - logger.debug("handleNodeConnectorStatusDown {}", nodeConnector); + logger.trace("handleNodeConnectorStatusDown {}", nodeConnector); for (Entry entry : hostsDB.entrySet()) { HostNodeConnector host = entry.getValue(); diff --git a/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java b/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java index 3734a63e56..57e2714ff1 100644 --- a/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java +++ b/opendaylight/hosttracker/integrationtest/src/test/java/org/opendaylight/controller/hosttracker/internal/HostTrackerIT.java @@ -69,13 +69,13 @@ public class HostTrackerIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services","3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), // List logger bundles mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), @@ -174,9 +174,9 @@ public class HostTrackerIT { NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); // test addStaticHost(), store into inactive host DB - Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0"); + Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null); Assert.assertTrue(st.isSuccess()); - st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0"); + st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, ""); Assert.assertTrue(st.isSuccess()); // check inactive DB @@ -213,8 +213,11 @@ public class HostTrackerIT { NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); // test addStaticHost(), put into inactive host DB if not verifiable - Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0"); + Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null); + Assert.assertTrue(st.isSuccess()); st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0"); + Assert.assertFalse(st.isSuccess()); + this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null); @@ -251,8 +254,8 @@ public class HostTrackerIT { NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1); // test addStaticHost(), put into inactive host DB if not verifiable - Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0"); - st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0"); + Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null); + st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, ""); HostNodeConnector hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8")); assertNull(hnc_1); diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/RestMessages.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/RestMessages.java index 668efbc7ee..ba2476a137 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/RestMessages.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/RestMessages.java @@ -15,7 +15,7 @@ public enum RestMessages { "Operation failed due to Resource Conflict"), NODEFAULT("Container default is not a custom container"), DEFAULTDISABLED( "Container(s) are configured. Container default is not operational"), NOTALLOWEDONDEFAULT( "Container default is a static resource, no modification allowed on it"), UNKNOWNACTION("Unknown action"), INVALIDJSON( - "JSON message is invalid"), INVALIDADDRESS("invalid InetAddress"), AVAILABLESOON( + "JSON message is invalid"), INVALIDADDRESS("Invalid InetAddress"), AVAILABLESOON( "Resource is not implemented yet"), INTERNALERROR("Internal Error"), SERVICEUNAVAILABLE( "Service is not available. Could be down for maintanence"), INVALIDDATA( "Data is invalid or conflicts with URI"); diff --git a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java index 769461167c..91185bb405 100644 --- a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java +++ b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.core.UriInfo; import javax.xml.bind.JAXBElement; import org.codehaus.enunciate.jaxrs.ResponseCode; @@ -34,12 +35,11 @@ import org.opendaylight.controller.containermanager.IContainerManager; import org.opendaylight.controller.hosttracker.IfIptoHost; import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector; import org.opendaylight.controller.northbound.commons.RestMessages; -import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException; +import org.opendaylight.controller.northbound.commons.exception.BadRequestException; import org.opendaylight.controller.northbound.commons.exception.ResourceConflictException; import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException; import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException; import org.opendaylight.controller.northbound.commons.exception.UnauthorizedException; -import org.opendaylight.controller.northbound.commons.exception.UnsupportedMediaTypeException; import org.opendaylight.controller.northbound.commons.utils.NorthboundUtils; import org.opendaylight.controller.sal.authorization.Privilege; import org.opendaylight.controller.sal.core.Node; @@ -47,7 +47,6 @@ import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.utils.GlobalConstants; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.utils.Status; -import org.opendaylight.controller.sal.utils.StatusCode; import org.opendaylight.controller.switchmanager.ISwitchManager; /** @@ -86,11 +85,10 @@ public class HostTrackerNorthbound { } private IfIptoHost getIfIpToHostService(String containerName) { - IContainerManager containerManager = (IContainerManager) ServiceHelper - .getGlobalInstance(IContainerManager.class, this); + IContainerManager containerManager = (IContainerManager) ServiceHelper.getGlobalInstance( + IContainerManager.class, this); if (containerManager == null) { - throw new ServiceUnavailableException("Container " - + RestMessages.SERVICEUNAVAILABLE.toString()); + throw new ServiceUnavailableException("Container " + RestMessages.SERVICEUNAVAILABLE.toString()); } boolean found = false; @@ -98,20 +96,17 @@ public class HostTrackerNorthbound { for (String cName : containerNames) { if (cName.trim().equalsIgnoreCase(containerName.trim())) { found = true; + break; } } - if (found == false) { - throw new ResourceNotFoundException(containerName + " " - + RestMessages.NOCONTAINER.toString()); + if (!found) { + throw new ResourceNotFoundException(containerName + " " + RestMessages.NOCONTAINER.toString()); } - IfIptoHost hostTracker = (IfIptoHost) ServiceHelper.getInstance( - IfIptoHost.class, containerName, this); - + IfIptoHost hostTracker = (IfIptoHost) ServiceHelper.getInstance(IfIptoHost.class, containerName, this); if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); + throw new ServiceUnavailableException("Host Tracker " + RestMessages.SERVICEUNAVAILABLE.toString()); } return hostTracker; @@ -207,17 +202,11 @@ public class HostTrackerNorthbound { @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") }) public Hosts getActiveHosts(@PathParam("containerName") String containerName) { - if (!NorthboundUtils.isAuthorized( - getUserName(), containerName, Privilege.READ, this)) { - throw new UnauthorizedException( - "User is not authorized to perform this operation on container " - + containerName); + if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.READ, this)) { + throw new UnauthorizedException("User is not authorized to perform this operation on container " + + containerName); } IfIptoHost hostTracker = getIfIpToHostService(containerName); - if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } return convertHosts(hostTracker.getAllHosts()); } @@ -300,17 +289,11 @@ public class HostTrackerNorthbound { @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") }) public Hosts getInactiveHosts( @PathParam("containerName") String containerName) { - if (!NorthboundUtils.isAuthorized( - getUserName(), containerName, Privilege.READ, this)) { - throw new UnauthorizedException( - "User is not authorized to perform this operation on container " - + containerName); + if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.READ, this)) { + throw new UnauthorizedException("User is not authorized to perform this operation on container " + + containerName); } IfIptoHost hostTracker = getIfIpToHostService(containerName); - if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } return convertHosts(hostTracker.getInactiveStaticHosts()); } @@ -364,30 +347,23 @@ public class HostTrackerNorthbound { @TypeHint(HostConfig.class) @StatusCodes({ @ResponseCode(code = 200, condition = "Operation successful"), + @ResponseCode(code = 400, condition = "Invalid IP specified in networkAddress parameter"), @ResponseCode(code = 404, condition = "The containerName is not found"), - @ResponseCode(code = 415, condition = "Invalid IP Address passed in networkAddress parameter"), @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") }) public HostConfig getHostDetails( @PathParam("containerName") String containerName, @PathParam("networkAddress") String networkAddress) { - if (!NorthboundUtils.isAuthorized( - getUserName(), containerName, Privilege.READ, this)) { - throw new UnauthorizedException( - "User is not authorized to perform this operation on container " - + containerName); + if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.READ, this)) { + throw new UnauthorizedException("User is not authorized to perform this operation on container " + + containerName); } IfIptoHost hostTracker = getIfIpToHostService(containerName); - if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } InetAddress ip; try { ip = InetAddress.getByName(networkAddress); } catch (UnknownHostException e) { - throw new UnsupportedMediaTypeException(networkAddress + " " - + RestMessages.INVALIDADDRESS.toString()); + throw new BadRequestException(RestMessages.INVALIDADDRESS.toString() + " " + networkAddress); } for (HostNodeConnector host : hostTracker.getAllHosts()) { if (host.getNetworkAddress().equals(ip)) { @@ -450,63 +426,44 @@ public class HostTrackerNorthbound { @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @StatusCodes({ @ResponseCode(code = 201, condition = "Static host created successfully"), - @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"), - @ResponseCode(code = 406, condition = "Cannot operate on Default Container when other Containers are active"), - @ResponseCode(code = 415, condition = "Invalid IP Address passed in networkAddress parameter"), - @ResponseCode(code = 500, condition = "Failed to create Static Host entry. Failure Reason included in HTTP Error response"), + @ResponseCode(code = 400, condition = "Invalid parameters specified, see response body for details"), + @ResponseCode(code = 404, condition = "The container or resource is not found"), + @ResponseCode(code = 409, condition = "Resource conflict, see response body for details"), @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") }) - public Response addHost(@PathParam("containerName") String containerName, + public Response addHost(@Context UriInfo uriInfo, @PathParam("containerName") String containerName, @PathParam("networkAddress") String networkAddress, @TypeHint(HostConfig.class) JAXBElement hostConfig) { - if (!NorthboundUtils.isAuthorized( - getUserName(), containerName, Privilege.WRITE, this)) { - throw new UnauthorizedException( - "User is not authorized to perform this operation on container " - + containerName); + if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) { + return Response.status(Response.Status.UNAUTHORIZED) + .entity("User is not authorized to perform this operation on container " + containerName) + .build(); } handleDefaultDisabled(containerName); IfIptoHost hostTracker = getIfIpToHostService(containerName); - if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } HostConfig hc = hostConfig.getValue(); - Node node = handleNodeAvailability(containerName, hc.getNodeType(), hc.getNodeId()); - if (node == null) { - throw new InternalServerErrorException( - RestMessages.NONODE.toString()); + if (!networkAddress.equals(hc.getNetworkAddress())) { + return Response.status(Response.Status.CONFLICT) + .entity("Resource name in config object doesn't match URI") + .build(); } - - try { - InetAddress.getByName(networkAddress); - } catch (UnknownHostException e) { - throw new UnsupportedMediaTypeException(networkAddress + " " - + RestMessages.INVALIDADDRESS.toString()); - } - if(!networkAddress.equals(hc.getNetworkAddress())) { - throw new UnsupportedMediaTypeException(networkAddress + " is not the same as " - + hc.getNetworkAddress()); - } - if(!hc.isStaticHost()) { - throw new UnsupportedMediaTypeException("StaticHost flag must be true"); + if (!hc.isStaticHost()) { + return Response.status(Response.Status.BAD_REQUEST) + .entity("Can only add static host.") + .build(); } + Node node = handleNodeAvailability(containerName, hc.getNodeType(), hc.getNodeId()); NodeConnector nc = NodeConnector.fromStringNoNode(hc.getNodeConnectorType(), hc.getNodeConnectorId(), node); - if (nc == null) { - throw new ResourceNotFoundException(hc.getNodeConnectorType() + "|" - + hc.getNodeConnectorId() + " : " + RestMessages.NONODE.toString()); - } - Status status = hostTracker.addStaticHost(networkAddress, - hc.getDataLayerAddress(), nc, hc.getVlan()); + + Status status = hostTracker.addStaticHost(networkAddress, hc.getDataLayerAddress(), nc, hc.getVlan()); if (status.isSuccess()) { NorthboundUtils.auditlog("Static Host", username, "added", networkAddress, containerName); - return Response.status(Response.Status.CREATED).build(); - } else if (status.getCode().equals(StatusCode.BADREQUEST)) { - throw new UnsupportedMediaTypeException(status.getDescription()); + return Response.created(uriInfo.getRequestUri()).build(); } - throw new InternalServerErrorException(status.getDescription()); + + return NorthboundUtils.getResponse(status); } /** @@ -524,42 +481,28 @@ public class HostTrackerNorthbound { @DELETE @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @StatusCodes({ - @ResponseCode(code = 200, condition = "Flow Config deleted successfully"), - @ResponseCode(code = 404, condition = "The Container Name or Node-id or Flow Name passed is not found"), + @ResponseCode(code = 204, condition = "Static host deleted successfully"), + @ResponseCode(code = 404, condition = "The container or a specified resource was not found"), @ResponseCode(code = 406, condition = "Cannot operate on Default Container when other Containers are active"), - @ResponseCode(code = 415, condition = "Invalid IP Address passed in networkAddress parameter"), - @ResponseCode(code = 500, condition = "Failed to delete Flow config. Failure Reason included in HTTP Error response"), @ResponseCode(code = 503, condition = "One or more of Controller service is unavailable") }) - public Response deleteFlow( + public Response deleteHost( @PathParam(value = "containerName") String containerName, @PathParam(value = "networkAddress") String networkAddress) { - if (!NorthboundUtils.isAuthorized( - getUserName(), containerName, Privilege.WRITE, this)) { - throw new UnauthorizedException( - "User is not authorized to perform this operation on container " - + containerName); + if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) { + return Response.status(Response.Status.UNAUTHORIZED) + .entity("User is not authorized to perform this operation on container " + containerName) + .build(); } handleDefaultDisabled(containerName); IfIptoHost hostTracker = getIfIpToHostService(containerName); - if (hostTracker == null) { - throw new ServiceUnavailableException("Host Tracker " - + RestMessages.SERVICEUNAVAILABLE.toString()); - } - - try { - InetAddress.getByName(networkAddress); - } catch (UnknownHostException e) { - throw new UnsupportedMediaTypeException(networkAddress + " " - + RestMessages.INVALIDADDRESS.toString()); - } Status status = hostTracker.removeStaticHost(networkAddress); if (status.isSuccess()) { NorthboundUtils.auditlog("Static Host", username, "removed", networkAddress, containerName); - return Response.ok().build(); + return Response.noContent().build(); } - throw new InternalServerErrorException(status.getDescription()); + return NorthboundUtils.getResponse(status); } @@ -567,8 +510,8 @@ public class HostTrackerNorthbound { IContainerManager containerManager = (IContainerManager) ServiceHelper .getGlobalInstance(IContainerManager.class, this); if (containerManager == null) { - throw new InternalServerErrorException( - RestMessages.INTERNALERROR.toString()); + throw new ServiceUnavailableException( + RestMessages.SERVICEUNAVAILABLE.toString()); } if (containerName.equals(GlobalConstants.DEFAULT.toString()) && containerManager.hasNonDefaultContainer()) { @@ -577,8 +520,7 @@ public class HostTrackerNorthbound { } } - private Node handleNodeAvailability(String containerName, String nodeType, - String nodeId) { + private Node handleNodeAvailability(String containerName, String nodeType, String nodeId) { Node node = Node.fromString(nodeType, nodeId); if (node == null) { diff --git a/opendaylight/northbound/integrationtest/pom.xml b/opendaylight/northbound/integrationtest/pom.xml index 9432d6f622..88cff5ed83 100644 --- a/opendaylight/northbound/integrationtest/pom.xml +++ b/opendaylight/northbound/integrationtest/pom.xml @@ -5,9 +5,9 @@ 4.0.0 org.opendaylight.controller - commons.opendaylight - 1.4.0-SNAPSHOT - ../../commons/opendaylight + commons.integrationtest + 0.5.0-SNAPSHOT + ../../commons/integrationtest scm:git:ssh://git.opendaylight.org:29418/controller.git @@ -23,6 +23,12 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + @@ -151,6 +157,11 @@ usermanager 0.4.0-SNAPSHOT + + org.opendaylight.controller + usermanager.implementation + 0.4.0-SNAPSHOT + org.opendaylight.controller security @@ -282,6 +293,11 @@ commons-fileupload 1.2.2 + + commons-codec + commons-codec + 1.8 + equinoxSDK381 javax.servlet diff --git a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java index f4adc71fa2..f7ebfe438f 100644 --- a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java +++ b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java @@ -903,7 +903,7 @@ public class NorthboundIT { Integer nodeId_1 = 3366; String nodeConnectorType_1 = "STUB"; Integer nodeConnectorId_1 = 12; - String vlan_1 = "4"; + String vlan_1 = ""; // 2nd host String networkAddress_2 = "10.1.1.1"; @@ -912,7 +912,7 @@ public class NorthboundIT { Integer nodeId_2 = 4477; String nodeConnectorType_2 = "STUB"; Integer nodeConnectorId_2 = 34; - String vlan_2 = "0"; + String vlan_2 = "123"; String baseURL = "http://127.0.0.1:8080/controller/nb/v2/host/default"; @@ -969,7 +969,7 @@ public class NorthboundIT { Assert.assertTrue(host_jo.getInt("nodeConnectorId") == nodeConnectorId_1); Assert.assertTrue(host_jo.getString("nodeType").equalsIgnoreCase(nodeType_1)); Assert.assertTrue(host_jo.getInt("nodeId") == nodeId_1); - Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(vlan_1)); + Assert.assertTrue(host_jo.getString("vlan").equals("0")); Assert.assertTrue(host_jo.getBoolean("staticHost")); } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) { Assert.assertTrue(host_jo.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_2)); @@ -1030,13 +1030,13 @@ public class NorthboundIT { Assert.assertTrue(json.getInt("nodeConnectorId") == nodeConnectorId_1); Assert.assertTrue(json.getString("nodeType").equalsIgnoreCase(nodeType_1)); Assert.assertTrue(json.getInt("nodeId") == nodeId_1); - Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1)); + Assert.assertTrue(json.getString("vlan").equals("0")); Assert.assertTrue(json.getBoolean("staticHost")); // test DELETE method for deleteFlow() result = getJsonResult(baseURL + "/" + networkAddress_1, "DELETE"); - Assert.assertTrue(httpResponseCode == 200); + Assert.assertTrue(httpResponseCode == 204); // verify host_1 removed from active host DB // test GET method: getActiveHosts() - no host expected @@ -1274,160 +1274,160 @@ public class NorthboundIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), - mavenBundle("javax.servlet", "servlet-api", "2.5"), - - mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.2"), - mavenBundle("org.slf4j", "slf4j-api", "1.7.2"), - mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"), - mavenBundle("ch.qos.logback", "logback-core", "1.0.9"), - mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), - mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager", "3.1.0"), + mavenBundle("org.slf4j", "jcl-over-slf4j").versionAsInProject(), + mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), + mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), + mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), + mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(), // the plugin stub to get data for the tests - mavenBundle("org.opendaylight.controller", "protocol_plugins.stub", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "protocol_plugins.stub").versionAsInProject(), // List all the opendaylight modules - mavenBundle("org.opendaylight.controller", "configuration", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "configuration.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "containermanager", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "containermanager.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.services", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.services-implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "security", "0.4.0-SNAPSHOT").noStart(), - mavenBundle("org.opendaylight.controller", "sal", "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal.connection", "0.1.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "sal.connection.implementation", "0.1.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager", "0.5.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "connectionmanager", "0.1.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "connectionmanager.implementation", "0.1.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "forwardingrulesmanager", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "forwardingrulesmanager.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "statisticsmanager", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "arphandler", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "arphandler", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "routing.dijkstra_implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "topologymanager", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "usermanager", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "usermanager.implementation", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "logging.bridge", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "clustering.test", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "forwarding.staticrouting", "0.4.0-SNAPSHOT"), + mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "containermanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "clustering.services-implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "security").versionAsInProject().noStart(), + mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "sal.connection.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "connectionmanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "connectionmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "forwardingrulesmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "routing.dijkstra_implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "topologymanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "usermanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "logging.bridge").versionAsInProject(), +// mavenBundle("org.opendaylight.controller", "clustering.test").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "forwarding.staticrouting").versionAsInProject(), // Northbound bundles - mavenBundle("org.opendaylight.controller", "commons.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "forwarding.staticrouting.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "statistics.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "topology.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "hosttracker.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "switchmanager.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound", "0.4.0-SNAPSHOT"), - mavenBundle("org.opendaylight.controller", "subnets.northbound", "0.4.0-SNAPSHOT"), - - mavenBundle("org.codehaus.jackson", "jackson-mapper-asl", "1.9.8"), - mavenBundle("org.codehaus.jackson", "jackson-core-asl", "1.9.8"), - mavenBundle("org.codehaus.jackson", "jackson-jaxrs", "1.9.8"), - mavenBundle("org.codehaus.jettison", "jettison", "1.3.3"), - - mavenBundle("commons-io", "commons-io", "2.3"), - - mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"), - - mavenBundle("equinoxSDK381", "javax.servlet", "3.0.0.v201112011016"), - mavenBundle("equinoxSDK381", "javax.servlet.jsp", "2.2.0.v201112011158"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", "1.4.0.v20120522-1841"), - mavenBundle("orbit", "javax.xml.rpc", "1.1.0.v201005080400"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm", "1.0.400.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher", "1.3.0.v20120522-1813"), - - mavenBundle("geminiweb", "org.eclipse.gemini.web.core", "2.2.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.gemini.web.extender", "2.2.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat", "2.2.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions", "3.6.0.RELEASE").noStart(), - mavenBundle("geminiweb", "org.eclipse.virgo.util.common", "3.6.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.util.io", "3.6.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.util.math", "3.6.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi", "3.6.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest", "3.6.0.RELEASE"), - mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest", "3.6.0.RELEASE"), - - mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager", "3.1.0"), - mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell", "3.0.1"), - - mavenBundle("com.google.code.gson", "gson", "2.1"), - mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec", "1.0.1.Final"), - mavenBundle("org.apache.felix", "org.apache.felix.fileinstall", "3.1.6"), - mavenBundle("org.apache.commons", "commons-lang3", "3.1"), - mavenBundle("commons-codec", "commons-codec"), - mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch", "3.8.0.I20120518-2145"), - mavenBundle("eclipselink", "javax.persistence", "2.0.4.v201112161009"), - mavenBundle("eclipselink", "javax.resource", "1.5.0.v200906010428"), - - mavenBundle("orbit", "javax.activation", "1.1.0.v201211130549"), - mavenBundle("orbit", "javax.annotation", "1.1.0.v201209060031"), - mavenBundle("orbit", "javax.ejb", "3.1.1.v201204261316"), - mavenBundle("orbit", "javax.el", "2.2.0.v201108011116"), - mavenBundle("orbit", "javax.mail.glassfish", "1.4.1.v201108011116"), - mavenBundle("orbit", "javax.xml.rpc", "1.1.0.v201005080400"), - mavenBundle("orbit", "org.apache.catalina", "7.0.32.v201211201336"), + mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "forwarding.staticrouting.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "statistics.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "topology.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "hosttracker.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "switchmanager.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound").versionAsInProject(), + mavenBundle("org.opendaylight.controller", "subnets.northbound").versionAsInProject(), + + mavenBundle("org.codehaus.jackson", "jackson-mapper-asl").versionAsInProject(), + mavenBundle("org.codehaus.jackson", "jackson-core-asl").versionAsInProject(), + mavenBundle("org.codehaus.jackson", "jackson-jaxrs").versionAsInProject(), + mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(), + + mavenBundle("commons-io", "commons-io").versionAsInProject(), + + mavenBundle("commons-fileupload", "commons-fileupload").versionAsInProject(), + + mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(), + mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher").versionAsInProject(), + + mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.gemini.web.extender").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.common").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.io").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest").versionAsInProject(), + mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(), + + mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(), + mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(), + + mavenBundle("com.google.code.gson", "gson").versionAsInProject(), + mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(), + mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").versionAsInProject(), + mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), + mavenBundle("commons-codec", "commons-codec").versionAsInProject(), + mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch").versionAsInProject(), + mavenBundle("eclipselink", "javax.persistence").versionAsInProject(), + mavenBundle("eclipselink", "javax.resource").versionAsInProject(), + + mavenBundle("orbit", "javax.activation").versionAsInProject(), + mavenBundle("orbit", "javax.annotation").versionAsInProject(), + mavenBundle("orbit", "javax.ejb").versionAsInProject(), + mavenBundle("orbit", "javax.el").versionAsInProject(), + mavenBundle("orbit", "javax.mail.glassfish").versionAsInProject(), + mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(), + mavenBundle("orbit", "org.apache.catalina").versionAsInProject(), // these are bundle fragments that can't be started on its own - mavenBundle("orbit", "org.apache.catalina.ha", "7.0.32.v201211201952").noStart(), - mavenBundle("orbit", "org.apache.catalina.tribes", "7.0.32.v201211201952").noStart(), - mavenBundle("orbit", "org.apache.coyote", "7.0.32.v201211201952").noStart(), - mavenBundle("orbit", "org.apache.jasper", "7.0.32.v201211201952").noStart(), - - mavenBundle("orbit", "org.apache.el", "7.0.32.v201211081135"), - mavenBundle("orbit", "org.apache.juli.extras", "7.0.32.v201211081135"), - mavenBundle("orbit", "org.apache.tomcat.api", "7.0.32.v201211081135"), - mavenBundle("orbit", "org.apache.tomcat.util", "7.0.32.v201211201952").noStart(), - mavenBundle("orbit", "javax.servlet.jsp.jstl", "1.2.0.v201105211821"), - mavenBundle("orbit", "javax.servlet.jsp.jstl.impl", "1.2.0.v201210211230"), - - mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native"), - mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4"), - mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn"), - mavenBundle("org.ops4j.pax.url", "pax-url-aether"), - - mavenBundle("org.springframework", "org.springframework.asm", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.aop", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.context", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.context.support", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.core", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.beans", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.expression", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.web", "3.1.3.RELEASE"), - - mavenBundle("org.aopalliance", "com.springsource.org.aopalliance", "1.0.0"), - mavenBundle("org.springframework", "org.springframework.web.servlet", "3.1.3.RELEASE"), - mavenBundle("org.springframework.security", "spring-security-config", "3.1.3.RELEASE"), - mavenBundle("org.springframework.security", "spring-security-core", "3.1.3.RELEASE"), - mavenBundle("org.springframework.security", "spring-security-web", "3.1.3.RELEASE"), - mavenBundle("org.springframework.security", "spring-security-taglibs", "3.1.3.RELEASE"), - mavenBundle("org.springframework", "org.springframework.transaction", "3.1.3.RELEASE"), - - mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans", "1.0.0"), - mavenBundle("org.opendaylight.controller.thirdparty", "net.sf.jung2", "2.0.1-SNAPSHOT"), - mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet", "1.17-SNAPSHOT"), - mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter", - "7.0.42-SNAPSHOT").noStart(), + mavenBundle("orbit", "org.apache.catalina.ha").versionAsInProject().noStart(), + mavenBundle("orbit", "org.apache.catalina.tribes").versionAsInProject().noStart(), + mavenBundle("orbit", "org.apache.coyote").versionAsInProject().noStart(), + mavenBundle("orbit", "org.apache.jasper").versionAsInProject().noStart(), + + mavenBundle("orbit", "org.apache.el").versionAsInProject(), + mavenBundle("orbit", "org.apache.juli.extras").versionAsInProject(), + mavenBundle("orbit", "org.apache.tomcat.api").versionAsInProject(), + mavenBundle("orbit", "org.apache.tomcat.util").versionAsInProject().noStart(), + mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(), + mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(), + + mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native").versionAsInProject(), + mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4").versionAsInProject(), + mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn").versionAsInProject(), + mavenBundle("org.ops4j.pax.url", "pax-url-aether").versionAsInProject(), + + mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.aop").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.context").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.beans").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.expression").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(), + + mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.web.servlet").versionAsInProject(), + mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(), + mavenBundle("org.springframework.security", "spring-security-core").versionAsInProject(), + mavenBundle("org.springframework.security", "spring-security-web").versionAsInProject(), + mavenBundle("org.springframework.security", "spring-security-taglibs").versionAsInProject(), + mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(), + + mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans").versionAsInProject(), + mavenBundle("org.opendaylight.controller.thirdparty", "net.sf.jung2").versionAsInProject(), + mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet") + .versionAsInProject(), + mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter") + .versionAsInProject().noStart(), // Jersey needs to be started before the northbound application // bundles, using a lower start level - mavenBundle("com.sun.jersey", "jersey-client", "1.17"), - mavenBundle("com.sun.jersey", "jersey-server", "1.17").startLevel(2), - mavenBundle("com.sun.jersey", "jersey-core", "1.17").startLevel(2), - mavenBundle("com.sun.jersey", "jersey-json", "1.17").startLevel(2), junitBundles()); + mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(), + mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2), + mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2), + mavenBundle("com.sun.jersey", "jersey-json").versionAsInProject().startLevel(2), junitBundles()); } } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java index 1938cb1ae6..0895d9af27 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java @@ -131,6 +131,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa class DiscoveryTransmit implements Runnable { private final BlockingQueue transmitQ; + private int count = 0; DiscoveryTransmit(BlockingQueue transmitQ) { this.transmitQ = transmitQ; @@ -144,6 +145,9 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa RawPacket outPkt = createDiscoveryPacket(nodeConnector); sendDiscoveryPacket(nodeConnector, outPkt); nodeConnector = null; + if ((++count & 0x7f) == 0) { + Thread.sleep(10); + } } catch (InterruptedException e1) { logger.warn("DiscoveryTransmit interupted", e1.getMessage()); if (shuttingDown) { @@ -1679,7 +1683,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa */ private int getDiscoveryBatchMaxPorts() { String val = System.getProperty("of.discoveryBatchMaxPorts"); - int ports = 1024; + int ports = 512; if (val != null) { try { diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java index c26800890b..7b934edfa7 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java @@ -105,4 +105,9 @@ public class Actions extends Property { public String toString() { return "Actions[" + actionsValue + "]"; } + + @Override + public String getStringValue() { + return Integer.toHexString(actionsValue); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java index 1282d5ef9c..8c3a977518 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Bandwidth.java @@ -105,24 +105,25 @@ public class Bandwidth extends Property { @Override public String toString() { - StringBuffer sb = new StringBuffer(); + return "BandWidth[" + getStringValue() + "]"; + } - sb.append("BandWidth["); + @Override + public String getStringValue() { if (this.bandwidthValue == 0) { - sb.append("UnKnown"); + return("UnKnown"); } else if (this.bandwidthValue < BW1Kbps) { - sb.append(this.bandwidthValue + "bps"); + return(this.bandwidthValue + "bps"); } else if (this.bandwidthValue < BW1Mbps) { - sb.append(Long.toString(this.bandwidthValue / BW1Kbps) + "Kbps"); + return(Long.toString(this.bandwidthValue / BW1Kbps) + "Kbps"); } else if (this.bandwidthValue < BW1Gbps) { - sb.append(Long.toString(this.bandwidthValue / BW1Mbps) + "Mbps"); + return(Long.toString(this.bandwidthValue / BW1Mbps) + "Mbps"); } else if (this.bandwidthValue < BW1Tbps) { - sb.append(Long.toString(this.bandwidthValue / BW1Gbps) + "Gbps"); + return(Long.toString(this.bandwidthValue / BW1Gbps) + "Gbps"); } else if (this.bandwidthValue < BW1Pbps) { - sb.append(Long.toString(this.bandwidthValue / BW1Tbps) + "Tbps"); + return(Long.toString(this.bandwidthValue / BW1Tbps) + "Tbps"); + } else { + return(this.bandwidthValue + "bps"); } - - sb.append("]"); - return sb.toString(); } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java index 6d7369d72b..4c6e08102b 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java @@ -81,4 +81,9 @@ public class Buffers extends Property { public String toString() { return "Buffers[" + buffersValue + "]"; } + + @Override + public String getStringValue() { + return Integer.toHexString(buffersValue); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java index 7867b93a68..b2005913d0 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java @@ -98,4 +98,9 @@ public class Capabilities extends Property { public String toString() { return "Capabilities[" + capabilitiesValue + "]"; } + + @Override + public String getStringValue() { + return Integer.toHexString(capabilitiesValue); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java index ef6efc5821..651c2f44e1 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java @@ -75,4 +75,17 @@ public class Config extends Property { public String toString() { return "Config["+ configValue +"]"; } + + @Override + public String getStringValue() { + if (configValue == 0) { + return "ADMIN_DOWN"; + } else if (configValue == 1) { + return "ADMIN_UP"; + } else if (configValue == 0x7fff) { + return "ADMIN_UNDEF"; + } else { + return String.valueOf(configValue); + } + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java index 6915404e24..ebc12cdbf7 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Description.java @@ -65,4 +65,9 @@ public class Description extends Property { public String toString() { return "Description[" + descriptionValue + "]"; } + + @Override + public String getStringValue() { + return descriptionValue; + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java index a1d4ff9db7..1b19f19778 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java @@ -71,4 +71,9 @@ public class ForwardingMode extends Property { public String toString() { return "Mode[" + modeValue + "]"; } + + @Override + public String getStringValue() { + return (modeValue == ForwardingMode.PROACTIVE_FORWARDING) ? "Proactive" : "Reactive"; + } } \ No newline at end of file diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Latency.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Latency.java index a0ba47b29d..a64ee105cf 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Latency.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Latency.java @@ -112,4 +112,21 @@ public class Latency extends Property { sb.append("]"); return sb.toString(); } + + @Override + public String getStringValue() { + if (this.latencyValue == 0) { + return("UnKnown"); + } else if (this.latencyValue < LATENCY1ns) { + return(this.latencyValue + "psec"); + } else if (this.latencyValue < LATENCY1us) { + return(Long.toString(this.latencyValue / LATENCY1ns) + "nsec"); + } else if (this.latencyValue < LATENCY1ms) { + return(Long.toString(this.latencyValue / LATENCY1us) + "usec"); + } else if (this.latencyValue < LATENCY1s) { + return(Long.toString(this.latencyValue / LATENCY1ms) + "msec"); + } else { + return Long.toString(this.latencyValue) + "sec"; + } + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/MacAddress.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/MacAddress.java index 27e74e0800..2dfa9168fe 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/MacAddress.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/MacAddress.java @@ -109,4 +109,9 @@ public class MacAddress extends Property implements Cloneable { public String toString() { return "MacAddress[" + address + "]"; } + + @Override + public String getStringValue() { + return address; + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Name.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Name.java index d35610add0..92c8454a4d 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Name.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Name.java @@ -74,4 +74,9 @@ public class Name extends Property { public String toString() { return "Name[" + nameValue + "]"; } + + @Override + public String getStringValue() { + return nameValue; + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java index 574f6d0238..a5deb547e3 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java @@ -53,6 +53,8 @@ abstract public class Property implements Serializable, Cloneable { return this.name; } + public abstract String getStringValue(); + /** * Used to copy the Property in a polymorphic way * diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java index 058adb63e2..e47542a7be 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java @@ -76,4 +76,17 @@ public class State extends Property { public String toString() { return "State[" + stateValue + "]"; } + + @Override + public String getStringValue() { + if (stateValue == 0) { + return ("EDGE_DOWN"); + } else if (stateValue == 1) { + return ("EDGE_UP"); + } else if (stateValue == 0x7fff) { + return ("EDGE_UNK"); + } else { + return String.valueOf(stateValue); + } + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java index bd50cf9be0..b92c4b693c 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java @@ -80,4 +80,9 @@ public class Tables extends Property { public String toString() { return "Tables[" + tablesValue + "]"; } + + @Override + public String getStringValue() { + return String.format("%02x", tablesValue); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tier.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tier.java index 6756a82135..d1af778526 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tier.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tier.java @@ -72,4 +72,9 @@ public class Tier extends Property { public String toString() { return "Tier[" + tierValue + "]"; } + + @Override + public String getStringValue() { + return String.valueOf(tierValue); + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java index b38ec8582b..a2d3d36c6f 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java @@ -9,6 +9,8 @@ package org.opendaylight.controller.sal.core; +import java.util.Date; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -103,4 +105,9 @@ public class TimeStamp extends Property { public String toString() { return "TimeStamp[" + timestampName + ": " + timestamp +"]"; } + + @Override + public String getStringValue() { + return timestampName + ": " + new Date(timestamp); + } } diff --git a/opendaylight/sal/yang-prototype/pom.xml b/opendaylight/sal/yang-prototype/pom.xml index 4c5db1086c..b1107594f5 100644 --- a/opendaylight/sal/yang-prototype/pom.xml +++ b/opendaylight/sal/yang-prototype/pom.xml @@ -46,6 +46,12 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + opendaylight.snapshot @@ -74,11 +80,23 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + central central http://repo1.maven.org/maven2 + + false + + + true + diff --git a/opendaylight/sal/yang-prototype/sal/pom.xml b/opendaylight/sal/yang-prototype/sal/pom.xml index fc6fb8eaed..0442e8f9b2 100644 --- a/opendaylight/sal/yang-prototype/sal/pom.xml +++ b/opendaylight/sal/yang-prototype/sal/pom.xml @@ -28,6 +28,7 @@ 0.5.7-SNAPSHOT 2.4.0 2.3.2 + 14.0.1 @@ -35,6 +36,12 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + opendaylight.snapshot @@ -49,11 +56,23 @@ central2 central2 http://repo2.maven.org/maven2 + + false + + + true + central central http://repo1.maven.org/maven2 + + false + + + true + @@ -128,8 +147,7 @@ com.google.guava guava - 14.0.1 - jar + ${guava.version} org.slf4j diff --git a/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/pom.xml b/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/pom.xml index b8ba605524..549e427d82 100644 --- a/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/pom.xml +++ b/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/pom.xml @@ -93,7 +93,6 @@ com.google.guava guava - jar org.reflections diff --git a/opendaylight/sal/yang-prototype/sal/sal-broker-impl/pom.xml b/opendaylight/sal/yang-prototype/sal/sal-broker-impl/pom.xml index fa35363357..0965e25231 100644 --- a/opendaylight/sal/yang-prototype/sal/sal-broker-impl/pom.xml +++ b/opendaylight/sal/yang-prototype/sal/sal-broker-impl/pom.xml @@ -36,7 +36,6 @@ com.google.guava guava - jar diff --git a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java index 00629a43b1..43c297da18 100644 --- a/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java +++ b/opendaylight/statisticsmanager/integrationtest/src/test/java/org/opendaylight/controller/statisticsmanager/internal/StatisticsManagerIT.java @@ -67,20 +67,13 @@ public class StatisticsManagerIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", - "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", - "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", - "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", - "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", - "0.8.0.v201110170705"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), // List logger bundles mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), mavenBundle("org.slf4j", "log4j-over-slf4j") @@ -326,4 +319,4 @@ public class StatisticsManagerIT { } } -} \ No newline at end of file +} diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java index d3d41be19f..1390f94b49 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java @@ -772,6 +772,10 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa propMap.put(Description.propertyName, desc); } continue; + } else if (prop.equals(ForwardingMode.name)) { + Property defaultMode = new ForwardingMode(ForwardingMode.REACTIVE_FORWARDING); + propMap.put(ForwardingMode.name, defaultMode); + continue; } propMap.remove(prop); } @@ -911,8 +915,8 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa } } - // copy node properties from config boolean proactiveForwarding = false; + // copy node properties from config if (nodeConfigList != null) { String nodeId = node.toString(); SwitchConfig conf = nodeConfigList.get(nodeId); @@ -926,6 +930,10 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa } } + if (!propMap.containsKey(ForwardingMode.name)) { + Property defaultMode = new ForwardingMode(ForwardingMode.REACTIVE_FORWARDING); + propMap.put(ForwardingMode.name, defaultMode); + } boolean result = false; if (propMapCurr == null) { if (nodeProps.putIfAbsent(node, propMap) == null) { @@ -1096,7 +1104,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa @Override public Set getNodes() { return (nodeProps != null) ? new HashSet(nodeProps.keySet()) - : null; + : new HashSet(); } /* @@ -1758,8 +1766,6 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa public String getHelp() { StringBuffer help = new StringBuffer(); help.append("---Switch Manager---\n"); - help.append("\t pns - Print connected nodes\n"); - help.append("\t pncs - Print node connectors for a given node\n"); help.append("\t pencs - Print enabled node connectors for a given node\n"); help.append("\t pdm - Print switch ports in device map\n"); help.append("\t snt - Set node tier number\n"); @@ -1768,37 +1774,6 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa return help.toString(); } - public void _pns(CommandInterpreter ci) { - ci.println(" Node Type MAC Name Tier"); - if (nodeProps == null) { - return; - } - Set nodeSet = nodeProps.keySet(); - if (nodeSet == null) { - return; - } - List nodeArray = new ArrayList(); - for (Node node : nodeSet) { - nodeArray.add(node.toString()); - } - Collections.sort(nodeArray); - for (String str: nodeArray) { - Node node = Node.fromString(str); - Description desc = ((Description) getNodeProp(node, - Description.propertyName)); - Tier tier = ((Tier) getNodeProp(node, Tier.TierPropName)); - String nodeName = (desc == null) ? "" : desc.getValue(); - MacAddress mac = (MacAddress) getNodeProp(node, - MacAddress.name); - String macAddr = (mac == null) ? "" : HexEncode - .bytesToHexStringFormat(mac.getMacAddress()); - int tierNum = (tier == null) ? 0 : tier.getValue(); - ci.println(node + " " + node.getType() + " " + macAddr - + " " + nodeName + " " + tierNum); - } - ci.println("Total number of Nodes: " + nodeSet.size()); - } - public void _pencs(CommandInterpreter ci) { String st = ci.nextArgument(); if (st == null) { @@ -1825,43 +1800,6 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa ci.println("Total number of NodeConnectors: " + nodeConnectorSet.size()); } - public void _pncs(CommandInterpreter ci) { - String st = ci.nextArgument(); - if (st == null) { - ci.println("Please enter node id"); - return; - } - - Node node = Node.fromString(st); - if (node == null) { - ci.println("Please enter node id"); - return; - } - - ci.println(" NodeConnector BandWidth(Gbps) Admin State"); - Set nodeConnectorSet = getNodeConnectors(node); - if (nodeConnectorSet == null) { - return; - } - for (NodeConnector nodeConnector : nodeConnectorSet) { - if (nodeConnector == null) { - continue; - } - Map propMap = getNodeConnectorProps(nodeConnector); - Bandwidth bw = (Bandwidth) propMap.get(Bandwidth.BandwidthPropName); - Config config = (Config) propMap.get(Config.ConfigPropName); - State state = (State) propMap.get(State.StatePropName); - String out = nodeConnector + " "; - out += (bw != null) ? bw.getValue() / Math.pow(10, 9) : " "; - out += " "; - out += (config != null) ? config.getValue() : " "; - out += " "; - out += (state != null) ? state.getValue() : " "; - ci.println(out); - } - ci.println("Total number of NodeConnectors: " + nodeConnectorSet.size()); - } - public void _pdm(CommandInterpreter ci) { String st = ci.nextArgument(); if (st == null) { diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerCLI.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerCLI.java index bcf9fd6d0b..268e45ad85 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerCLI.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerCLI.java @@ -11,23 +11,17 @@ package org.opendaylight.controller.switchmanager.internal; import java.util.ArrayList; import java.util.Collections; import java.util.Dictionary; +import java.util.HashSet; import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.felix.service.command.Descriptor; -import org.opendaylight.controller.sal.core.Bandwidth; -import org.opendaylight.controller.sal.core.Config; -import org.opendaylight.controller.sal.core.Description; -import org.opendaylight.controller.sal.core.MacAddress; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.Property; -import org.opendaylight.controller.sal.core.State; -import org.opendaylight.controller.sal.core.Tier; import org.opendaylight.controller.sal.utils.GlobalConstants; -import org.opendaylight.controller.sal.utils.HexEncode; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.switchmanager.ISwitchManager; import org.osgi.framework.ServiceRegistration; @@ -70,28 +64,34 @@ public class SwitchManagerCLI { return; } - System.out.println(" Node Type MAC Name Tier"); - Set nodes = sm.getNodes(); if (nodes == null || nodes.isEmpty()) { return; } - List nodeArray = new ArrayList(); + Set propertyList = new HashSet(); for (Node node : nodes) { - nodeArray.add(node.toString()); + Map propList = sm.getNodeProps(node); + propertyList.addAll(propList.keySet()); + } + List sortedProps = new ArrayList(propertyList); + Collections.sort(sortedProps); + String properties = String.format("%-26s ", "Node"); + for (String s : sortedProps) { + properties = properties.concat(String.format("%-18s ", s)); } - Collections.sort(nodeArray); - for (String str : nodeArray) { - Node node = Node.fromString(str); - Description desc = ((Description) sm.getNodeProp(node, Description.propertyName)); - Tier tier = ((Tier) sm.getNodeProp(node, Tier.TierPropName)); - String nodeName = (desc == null) ? "" : desc.getValue(); - MacAddress mac = (MacAddress) sm.getNodeProp(node, MacAddress.name); - String macAddr = (mac == null) ? "" : HexEncode.bytesToHexStringFormat(mac.getMacAddress()); - int tierNum = (tier == null) ? 0 : tier.getValue(); - System.out.println(node + " " + node.getType() + " " + macAddr + " " + nodeName + " " - + tierNum); + System.out.println(properties); + for (Node node : nodes) { + String nodeProp = String.format("%-26s ", node); + Map propList = sm.getNodeProps(node); + for (String s : sortedProps) { + if (propList.containsKey(s)) { + nodeProp = nodeProp.concat(String.format("%-18s ", propList.get(s).getStringValue())); + } else { + nodeProp = nodeProp.concat(String.format("%-18s ", "null")); + } + } + System.out.println(nodeProp); } System.out.println("Total number of Nodes: " + nodes.size()); } @@ -113,26 +113,34 @@ public class SwitchManagerCLI { return; } - System.out.println(" NodeConnector BandWidth(Gbps) Admin State"); Set nodeConnectorSet = sm.getNodeConnectors(target); - if (nodeConnectorSet == null) { + if (nodeConnectorSet == null || nodeConnectorSet.isEmpty()) { return; } + + Set propertyList = new HashSet(); + for (NodeConnector nodeConnector : nodeConnectorSet) { + Map propList = sm.getNodeConnectorProps(nodeConnector); + propertyList.addAll(propList.keySet()); + } + List sortedProps = new ArrayList(propertyList); + Collections.sort(sortedProps); + String properties = String.format("%-33s ", "NodeConnector"); + for (String s : sortedProps) { + properties = properties.concat(String.format("%-18s ", s)); + } + System.out.println(properties); for (NodeConnector nodeConnector : nodeConnectorSet) { - if (nodeConnector == null) { - continue; + String ncProp = String.format("%-33s ", nodeConnector); + Map ncProperties = sm.getNodeConnectorProps(nodeConnector); + for (String s : sortedProps) { + if (ncProperties.containsKey(s)) { + ncProp = ncProp.concat(String.format("%-18s ", ncProperties.get(s).getStringValue())); + } else { + ncProp = ncProp.concat(String.format("%-18s ", "null")); + } } - Map propMap = sm.getNodeConnectorProps(nodeConnector); - Bandwidth bw = (Bandwidth) propMap.get(Bandwidth.BandwidthPropName); - Config config = (Config) propMap.get(Config.ConfigPropName); - State state = (State) propMap.get(State.StatePropName); - String out = nodeConnector + " "; - out += (bw != null) ? bw.getValue() / Math.pow(10, 9) : " "; - out += " "; - out += (config != null) ? config.getValue() : " "; - out += " "; - out += (state != null) ? state.getValue() : " "; - System.out.println(out); + System.out.println(ncProp); } System.out.println("Total number of NodeConnectors: " + nodeConnectorSet.size()); } diff --git a/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java b/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java index 54dbbdcce0..eb8a07e707 100644 --- a/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java +++ b/opendaylight/switchmanager/integrationtest/src/test/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerIT.java @@ -68,20 +68,13 @@ public class SwitchManagerIT { // Set the systemPackages (used by clustering) systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"), // List framework bundles - mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", - "1.0.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", - "1.0.400.v20120522-2049"), - mavenBundle("equinoxSDK381", "org.eclipse.osgi.services", - "3.3.100.v20120522-1822"), - mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", - "1.4.0.v20120522-1841"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", - "0.8.0.v201108120515"), - mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", - "0.8.0.v201110170705"), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(), + mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(), // List logger bundles mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), mavenBundle("org.slf4j", "log4j-over-slf4j") diff --git a/opendaylight/web/root/pom.xml b/opendaylight/web/root/pom.xml index 6000efadc7..bc5c73a7d8 100644 --- a/opendaylight/web/root/pom.xml +++ b/opendaylight/web/root/pom.xml @@ -34,6 +34,9 @@ org.opendaylight.controller.sal.utils, org.opendaylight.controller.usermanager, org.opendaylight.controller.containermanager, + org.opendaylight.controller.clustering.services, + org.opendaylight.controller.connectionmanager, + org.opendaylight.controller.switchmanager, com.google.gson, javax.annotation, javax.naming, @@ -92,6 +95,16 @@ + + org.opendaylight.controller + clustering.services + 0.4.0-SNAPSHOT + + + org.opendaylight.controller + connectionmanager + 0.1.0-SNAPSHOT + org.opendaylight.controller configuration @@ -112,6 +125,11 @@ containermanager 0.4.0-SNAPSHOT + + org.opendaylight.controller + switchmanager + 0.5.0-SNAPSHOT + junit junit diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java new file mode 100644 index 0000000000..5e4f22afe2 --- /dev/null +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/ClusterNodeBean.java @@ -0,0 +1,50 @@ +package org.opendaylight.controller.web; + +import java.net.InetAddress; + +/** + * Information about a clustered controller to send to the UI frontend + * @author andrekim + */ +public class ClusterNodeBean { + private final byte[] address; + private final String name; + private final Boolean me; + private final Boolean coordinator; + + public static class Builder { + // required params + private final byte[] address; + private final String name; + + // optional params + private Boolean me = null; + private Boolean coordinator = null; + + public Builder(InetAddress address) { + this.address = address.getAddress(); + this.name = address.getHostAddress(); + } + + public Builder highlightMe() { + this.me = true; + return this; + } + + public Builder iAmCoordinator() { + this.coordinator = true; + return this; + } + + public ClusterNodeBean build() { + return new ClusterNodeBean(this); + } + } + + private ClusterNodeBean(Builder builder) { + this.address = builder.address; + this.name = builder.name; + this.me = builder.me; + this.coordinator = builder.coordinator; + } +} \ No newline at end of file diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java index 524cb62b3a..3b0b85c065 100644 --- a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java @@ -8,14 +8,24 @@ package org.opendaylight.controller.web; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.ArrayList; import java.util.List; +import java.util.Set; import javax.servlet.http.HttpServletRequest; +import org.opendaylight.controller.clustering.services.IClusterGlobalServices; +import org.opendaylight.controller.connectionmanager.IConnectionManager; import org.opendaylight.controller.sal.authorization.UserLevel; +import org.opendaylight.controller.sal.core.Description; +import org.opendaylight.controller.sal.core.Node; +import org.opendaylight.controller.sal.utils.GlobalConstants; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.sal.utils.StatusCode; +import org.opendaylight.controller.switchmanager.ISwitchManager; import org.opendaylight.controller.usermanager.IUserManager; import org.opendaylight.controller.usermanager.UserConfig; import org.springframework.stereotype.Controller; @@ -30,14 +40,96 @@ import com.google.gson.Gson; @Controller @RequestMapping("/admin") public class DaylightWebAdmin { + Gson gson = new Gson(); + /** + * Returns list of clustered controllers. Highlights "this" controller and + * if controller is coordinator + * @return List + */ + @RequestMapping("/cluster") + @ResponseBody + public String getClusteredControllers() { + IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance( + IClusterGlobalServices.class, this); + if (clusterServices == null) { + return null; + } + + List clusterNodes = new ArrayList(); + + List controllers = clusterServices.getClusteredControllers(); + for (InetAddress controller : controllers) { + ClusterNodeBean.Builder clusterBeanBuilder = new ClusterNodeBean.Builder(controller); + if (controller.equals(clusterServices.getMyAddress())) { + clusterBeanBuilder.highlightMe(); + } + if (clusterServices.getCoordinatorAddress().equals(controller)) { + clusterBeanBuilder.iAmCoordinator(); + } + clusterNodes.add(clusterBeanBuilder.build()); + } + return gson.toJson(clusterNodes); + } + + /** + * Return nodes connected to controller {controller} + * @param controller + * - byte[] of the address of the controller + * @return List + */ + @RequestMapping("/cluster/controller/{controller}") + @ResponseBody + public String getNodesConnectedToController(@PathVariable("controller") String controller) { + IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance( + IClusterGlobalServices.class, this); + if (clusterServices == null) { + return null; + } + IConnectionManager connectionManager = (IConnectionManager) ServiceHelper.getGlobalInstance( + IConnectionManager.class, this); + if (connectionManager == null) { + return null; + } + ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, + GlobalConstants.DEFAULT.toString(), this); + if (switchManager == null) { + return null; + } + + byte[] address = gson.fromJson(controller, byte[].class); + InetAddress controllerAddress = null; + try { + controllerAddress = InetAddress.getByAddress(address); + } catch (UnknownHostException e) { + return null; + } + + List result = new ArrayList(); + + Set nodes = connectionManager.getNodes(controllerAddress); + if (nodes == null) { + return gson.toJson(result); + } + for (Node node : nodes) { + Description description = (Description) switchManager.getNodeProp(node, Description.propertyName); + NodeBean nodeBean; + if (description == null || description.getValue().equals("None")) { + nodeBean = new NodeBean(node); + } else { + nodeBean = new NodeBean(node, description.getValue()); + } + result.add(nodeBean); + } + + return gson.toJson(result); + } @RequestMapping("/users") @ResponseBody public List getUsers() { - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); + IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this); if (userManager == null) { return null; } @@ -52,13 +144,10 @@ public class DaylightWebAdmin { */ @RequestMapping(value = "/users", method = RequestMethod.POST) @ResponseBody - public String saveLocalUserConfig( - @RequestParam(required = true) String json, - @RequestParam(required = true) String action, - HttpServletRequest request) { + public String saveLocalUserConfig(@RequestParam(required = true) String json, + @RequestParam(required = true) String action, HttpServletRequest request) { - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); + IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this); if (userManager == null) { return "Internal Error"; } @@ -70,10 +159,9 @@ public class DaylightWebAdmin { Gson gson = new Gson(); UserConfig config = gson.fromJson(json, UserConfig.class); - Status result = (action.equals("add")) ? userManager - .addLocalUser(config) : userManager.removeLocalUser(config); - if(result.getCode().equals(StatusCode.SUCCESS)) { - String userAction=(action.equals("add")) ? "added":"removed"; + Status result = (action.equals("add")) ? userManager.addLocalUser(config) : userManager.removeLocalUser(config); + if (result.isSuccess()) { + String userAction = (action.equals("add")) ? "added" : "removed"; DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), userAction, config.getUser()); return "Success"; } @@ -82,16 +170,14 @@ public class DaylightWebAdmin { @RequestMapping(value = "/users/{username}", method = RequestMethod.POST) @ResponseBody - public String removeLocalUser(@PathVariable("username") String userName, - HttpServletRequest request) { + public String removeLocalUser(@PathVariable("username") String userName, HttpServletRequest request) { String username = request.getUserPrincipal().getName(); if (username.equals(userName)) { return "Invalid Request: User cannot delete itself"; } - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); + IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this); if (userManager == null) { return "Internal Error"; } @@ -101,7 +187,7 @@ public class DaylightWebAdmin { } Status result = userManager.removeLocalUser(userName); - if(result.getCode().equals(StatusCode.SUCCESS)) { + if (result.isSuccess()) { DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "removed", userName); return "Success"; } @@ -112,8 +198,7 @@ public class DaylightWebAdmin { @ResponseBody public Status changePassword(@PathVariable("username") String username, HttpServletRequest request, @RequestParam("currentPassword") String currentPassword, @RequestParam("newPassword") String newPassword) { - IUserManager userManager = (IUserManager) ServiceHelper - .getGlobalInstance(IUserManager.class, this); + IUserManager userManager = (IUserManager) ServiceHelper.getGlobalInstance(IUserManager.class, this); if (userManager == null) { return new Status(StatusCode.GONE, "User Manager not found"); } @@ -127,7 +212,7 @@ public class DaylightWebAdmin { } Status status = userManager.changeLocalUserPassword(username, currentPassword, newPassword); - if(status.isSuccess()){ + if (status.isSuccess()) { DaylightWebUtil.auditlog("User", request.getUserPrincipal().getName(), "changed password for", username); } return status; @@ -135,11 +220,9 @@ public class DaylightWebAdmin { /** * Is the operation permitted for the given level - * * @param level */ - private boolean authorize(IUserManager userManager, UserLevel level, - HttpServletRequest request) { + private boolean authorize(IUserManager userManager, UserLevel level, HttpServletRequest request) { String username = request.getUserPrincipal().getName(); UserLevel userLevel = userManager.getUserLevel(username); return userLevel.toNumber() <= level.toNumber(); diff --git a/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java new file mode 100644 index 0000000000..21d931051b --- /dev/null +++ b/opendaylight/web/root/src/main/java/org/opendaylight/controller/web/NodeBean.java @@ -0,0 +1,21 @@ +package org.opendaylight.controller.web; + +import org.opendaylight.controller.sal.core.Node; + +/** + * Information about a node connected to a controller to send to the UI frontend + * @author andrekim + */ +public class NodeBean { + private final String node; + private final String description; + + public NodeBean(Node node) { + this(node, node.toString()); + } + + public NodeBean(Node node, String description) { + this.node = node.toString(); + this.description = description; + } +} diff --git a/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp b/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp index c7c3ef16c3..c795a5d56b 100644 --- a/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp +++ b/opendaylight/web/root/src/main/resources/WEB-INF/jsp/main.jsp @@ -71,12 +71,10 @@
${username} diff --git a/opendaylight/web/root/src/main/resources/css/one.less b/opendaylight/web/root/src/main/resources/css/one.less index 6ec818c18c..db9d7632d5 100644 --- a/opendaylight/web/root/src/main/resources/css/one.less +++ b/opendaylight/web/root/src/main/resources/css/one.less @@ -88,6 +88,10 @@ .icon; background-image: url('../img/user_group_0107_16.png'); } + .icon-cluster { + .icon; + background-image: url('../img/topology_view_1033_16.png'); + } .icon-save { .icon; background-image: url('../img/save_as_0106_16.png'); diff --git a/opendaylight/web/root/src/main/resources/img/topology_view_1033_16.png b/opendaylight/web/root/src/main/resources/img/topology_view_1033_16.png new file mode 100644 index 0000000000..1a132542c9 Binary files /dev/null and b/opendaylight/web/root/src/main/resources/img/topology_view_1033_16.png differ diff --git a/opendaylight/web/root/src/main/resources/js/lib.js b/opendaylight/web/root/src/main/resources/js/lib.js index 90fd49772a..64dc09890d 100644 --- a/opendaylight/web/root/src/main/resources/js/lib.js +++ b/opendaylight/web/root/src/main/resources/js/lib.js @@ -26,6 +26,17 @@ one.lib.dashlet = { $h4.text(header); return $h4; }, + label : function(name, type) { + var $span = $(document.createElement('span')); + $span.addClass('label'); + if (type !== undefined) { + $span.addClass(type); + } else if (type !== null) { + $span.addClass('label-info'); + } + $span.append(name); + return $span; + }, list : function(list) { var $ul = $(document.createElement('ul')); $(list).each(function(index, value) { @@ -251,7 +262,7 @@ one.lib.modal = { one.lib.form = { // create select-option form element select : { - create : function(options, multiple) { + create : function(options, multiple, sort) { // assert - auto assign if (options == undefined) options = {}; @@ -261,6 +272,24 @@ one.lib.form = { $select.attr("multiple", "multiple"); } var optionArray = one.lib.form.select.options(options); + + // If specified, sort the option elements based on their text field + if (sort == true && optionArray.length > 1) { + var shifted = true; + var limit = optionArray.length; + while (shifted) { + shifted = false; + for ( var i = 1; i < limit; i++) { + if (optionArray[i - 1].text() > optionArray[i].text()) { + var swap = optionArray[i - 1]; + optionArray[i - 1] = optionArray[i]; + optionArray[i] = swap; + shifted = true; + } + } + } + } + $(optionArray).each(function(index, value) { $select.append(value); }); diff --git a/opendaylight/web/root/src/main/resources/js/open.js b/opendaylight/web/root/src/main/resources/js/open.js index b82a85a74a..85e4d472ef 100644 --- a/opendaylight/web/root/src/main/resources/js/open.js +++ b/opendaylight/web/root/src/main/resources/js/open.js @@ -175,12 +175,9 @@ one.main.admin = { }, footer : function() { var footer = []; - - var closeButton = one.lib.dashlet.button.single("Close", - one.main.admin.id.modal.close, "", ""); + var closeButton = one.lib.dashlet.button.single('Close', one.main.admin.id.modal.close, '', ''); var $closeButton = one.lib.dashlet.button.button(closeButton); footer.push($closeButton); - return footer; } }, @@ -257,76 +254,53 @@ one.main.admin = { var $body = one.main.admin.remove.body(); var $modal = one.lib.modal.spawn(one.main.admin.id.modal.user, h3, $body, footer); - // close binding - $('#' + one.main.admin.id.modal.remove.close, $modal).click( - function() { - $modal.modal('hide'); - }); - + $('#'+one.main.admin.id.modal.remove.close, $modal).click(function() { + $modal.modal('hide'); + }); // remove binding - $('#' + one.main.admin.id.modal.remove.user, $modal) - .click( - function() { - one.main.admin.remove.modal - .ajax( - id, - function(result) { - if (result == 'Success') { - $modal - .modal('hide'); - // body inject - var $admin = $('#' - + one.main.admin.id.modal.main); - one.main.admin.ajax - .users(function($body) { - one.lib.modal.inject - .body( - $admin, - $body); - }); - } else - alert("Failed to remove user: " - + result); - }); - }); - + $('#' + one.main.admin.id.modal.remove.user, $modal).click(function() { + one.main.admin.remove.modal.ajax(id, function(result) { + if (result == 'Success') { + $modal.modal('hide'); + // body inject + var $admin = $('#'+one.main.admin.id.modal.main); + one.main.admin.ajax.users(function($body) { + one.lib.modal.inject.body($admin, $body); + }); + } else { + alert("Failed to remove user: " + result); + } + }); + }); // change password binding $('#' + one.main.admin.id.modal.remove.password, $modal).click(function() { one.main.admin.password.initialize(id, function() { $modal.modal('hide'); }); }); - $modal.modal(); }, ajax : function(id, callback) { - $.post(one.main.admin.address.root - + one.main.admin.address.users + '/' + id, - function(data) { - callback(data); - }); + $.post(one.main.admin.address.root + one.main.admin.address.users + '/' + id, function(data) { + callback(data); + }); }, }, - footer : function() { var footer = []; - var removeButton = one.lib.dashlet.button.single("Remove User", one.main.admin.id.modal.remove.user, "btn-danger", ""); var $removeButton = one.lib.dashlet.button.button(removeButton); footer.push($removeButton); - var change = one.lib.dashlet.button.single('Change Password', one.main.admin.id.modal.remove.password, 'btn-success', ''); var $change = one.lib.dashlet.button.button(change); footer.push($change); - var closeButton = one.lib.dashlet.button.single("Close", one.main.admin.id.modal.remove.close, "", ""); var $closeButton = one.lib.dashlet.button.button(closeButton); footer.push($closeButton); - return footer; }, body : function() { @@ -343,40 +317,25 @@ one.main.admin = { var $body = one.main.admin.add.body(); var $modal = one.lib.modal.spawn(one.main.admin.id.modal.user, h3, $body, footer); - // close binding - $('#' + one.main.admin.id.modal.add.close, $modal).click( - function() { - $modal.modal('hide'); - }); - + $('#' + one.main.admin.id.modal.add.close, $modal).click(function() { + $modal.modal('hide'); + }); // add binding - $('#' + one.main.admin.id.modal.add.user, $modal) - .click( - function() { - one.main.admin.add.modal - .add( - $modal, - function(result) { - if (result == 'Success') { - $modal - .modal('hide'); - // body inject - var $admin = $('#' - + one.main.admin.id.modal.main); - one.main.admin.ajax - .users(function($body) { - one.lib.modal.inject - .body( - $admin, - $body); - }); - } else - alert("Failed to add user: " - + result); - }); - }); - + $('#' + one.main.admin.id.modal.add.user, $modal).click(function() { + one.main.admin.add.modal.add($modal, function(result) { + if (result == 'Success') { + $modal.modal('hide'); + // body inject + var $admin = $('#'+one.main.admin.id.modal.main); + one.main.admin.ajax.users(function($body) { + one.lib.modal.inject.body($admin, $body); + }); + } else { + alert("Failed to add user: "+result); + } + }); + }); $modal.modal(); }, add : function($modal, callback) { @@ -550,6 +509,155 @@ one.main.admin = { } } +one.main.cluster = { + id : { // one.main.cluster.id + modal : 'one-main-cluster-id-modal', + close : 'one-main-cluster-id-close', + datagrid : 'one-main-cluster-id-datagrid' + }, + initialize : function() { + var h3 = 'Cluster Management'; + var footer = one.main.cluster.footer(); + var $body = ''; + var $modal = one.lib.modal.spawn(one.main.cluster.id.modal, h3, $body, footer); + + // close + $('#'+one.main.cluster.id.close, $modal).click(function() { + $modal.modal('hide'); + }); + + // body + $.getJSON('/admin/cluster', function(data) { + var $gridHTML = one.lib.dashlet.datagrid.init(one.main.cluster.id.datagrid, { + searchable: true, + filterable: false, + pagination: true, + flexibleRowsPerPage: true + }, 'table-striped table-condensed table-cursor'); + var source = one.main.cluster.data(data); + $gridHTML.datagrid({dataSource : source}).on('loaded', function() { + $(this).find('tbody tr').click(function() { + var $tr = $(this); + if ($tr.find('td:nth-child(1)').attr('colspan') === '1') { + return false; + } + var address = $tr.find('.ux-id').text(); + one.main.cluster.nodes.initialize(address); + }); + }); + one.lib.modal.inject.body($modal, $gridHTML); + }); + + $modal.modal(); + }, + data : function(data) { + var tdata = []; + var registry = []; + $(data).each(function(idx, val) { + var name = val.name; + var address = val.address; + var $registry = $(document.createElement('span')); + $registry + .append(JSON.stringify(address)) + .css('display', 'none') + .addClass('ux-id'); + name = one.lib.dashlet.label(name, null)[0].outerHTML; + name += $registry[0].outerHTML; + if (val.me === true) { + var me = one.lib.dashlet.label('*', 'label-inverse')[0].outerHTML; + name += ' '+me; + } + if (val.coordinator === true) { + var coord = one.lib.dashlet.label('C')[0].outerHTML; + name += ' '+coord; + } + tdata.push({ + 'controller' : name + }); + }); + var source = new StaticDataSource({ + columns : [ + { + property : 'controller', + label : 'Controller', + sortable : true + } + ], + data : tdata, + delay : 0 + }); + return source; + }, + footer : function() { + var footer = []; + var close = one.lib.dashlet.button.single('Close', one.main.cluster.id.close, '', ''); + var $close = one.lib.dashlet.button.button(close); + footer.push($close); + return footer; + } +} + +one.main.cluster.nodes = { + id : { // one.main.cluster.nodes.id + modal : 'one-main-cluster-nodes-id-modal', + close : 'one-main-cluster-nodes-id-close', + datagrid : 'one-main-cluser-nodes-id-datagrid' + }, + initialize : function(address) { // one.main.cluster.nodes.initialize + var h3 = 'Connected Nodes'; + var footer = one.main.cluster.nodes.footer(); + var $body = ''; + var $modal = one.lib.modal.spawn(one.main.cluster.nodes.id.modal, h3, $body, footer); + + // close + $('#'+one.main.cluster.nodes.id.close, $modal).click(function() { + $modal.modal('hide'); + }); + + // body + $.getJSON('/admin/cluster/controller/'+address, function(data) { + var $gridHTML = one.lib.dashlet.datagrid.init(one.main.cluster.nodes.id.datagrid, { + searchable: true, + filterable: false, + pagination: true, + flexibleRowsPerPage: true + }, 'table-striped table-condensed'); + var source = one.main.cluster.nodes.data(data); + $gridHTML.datagrid({dataSource : source}); + one.lib.modal.inject.body($modal, $gridHTML); + }); + + $modal.modal(); + }, + data : function(data) { + var tdata = []; + $(data).each(function(idx, val) { + tdata.push({ + 'node' : val.description + }); + }); + var source = new StaticDataSource({ + columns : [ + { + property : 'node', + label : 'Node', + sortable : true + } + ], + data : tdata, + delay : 0 + }); + return source; + }, + footer : function() { // one.main.cluster.nodes.footer + var footer = []; + var close = one.lib.dashlet.button.single('Close', one.main.cluster.nodes.id.close, '', ''); + var $close = one.lib.dashlet.button.button(close); + footer.push($close); + return footer; + } +} + one.main.dashlet = { left : { top : $("#left-top .dashlet"), @@ -581,6 +689,11 @@ $("#admin").click(function() { }); }); +// cluster +$('#cluster').click(function() { + one.main.cluster.initialize(); +}); + // save $("#save").click(function() { $.post(one.main.constants.address.save, function(data) {