aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-10-09 18:32:44 -0700
committerAshlee Young <ashlee@onosfw.com>2015-10-09 18:32:44 -0700
commit6a07d2d622eaa06953f3353e39c080984076e8de (patch)
treebfb50a2090fce186c2cc545a400c969bf2ea702b /framework/src/onos/core/api
parente6d71622143ff9b2421a1abbe8434b954b5b1099 (diff)
Updated master to commit id 6ee8aa3e67ce89908a8c93aa9445c6f71a18f986
Change-Id: I94b055ee2f298daf71e2ec794fd0f2495bd8081f
Diffstat (limited to 'framework/src/onos/core/api')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java11
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java16
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java100
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/DisjointPath.java49
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java6
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java100
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java12
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java26
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java20
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java16
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java89
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java22
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java46
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java122
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java37
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java21
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java7
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java21
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java59
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java24
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java10
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java65
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java24
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java9
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java73
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java9
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java9
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java13
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastEvent.java118
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastListener.java26
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastRoute.java117
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/MulticastRouteService.java84
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/package-info.java20
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java5
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java72
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java4
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java6
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java9
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java58
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java8
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java6
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java16
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java47
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java2
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java105
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticStore.java65
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java143
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java143
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/DefaultGraphDescription.java17
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/PathService.java54
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java63
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java55
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java17
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java16
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexExecutionService.java34
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexTask.java39
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java50
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java9
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/behaviour/ControllerInfoTest.java112
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/config/NetworkConfigServiceAdapter.java4
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java24
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java9
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java65
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java19
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/packet/PacketServiceAdapter.java3
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java4
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java62
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java26
-rw-r--r--framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java10
69 files changed, 2419 insertions, 343 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
index a311002f..408a8933 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/cfg/ComponentConfigService.java
@@ -63,6 +63,16 @@ public interface ComponentConfigService {
void setProperty(String componentName, String name, String value);
/**
+ * Presets the value of the specified configuration property, regardless
+ * of the component's state.
+ *
+ * @param componentName component name
+ * @param name property name
+ * @param value new property value
+ */
+ void preSetProperty(String componentName, String name, String value);
+
+ /**
* Clears the value of the specified configuration property thus making
* the property take on its default value.
*
@@ -72,3 +82,4 @@ public interface ComponentConfigService {
void unsetProperty(String componentName, String name);
}
+
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index 4949bc40..8c5fb790 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -25,8 +25,10 @@ package org.onosproject.net;
*/
public final class AnnotationKeys {
+
// Prohibit instantiation
- private AnnotationKeys() {}
+ private AnnotationKeys() {
+ }
/**
* Annotation key for instance name.
@@ -125,12 +127,22 @@ public final class AnnotationKeys {
public static final String OWNER = "owner";
/**
+ * Annotation key for the channel id.
+ */
+ public static final String CHANNEL_ID = "channelId";
+
+ /**
+ * Annotation key for the management address.
+ */
+ public static final String MANAGEMENT_ADDRESS = "managementAddress";
+
+ /**
* Returns the value annotated object for the specified annotation key.
* The annotated value is expected to be String that can be parsed as double.
* If parsing fails, the returned value will be 1.0.
*
* @param annotated annotated object whose annotated value is obtained
- * @param key key of annotation
+ * @param key key of annotation
* @return double value of annotated object for the specified key
*/
public static double getAnnotatedValue(Annotated annotated, String key) {
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java
new file mode 100644
index 00000000..4895964f
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/DefaultDisjointPath.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net;
+
+import org.onosproject.net.provider.ProviderId;
+
+import java.util.List;
+import java.util.Objects;
+import static com.google.common.collect.ImmutableSet.of;
+
+/**
+ * Default implementation of a network disjoint path pair.
+ */
+public class DefaultDisjointPath extends DefaultPath implements DisjointPath {
+
+ private final DefaultPath path1;
+ private final DefaultPath path2;
+
+ boolean usingPath1 = true;
+
+ /**
+ * Creates a disjoint path pair from two default paths.
+ *
+ * @param providerId provider identity
+ * @param path1 primary path
+ * @param path2 backup path
+ */
+ public DefaultDisjointPath(ProviderId providerId, DefaultPath path1, DefaultPath path2) {
+ super(providerId, path1.links(), path1.cost() + path2.cost());
+ this.path1 = path1;
+ this.path2 = path2;
+ }
+
+ @Override
+ public List<Link> links() {
+ if (usingPath1) {
+ return path1.links();
+ } else {
+ return path2.links();
+ }
+ }
+
+ @Override
+ public double cost() {
+ if (usingPath1) {
+ return path1.cost();
+ }
+ return path2.cost();
+ }
+
+ @Override
+ public Path primary() {
+ return path1;
+ }
+
+ @Override
+ public Path backup() {
+ return path2;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(of(path1, path2), src(), dst());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultDisjointPath) {
+ final DefaultDisjointPath other = (DefaultDisjointPath) obj;
+ return Objects.equals(this.path1, other.path1) && Objects.equals(this.path2, other.path2);
+ }
+ return false;
+ }
+
+ @Override
+ public boolean useBackup() {
+ if (path2 == null || path2.links() == null) {
+ return false;
+ }
+ usingPath1 = !usingPath1;
+ return true;
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/DisjointPath.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/DisjointPath.java
new file mode 100644
index 00000000..3d54cbfc
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/DisjointPath.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net;
+
+
+/**
+ * Representation of a contiguous directed path in a network. Path comprises
+ * of a sequence of links, where adjacent links must share the same device,
+ * meaning that destination of the source of one link must coincide with the
+ * destination of the previous link.
+ */
+public interface DisjointPath extends Path {
+
+ /**
+ * Uses backup path.
+ *
+ * @return boolean corresponding to whether request to use
+ * backup was successful.
+ */
+ boolean useBackup();
+
+ /**
+ * Gets primary path.
+ *
+ * @return primary path
+ */
+ Path primary();
+
+ /**
+ * Gets secondary path.
+ *
+ * @return secondary path
+ */
+ Path backup();
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java
index bb8a788b..cd7cb977 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerConfig.java
@@ -15,23 +15,27 @@
*/
package org.onosproject.net.behaviour;
+import org.onosproject.net.driver.HandlerBehaviour;
+
import java.util.List;
/**
* Device behaviour to obtain and set controllers at the device.
*/
-public interface ControllerConfig {
+public interface ControllerConfig extends HandlerBehaviour {
//TODO: add other controller parameters as needed.
/**
* Obtain the list of controller which are currently configured.
+ *
* @return a list for controller descriptions
*/
List<ControllerInfo> getControllers();
/**
* Set a list of controllers on a device.
+ *
* @param controllers a list of controller descriptions
*/
void setControllers(List<ControllerInfo> controllers);
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
index 9ff808a9..ded3b3ae 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/behaviour/ControllerInfo.java
@@ -15,24 +15,112 @@
*/
package org.onosproject.net.behaviour;
+import com.google.common.base.Preconditions;
import org.onlab.packet.IpAddress;
+import java.util.Objects;
+
/**
* Represents information for a device to connect to a controller.
*/
public class ControllerInfo {
- public final IpAddress ip;
- public final int tcpPort;
+ private IpAddress ip = IpAddress.valueOf("0.0.0.0");
+ private int port = 6653;
+ private String type = "error";
/**
* Information for contacting the controller.
*
- * @param ip the ip address
- * @param tcpPort the tcp port
+ * @param ip the ip address
+ * @param port the tcp port
*/
- public ControllerInfo(IpAddress ip, int tcpPort) {
+ public ControllerInfo(IpAddress ip, int port, String type) {
this.ip = ip;
- this.tcpPort = tcpPort;
+ this.port = port;
+ this.type = type;
+ }
+
+ /**
+ * Information for contacting the controller, if some information
+ * is not contained in the target string because it's optional
+ * it's leaved as in the field declaration (default values).
+ *
+ * @param target column returned from ovsdb query
+ */
+ public ControllerInfo(String target) {
+ String[] data = target.split(":");
+ this.type = data[0];
+ Preconditions.checkArgument(!data[0].contains("unix"),
+ "Unable to create controller info " +
+ "from {} because it's based " +
+ "on unix sockets", target);
+ if (data[0].startsWith("p")) {
+ if (data.length >= 2) {
+ this.port = Integer.parseInt(data[1]);
+ }
+ if (data.length == 3) {
+ this.ip = IpAddress.valueOf(data[2]);
+ }
+ } else {
+ this.ip = IpAddress.valueOf(data[1]);
+ if (data.length == 3) {
+ this.port = Integer.parseInt(data[2]);
+ }
+ }
+ }
+
+ /**
+ * Exposes the ip address of the controller.
+ *
+ * @return IpAddress ip address
+ */
+ public IpAddress ip() {
+ return ip;
+ }
+
+ /**
+ * Exposes the tcp port of the controller.
+ *
+ * @return int tcp port
+ */
+ public int port() {
+ return port;
+ }
+
+ /**
+ * Exposes the type of the controller connection.
+ *
+ * @return String type
+ */
+ public String type() {
+ return type;
+ }
+
+ public String target() {
+ if (type.startsWith("p")) {
+ return type + ":" + port + ":" + ip;
+ } else {
+ return type + ":" + ip + ":" + port;
+ }
+ }
+
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(ip, port, type);
+ }
+
+ @Override
+ public boolean equals(Object toBeCompared) {
+ if (toBeCompared instanceof ControllerInfo) {
+ ControllerInfo controllerInfo = (ControllerInfo) toBeCompared;
+ if (controllerInfo.type().equals(this.type)
+ && controllerInfo.ip().equals(this.ip())
+ && controllerInfo.port() == this.port) {
+ return true;
+ }
+ }
+ return false;
}
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
index c1eed980..8eb69a45 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/NetworkConfigService.java
@@ -41,27 +41,27 @@ public interface NetworkConfigService
/**
* Returns the subject factory with the specified key.
*
- * @param subjectKey subject class key
+ * @param subjectClassKey subject class key
* @return subject class
*/
- SubjectFactory getSubjectFactory(String subjectKey);
+ SubjectFactory getSubjectFactory(String subjectClassKey);
/**
* Returns the subject factory for the specified class.
*
* @param subjectClass subject class
- * @return subject class key
+ * @return subject class factory
*/
SubjectFactory getSubjectFactory(Class subjectClass);
/**
* Returns the configuration class with the specified key.
*
- * @param subjectKey subject class key
- * @param configKey subject class name
+ * @param subjectClassKey subject class key
+ * @param configKey subject class name
* @return subject class
*/
- Class<? extends Config> getConfigClass(String subjectKey, String configKey);
+ Class<? extends Config> getConfigClass(String subjectClassKey, String configKey);
/**
* Returns the set of subjects for which some configuration is available.
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java
index cd2db344..f992d727 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/SubjectFactory.java
@@ -28,7 +28,7 @@ import com.google.common.annotations.Beta;
public abstract class SubjectFactory<S> {
private final Class<S> subjectClass;
- private final String subjectKey;
+ private final String subjectClassKey;
/**
* Creates a new configuration factory for the specified class of subjects
@@ -36,12 +36,12 @@ public abstract class SubjectFactory<S> {
* subject and configuration class keys are used merely as keys for use in
* composite JSON trees.
*
- * @param subjectClass subject class
- * @param subjectKey subject class key
+ * @param subjectClass subject class
+ * @param subjectClassKey subject class key
*/
- protected SubjectFactory(Class<S> subjectClass, String subjectKey) {
+ protected SubjectFactory(Class<S> subjectClass, String subjectClassKey) {
this.subjectClass = subjectClass;
- this.subjectKey = subjectKey;
+ this.subjectClassKey = subjectClassKey;
}
/**
@@ -60,8 +60,20 @@ public abstract class SubjectFactory<S> {
*
* @return configuration key
*/
- public String subjectKey() {
- return subjectKey;
+ public String subjectClassKey() {
+ return subjectClassKey;
+ }
+
+ /**
+ * Returns the unique key of the specified configuration subject.
+ * This is primarily aimed for use in composite JSON trees in external
+ * representations and has no bearing on the internal behaviours.
+ *
+ * @param subject specific subject
+ * @return subject key
+ */
+ public String subjectKey(S subject) {
+ return subject.toString();
}
/**
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
index fd8bfa3e..afde9a9e 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/BasicDeviceConfig.java
@@ -25,6 +25,7 @@ public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
public static final String TYPE = "type";
public static final String DRIVER = "driver";
+ public static final String MANAGEMENT_ADDRESS = "managementAddress";
/**
* Returns the device type.
@@ -64,6 +65,25 @@ public class BasicDeviceConfig extends BasicElementConfig<DeviceId> {
return (BasicElementConfig) setOrClear(DRIVER, driverName);
}
+ /**
+ * Returns the device management ip (ip:port).
+ *
+ * @return device management address (ip:port) or null if not set
+ */
+ public String managementAddress() {
+ return get(MANAGEMENT_ADDRESS, null);
+ }
+
+ /**
+ * Sets the driver name.
+ *
+ * @param managementAddress new device management address (ip:port); null to clear
+ * @return self
+ */
+ public BasicElementConfig managementAddress(String managementAddress) {
+ return (BasicElementConfig) setOrClear(MANAGEMENT_ADDRESS, managementAddress);
+ }
+
// TODO: device port meta-data to be configured via BasicPortsConfig
// TODO: device credentials/keys
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java
index 884f2e20..311566b3 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/config/basics/SubjectFactories.java
@@ -43,6 +43,10 @@ public final class SubjectFactories {
public ApplicationId createSubject(String key) {
return coreService.registerApplication(key);
}
+ @Override
+ public String subjectKey(ApplicationId subject) {
+ return subject.name();
+ }
};
public static final SubjectFactory<DeviceId> DEVICE_SUBJECT_FACTORY =
@@ -59,6 +63,10 @@ public final class SubjectFactories {
public ConnectPoint createSubject(String key) {
return ConnectPoint.deviceConnectPoint(key);
}
+ @Override
+ public String subjectKey(ConnectPoint subject) {
+ return key(subject);
+ }
};
public static final SubjectFactory<HostId> HOST_SUBJECT_FACTORY =
@@ -78,6 +86,10 @@ public final class SubjectFactories {
return LinkKey.linkKey(ConnectPoint.deviceConnectPoint(cps[0]),
ConnectPoint.deviceConnectPoint(cps[1]));
}
+ @Override
+ public String subjectKey(LinkKey subject) {
+ return key(subject.src()) + "-" + key(subject.dst());
+ }
};
/**
@@ -90,4 +102,8 @@ public final class SubjectFactories {
coreService = service;
}
+ private static String key(ConnectPoint subject) {
+ return subject.deviceId() + "/" + subject.port();
+ }
+
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java
new file mode 100644
index 00000000..929b285d
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTableStatisticsEntry.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.flow;
+
+import org.onosproject.net.DeviceId;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of table statistics entry interface.
+ */
+public final class DefaultTableStatisticsEntry implements TableStatisticsEntry {
+
+ private final DeviceId deviceId;
+ private final int tableId;
+ private final long activeFlowEntries;
+ private final long packetsLookedupCount;
+ private final long packetsMatchedCount;
+
+ /**
+ * Default table statistics constructor.
+ *
+ * @param deviceId device identifier
+ * @param tableId table identifier
+ * @param activeFlowEntries number of active flow entries in the table
+ * @param packetsLookedupCount number of packets looked up in table
+ * @param packetsMatchedCount number of packets that hit table
+ */
+ public DefaultTableStatisticsEntry(DeviceId deviceId,
+ int tableId,
+ long activeFlowEntries,
+ long packetsLookedupCount,
+ long packetsMatchedCount) {
+ this.deviceId = checkNotNull(deviceId);
+ this.tableId = tableId;
+ this.activeFlowEntries = activeFlowEntries;
+ this.packetsLookedupCount = packetsLookedupCount;
+ this.packetsMatchedCount = packetsMatchedCount;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("device: " + deviceId + ", ");
+
+ sb.append("tableId: " + this.tableId + ", ");
+ sb.append("activeEntries: " + this.activeFlowEntries + ", ");
+ sb.append("packetsLookedUp: " + this.packetsLookedupCount + ", ");
+ sb.append("packetsMatched: " + this.packetsMatchedCount);
+
+ return sb.toString();
+ }
+
+ @Override
+ public int tableId() {
+ return tableId;
+ }
+
+ @Override
+ public long activeFlowEntries() {
+ return activeFlowEntries;
+ }
+
+ @Override
+ public long packetsLookedup() {
+ return packetsLookedupCount;
+ }
+
+ @Override
+ public long packetsMatched() {
+ return packetsMatchedCount;
+ }
+
+ @Override
+ public DeviceId deviceId() {
+ return deviceId;
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
index f88c6bc3..4416456c 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
@@ -23,22 +23,26 @@ import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.TpPort;
import org.onlab.packet.VlanId;
-import org.onosproject.net.IndexedLambda;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.flow.criteria.Criterion;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.TreeSet;
/**
* Default traffic selector implementation.
*/
public final class DefaultTrafficSelector implements TrafficSelector {
+ private static final Comparator<? super Criterion> TYPE_COMPARATOR =
+ (c1, c2) -> c1.type().compareTo(c2.type());
+
private final Set<Criterion> criteria;
private static final TrafficSelector EMPTY
@@ -50,7 +54,9 @@ public final class DefaultTrafficSelector implements TrafficSelector {
* @param criteria criteria
*/
private DefaultTrafficSelector(Set<Criterion> criteria) {
- this.criteria = ImmutableSet.copyOf(criteria);
+ TreeSet<Criterion> elements = new TreeSet<>(TYPE_COMPARATOR);
+ elements.addAll(criteria);
+ this.criteria = ImmutableSet.copyOf(elements);
}
@Override
@@ -345,18 +351,6 @@ public final class DefaultTrafficSelector implements TrafficSelector {
return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags));
}
- @Deprecated
- @Override
- public Builder matchLambda(short lambda) {
- return add(Criteria.matchLambda(new IndexedLambda(lambda)));
- }
-
- @Deprecated
- @Override
- public Builder matchOpticalSignalType(short signalType) {
- return add(Criteria.matchOpticalSignalType(signalType));
- }
-
@Override
public TrafficSelector build() {
return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values()));
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 5d18a9ad..a628725c 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -31,7 +31,6 @@ import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.meter.MeterId;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -51,7 +50,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
private final boolean hasClear;
private static final DefaultTrafficTreatment EMPTY
- = new DefaultTrafficTreatment(Collections.emptyList());
+ = new DefaultTrafficTreatment(ImmutableList.of(Instructions.createNoAction()));
private final Instructions.MeterInstruction meter;
/**
@@ -212,8 +211,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
List<Instruction> current = immediate;
-
-
// Creates a new builder
private Builder() {
}
@@ -224,7 +221,10 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
treatment.deferred().forEach(i -> add(i));
immediate();
- treatment.immediate().forEach(i -> add(i));
+ treatment.immediate().stream()
+ // NOACTION will get re-added if there are no other actions
+ .filter(i -> i.type() != Instruction.Type.NOACTION)
+ .forEach(i -> add(i));
clear = treatment.clearedDeferred();
}
@@ -234,6 +234,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
switch (instruction.type()) {
case DROP:
+ case NOACTION:
case OUTPUT:
case GROUP:
case L0MODIFICATION:
@@ -250,6 +251,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
break;
case METER:
meter = (Instructions.MeterInstruction) instruction;
+ break;
default:
throw new IllegalArgumentException("Unknown instruction type: " +
instruction.type());
@@ -258,9 +260,23 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
return this;
}
+ /**
+ * Add a NOACTION when DROP instruction is explicitly specified.
+ *
+ * @return the traffic treatment builder
+ */
@Override
public Builder drop() {
- return add(Instructions.createDrop());
+ return add(Instructions.createNoAction());
+ }
+
+ /**
+ * Add a NOACTION when no instruction is specified.
+ *
+ * @return the traffic treatment builder
+ */
+ private Builder noAction() {
+ return add(Instructions.createNoAction());
}
@Override
@@ -380,11 +396,6 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
}
@Override
- public Builder transition(FlowRule.Type type) {
- return add(Instructions.transition(type.ordinal()));
- }
-
- @Override
public Builder transition(Integer tableId) {
return add(Instructions.transition(tableId));
}
@@ -463,14 +474,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
@Override
public TrafficTreatment build() {
- //Don't add DROP instruction by default when instruction
- //set is empty. This will be handled in DefaultSingleTablePipeline
- //driver.
-
- //if (deferred.size() == 0 && immediate.size() == 0
- // && table == null && !clear) {
- // drop();
- //}
+ if (deferred.size() == 0 && immediate.size() == 0
+ && table == null && !clear) {
+ immediate();
+ noAction();
+ }
return new DefaultTrafficTreatment(deferred, immediate, table, clear, meta, meter);
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java
new file mode 100644
index 00000000..afceb14e
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/DefaultTypedFlowEntry.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.flow;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW.
+ */
+public class DefaultTypedFlowEntry extends DefaultFlowEntry
+ implements TypedStoredFlowEntry {
+ private FlowLiveType liveType;
+
+ /**
+ * Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param rule the flow rule
+ * @param state the flow state
+ * @param life the flow duration since creation
+ * @param packets the flow packets count
+ * @param bytes the flow bytes count
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state,
+ long life, long packets, long bytes) {
+ super(rule, state, life, packets, bytes);
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param rule the flow rule
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule) {
+ super(rule);
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW).
+ *
+ * @param fe the flow entry
+ *
+ */
+ public DefaultTypedFlowEntry(FlowEntry fe) {
+ super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+ this.liveType = FlowLiveType.IMMEDIATE_FLOW;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule and flow live type.
+ *
+ * @param rule the flow rule
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) {
+ super(rule);
+ this.liveType = liveType;
+ }
+
+ /**
+ * Creates a typed flow entry from flow entry and flow live type.
+ *
+ * @param fe the flow rule
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) {
+ super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
+ this.liveType = liveType;
+ }
+
+ /**
+ * Creates a typed flow entry from flow rule, error code and flow live type.
+ *
+ * @param rule the flow rule
+ * @param errType the flow error type
+ * @param errCode the flow error code
+ * @param liveType the flow live type
+ *
+ */
+ public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) {
+ super(rule, errType, errCode);
+ this.liveType = liveType;
+ }
+
+ @Override
+ public FlowLiveType flowLiveType() {
+ return this.liveType;
+ }
+
+ @Override
+ public void setFlowLiveType(FlowLiveType liveType) {
+ this.liveType = liveType;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("entry", super.toString())
+ .add("type", liveType)
+ .toString();
+ }
+}
+
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
index a487cbc4..35d45fbd 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRule.java
@@ -29,43 +29,6 @@ public interface FlowRule {
int MIN_PRIORITY = 0;
/**
- * The FlowRule type is used to determine in which table the flow rule needs
- * to be put for multi-table support switch. For single table switch,
- * Default is used.
- *
- * @deprecated in Cardinal Release
- */
- @Deprecated
- enum Type {
- /*
- * Default type - used in flow rule for single table switch NOTE: this
- * setting should not be used as Table 0 in a multi-table pipeline
- */
- DEFAULT,
- /* Used in flow entry for IP table */
- IP,
- /* Used in flow entry for MPLS table */
- MPLS,
- /* Used in flow entry for ACL table */
- ACL,
-
- /* VLAN-to-MPLS table */
- VLAN_MPLS,
-
- /* VLAN table */
- VLAN,
-
- /* Ethtype table */
- ETHER,
-
- /* Class of Service table */
- COS,
-
- /* Table 0 in a multi-table pipeline */
- FIRST,
- }
-
- /**
* Returns the ID of this flow.
*
* @return the flow ID
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java
index 8a36a921..aefa96b4 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleProviderService.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.net.flow;
+import java.util.List;
+
import org.onosproject.net.DeviceId;
import org.onosproject.net.provider.ProviderService;
@@ -41,6 +43,24 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide
void pushFlowMetrics(DeviceId deviceId, Iterable<FlowEntry> flowEntries);
/**
+ * Pushes the collection of flow entries currently applied on the given
+ * device without flowMissing process.
+ *
+ * @param deviceId device identifier
+ * @param flowEntries collection of flow rules
+ */
+ void pushFlowMetricsWithoutFlowMissing(DeviceId deviceId, Iterable<FlowEntry> flowEntries);
+
+ /**
+ * Pushes the collection of table statistics entries currently extracted
+ * from the given device.
+ *
+ * @param deviceId device identifier
+ * @param tableStatsEntries collection of flow table statistics entries
+ */
+ void pushTableStatistics(DeviceId deviceId, List<TableStatisticsEntry> tableStatsEntries);
+
+ /**
* Indicates to the core that the requested batch operation has
* been completed.
*
@@ -48,5 +68,4 @@ public interface FlowRuleProviderService extends ProviderService<FlowRuleProvide
* @param operation the resulting outcome of the operation
*/
void batchOperationCompleted(long batchId, CompletedBatchOperation operation);
-
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
index d4f959c3..ee8d5a98 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
@@ -104,4 +104,11 @@ public interface FlowRuleService
*/
void apply(FlowRuleOperations ops);
+ /**
+ * Returns the collection of flow table statistics of the specified device.
+ *
+ * @param deviceId device identifier
+ * @return collection of flow table statistics
+ */
+ Iterable<TableStatisticsEntry> getFlowTableStatistics(DeviceId deviceId);
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java
index cece9893..d81c73c9 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/FlowRuleStore.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.net.flow;
+import java.util.List;
+
import org.onosproject.net.DeviceId;
import org.onosproject.store.Store;
@@ -93,4 +95,23 @@ public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDe
* @return flow_removed event, or null if nothing removed
*/
FlowRuleEvent removeFlowRule(FlowEntry rule);
+
+ /**
+ * Updates the flow table statistics of the specified device using
+ * the given statistics.
+ *
+ * @param deviceId device identifier
+ * @param tableStats list of table statistics
+ * @return ready to send event describing what occurred;
+ */
+ FlowRuleEvent updateTableStatistics(DeviceId deviceId,
+ List<TableStatisticsEntry> tableStats);
+
+ /**
+ * Returns the flow table statistics associated with a device.
+ *
+ * @param deviceId the device ID
+ * @return the flow table statistics
+ */
+ Iterable<TableStatisticsEntry> getTableStatistics(DeviceId deviceId);
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java
new file mode 100644
index 00000000..563f31ce
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TableStatisticsEntry.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.flow;
+
+import org.onosproject.net.DeviceId;
+
+/**
+ * Interface for flow table statistics of a device.
+ */
+public interface TableStatisticsEntry {
+
+ /**
+ * Returns the device Id.
+ *
+ * @return device id
+ */
+ DeviceId deviceId();
+
+ /**
+ * Returns the table number.
+ *
+ * @return table number
+ */
+ int tableId();
+
+ /**
+ * Returns the number of active flow entries in this table.
+ *
+ * @return the number of active flow entries
+ */
+ long activeFlowEntries();
+
+ /**
+ * Returns the number of packets looked up in the table.
+ *
+ * @return the number of packets looked up in the table
+ */
+ long packetsLookedup();
+
+ /**
+ * Returns the number of packets that successfully matched in the table.
+ *
+ * @return the number of packets that successfully matched in the table
+ */
+ long packetsMatched();
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
index 534f6b9e..1286ffc1 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
@@ -386,30 +386,6 @@ public interface TrafficSelector {
Builder matchIPv6ExthdrFlags(short exthdrFlags);
/**
- * Matches an optical signal ID or lambda.
- *
- * @param lambda lambda
- * @return a selection builder
- * @deprecated in Cardinal Release.
- * Use {@link #add(Criterion)} with an instance created
- * by {@link org.onosproject.net.flow.criteria.Criteria#matchLambda(org.onosproject.net.Lambda)}.
- */
- @Deprecated
- Builder matchLambda(short lambda);
-
- /**
- * Matches an optical Signal Type.
- *
- * @param signalType signalType
- * @return a selection builder
- * @deprecated in Cardinal Release.
- * Use {@link #add(Criterion)}} with an instance created
- * by {@link org.onosproject.net.flow.criteria.Criteria#matchOchSignalType(org.onosproject.net.OchSignalType)}.
- */
- @Deprecated
- Builder matchOpticalSignalType(short signalType);
-
- /**
* Builds an immutable traffic selector.
*
* @return traffic selector
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index 1ce669c2..33753afa 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -269,16 +269,6 @@ public interface TrafficTreatment {
Builder meter(MeterId meterId);
/**
- * Sets the next table type to transition to.
- *
- * @param type the table type
- * @return a treatement builder
- * @deprecated in Cardinal Release
- */
- @Deprecated
- Builder transition(FlowRule.Type type);
-
- /**
* Sets the next table id to transition to.
*
* @param tableId the table table
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java
new file mode 100644
index 00000000..a93dc071
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/TypedStoredFlowEntry.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.flow;
+
+/**
+ * Represents a flow live type for a given flow entry.
+ */
+public interface TypedStoredFlowEntry extends StoredFlowEntry {
+ enum FlowLiveType {
+ /**
+ * Indicates that this rule has been submitted for addition immediately.
+ * Not necessarily collecting flow stats.
+ */
+ IMMEDIATE_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a short time.
+ * Necessarily collecting flow stats every calAndPollInterval.
+ */
+ SHORT_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a mid time.
+ * Necessarily collecting flow stats every midPollInterval.
+ */
+ MID_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for a long time.
+ * Necessarily collecting flow stats every longPollInterval.
+ */
+ LONG_FLOW,
+
+ /**
+ * Indicates that this rule has been submitted for UNKNOWN or ERROR.
+ * Not necessarily collecting flow stats.
+ */
+ UNKNOWN_FLOW
+ }
+
+ /**
+ * Gets the flow live type for this entry.
+ */
+ FlowLiveType flowLiveType();
+
+ /**
+ * Sets the new flow live type for this entry.
+ * @param liveType new flow live type.
+ */
+ void setFlowLiveType(FlowLiveType liveType);
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index 0252cfbc..7e1d43a5 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -461,18 +461,6 @@ public final class Criteria {
}
/**
- * Creates a match on lambda field using the specified value.
- *
- * @param lambda lambda to match on (16 bits unsigned integer)
- * @return match criterion
- * @deprecated in Cardinal Release. Use {@link #matchLambda(Lambda)} instead.
- */
- @Deprecated
- public static Criterion matchLambda(int lambda) {
- return new LambdaCriterion(lambda, Type.OCH_SIGID);
- }
-
- /**
* Creates a match on lambda using the specified value.
*
* @param lambda lambda
@@ -489,18 +477,6 @@ public final class Criteria {
}
/**
- * Creates a match on optical signal type using the specified value.
- *
- * @param sigType optical signal type (8 bits unsigned integer)
- * @return match criterion
- * @deprecated in Cardinal Release
- */
- @Deprecated
- public static Criterion matchOpticalSignalType(short sigType) {
- return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE);
- }
-
- /**
* Create a match on OCh (Optical Channel) signal type.
*
* @param signalType OCh signal type
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
index 6f2cac6b..d01ea298 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instruction.java
@@ -27,9 +27,18 @@ public interface Instruction {
/**
* Signifies that the traffic should be dropped.
*/
+ @Deprecated
DROP,
/**
+ * Signifies that the traffic requires no action.
+ *
+ * In OF10, the behavior of NOACTION is DROP.
+ * In OF13, the behavior depends on current Action Set.
+ */
+ NOACTION,
+
+ /**
* Signifies that the traffic should be output to a port.
*/
OUTPUT,
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index c5358a29..c9f10685 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -68,11 +68,21 @@ public final class Instructions {
*
* @return drop instruction
*/
+ @Deprecated
public static DropInstruction createDrop() {
return new DropInstruction();
}
/**
+ * Creates a no action instruction.
+ *
+ * @return no action instruction
+ */
+ public static NoActionInstruction createNoAction() {
+ return new NoActionInstruction();
+ }
+
+ /**
* Creates a group instruction.
*
* @param groupId Group Id
@@ -89,19 +99,6 @@ public final class Instructions {
}
/**
- * Creates a l0 modification.
- *
- * @param lambda the lambda to modify to
- * @return a l0 modification
- * @deprecated in Cardinal Release. Use {@link #modL0Lambda(Lambda)} instead.
- */
- @Deprecated
- public static L0ModificationInstruction modL0Lambda(short lambda) {
- checkNotNull(lambda, "L0 lambda cannot be null");
- return new ModLambdaInstruction(L0SubType.LAMBDA, lambda);
- }
-
- /**
* Creates an L0 modification with the specified OCh signal.
*
* @param lambda OCh signal
@@ -303,21 +300,6 @@ public final class Instructions {
*
* @param etherType Ethernet type to set
* @return a L2 modification.
- * @deprecated in Cardinal Release
- */
- @Deprecated
- public static Instruction popMpls(int etherType) {
- checkNotNull(etherType, "Ethernet type cannot be null");
- return new L2ModificationInstruction.PushHeaderInstructions(
- L2ModificationInstruction.L2SubType.MPLS_POP, new EthType(etherType));
- }
-
-
- /**
- * Creates a pop MPLS header instruction with a particular ethertype.
- *
- * @param etherType Ethernet type to set
- * @return a L2 modification.
*/
public static Instruction popMpls(EthType etherType) {
checkNotNull(etherType, "Ethernet type cannot be null");
@@ -478,6 +460,7 @@ public final class Instructions {
/**
* Drop instruction.
*/
+ @Deprecated
public static final class DropInstruction implements Instruction {
private DropInstruction() {}
@@ -510,6 +493,40 @@ public final class Instructions {
}
/**
+ * No Action instruction.
+ */
+ public static final class NoActionInstruction implements Instruction {
+
+ private NoActionInstruction() {}
+
+ @Override
+ public Type type() {
+ return Type.NOACTION;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(type().toString()).toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type().ordinal());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof NoActionInstruction) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
* Output Instruction.
*/
public static final class OutputInstruction implements Instruction {
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
index f7b7c499..068663bd 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.host;
+import org.onlab.packet.IpAddress;
import org.onosproject.net.HostId;
import org.onosproject.net.provider.ProviderService;
@@ -29,6 +30,7 @@ public interface HostProviderService extends ProviderService<HostProvider> {
*
* @param hostId id of the host that been detected
* @param hostDescription description of host and its location
+ * @deprecated in Drake release
*/
@Deprecated
default void hostDetected(HostId hostId, HostDescription hostDescription) {
@@ -52,4 +54,11 @@ public interface HostProviderService extends ProviderService<HostProvider> {
*/
void hostVanished(HostId hostId);
+ /**
+ * Notifies the core when a host is no longer detected on a network.
+ *
+ * @param hostId id of the host that vanished
+ */
+ void removeIpFromHost(HostId hostId, IpAddress ipAddress);
+
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java
index 5894fe92..918ced45 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/host/HostStore.java
@@ -55,6 +55,15 @@ public interface HostStore extends Store<HostEvent, HostStoreDelegate> {
HostEvent removeHost(HostId hostId);
/**
+ * Removes the specified ip from the host entry.
+ *
+ * @param hostId host identification
+ * @param ipAddress ipAddress to be removed
+ * @return remove event or null if host was not found
+ */
+ HostEvent removeIp(HostId hostId, IpAddress ipAddress);
+
+ /**
* Returns the number of hosts in the store.
*
* @return host count
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
index 0646a003..2a2d7c78 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
@@ -23,7 +23,6 @@ import org.onosproject.net.NetworkResource;
import org.onosproject.net.flow.FlowRule;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -38,18 +37,6 @@ public class FlowRuleIntent extends Intent {
private final Collection<FlowRule> flowRules;
/**
- * Creates an flow rule intent with the specified flow rules to be set.
- *
- * @param appId application id
- * @param flowRules flow rules to be set.
- * @deprecated in Cardinal Release
- */
- @Deprecated
- public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules) {
- this(appId, null, flowRules, Collections.emptyList());
- }
-
- /**
* Creates a flow rule intent with the specified flow rules and resources.
*
* @param appId application id
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastEvent.java
new file mode 100644
index 00000000..979194c3
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastEvent.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.mcast;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.event.AbstractEvent;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.Optional;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * An entity representing a multicast event. Event either add or remove
+ * sinks or sources.
+ */
+@Beta
+public class McastEvent extends AbstractEvent<McastEvent.Type, McastRoute> {
+
+ private final Optional<ConnectPoint> sink;
+ private final Optional<ConnectPoint> source;
+
+ public enum Type {
+ /**
+ * A new mcast route has been added.
+ */
+ ROUTE_ADDED,
+
+ /**
+ * A mcast route has been removed.
+ */
+ ROUTE_REMOVED,
+
+ /**
+ * A source for a mcast route (ie. the subject) has been added.
+ */
+ SOURCE_ADDED,
+
+ /**
+ * A sink for a mcast route (ie. the subject) has been added.
+ */
+ SINK_ADDED,
+
+ /**
+ * A source for a mcast route (ie. the subject) has been removed.
+ */
+ SINK_REMOVED
+ }
+
+ private McastEvent(McastEvent.Type type, McastRoute subject) {
+ super(type, subject);
+ sink = Optional.empty();
+ source = Optional.empty();
+ }
+
+ private McastEvent(McastEvent.Type type, McastRoute subject, long time) {
+ super(type, subject, time);
+ sink = Optional.empty();
+ source = Optional.empty();
+ }
+
+ public McastEvent(McastEvent.Type type, McastRoute subject,
+ ConnectPoint sink,
+ ConnectPoint source) {
+ super(type, subject);
+ this.sink = Optional.ofNullable(sink);
+ this.source = Optional.ofNullable(source);
+ }
+
+ public McastEvent(McastEvent.Type type, McastRoute subject, long time,
+ ConnectPoint sink,
+ ConnectPoint source) {
+ super(type, subject, time);
+ this.sink = Optional.ofNullable(sink);
+ this.source = Optional.ofNullable(source);
+ }
+
+ /**
+ * The sink which has been removed or added. The field may not be set
+ * if the sink has not been detected yet or has been removed.
+ *
+ * @return an optional connect point
+ */
+ public Optional<ConnectPoint> sink() {
+ return sink;
+ }
+
+ /**
+ * The source which has been removed or added.
+
+ * @return an optional connect point
+ */
+ public Optional<ConnectPoint> source() {
+ return source;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("type", type())
+ .add("route", subject())
+ .add("source", source)
+ .add("sinks", sink).toString();
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastListener.java
new file mode 100644
index 00000000..06449b99
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastListener.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.mcast;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.event.EventListener;
+
+/**
+ * A listener interface for multicast events.
+ */
+@Beta
+public interface McastListener extends EventListener<McastEvent> {
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastRoute.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastRoute.java
new file mode 100644
index 00000000..ff1292bf
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/McastRoute.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.mcast;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Objects;
+import org.onlab.packet.IpPrefix;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * An entity representing a multicast route consisting of a source
+ * and a multicast group address.
+ */
+@Beta
+public class McastRoute {
+
+ public enum Type {
+ /**
+ * Route originates from PIM.
+ */
+ PIM,
+
+ /**
+ * Route originates from IGMP.
+ */
+ IGMP,
+
+ /**
+ * Route originates from other config (ie. REST, CLI).
+ */
+ STATIC
+ }
+
+ private final IpPrefix source;
+ private final IpPrefix group;
+ private final Type type;
+
+ public McastRoute(IpPrefix source, IpPrefix group, Type type) {
+ checkNotNull(source, "Multicast route must have a source");
+ checkNotNull(group, "Multicast route must specify a group address");
+ checkNotNull(type, "Must indicate what type of route");
+ this.source = source;
+ this.group = group;
+ this.type = type;
+ }
+
+ /**
+ * Fetches the source address of this route.
+ *
+ * @return an ip address
+ */
+ public IpPrefix source() {
+ return source;
+ }
+
+ /**
+ * Fetches the group address of this route.
+ *
+ * @return an ip address
+ */
+ public IpPrefix group() {
+ return group;
+ }
+
+ /**
+ * Obtains how this route was created.
+ * @return a type of route
+
+ */
+ public Type type() {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("source", source)
+ .add("group", group)
+ .add("origin", type)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ McastRoute that = (McastRoute) o;
+ return Objects.equal(source, that.source) &&
+ Objects.equal(group, that.group) &&
+ Objects.equal(type, that.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(source, group, type);
+ }
+
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/MulticastRouteService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/MulticastRouteService.java
new file mode 100644
index 00000000..56e87c55
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/MulticastRouteService.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.mcast;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.List;
+
+/**
+ * A service interface for maintaining multicast information.
+ */
+@Beta
+public interface MulticastRouteService {
+
+ /**
+ * Adds a route to the information base.
+ *
+ * @param route a multicast route
+ */
+ void add(McastRoute route);
+
+ /**
+ * Removes a route from the information base.
+ *
+ * @param route a multicast route
+ */
+ void remove(McastRoute route);
+
+ /**
+ * Adds a source connection to the route from where the
+ * data stream is originating.
+ *
+ * @param route the multicast route
+ * @param connectPoint a source connect point
+ */
+ void addSource(McastRoute route, ConnectPoint connectPoint);
+
+ /**
+ * Adds a sink to the route to which a data stream should be
+ * sent to.
+ *
+ * @param route a multicast route
+ * @param connectPoint a sink connect point
+ */
+ void addSink(McastRoute route, ConnectPoint connectPoint);
+
+ /**
+ * Removes a sink from the route.
+ *
+ * @param route the multicast route
+ * @param connectPoint a sink connect point
+ */
+ void removeSink(McastRoute route, ConnectPoint connectPoint);
+
+ /**
+ * Find the data source association for this multicast route.
+ *
+ * @param route a multicast route
+ * @return a connect point
+ */
+ ConnectPoint fetchSource(McastRoute route);
+
+ /**
+ * Find the list of sinks for this route.
+ *
+ * @param route a multicast route
+ * @return a list of connect points
+ */
+ List<ConnectPoint> fetchSinks(McastRoute route);
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/package-info.java
new file mode 100644
index 00000000..e8dcc7b8
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/mcast/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * External model entities of the multicast RIB.
+ */
+package org.onosproject.net.mcast; \ No newline at end of file
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
index 94cada47..51394c30 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/DefaultMeterRequest.java
@@ -43,7 +43,8 @@ public final class DefaultMeterRequest implements MeterRequest {
private DefaultMeterRequest(DeviceId deviceId, ApplicationId appId,
Meter.Unit unit, boolean burst,
- Collection<Band> bands, MeterContext context, Type op) {
+ Collection<Band> bands, MeterContext context,
+ Type op) {
this.deviceId = deviceId;
this.appId = appId;
this.unit = unit;
@@ -58,6 +59,7 @@ public final class DefaultMeterRequest implements MeterRequest {
return deviceId;
}
+
@Override
public ApplicationId appId() {
return appId;
@@ -107,6 +109,7 @@ public final class DefaultMeterRequest implements MeterRequest {
private Collection<Band> bands;
private DeviceId deviceId;
private MeterContext context;
+ private Optional<MeterId> desiredId = Optional.empty();
@Override
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java
new file mode 100644
index 00000000..5bc01b02
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterKey.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.meter;
+
+import com.google.common.base.Objects;
+import org.onosproject.net.DeviceId;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * A meter key represents a meter uniquely.
+ */
+public final class MeterKey {
+
+ private final DeviceId deviceId;
+ private final MeterId id;
+
+ private MeterKey(DeviceId deviceId, MeterId id) {
+ this.deviceId = deviceId;
+ this.id = id;
+ }
+
+ public DeviceId deviceId() {
+ return deviceId;
+ }
+
+ public MeterId meterId() {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MeterKey meterKey = (MeterKey) o;
+ return Objects.equal(deviceId, meterKey.deviceId) &&
+ Objects.equal(id, meterKey.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(deviceId, id);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("deviceId", deviceId)
+ .add("meterId", id).toString();
+ }
+
+ public static MeterKey key(DeviceId deviceId, MeterId id) {
+ return new MeterKey(deviceId, id);
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
index bdc90eb7..2e07cb67 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
@@ -16,6 +16,7 @@
package org.onosproject.net.meter;
import org.onosproject.event.ListenerService;
+import org.onosproject.net.DeviceId;
import java.util.Collection;
@@ -46,10 +47,11 @@ public interface MeterService
/**
* Fetch the meter by the meter id.
*
+ * @param deviceId a device id
* @param id a meter id
* @return a meter
*/
- Meter getMeter(MeterId id);
+ Meter getMeter(DeviceId deviceId, MeterId id);
/**
* Fetches all the meters.
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
index 5112a4a3..f429e95a 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
@@ -57,12 +57,12 @@ public interface MeterStore extends Store<MeterEvent, MeterStoreDelegate> {
void updateMeterState(Meter meter);
/**
- * Obtains a meter matching the given meter id.
+ * Obtains a meter matching the given meter key.
*
- * @param meterId a meter id
+ * @param key a meter key
* @return a meter
*/
- Meter getMeter(MeterId meterId);
+ Meter getMeter(MeterKey key);
/**
* Returns all meters stored in the store.
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
index 618042a3..82d84743 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java
@@ -125,6 +125,15 @@ public interface ResourceService {
boolean release(ResourceConsumer consumer);
/**
+ * Returns resource allocation of the specified resource.
+ *
+ * @param resource resource to check the allocation
+ * @return allocation information enclosed by Optional.
+ * If the resource is not allocated, the return value is empty.
+ */
+ Optional<ResourceAllocation> getResourceAllocation(ResourcePath resource);
+
+ /**
* Returns allocated resources being as children of the specified parent and being the specified resource type.
*
* @param parent parent resource path
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java
new file mode 100644
index 00000000..40386fb7
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketProcessorEntry.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.packet;
+
+/**
+ * Packet processor entry tracking the processor, its priority and
+ * time consumption.
+ */
+public interface PacketProcessorEntry {
+
+ /**
+ * Returns the packet processor.
+ *
+ * @return packet processor
+ */
+ PacketProcessor processor();
+
+ /**
+ * Returns the packet processor priority.
+ *
+ * @return processor priority
+ */
+ int priority();
+
+ /**
+ * Returns the number of invocations.
+ *
+ * @return number of invocations
+ */
+ long invocations();
+
+ /**
+ * Returns the total time, in nanoseconds, spent processing packets.
+ *
+ * @return total time in nanos
+ */
+ long totalNanos();
+
+ /**
+ * Returns the average time, in nanoseconds, spent processing packets.
+ *
+ * @return average time in nanos
+ */
+ long averageNanos();
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java
index 98f4d8e0..2e7a1b91 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketService.java
@@ -20,7 +20,6 @@ import org.onosproject.core.ApplicationId;
import org.onosproject.net.flow.TrafficSelector;
import java.util.List;
-import java.util.Map;
/**
* Service for intercepting data plane packets and for emitting synthetic
@@ -52,13 +51,12 @@ public interface PacketService {
void removeProcessor(PacketProcessor processor);
/**
- * Returns priority bindings of all registered packet processors.
+ * Returns priority bindings of all registered packet processor entries.
*
- * @return list of existing packet processors
+ * @return list of existing packet processor entries
*/
@Beta
- // TODO: Consider returning list of PacketProcessorEntry with processor, priority and stats
- Map<Integer, PacketProcessor> getProcessors();
+ List<PacketProcessorEntry> getProcessors();
/**
* Requests that packets matching the given selector are punted from the
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java
index 97f7cb55..d83fc9a2 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStore.java
@@ -37,17 +37,15 @@ public interface PacketStore extends Store<PacketEvent, PacketStoreDelegate> {
* Requests intercept of packets that match the given selector.
*
* @param request a packet request
- * @return true if the first time the given selector was requested
*/
- boolean requestPackets(PacketRequest request);
+ void requestPackets(PacketRequest request);
/**
* Cancels intercept of packets that match the given selector.
*
* @param request a packet request
- * @return true if there is no other application requesting the given selector
*/
- boolean cancelPackets(PacketRequest request);
+ void cancelPackets(PacketRequest request);
/**
* Obtains all existing requests in the system.
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java
index bf5c3cc0..2e59b19d 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/packet/PacketStoreDelegate.java
@@ -21,4 +21,20 @@ import org.onosproject.store.StoreDelegate;
* Packet store delegate abstraction.
*/
public interface PacketStoreDelegate extends StoreDelegate<PacketEvent> {
+
+ /**
+ * Requests that packets matching to following request be collected
+ * from all switches.
+ *
+ * @param request packet request
+ */
+ void requestPackets(PacketRequest request);
+
+ /**
+ * Requests that packets matching to following request no longer be
+ * collected from any switches.
+ *
+ * @param request packet request
+ */
+ void cancelPackets(PacketRequest request);
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java
new file mode 100644
index 00000000..67c539df
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/device/IntentSetMultimap.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.resource.device;
+
+import org.onosproject.net.intent.IntentId;
+
+import java.util.Set;
+
+public interface IntentSetMultimap {
+
+ /**
+ * Allocates the mapping between the given intents.
+ *
+ * @param keyIntentId key intent ID
+ * @param valIntentId value intent ID
+ * @return true if mapping was successful, false otherwise
+ */
+ boolean allocateMapping(IntentId keyIntentId, IntentId valIntentId);
+
+ /**
+ * Returns the set of intents mapped to a lower intent.
+ *
+ * @param intentId intent ID
+ * @return set of intent IDs
+ */
+ Set<IntentId> getMapping(IntentId intentId);
+
+ /**
+ * Releases the mapping of the given intent.
+ *
+ * @param intentId intent ID
+ */
+ void releaseMapping(IntentId intentId);
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
index 91cc3d19..e07309cb 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
@@ -64,7 +64,7 @@ public class BandwidthResourceRequest implements ResourceRequest {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
- final BandwidthResourceAllocation other = (BandwidthResourceAllocation) obj;
+ final BandwidthResourceRequest other = (BandwidthResourceRequest) obj;
return Objects.equals(this.bandwidth, other.bandwidth());
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
new file mode 100644
index 00000000..f59670bc
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticService.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.statistic;
+
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.TypedStoredFlowEntry;
+import org.onosproject.net.flow.instructions.Instruction;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service for obtaining individual flow statistic information about device and link in the system.
+ * Basic statistics are obtained from the StatisticService
+ */
+public interface FlowStatisticService {
+
+ /**
+ * Obtain the summary load list for the device with the given link.
+ *
+ * @param device the Device to query.
+ * @return map of summary flow entry load
+ */
+ Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device);
+
+ /**
+ * Obtain the summary load for the device with the given link or port.
+ *
+ * @param device the Device to query.
+ * @param pNumber the port number to query.
+ * @return summary flow entry load
+ */
+ SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber);
+
+ /**
+ * Obtain the set of the flow type and load list for the device with the given link.
+ *
+ * @param device the Device to query.
+ * @param liveType the FlowLiveType to filter, null means no filtering .
+ * @param instType the InstructionType to filter, null means no filtering.
+ * @return map of flow entry load
+ */
+ Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
+ TypedStoredFlowEntry.FlowLiveType liveType,
+ Instruction.Type instType);
+
+ /**
+ * Obtain the flow type and load list for the device with the given link or port.
+ *
+ * @param device the Device to query.
+ * @param pNumber the port number of the Device to query
+ * @param liveType the FlowLiveType to filter, null means no filtering .
+ * @param instType the InstructionType to filter, null means no filtering.
+ * @return list of flow entry load
+ */
+ List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber,
+ TypedStoredFlowEntry.FlowLiveType liveType,
+ Instruction.Type instType);
+
+ /**
+ * Obtain the set of the flow type and load topn list for the device with the given link.
+ *
+ * @param device the Device to query.
+ * @param liveType the FlowLiveType to filter, null means no filtering .
+ * @param instType the InstructionType to filter, null means no filtering.
+ * @param topn the top number to filter, null means no filtering.
+ * @return map of flow entry load
+ */
+ Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device,
+ TypedStoredFlowEntry.FlowLiveType liveType,
+ Instruction.Type instType,
+ int topn);
+
+ /**
+ * Obtain the flow type and load topn list for the device with the given link or port.
+ *
+ * @param device the Device to query.
+ * @param pNumber the port number of the Device to query
+ * @param liveType the FlowLiveType to filter, null means no filtering .
+ * @param instType the InstructionType to filter, null means no filtering.
+ * @return list of flow entry load
+ */
+ List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber,
+ TypedStoredFlowEntry.FlowLiveType liveType,
+ Instruction.Type instType,
+ int topn);
+}
+
+
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticStore.java
new file mode 100644
index 00000000..3c2aa89b
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/FlowStatisticStore.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.statistic;
+
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.flow.FlowEntry;
+import org.onosproject.net.flow.FlowRule;
+
+import java.util.Set;
+
+/**
+ * Flow Store to house the computed statistics.
+ */
+public interface FlowStatisticStore {
+ /**
+ * Remove entries associated with this rule.
+ *
+ * @param rule {@link org.onosproject.net.flow.FlowRule}
+ */
+ void removeFlowStatistic(FlowRule rule);
+
+ /**
+ * Adds a flow stats observation for a flow rule. The previous flow will be removed.
+ *
+ * @param rule a {@link org.onosproject.net.flow.FlowEntry}
+ */
+ void addFlowStatistic(FlowEntry rule);
+
+ /**
+ * Updates a stats observation for a flow rule. The old flow stats will be moved to previous stats.
+ *
+ * @param rule a {@link org.onosproject.net.flow.FlowEntry}
+ */
+ void updateFlowStatistic(FlowEntry rule);
+
+ /**
+ * Fetches the current observed flow stats values.
+ *
+ * @param connectPoint the port to fetch information for
+ * @return set of current flow rules
+ */
+ Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint);
+
+ /**
+ * Fetches the current observed flow stats values.
+ *
+ * @param connectPoint the port to fetch information for
+ * @return set of current values
+ */
+ Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint);
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java
new file mode 100644
index 00000000..60da636a
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/SummaryFlowEntryWithLoad.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.statistic;
+
+import org.onosproject.net.ConnectPoint;
+
+/**
+ * Summary Load classified by flow live type.
+ */
+public class SummaryFlowEntryWithLoad {
+ private ConnectPoint cp;
+ private Load totalLoad;
+ private Load immediateLoad;
+ private Load shortLoad;
+ private Load midLoad;
+ private Load longLoad;
+ private Load unknownLoad;
+
+ /**
+ * Creates a new summary flow entry having load for the given connect point and total load.
+ *
+ * @param cp connect point
+ * @param totalLoad total load
+ */
+ public SummaryFlowEntryWithLoad(ConnectPoint cp, Load totalLoad) {
+ this.cp = cp;
+ this.totalLoad = totalLoad;
+ this.immediateLoad = new DefaultLoad();
+ this.shortLoad = new DefaultLoad();
+ this.midLoad = new DefaultLoad();
+ this.longLoad = new DefaultLoad();
+ this.unknownLoad = new DefaultLoad();
+ }
+
+ /**
+ * Creates a new summary flow entry having load for the given connect point
+ * and total, immediate, short, mid, and long load.
+ *
+ * @param cp connect point
+ * @param totalLoad total load
+ * @param immediateLoad immediate load
+ * @param shortLoad short load
+ * @param midLoad mid load
+ * @param longLoad long load
+ */
+ public SummaryFlowEntryWithLoad(ConnectPoint cp,
+ Load totalLoad, Load immediateLoad, Load shortLoad, Load midLoad, Load longLoad) {
+ this.cp = cp;
+ this.totalLoad = totalLoad;
+ this.immediateLoad = immediateLoad;
+ this.shortLoad = shortLoad;
+ this.midLoad = midLoad;
+ this.longLoad = longLoad;
+ this.unknownLoad = new DefaultLoad();
+ }
+
+ /**
+ * Creates a new summary flow entry having load for the given connect point
+ * and total, immediate, short, mid, long, and unknown load.
+ *
+ * @param cp connect point
+ * @param totalLoad total load
+ * @param immediateLoad immediate load
+ * @param shortLoad short load
+ * @param midLoad mid load
+ * @param longLoad long load
+ * @param unknownLoad long load
+ */
+ public SummaryFlowEntryWithLoad(ConnectPoint cp,
+ Load totalLoad, Load immediateLoad,
+ Load shortLoad, Load midLoad, Load longLoad, Load unknownLoad) {
+ this.cp = cp;
+ this.totalLoad = totalLoad;
+ this.immediateLoad = immediateLoad;
+ this.shortLoad = shortLoad;
+ this.midLoad = midLoad;
+ this.longLoad = longLoad;
+ this.unknownLoad = unknownLoad;
+ }
+
+ /**
+ * Returns connect point.
+ */
+ public ConnectPoint connectPoint() {
+ return cp;
+ }
+
+ /**
+ * Returns total load of connect point.
+ */
+ public Load totalLoad() {
+ return totalLoad;
+ }
+
+ /**
+ * Returns immediate load of connect point.
+ */
+ public Load immediateLoad() {
+ return immediateLoad;
+ }
+
+ /**
+ * Returns short load of connect point.
+ */
+ public Load shortLoad() {
+ return shortLoad;
+ }
+
+ /**
+ * Returns mid load of connect point.
+ */
+ public Load midLoad() {
+ return midLoad;
+ }
+
+ /**
+ * Returns long load of connect point.
+ */
+ public Load longLoad() {
+ return longLoad;
+ }
+
+ /**
+ * Returns unknown load of connect point.
+ */
+ public Load unknownLoad() {
+ return unknownLoad;
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java
new file mode 100644
index 00000000..3e2dbdf8
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/statistic/TypedFlowEntryWithLoad.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.statistic;
+
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.flow.FlowEntry;
+import org.onosproject.net.flow.TypedStoredFlowEntry;
+import org.onosproject.net.flow.DefaultTypedFlowEntry;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Load of flow entry of flow live type.
+ */
+public class TypedFlowEntryWithLoad {
+ private ConnectPoint cp;
+ private TypedStoredFlowEntry tfe;
+ private Load load;
+
+ //TODO: make this variables class, and share with NewAdaptivceFlowStatsCollector class
+ private static final int CAL_AND_POLL_INTERVAL = 5; // means SHORT_POLL_INTERVAL
+ private static final int MID_POLL_INTERVAL = 10;
+ private static final int LONG_POLL_INTERVAL = 15;
+
+
+ public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe, Load load) {
+ this.cp = cp;
+ this.tfe = tfe;
+ this.load = load;
+ }
+
+ public TypedFlowEntryWithLoad(ConnectPoint cp, TypedStoredFlowEntry tfe) {
+ this.cp = cp;
+ this.tfe = tfe;
+ this.load = new DefaultLoad(tfe.bytes(), 0, typedPollInterval(tfe));
+ }
+
+ public TypedFlowEntryWithLoad(ConnectPoint cp, FlowEntry fe) {
+ this.cp = cp;
+ this.tfe = newTypedStoredFlowEntry(fe);
+ this.load = new DefaultLoad(fe.bytes(), 0, typedPollInterval(this.tfe));
+ }
+
+ public ConnectPoint connectPoint() {
+ return cp;
+ }
+ public TypedStoredFlowEntry typedStoredFlowEntry() {
+ return tfe;
+ }
+ public Load load() {
+ return load;
+ }
+ public void setLoad(Load load) {
+ this.load = load;
+ }
+
+ /**
+ * Returns short polling interval.
+ */
+ public static int shortPollInterval() {
+ return CAL_AND_POLL_INTERVAL;
+ }
+
+ /**
+ * Returns mid polling interval.
+ */
+ public static int midPollInterval() {
+ return MID_POLL_INTERVAL;
+ }
+
+ /**
+ * Returns long polling interval.
+ */
+ public static int longPollInterval() {
+ return LONG_POLL_INTERVAL;
+ }
+
+ /**
+ * Returns average polling interval.
+ */
+ public static int avgPollInterval() {
+ return (CAL_AND_POLL_INTERVAL + MID_POLL_INTERVAL + LONG_POLL_INTERVAL) / 3;
+ }
+
+ /**
+ * Returns current typed flow entry's polling interval.
+ *
+ * @param tfe typed flow entry
+ */
+ public static long typedPollInterval(TypedStoredFlowEntry tfe) {
+ checkNotNull(tfe, "TypedStoredFlowEntry cannot be null");
+
+ switch (tfe.flowLiveType()) {
+ case LONG_FLOW:
+ return LONG_POLL_INTERVAL;
+ case MID_FLOW:
+ return MID_POLL_INTERVAL;
+ case SHORT_FLOW:
+ case IMMEDIATE_FLOW:
+ default:
+ return CAL_AND_POLL_INTERVAL;
+ }
+ }
+
+ /**
+ * Creates a new typed flow entry with the given flow entry fe.
+ *
+ * @param fe flow entry
+ */
+ public static TypedStoredFlowEntry newTypedStoredFlowEntry(FlowEntry fe) {
+ if (fe == null) {
+ return null;
+ }
+
+ long life = fe.life();
+
+ if (life >= LONG_POLL_INTERVAL) {
+ return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.LONG_FLOW);
+ } else if (life >= MID_POLL_INTERVAL) {
+ return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.MID_FLOW);
+ } else if (life >= CAL_AND_POLL_INTERVAL) {
+ return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.SHORT_FLOW);
+ } else if (life >= 0) {
+ return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.IMMEDIATE_FLOW);
+ } else { // life < 0
+ return new DefaultTypedFlowEntry(fe, TypedStoredFlowEntry.FlowLiveType.UNKNOWN_FLOW);
+ }
+ }
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/DefaultGraphDescription.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/DefaultGraphDescription.java
index f1e20dac..965c05d4 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/DefaultGraphDescription.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/DefaultGraphDescription.java
@@ -50,23 +50,6 @@ public class DefaultGraphDescription extends AbstractDescription
* and process the topology graph.
*
* @param nanos time in nanos of when the topology description was created
- * @param devices collection of infrastructure devices
- * @param links collection of infrastructure links
- * @param annotations optional key/value annotations map
- * @deprecated in Cardinal Release
- */
- @Deprecated
- public DefaultGraphDescription(long nanos, Iterable<Device> devices,
- Iterable<Link> links,
- SparseAnnotations... annotations) {
- this(nanos, System.currentTimeMillis(), devices, links, annotations);
- }
-
- /**
- * Creates a minimal topology graph description to allow core to construct
- * and process the topology graph.
- *
- * @param nanos time in nanos of when the topology description was created
* @param millis time in millis of when the topology description was created
* @param devices collection of infrastructure devices
* @param links collection of infrastructure links
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/PathService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/PathService.java
index be8c7cfc..0bd4d75d 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/PathService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/PathService.java
@@ -15,9 +15,12 @@
*/
package org.onosproject.net.topology;
+import org.onosproject.net.DisjointPath;
import org.onosproject.net.ElementId;
+import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import java.util.Map;
import java.util.Set;
/**
@@ -41,11 +44,58 @@ public interface PathService {
* edge-weight entity, between the specified source and destination
* network elements.
*
- * @param src source element
- * @param dst destination element
+ * @param src source element
+ * @param dst destination element
* @param weight edge-weight entity
* @return set of all shortest paths between the two element
*/
Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight);
+ /**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param src source device
+ * @param dst destination device
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, computed using the supplied
+ * edge-weight entity, between the specified source and destination devices.
+ *
+ * @param src source device
+ * @param dst destination device
+ * @param weight edge-weight entity
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+ LinkWeight weight);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param src source device
+ * @param dst destination device
+ * @param riskProfile map of edges to risk profiles
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+ Map<Link, Object> riskProfile);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param src source device
+ * @param dst destination device
+ * @param weight edge-weight entity
+ * @param riskProfile map of edges to risk profiles
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+ LinkWeight weight, Map<Link, Object> riskProfile);
+
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
index 41eac2c4..466e4f9b 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyService.java
@@ -18,16 +18,18 @@ package org.onosproject.net.topology;
import org.onosproject.event.ListenerService;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.DisjointPath;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import java.util.Map;
import java.util.Set;
/**
* Service for providing network topology information.
*/
public interface TopologyService
- extends ListenerService<TopologyEvent, TopologyListener> {
+ extends ListenerService<TopologyEvent, TopologyListener> {
/**
* Returns the current topology descriptor.
@@ -72,8 +74,8 @@ public interface TopologyService
/**
* Returns the set of devices that belong to the specified cluster.
*
- * @param topology topology descriptor
- * @param cluster topology cluster
+ * @param topology topology descriptor
+ * @param cluster topology cluster
* @return set of cluster devices
*/
Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster);
@@ -81,8 +83,8 @@ public interface TopologyService
/**
* Returns the set of links that form the specified cluster.
*
- * @param topology topology descriptor
- * @param cluster topology cluster
+ * @param topology topology descriptor
+ * @param cluster topology cluster
* @return set of cluster links
*/
Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster);
@@ -112,6 +114,57 @@ public interface TopologyService
LinkWeight weight);
/**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, computed using the supplied
+ * edge-weight entity, between the specified source and destination devices.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param weight edge-weight entity
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ LinkWeight weight);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param riskProfile map of edges to risk profiles
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ Map<Link, Object> riskProfile);
+
+ /**
+ * Returns the set of all disjoint shortest path pairs, precomputed in terms of hop-count,
+ * between the specified source and destination devices.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param weight edge-weight entity
+ * @param riskProfile map of edges to risk profiles
+ * @return set of all shortest paths between the two devices
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ LinkWeight weight, Map<Link, Object> riskProfile);
+
+ /**
* Indicates whether the specified connection point is part of the network
* infrastructure or part of network edge.
*
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
index 983e616e..039a205c 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/net/topology/TopologyStore.java
@@ -20,11 +20,13 @@ import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import org.onosproject.net.DisjointPath;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.Store;
import java.util.List;
import java.util.Set;
+import java.util.Map;
/**
* Manages inventory of topology snapshots; not intended for direct use.
@@ -112,6 +114,59 @@ public interface TopologyStore extends Store<TopologyEvent, TopologyStoreDelegat
LinkWeight weight);
/**
+ * Computes and returns the set of disjoint shortest path pairs
+ * between src and dst.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param weight link weight function
+ * @return set of shortest paths
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ LinkWeight weight);
+
+ /**
+ * Computes and returns the set of disjoint shortest path pairs
+ * between src and dst.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @return set of shortest paths
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst);
+
+ /**
+ * Computes and returns the set of SRLG disjoint shortest path pairs between source
+ * and dst, given a mapping of edges to SRLG risk groups.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param weight link weight function
+ * @param riskProfile map of edges to objects. Edges that map to the same object will
+ * be treated as if they were in the same risk group.
+ * @return set of shortest paths
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ LinkWeight weight, Map<Link, Object> riskProfile);
+
+ /**
+ * Returns the set of pre-computed SRLG shortest paths between src and dest.
+ *
+ * @param topology topology descriptor
+ * @param src source device
+ * @param dst destination device
+ * @param riskProfile map of edges to objects. Edges that map to the same object will
+ * be treated as if they were in the same risk group.
+ * @return set of shortest paths
+ */
+ Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ Map<Link, Object> riskProfile);
+
+
+ /**
* Indicates whether the given connect point is part of the network fabric.
*
* @param topology topology descriptor
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
index a879cc59..c0df7134 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AsyncAtomicCounter.java
@@ -58,4 +58,21 @@ public interface AsyncAtomicCounter {
* @return current value
*/
CompletableFuture<Long> get();
+
+
+ /**
+ * Atomically sets the given value to the current value.
+ *
+ * @return future void
+ */
+ CompletableFuture<Void> set(long value);
+
+ /**
+ * Atomically sets the given counter to the updated value if the current value is the expected value, otherwise
+ * no change occurs.
+ * @param expectedValue the expected current value of the counter
+ * @param updateValue the new value to be set
+ * @return true if the update occurred and the expected value was equal to the current value, false otherwise
+ */
+ CompletableFuture<Boolean> compareAndSet(long expectedValue, long updateValue);
}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java
index f620e082..3c9e02c8 100644
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/AtomicCounter.java
@@ -51,6 +51,22 @@ public interface AtomicCounter {
long addAndGet(long delta);
/**
+ * Atomically sets the given value to the current value.
+ *
+ * @param value the value to set
+ */
+ void set(long value);
+
+ /**
+ * Atomically sets the given counter to the updated value if the current value is the expected value, otherwise
+ * no change occurs.
+ * @param expectedValue the expected current value of the counter
+ * @param updateValue the new value to be set
+ * @return true if the update occurred and the expected value was equal to the current value, false otherwise
+ */
+ boolean compareAndSet(long expectedValue, long updateValue);
+
+ /**
* Returns the current value of the counter without modifying it.
*
* @return current value
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexExecutionService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexExecutionService.java
new file mode 100644
index 00000000..d05f3b91
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexExecutionService.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+
+/**
+ * Service for mutually exclusive job execution.
+ */
+public interface MutexExecutionService {
+
+ /**
+ * Runs the specified task in a mutually exclusive fashion.
+ * @param task task to run
+ * @param exclusionPath path on which different instances synchronize
+ * @param executor executor to use for running the task
+ * @return future that is completed when the task execution completes.
+ */
+ CompletableFuture<Void> execute(MutexTask task, String exclusionPath, Executor executor);
+} \ No newline at end of file
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexTask.java b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexTask.java
new file mode 100644
index 00000000..ba5ee47f
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/store/service/MutexTask.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.store.service;
+
+/**
+ * The MutexTask interface should be implemented by any class whose
+ * instances distributed across controllers are intended to be executed
+ * in a mutually exclusive fashion.
+ */
+public interface MutexTask {
+
+ /**
+ * Begins the execution of a mutually exclusive task.
+ * The start method will be called once the "lock" is acquired.
+ * After the start method returns the lock is released and some other
+ * instance can take over execution.
+ */
+ void start();
+
+ /**
+ * This method will be called when exclusivity of task execution
+ * can no longer be guaranteed. The implementation should take necessary steps
+ * to halt task execution in order to ensure correctness.
+ */
+ void stop();
+}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
new file mode 100644
index 00000000..76f42466
--- /dev/null
+++ b/framework/src/onos/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.ui.table.cell;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+/**
+ * Formats number using the specified format string".
+ */
+public final class NumberFormatter extends AbstractCellFormatter {
+
+ private final NumberFormat format;
+
+ /**
+ * Creates a formatter using a default decimal format.
+ */
+ public NumberFormatter() {
+ this(new DecimalFormat("#,##0.00000"));
+ }
+
+ /**
+ * Creates a formatter using the specified format.
+ *
+ * @param format number format
+ */
+ public NumberFormatter(NumberFormat format) {
+ this.format = format;
+ }
+
+ @Override
+ protected String nonNullFormat(Object value) {
+ return format.format(value);
+ }
+
+}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
index a1abd188..0fccef81 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/cfg/ComponentConfigAdapter.java
@@ -17,10 +17,13 @@ package org.onosproject.cfg;
import java.util.Set;
+import com.google.common.collect.ImmutableSet;
+
/**
* Adapter for testing against component configuration service.
*/
public class ComponentConfigAdapter implements ComponentConfigService {
+
@Override
public Set<String> getComponentNames() {
return null;
@@ -38,7 +41,7 @@ public class ComponentConfigAdapter implements ComponentConfigService {
@Override
public Set<ConfigProperty> getProperties(String componentName) {
- return null;
+ return ImmutableSet.of();
}
@Override
@@ -47,6 +50,10 @@ public class ComponentConfigAdapter implements ComponentConfigService {
}
@Override
+ public void preSetProperty(String componentName, String name, String value) {
+ }
+
+ @Override
public void unsetProperty(String componentName, String name) {
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/behaviour/ControllerInfoTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/behaviour/ControllerInfoTest.java
new file mode 100644
index 00000000..ece7f199
--- /dev/null
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/behaviour/ControllerInfoTest.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.behaviour;
+
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onlab.packet.IpAddress;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test for ControllerInfo class.
+ */
+public class ControllerInfoTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void tcpSslFormat() {
+ String target = "tcp:192.168.1.1:6653";
+ ControllerInfo controllerInfo = new ControllerInfo(target);
+ assertEquals("wrong type", controllerInfo.type(), "tcp");
+ assertEquals("wrong ip", controllerInfo.ip(), IpAddress.valueOf("192.168.1.1"));
+ assertEquals("wrong port", controllerInfo.port(), 6653);
+
+ }
+
+ @Test
+ public void ptcpPsslFormat() {
+ String target = "ptcp:6653:192.168.1.1";
+ ControllerInfo controllerInfo = new ControllerInfo(target);
+ assertEquals("wrong type", controllerInfo.type(), "ptcp");
+ assertEquals("wrong ip", controllerInfo.ip(), IpAddress.valueOf("192.168.1.1"));
+ assertEquals("wrong port", controllerInfo.port(), 6653);
+
+ }
+
+ @Test
+ public void unixFormat() {
+ String target = "unix:file";
+ thrown.expect(IllegalArgumentException.class);
+ ControllerInfo controllerInfo = new ControllerInfo(target);
+ assertTrue("wrong type", controllerInfo.type().contains("unix"));
+ assertNull("wrong ip", controllerInfo.ip());
+ assertEquals("wrong port", controllerInfo.port(), -1);
+
+ }
+
+ @Test
+ public void defaultValues() {
+ String target = "tcp:192.168.1.1";
+ ControllerInfo controllerInfo = new ControllerInfo(target);
+ assertEquals("wrong type", controllerInfo.type(), "tcp");
+ assertEquals("wrong ip", controllerInfo.ip(), IpAddress.valueOf("192.168.1.1"));
+ assertEquals("wrong port", controllerInfo.port(), 6653);
+ String target1 = "ptcp:5000:";
+ ControllerInfo controllerInfo2 = new ControllerInfo(target1);
+ assertEquals("wrong type", controllerInfo2.type(), "ptcp");
+ assertEquals("wrong ip", controllerInfo2.ip(), IpAddress.valueOf("0.0.0.0"));
+ assertEquals("wrong port", controllerInfo2.port(), 5000);
+ String target2 = "ptcp:";
+ ControllerInfo controllerInfo3 = new ControllerInfo(target2);
+ assertEquals("wrong type", controllerInfo3.type(), "ptcp");
+ assertEquals("wrong ip", controllerInfo3.ip(), IpAddress.valueOf("0.0.0.0"));
+ assertEquals("wrong port", controllerInfo3.port(), 6653);
+ }
+
+
+ @Test
+ public void testEquals() {
+ String target1 = "ptcp:6653:192.168.1.1";
+ ControllerInfo controllerInfo1 = new ControllerInfo(target1);
+ String target2 = "ptcp:6653:192.168.1.1";
+ ControllerInfo controllerInfo2 = new ControllerInfo(target2);
+ assertTrue("wrong equals method", controllerInfo1.equals(controllerInfo2));
+ }
+
+ @Test
+ public void testListEquals() {
+ String target1 = "ptcp:6653:192.168.1.1";
+ ControllerInfo controllerInfo1 = new ControllerInfo(target1);
+ String target2 = "ptcp:6653:192.168.1.1";
+ ControllerInfo controllerInfo2 = new ControllerInfo(target2);
+ String target3 = "tcp:192.168.1.1:6653";
+ ControllerInfo controllerInfo3 = new ControllerInfo(target3);
+ String target4 = "tcp:192.168.1.1:6653";
+ ControllerInfo controllerInfo4 = new ControllerInfo(target4);
+ List<ControllerInfo> list1 = new ArrayList<>(Arrays.asList(controllerInfo1, controllerInfo3));
+ List<ControllerInfo> list2 = new ArrayList<>(Arrays.asList(controllerInfo2, controllerInfo4));
+ assertTrue("wrong equals list method", list1.equals(list2));
+ }
+}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/config/NetworkConfigServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/config/NetworkConfigServiceAdapter.java
index b70d14e8..73072583 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/config/NetworkConfigServiceAdapter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/config/NetworkConfigServiceAdapter.java
@@ -29,7 +29,7 @@ public class NetworkConfigServiceAdapter implements NetworkConfigService {
}
@Override
- public SubjectFactory getSubjectFactory(String subjectKey) {
+ public SubjectFactory getSubjectFactory(String subjectClassKey) {
return null;
}
@@ -39,7 +39,7 @@ public class NetworkConfigServiceAdapter implements NetworkConfigService {
}
@Override
- public Class<? extends Config> getConfigClass(String subjectKey, String configKey) {
+ public Class<? extends Config> getConfigClass(String subjectClassKey, String configKey) {
return null;
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
index b871397b..10c5a637 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/DefaultTrafficSelectorTest.java
@@ -267,29 +267,5 @@ public class DefaultTrafficSelectorTest {
selector = DefaultTrafficSelector.builder()
.add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
-
- selector = DefaultTrafficSelector.builder()
- .add(Criteria.matchOpticalSignalType(shortValue)).build();
- assertThat(selector, hasCriterionWithType(Type.OCH_SIGTYPE));
- }
-
- /**
- * Tests the traffic selector builder.
- */
- @Test
- public void testTrafficSelectorBuilder() {
- TrafficSelector selector;
- final short shortValue = 33;
-
- final TrafficSelector baseSelector = DefaultTrafficSelector.builder()
- .add(Criteria.matchLambda(new IndexedLambda(shortValue))).build();
- selector = DefaultTrafficSelector.builder(baseSelector)
- .build();
- assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
-
- final Criterion criterion = Criteria.matchLambda(shortValue);
- selector = DefaultTrafficSelector.builder()
- .add(criterion).build();
- assertThat(selector, hasCriterionWithType(Type.OCH_SIGID));
}
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
index c7b78791..56e59118 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
@@ -35,17 +35,14 @@ public class FlowRuleServiceAdapter implements FlowRuleService {
@Override
public void applyFlowRules(FlowRule... flowRules) {
-
}
@Override
public void removeFlowRules(FlowRule... flowRules) {
-
}
@Override
public void removeFlowRulesById(ApplicationId appId) {
-
}
@Override
@@ -60,16 +57,18 @@ public class FlowRuleServiceAdapter implements FlowRuleService {
@Override
public void apply(FlowRuleOperations ops) {
-
}
@Override
public void addListener(FlowRuleListener listener) {
-
}
@Override
public void removeListener(FlowRuleListener listener) {
+ }
+ @Override
+ public Iterable<TableStatisticsEntry> getFlowTableStatistics(DeviceId deviceId) {
+ return null;
}
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
index ee294f6f..95d605c6 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/flow/criteria/CriteriaTest.java
@@ -225,12 +225,6 @@ public class CriteriaTest {
Criterion matchIpv6ExthdrFlags2 =
Criteria.matchIPv6ExthdrFlags(ipv6ExthdrFlags2);
- int lambda1 = 1;
- int lambda2 = 2;
- Criterion matchLambda1 = Criteria.matchLambda(lambda1);
- Criterion sameAsMatchLambda1 = Criteria.matchLambda(lambda1);
- Criterion matchLambda2 = Criteria.matchLambda(lambda2);
-
Criterion matchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
Criterion sameAsMatchOchSignalType1 = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
Criterion matchOchSignalType2 = Criteria.matchOchSignalType(OchSignalType.FLEX_GRID);
@@ -239,12 +233,6 @@ public class CriteriaTest {
Criterion sameAsMatchIndexedLambda1 = Criteria.matchLambda(Lambda.indexedLambda(1));
Criterion matchIndexedLambda2 = Criteria.matchLambda(Lambda.indexedLambda(2));
- short signalLambda1 = 1;
- short signalLambda2 = 2;
- Criterion matchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
- Criterion sameAsMatchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
- Criterion matchSignalLambda2 = Criteria.matchOpticalSignalType(signalLambda2);
-
Criterion matchOchSignal1 =
Criteria.matchLambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8));
Criterion sameAsMatchOchSignal1 =
@@ -306,7 +294,6 @@ public class CriteriaTest {
assertThatClassIsImmutable(MplsCriterion.class);
assertThatClassIsImmutable(IPv6ExthdrFlagsCriterion.class);
assertThatClassIsImmutable(LambdaCriterion.class);
- assertThatClassIsImmutable(OpticalSignalTypeCriterion.class);
}
// PortCriterion class
@@ -1057,32 +1044,6 @@ public class CriteriaTest {
.testEquals();
}
- // LambdaCriterion class
-
- /**
- * Test the matchLambda method.
- */
- @Test
- public void testMatchLambdaMethod() {
- Criterion matchLambda = Criteria.matchLambda(lambda1);
- LambdaCriterion lambdaCriterion =
- checkAndConvert(matchLambda,
- Criterion.Type.OCH_SIGID,
- LambdaCriterion.class);
- assertThat(lambdaCriterion.lambda(), is(equalTo(lambda1)));
- }
-
- /**
- * Test the equals() method of the LambdaCriterion class.
- */
- @Test
- public void testLambdaCriterionEquals() {
- new EqualsTester()
- .addEqualityGroup(matchLambda1, sameAsMatchLambda1)
- .addEqualityGroup(matchLambda2)
- .testEquals();
- }
-
@Test
public void testIndexedLambdaCriterionEquals() {
new EqualsTester()
@@ -1109,30 +1070,4 @@ public class CriteriaTest {
.addEqualityGroup(matchOchSignalType2)
.testEquals();
}
-
- // OpticalSignalTypeCriterion class
-
- /**
- * Test the matchOpticalSignalType method.
- */
- @Test
- public void testMatchOpticalSignalTypeMethod() {
- Criterion matchLambda = Criteria.matchOpticalSignalType(signalLambda1);
- OpticalSignalTypeCriterion opticalSignalTypeCriterion =
- checkAndConvert(matchLambda,
- Criterion.Type.OCH_SIGTYPE,
- OpticalSignalTypeCriterion.class);
- assertThat(opticalSignalTypeCriterion.signalType(), is(equalTo(signalLambda1)));
- }
-
- /**
- * Test the equals() method of the OpticalSignalTypeCriterion class.
- */
- @Test
- public void testOpticalSignalTypeCriterionEquals() {
- new EqualsTester()
- .addEqualityGroup(matchSignalLambda1, sameAsMatchSignalLambda1)
- .addEqualityGroup(matchSignalLambda2)
- .testEquals();
- }
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
index ac4ecff3..d42e22fa 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
@@ -17,7 +17,6 @@ package org.onosproject.net.intent;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
-
import org.onlab.util.Bandwidth;
import org.onosproject.core.DefaultGroupId;
import org.onosproject.core.GroupId;
@@ -37,6 +36,9 @@ import org.onosproject.net.flow.criteria.Criterion.Type;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.flow.instructions.Instructions.MetadataInstruction;
+import org.onosproject.net.resource.ResourceAllocation;
+import org.onosproject.net.resource.ResourceRequest;
+import org.onosproject.net.resource.ResourceType;
import org.onosproject.net.resource.link.BandwidthResource;
import org.onosproject.net.resource.link.BandwidthResourceRequest;
import org.onosproject.net.resource.link.LambdaResource;
@@ -48,13 +50,10 @@ import org.onosproject.net.resource.link.LinkResourceRequest;
import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.resource.link.MplsLabel;
import org.onosproject.net.resource.link.MplsLabelResourceAllocation;
-import org.onosproject.net.resource.ResourceAllocation;
-import org.onosproject.net.resource.ResourceRequest;
-import org.onosproject.net.resource.ResourceType;
import org.onosproject.net.topology.DefaultTopologyEdge;
import org.onosproject.net.topology.DefaultTopologyVertex;
import org.onosproject.net.topology.LinkWeight;
-import org.onosproject.net.topology.PathService;
+import org.onosproject.net.topology.PathServiceAdapter;
import org.onosproject.net.topology.TopologyVertex;
import org.onosproject.store.Timestamp;
@@ -68,9 +67,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
-import static org.onosproject.net.NetTestTools.createPath;
-import static org.onosproject.net.NetTestTools.did;
-import static org.onosproject.net.NetTestTools.link;
+import static org.onosproject.net.NetTestTools.*;
/**
* Common mocks used by the intent framework tests.
@@ -134,7 +131,7 @@ public class IntentTestsMocks {
/**
* Mock path service for creating paths within the test.
*/
- public static class MockPathService implements PathService {
+ public static class MockPathService extends PathServiceAdapter {
final String[] pathHops;
final String[] reversePathHops;
@@ -424,7 +421,7 @@ public class IntentTestsMocks {
}
final MockFlowRule other = (MockFlowRule) obj;
return Objects.equals(this.timestamp, other.timestamp) &&
- this.id == other.id;
+ this.id == other.id;
}
@Override
@@ -450,7 +447,7 @@ public class IntentTestsMocks {
public MockIntent(Long number) {
super(NetTestTools.APP_ID, null, Collections.emptyList(),
- Intent.DEFAULT_INTENT_PRIORITY);
+ Intent.DEFAULT_INTENT_PRIORITY);
this.number = number;
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/packet/PacketServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/packet/PacketServiceAdapter.java
index c4386593..2993ce6b 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/packet/PacketServiceAdapter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/packet/PacketServiceAdapter.java
@@ -19,7 +19,6 @@ import org.onosproject.core.ApplicationId;
import org.onosproject.net.flow.TrafficSelector;
import java.util.List;
-import java.util.Map;
/**
* Test adapter for packet service.
@@ -34,7 +33,7 @@ public class PacketServiceAdapter implements PacketService {
}
@Override
- public Map<Integer, PacketProcessor> getProcessors() {
+ public List<PacketProcessorEntry> getProcessors() {
return null;
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java
index 8b0f8f05..f3958491 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java
@@ -41,7 +41,7 @@ public class DefaultGraphDescriptionTest {
@Test
public void basics() {
DefaultGraphDescription desc =
- new DefaultGraphDescription(4321L, ImmutableSet.of(DEV1, DEV2, DEV3),
+ new DefaultGraphDescription(4321L, System.currentTimeMillis(), ImmutableSet.of(DEV1, DEV2, DEV3),
ImmutableSet.of(L1, L2));
assertEquals("incorrect time", 4321L, desc.timestamp());
assertEquals("incorrect vertex count", 3, desc.vertexes().size());
@@ -50,7 +50,7 @@ public class DefaultGraphDescriptionTest {
@Test
public void missingVertex() {
- GraphDescription desc = new DefaultGraphDescription(4321L,
+ GraphDescription desc = new DefaultGraphDescription(4321L, System.currentTimeMillis(),
ImmutableSet.of(DEV1, DEV3),
ImmutableSet.of(L1, L2));
assertEquals("incorrect time", 4321L, desc.timestamp());
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
new file mode 100644
index 00000000..6a8e586f
--- /dev/null
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.topology;
+
+import org.onosproject.net.DisjointPath;
+import org.onosproject.net.ElementId;
+import org.onosproject.net.Link;
+import org.onosproject.net.Path;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Test adapter for path service.
+ */
+public class PathServiceAdapter implements PathService {
+ @Override
+ public Set<Path> getPaths(ElementId src, ElementId dst) {
+ return null;
+ }
+
+ @Override
+ public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+ Map<Link, Object> riskProfile) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
+ LinkWeight weight,
+ Map<Link, Object> riskProfile) {
+ return null;
+ }
+}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
index 07e67842..72cc67d7 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java
@@ -17,9 +17,11 @@ package org.onosproject.net.topology;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
+import org.onosproject.net.DisjointPath;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import java.util.Map;
import java.util.Set;
/**
@@ -89,4 +91,28 @@ public class TopologyServiceAdapter implements TopologyService {
public void removeListener(TopologyListener listener) {
}
+ @Override
+ public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+ DeviceId dst, LinkWeight weight) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
+ Map<Link, Object> riskProfile) {
+ return null;
+ }
+
+ @Override
+ public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src,
+ DeviceId dst, LinkWeight weight,
+ Map<Link, Object> riskProfile) {
+ return null;
+ }
+
}
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java
index 01209be2..8c577df9 100644
--- a/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java
+++ b/framework/src/onos/core/api/src/test/java/org/onosproject/store/service/TestAtomicCounter.java
@@ -48,6 +48,16 @@ public final class TestAtomicCounter implements AtomicCounter {
}
@Override
+ public void set(long value) {
+ this.value.set(value);
+ }
+
+ @Override
+ public boolean compareAndSet(long expectedValue, long updateValue) {
+ return value.compareAndSet(expectedValue, updateValue);
+ }
+
+ @Override
public long get() {
return value.get();
}