Merge branch 'master' into dev/auklet
Change-Id: I665c2ee99a7010d7494087d6a3935de3ceb7b864
diff --git a/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasClientController.java b/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasClientController.java
index fccda3e..7c1e01f 100644
--- a/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasClientController.java
+++ b/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasClientController.java
@@ -82,18 +82,13 @@
* Bootstrap netty socket.
*
* @return bootstrap
- * @throws Exception exception
*/
- private Bootstrap createBootstrap() throws Exception {
- try {
- workerGroup = new NioEventLoopGroup();
- return new Bootstrap()
- .group(workerGroup)
- .channel(NioSocketChannel.class)
- .option(ChannelOption.SO_KEEPALIVE, true);
- } catch (Exception e) {
- throw new Exception(e);
- }
+ private Bootstrap createBootstrap() {
+ workerGroup = new NioEventLoopGroup();
+ return new Bootstrap()
+ .group(workerGroup)
+ .channel(NioSocketChannel.class)
+ .option(ChannelOption.SO_KEEPALIVE, true);
}
/**
diff --git a/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasServerController.java b/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasServerController.java
index c27a134..33e30d0 100644
--- a/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasServerController.java
+++ b/apps/artemis/src/main/java/org/onosproject/artemis/impl/moas/MoasServerController.java
@@ -77,22 +77,17 @@
* Create netty server bootstrap.
*
* @return bootstrap
- * @throws Exception exception
*/
- private ServerBootstrap createServerBootStrap() throws Exception {
- try {
- bossGroup = new NioEventLoopGroup();
- workerGroup = new NioEventLoopGroup();
+ private ServerBootstrap createServerBootStrap() {
+ bossGroup = new NioEventLoopGroup();
+ workerGroup = new NioEventLoopGroup();
- return new ServerBootstrap()
- .group(bossGroup, workerGroup)
- .channel(NioServerSocketChannel.class)
- .option(ChannelOption.SO_REUSEADDR, true)
- .childOption(ChannelOption.SO_KEEPALIVE, true)
- .childOption(ChannelOption.TCP_NODELAY, true);
- } catch (Exception e) {
- throw new Exception(e);
- }
+ return new ServerBootstrap()
+ .group(bossGroup, workerGroup)
+ .channel(NioServerSocketChannel.class)
+ .option(ChannelOption.SO_REUSEADDR, true)
+ .childOption(ChannelOption.SO_KEEPALIVE, true)
+ .childOption(ChannelOption.TCP_NODELAY, true);
}
/**
diff --git a/apps/cpman/app/src/main/java/org/onosproject/cpman/impl/ControlMessageMetricMapper.java b/apps/cpman/app/src/main/java/org/onosproject/cpman/impl/ControlMessageMetricMapper.java
index bd541b4..92126bf 100644
--- a/apps/cpman/app/src/main/java/org/onosproject/cpman/impl/ControlMessageMetricMapper.java
+++ b/apps/cpman/app/src/main/java/org/onosproject/cpman/impl/ControlMessageMetricMapper.java
@@ -58,7 +58,7 @@
*/
private static <I, O> O lookup(BiMap<I, O> map, I input, Class<O> cls) {
if (!map.containsKey(input)) {
- throw new RuntimeException(
+ throw new IllegalArgumentException(
String.format("No mapping found for %s when converting to %s",
input, cls.getName()));
}
diff --git a/apps/evpnopenflow/pom.xml b/apps/evpnopenflow/pom.xml
index 5ced56a..184f15a 100644
--- a/apps/evpnopenflow/pom.xml
+++ b/apps/evpnopenflow/pom.xml
@@ -69,7 +69,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
diff --git a/apps/gangliametrics/pom.xml b/apps/gangliametrics/pom.xml
index 8699744..e3fa85c 100644
--- a/apps/gangliametrics/pom.xml
+++ b/apps/gangliametrics/pom.xml
@@ -71,12 +71,10 @@
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
- <version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-json</artifactId>
- <version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
diff --git a/apps/gluon/pom.xml b/apps/gluon/pom.xml
index 04f3796..48f3775 100644
--- a/apps/gluon/pom.xml
+++ b/apps/gluon/pom.xml
@@ -51,7 +51,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -64,7 +63,6 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.12</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/apps/gluon/src/main/java/org/onosproject/gluon/manager/GluonManager.java b/apps/gluon/src/main/java/org/onosproject/gluon/manager/GluonManager.java
index 11f3738..c0a4b67 100644
--- a/apps/gluon/src/main/java/org/onosproject/gluon/manager/GluonManager.java
+++ b/apps/gluon/src/main/java/org/onosproject/gluon/manager/GluonManager.java
@@ -57,7 +57,7 @@
}
};
- public static Map<String, GluonServer> serverMap = new LinkedHashMap<>();
+ private static Map<String, GluonServer> serverMap = new LinkedHashMap<>();
@Activate
public void activate() {
diff --git a/apps/graphitemetrics/pom.xml b/apps/graphitemetrics/pom.xml
index d6cff65..bef6ecb 100644
--- a/apps/graphitemetrics/pom.xml
+++ b/apps/graphitemetrics/pom.xml
@@ -59,7 +59,6 @@
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
- <version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
diff --git a/apps/influxdbmetrics/pom.xml b/apps/influxdbmetrics/pom.xml
index 300226b..a00b011 100644
--- a/apps/influxdbmetrics/pom.xml
+++ b/apps/influxdbmetrics/pom.xml
@@ -62,7 +62,6 @@
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
- <version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.izettle</groupId>
diff --git a/apps/l3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3VpnManager.java b/apps/l3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3VpnManager.java
index 0cb86ab..45e9f9b 100644
--- a/apps/l3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3VpnManager.java
+++ b/apps/l3vpn/src/main/java/org/onosproject/l3vpn/netl3vpn/impl/NetL3VpnManager.java
@@ -240,7 +240,7 @@
value = l3VpnIdGen.getNewId();
}
if (value > ID_LIMIT) {
- throw new RuntimeException(ID_LIMIT_EXCEEDED);
+ throw new IllegalStateException(ID_LIMIT_EXCEEDED);
}
return CONS_HUNDRED + String.valueOf(value);
}
diff --git a/apps/learning-switch/pom.xml b/apps/learning-switch/pom.xml
index 9c31fff..8301ab0 100644
--- a/apps/learning-switch/pom.xml
+++ b/apps/learning-switch/pom.xml
@@ -54,7 +54,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
<scope>test</scope>
</dependency>
@@ -69,14 +68,12 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.21</version>
</dependency>
</dependencies>
</project>
diff --git a/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfActiveComponent.java b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfActiveComponent.java
index 2c35f26..92043d5 100644
--- a/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfActiveComponent.java
+++ b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfActiveComponent.java
@@ -212,7 +212,7 @@
if (node.type() == DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE) {
temp = ((LeafNode) node).asString().split("\\:");
if (temp.length != 3) {
- throw new RuntimeException(new NetconfException("Invalid device id form, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id form, cannot apply"));
}
ip = temp[1];
port = temp[2];
@@ -220,12 +220,12 @@
ListKey key = (ListKey) node.key();
temp = key.keyLeafs().get(0).leafValAsString().split("\\:");
if (temp.length != 3) {
- throw new RuntimeException(new NetconfException("Invalid device id form, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id form, cannot apply"));
}
ip = temp[1];
port = temp[2];
} else {
- throw new RuntimeException(new NetconfException("Invalid device id type, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id type, cannot apply"));
}
try {
return DeviceId.deviceId(new URI("netconf", ip + ":" + port, (String) null));
@@ -246,7 +246,7 @@
this.controller.connectDevice(deviceId);
//}
} catch (Exception ex) {
- throw new RuntimeException(new NetconfException("Unable to connect to NETCONF device on " +
+ throw new IllegalStateException(new NetconfException("Unable to connect to NETCONF device on " +
deviceId, ex));
}
}
@@ -263,21 +263,21 @@
String resId = ResourceIdParser.parseResId(path);
String[] el = resId.split(ResourceIdParser.EL_CHK);
if (el.length < 3) {
- throw new RuntimeException(new NetconfException("Invalid resource id, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid resource id, cannot apply"));
}
if (!el[2].contains((ResourceIdParser.KEY_SEP))) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
String[] keys = el[2].split(ResourceIdParser.KEY_CHK);
if (keys.length < 2) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
String[] parts = keys[1].split(ResourceIdParser.NM_CHK);
if (parts.length < 3) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
if (parts[2].split("\\:").length != 3) {
- throw new RuntimeException(new NetconfException("Invalid device id form, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id form, cannot apply"));
}
return (new ResourceId.Builder()
.addBranchPointSchema(el[1].split(ResourceIdParser.NM_CHK)[0],
@@ -299,23 +299,23 @@
String resId = ResourceIdParser.parseResId(path);
String[] el = resId.split(ResourceIdParser.EL_CHK);
if (el.length < 3) {
- throw new RuntimeException(new NetconfException("Invalid resource id, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid resource id, cannot apply"));
}
if (!el[2].contains((ResourceIdParser.KEY_SEP))) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
String[] keys = el[2].split(ResourceIdParser.KEY_CHK);
if (keys.length < 2) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
String[] parts = keys[1].split(ResourceIdParser.NM_CHK);
if (parts.length < 3) {
- throw new RuntimeException(new NetconfException("Invalid device id key, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id key, cannot apply"));
}
String[] temp = parts[2].split("\\:");
String ip, port;
if (temp.length != 3) {
- throw new RuntimeException(new NetconfException("Invalid device id form, cannot apply"));
+ throw new IllegalStateException(new NetconfException("Invalid device id form, cannot apply"));
}
ip = temp[1];
port = temp[2];
diff --git a/apps/ofagent/pom.xml b/apps/ofagent/pom.xml
index 0244b21..5351b4c 100644
--- a/apps/ofagent/pom.xml
+++ b/apps/ofagent/pom.xml
@@ -110,7 +110,6 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-testlib</artifactId>
- <version>${guava.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/apps/openstacknetworking/pom.xml b/apps/openstacknetworking/pom.xml
index d2eea07..d3f08d6 100644
--- a/apps/openstacknetworking/pom.xml
+++ b/apps/openstacknetworking/pom.xml
@@ -173,7 +173,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
- <version>1.21.0</version>
<executions>
<execution>
<id>generate-scr-srcdescriptor</id>
diff --git a/apps/openstacknetworkingui/pom.xml b/apps/openstacknetworkingui/pom.xml
index 6acb0ba..fb3167e 100644
--- a/apps/openstacknetworkingui/pom.xml
+++ b/apps/openstacknetworkingui/pom.xml
@@ -78,7 +78,6 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.12</version>
<scope>provided</scope>
</dependency>
@@ -111,7 +110,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.4</version>
</dependency>
</dependencies>
diff --git a/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java b/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
index a1e65aa..5d37bd1 100644
--- a/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
+++ b/apps/p4-tutorial/pipeconf/src/main/java/org/onosproject/p4tutorial/pipeconf/PipeconfFactory.java
@@ -67,7 +67,7 @@
try {
pipelineModel = P4InfoParser.parse(P4INFO_URL);
} catch (P4InfoParserException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
return DefaultPiPipeconf.builder()
diff --git a/apps/rabbitmq/src/main/java/org/onosproject/rabbitmq/impl/MQServiceImpl.java b/apps/rabbitmq/src/main/java/org/onosproject/rabbitmq/impl/MQServiceImpl.java
index 11b46fb..2ecc5d2 100644
--- a/apps/rabbitmq/src/main/java/org/onosproject/rabbitmq/impl/MQServiceImpl.java
+++ b/apps/rabbitmq/src/main/java/org/onosproject/rabbitmq/impl/MQServiceImpl.java
@@ -91,7 +91,7 @@
prop.getProperty(SENDER_QUEUE)),
msgOutQueue);
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
manageSender.start();
}
diff --git a/apps/route-service/app/pom.xml b/apps/route-service/app/pom.xml
index 3334c6e..fd71d35 100644
--- a/apps/route-service/app/pom.xml
+++ b/apps/route-service/app/pom.xml
@@ -73,12 +73,10 @@
<dependency>
<groupId>com.googlecode.concurrent-trees</groupId>
<artifactId>concurrent-trees</artifactId>
- <version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
diff --git a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
index 1535100..2962c0b 100644
--- a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
+++ b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeDst.java
@@ -102,7 +102,7 @@
RouteAttribute.ROUTE_ATTRIBUTE_HEADER_LENGTH) {
cb.writeBytes(buffer, Ip4Address.BYTE_LENGTH);
} else {
- throw new RuntimeException("Dst address length incorrect!");
+ throw new IllegalArgumentException("Dst address length incorrect!");
}
}
}
diff --git a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
index 886f52e..3b1f5cd 100644
--- a/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
+++ b/apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RouteAttributeGateway.java
@@ -104,7 +104,7 @@
RouteAttribute.ROUTE_ATTRIBUTE_HEADER_LENGTH) {
cb.writeBytes(buffer, Ip4Address.BYTE_LENGTH);
} else {
- throw new RuntimeException("Gateway address length incorrect!");
+ throw new IllegalArgumentException("Gateway address length incorrect!");
}
}
}
diff --git a/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java b/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java
index b810d73..f497721 100644
--- a/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java
+++ b/apps/simplefabric/src/main/java/org/onosproject/simplefabric/SimpleFabricCommandCompleter.java
@@ -28,7 +28,7 @@
*/
public class SimpleFabricCommandCompleter extends AbstractChoicesCompleter {
- public static final List<String> COMMAND_LIST =
+ private static final List<String> COMMAND_LIST =
Arrays.asList("show", "intents", "reactive-intents", "refresh", "flush");
@Override
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/DistributedPrimitivesTest.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/DistributedPrimitivesTest.java
index a83c7db..3296046 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/DistributedPrimitivesTest.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/DistributedPrimitivesTest.java
@@ -27,6 +27,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.DistributedLock;
import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.store.service.LeaderElector;
import org.onosproject.store.service.StorageService;
@@ -35,7 +36,6 @@
import static org.slf4j.LoggerFactory.getLogger;
-
/**
* Simple application to test distributed primitives.
*/
@@ -56,6 +56,7 @@
private final Map<String, EventuallyConsistentMap<String, String>> maps = Maps.newConcurrentMap();
private final Map<String, LeaderElector> electors = Maps.newConcurrentMap();
+ private final Map<String, DistributedLock> locks = Maps.newConcurrentMap();
@Activate
protected void activate() {
@@ -90,8 +91,21 @@
*/
public LeaderElector getLeaderElector(String name) {
return electors.computeIfAbsent(name, n -> storageService.leaderElectorBuilder()
- .withName(name)
- .build()
- .asLeaderElector());
+ .withName(name)
+ .build()
+ .asLeaderElector());
+ }
+
+ /**
+ * Returns a lock instance by name.
+ *
+ * @param name the lock name
+ * @return the lock
+ */
+ public DistributedLock getLock(String name) {
+ return locks.computeIfAbsent(name, n -> storageService.lockBuilder()
+ .withName(name)
+ .build()
+ .asLock());
}
}
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/DistributedLockTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/DistributedLockTestCommand.java
new file mode 100644
index 0000000..9e23cb2
--- /dev/null
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/DistributedLockTestCommand.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.distributedprimitives.cli;
+
+import java.time.Duration;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.distributedprimitives.DistributedPrimitivesTest;
+import org.onosproject.store.service.DistributedLock;
+
+@Command(scope = "onos", name = "lock-test",
+ description = "DistributedLock test cli fixture")
+public class DistributedLockTestCommand extends AbstractShellCommand {
+ @Argument(index = 0, name = "name",
+ description = "lock name",
+ required = true,
+ multiValued = false)
+ String name = null;
+
+ @Argument(index = 1, name = "operation",
+ description = "operation",
+ required = true,
+ multiValued = false)
+ String operation = null;
+
+ @Argument(index = 2, name = "durationMillis",
+ description = "lock attempt duration in milliseconds",
+ required = false,
+ multiValued = false)
+ Long durationMillis = null;
+
+ DistributedLock lock;
+
+ @Override
+ protected void execute() {
+ DistributedPrimitivesTest test = get(DistributedPrimitivesTest.class);
+ lock = test.getLock(name);
+ if ("lock".equals(operation)) {
+ lock.lock();
+ } else if ("tryLock".equals(operation)) {
+ if (durationMillis == null) {
+ print("%b", lock.tryLock().isPresent());
+ } else {
+ print("%b", lock.tryLock(Duration.ofMillis(durationMillis)).isPresent());
+ }
+ } else if ("unlock".equals(operation)) {
+ lock.unlock();
+ }
+ }
+}
diff --git a/apps/test/distributed-primitives/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/test/distributed-primitives/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index ce02720..30401a0 100644
--- a/apps/test/distributed-primitives/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/apps/test/distributed-primitives/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -52,6 +52,9 @@
<command>
<action class="org.onosproject.distributedprimitives.cli.LeaderElectorTestCommand"/>
</command>
+ <command>
+ <action class="org.onosproject.distributedprimitives.cli.DistributedLockTestCommand"/>
+ </command>
</command-bundle>
</blueprint>
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
index e958765..c510647 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
@@ -193,10 +193,8 @@
*
* @param floatingIpNodes the floatingIp json node
* @return floatingIps a collection of floatingIp
- * @throws Exception when any argument is illegal
*/
- public Collection<FloatingIp> changeJsonToSub(JsonNode floatingIpNodes)
- throws Exception {
+ public Collection<FloatingIp> changeJsonToSub(JsonNode floatingIpNodes) {
checkNotNull(floatingIpNodes, JSON_NOT_NULL);
Map<FloatingIpId, FloatingIp> subMap = new HashMap<FloatingIpId, FloatingIp>();
if (!floatingIpNodes.hasNonNull("id")) {
diff --git a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
index c09b5cd..0d32a8d 100644
--- a/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
+++ b/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
@@ -131,7 +131,7 @@
}
return Response.status(CREATED).entity(result.toString()).build();
- } catch (Exception e) {
+ } catch (IllegalArgumentException | IOException e) {
return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
}
}
@@ -271,8 +271,7 @@
}
}
- private Collection<Router> createOrUpdateByInputStream(JsonNode subnode)
- throws Exception {
+ private Collection<Router> createOrUpdateByInputStream(JsonNode subnode) {
checkNotNull(subnode, JSON_NOT_NULL);
JsonNode routerNode = subnode.get("routers");
if (routerNode == null) {
@@ -281,7 +280,7 @@
log.debug("routerNode is {}", routerNode.toString());
if (routerNode.isArray()) {
- throw new Exception("only singleton requests allowed");
+ throw new IllegalArgumentException("only singleton requests allowed");
} else {
return changeJsonToSub(routerNode);
}
@@ -292,10 +291,8 @@
*
* @param routerNode the router json node
* @return routers a collection of router
- * @throws Exception when any argument is illegal
*/
- public Collection<Router> changeJsonToSub(JsonNode routerNode)
- throws Exception {
+ public Collection<Router> changeJsonToSub(JsonNode routerNode) {
checkNotNull(routerNode, JSON_NOT_NULL);
Map<RouterId, Router> subMap = new HashMap<RouterId, Router>();
if (!routerNode.hasNonNull("id")) {
@@ -361,11 +358,9 @@
* @param subnode the router json node
* @param routerId the router identify
* @return routers a collection of router
- * @throws Exception when any argument is illegal
*/
public Collection<Router> changeUpdateJsonToSub(JsonNode subnode,
- String routerId)
- throws Exception {
+ String routerId) {
checkNotNull(subnode, JSON_NOT_NULL);
checkNotNull(routerId, "routerId should not be null");
Map<RouterId, Router> subMap = new HashMap<RouterId, Router>();
diff --git a/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java b/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
index f83c5fa..09e08fa 100644
--- a/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
@@ -28,6 +28,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.net.DefaultAnnotations;
import java.util.Set;
import java.util.TreeSet;
@@ -90,6 +91,9 @@
* @return string image with ", k1=v1, k2=v2, ..." pairs
*/
public static String annotations(Annotations annotations) {
+ if (annotations == null) {
+ annotations = DefaultAnnotations.EMPTY;
+ }
StringBuilder sb = new StringBuilder();
Set<String> keys = new TreeSet<>(annotations.keys());
for (String key : keys) {
diff --git a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index 550899b..31e489e 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -208,7 +208,7 @@
/**
* 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 {@value DEFAULT_VALUE}.
+ * If parsing fails, the returned value will be {@value #DEFAULT_VALUE}.
*
* @param annotated annotated object whose annotated value is obtained
* @param key key of annotation
diff --git a/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java b/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java
index b027300..122d159 100644
--- a/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java
+++ b/core/api/src/main/java/org/onosproject/net/group/DefaultGroupKey.java
@@ -24,7 +24,7 @@
*/
public class DefaultGroupKey implements GroupKey {
private final byte[] key;
- protected static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
+ private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public DefaultGroupKey(byte[] key) {
this.key = checkNotNull(key);
diff --git a/core/api/src/main/java/org/onosproject/net/pi/model/DefaultPiPipeconf.java b/core/api/src/main/java/org/onosproject/net/pi/model/DefaultPiPipeconf.java
index b6cea63..7d9dd28 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/model/DefaultPiPipeconf.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/model/DefaultPiPipeconf.java
@@ -80,7 +80,7 @@
try {
return Optional.of(extensions.get(type).openStream());
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
} else {
return Optional.empty();
diff --git a/core/api/src/main/java/org/onosproject/store/primitives/DefaultDistributedLock.java b/core/api/src/main/java/org/onosproject/store/primitives/DefaultDistributedLock.java
new file mode 100644
index 0000000..8e48771
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/primitives/DefaultDistributedLock.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives;
+
+import java.time.Duration;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.onosproject.store.service.AsyncDistributedLock;
+import org.onosproject.store.service.DistributedLock;
+import org.onosproject.store.service.StorageException;
+import org.onosproject.store.service.Synchronous;
+import org.onosproject.store.service.Version;
+
+/**
+ * Default implementation for a {@code DistributedLock} backed by a {@link AsyncDistributedLock}.
+ */
+public class DefaultDistributedLock extends Synchronous<AsyncDistributedLock> implements DistributedLock {
+
+ private final AsyncDistributedLock asyncLock;
+ private final long operationTimeoutMillis;
+
+ public DefaultDistributedLock(AsyncDistributedLock asyncLock, long operationTimeoutMillis) {
+ super(asyncLock);
+ this.asyncLock = asyncLock;
+ this.operationTimeoutMillis = operationTimeoutMillis;
+ }
+
+ @Override
+ public Version lock() {
+ return complete(asyncLock.lock());
+ }
+
+ @Override
+ public Optional<Version> tryLock() {
+ return complete(asyncLock.tryLock());
+ }
+
+ @Override
+ public Optional<Version> tryLock(Duration timeout) {
+ return complete(asyncLock.tryLock(timeout));
+ }
+
+ @Override
+ public void unlock() {
+ complete(asyncLock.unlock());
+ }
+
+ private <T> T complete(CompletableFuture<T> future) {
+ if (operationTimeoutMillis == -1) {
+ return future.join();
+ }
+ try {
+ return future.get(operationTimeoutMillis, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new StorageException.Interrupted();
+ } catch (TimeoutException e) {
+ throw new StorageException.Timeout();
+ } catch (ExecutionException e) {
+ throw new StorageException(e.getCause());
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/primitives/DistributedPrimitiveCreator.java b/core/api/src/main/java/org/onosproject/store/primitives/DistributedPrimitiveCreator.java
index 5fad35a..1e68bdb 100644
--- a/core/api/src/main/java/org/onosproject/store/primitives/DistributedPrimitiveCreator.java
+++ b/core/api/src/main/java/org/onosproject/store/primitives/DistributedPrimitiveCreator.java
@@ -25,6 +25,7 @@
import org.onosproject.store.service.AsyncConsistentMap;
import org.onosproject.store.service.AsyncConsistentMultimap;
import org.onosproject.store.service.AsyncConsistentTreeMap;
+import org.onosproject.store.service.AsyncDistributedLock;
import org.onosproject.store.service.AsyncDistributedSet;
import org.onosproject.store.service.AsyncDocumentTree;
import org.onosproject.store.service.AsyncLeaderElector;
@@ -118,6 +119,14 @@
<E> AsyncDistributedSet<E> newAsyncDistributedSet(String name, Serializer serializer);
/**
+ * Creates a new {@code AsyncDistributedLock}.
+ *
+ * @param name lock name
+ * @return lock
+ */
+ AsyncDistributedLock newAsyncDistributedLock(String name);
+
+ /**
* Creates a new {@code AsyncLeaderElector}.
*
* @param name leader elector name
diff --git a/core/api/src/main/java/org/onosproject/store/service/AsyncDistributedLock.java b/core/api/src/main/java/org/onosproject/store/service/AsyncDistributedLock.java
new file mode 100644
index 0000000..be35b5e
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/AsyncDistributedLock.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.time.Duration;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+import org.onosproject.store.primitives.DefaultDistributedLock;
+
+/**
+ * Asynchronous lock primitive.
+ */
+public interface AsyncDistributedLock extends DistributedPrimitive {
+ @Override
+ default Type primitiveType() {
+ return Type.LOCK;
+ }
+
+ /**
+ * Acquires the lock, blocking until it's available.
+ *
+ * @return future to be completed once the lock has been acquired
+ */
+ CompletableFuture<Version> lock();
+
+ /**
+ * Attempts to acquire the lock.
+ *
+ * @return future to be completed with a boolean indicating whether the lock was acquired
+ */
+ CompletableFuture<Optional<Version>> tryLock();
+
+ /**
+ * Attempts to acquire the lock for a specified amount of time.
+ *
+ * @param timeout the timeout after which to give up attempting to acquire the lock
+ * @return future to be completed with a boolean indicating whether the lock was acquired
+ */
+ CompletableFuture<Optional<Version>> tryLock(Duration timeout);
+
+ /**
+ * Unlocks the lock.
+ *
+ * @return future to be completed once the lock has been released
+ */
+ CompletableFuture<Void> unlock();
+
+ default DistributedLock asLock() {
+ return asLock(-1);
+ }
+
+ default DistributedLock asLock(long timeoutMillis) {
+ return new DefaultDistributedLock(this, timeoutMillis);
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedLock.java b/core/api/src/main/java/org/onosproject/store/service/DistributedLock.java
new file mode 100644
index 0000000..cce53ff
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedLock.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.time.Duration;
+import java.util.Optional;
+
+/**
+ * Asynchronous lock primitive.
+ */
+public interface DistributedLock extends DistributedPrimitive {
+ @Override
+ default Type primitiveType() {
+ return Type.LOCK;
+ }
+
+ /**
+ * Acquires the lock, blocking until it's available.
+ *
+ * @return the acquired lock version
+ */
+ Version lock();
+
+ /**
+ * Attempts to acquire the lock.
+ *
+ * @return indicates whether the lock was acquired
+ */
+ Optional<Version> tryLock();
+
+ /**
+ * Attempts to acquire the lock for a specified amount of time.
+ *
+ * @param timeout the timeout after which to give up attempting to acquire the lock
+ * @return indicates whether the lock was acquired
+ */
+ Optional<Version> tryLock(Duration timeout);
+
+ /**
+ * Unlocks the lock.
+ */
+ void unlock();
+}
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java b/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java
new file mode 100644
index 0000000..7e61c6a
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedLockBuilder.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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 org.onosproject.store.primitives.DistributedPrimitiveBuilder;
+
+/**
+ * Builder for DistributedLock.
+ */
+public abstract class DistributedLockBuilder
+ extends DistributedPrimitiveBuilder<DistributedLockBuilder, AsyncDistributedLock> {
+ public DistributedLockBuilder() {
+ super(DistributedPrimitive.Type.LOCK);
+ }
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/store/service/DistributedPrimitive.java b/core/api/src/main/java/org/onosproject/store/service/DistributedPrimitive.java
index 8a440f3..620e16d 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DistributedPrimitive.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DistributedPrimitive.java
@@ -99,7 +99,12 @@
/**
* Transaction Context.
*/
- TRANSACTION_CONTEXT
+ TRANSACTION_CONTEXT,
+
+ /**
+ * Distributed lock.
+ */
+ LOCK,
}
/**
diff --git a/core/api/src/main/java/org/onosproject/store/service/StorageService.java b/core/api/src/main/java/org/onosproject/store/service/StorageService.java
index 94843fc..2dd42fa 100644
--- a/core/api/src/main/java/org/onosproject/store/service/StorageService.java
+++ b/core/api/src/main/java/org/onosproject/store/service/StorageService.java
@@ -24,4 +24,201 @@
* this service for their distributed state management and coordination.
*/
public interface StorageService extends PrimitiveService {
+
+ /**
+ * Creates a new EventuallyConsistentMapBuilder.
+ *
+ * @param <K> key type
+ * @param <V> value type
+ * @return builder for an eventually consistent map
+ */
+ <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder();
+
+ /**
+ * Creates a new ConsistentMapBuilder.
+ *
+ * @param <K> key type
+ * @param <V> value type
+ * @return builder for a consistent map
+ */
+ <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder();
+
+ /**
+ * Creates a new ConsistentMapBuilder.
+ *
+ * @param <V> value type
+ * @return builder for a consistent map
+ */
+ <V> DocumentTreeBuilder<V> documentTreeBuilder();
+
+ /**
+ * Creates a new {@code AsyncConsistentTreeMapBuilder}.
+ *
+ * @param <V> value type
+ * @return builder for a async consistent tree map
+ */
+ <V> ConsistentTreeMapBuilder<V> consistentTreeMapBuilder();
+
+ /**
+ * Creates a new {@code AsyncConsistentSetMultimapBuilder}.
+ *
+ * @param <K> key type
+ * @param <V> value type
+ * @return builder for a set based async consistent multimap
+ */
+ <K, V> ConsistentMultimapBuilder<K, V> consistentMultimapBuilder();
+
+ /**
+ * Creates a new {@code AtomicCounterMapBuilder}.
+ *
+ * @param <K> key type
+ * @return builder for an atomic counter map
+ */
+ <K> AtomicCounterMapBuilder<K> atomicCounterMapBuilder();
+
+ /**
+ * Creates a new DistributedSetBuilder.
+ *
+ * @param <E> set element type
+ * @return builder for an distributed set
+ */
+ <E> DistributedSetBuilder<E> setBuilder();
+
+ /**
+ * Creates a new AtomicCounterBuilder.
+ *
+ * @return atomic counter builder
+ */
+ AtomicCounterBuilder atomicCounterBuilder();
+
+ /**
+ * Creates a new AtomicIdGeneratorBuilder.
+ *
+ * @return atomic ID generator builder
+ */
+ AtomicIdGeneratorBuilder atomicIdGeneratorBuilder();
+
+ /**
+ * Creates a new AtomicValueBuilder.
+ *
+ * @param <V> atomic value type
+ * @return atomic value builder
+ */
+ <V> AtomicValueBuilder<V> atomicValueBuilder();
+
+ /**
+ * Creates a new DistributedLockBuilder.
+ *
+ * @return lock builder
+ */
+ DistributedLockBuilder lockBuilder();
+
+ /**
+ * Creates a new LeaderElectorBuilder.
+ *
+ * @return leader elector builder
+ */
+ LeaderElectorBuilder leaderElectorBuilder();
+
+ /**
+ * Creates a new transaction context builder.
+ *
+ * @return a builder for a transaction context.
+ */
+ TransactionContextBuilder transactionContextBuilder();
+
+ /**
+ * Returns an instance of {@code AsyncAtomicCounter} with specified name.
+ * @param name counter name
+ *
+ * @return AsyncAtomicCounter instance
+ */
+ default AsyncAtomicCounter getAsyncAtomicCounter(String name) {
+ return atomicCounterBuilder().withName(name).build();
+ }
+
+ /**
+ * Returns an instance of {@code AsyncAtomicIdGenerator} with specified name.
+ *
+ * @param name ID generator name
+ * @return AsyncAtomicIdGenerator instance
+ */
+ default AsyncAtomicIdGenerator getAsyncAtomicIdGenerator(String name) {
+ return atomicIdGeneratorBuilder().withName(name).build();
+ }
+
+ /**
+ * Returns an instance of {@code AtomicCounter} with specified name.
+ * @param name counter name
+ *
+ * @return AtomicCounter instance
+ */
+ default AtomicCounter getAtomicCounter(String name) {
+ return getAsyncAtomicCounter(name).asAtomicCounter();
+ }
+
+ /**
+ * Returns an instance of {@code AtomicIdGenerator} with specified name.
+ *
+ * @param name ID generator name
+ * @return AtomicIdGenerator instance
+ */
+ default AtomicIdGenerator getAtomicIdGenerator(String name) {
+ return getAsyncAtomicIdGenerator(name).asAtomicIdGenerator();
+ }
+
+ /**
+ * Returns an instance of {@code WorkQueue} with specified name.
+ *
+ * @param <E> work element type
+ * @param name work queue name
+ * @param serializer serializer
+ * @return WorkQueue instance
+ */
+ <E> WorkQueue<E> getWorkQueue(String name, Serializer serializer);
+
+ /**
+ * Returns an instance of {@code AsyncDocumentTree} with specified name.
+ *
+ * @param <V> tree node value type
+ * @param name document tree name
+ * @param serializer serializer
+ * @return AsyncDocumentTree instance
+ */
+ <V> AsyncDocumentTree<V> getDocumentTree(String name, Serializer serializer);
+
+ /** Returns a set backed instance of {@code AsyncConsistentMultimap} with
+ * the specified name.
+ *
+ * @param name the multimap name
+ * @param serializer serializer
+ * @param <K> key type
+ * @param <V> value type
+ * @return set backed {@code AsyncConsistentMultimap} instance
+ */
+ <K, V> AsyncConsistentMultimap<K, V> getAsyncSetMultimap(String name,
+ Serializer serializer);
+
+ /**
+ * Returns an instance of {@code AsyncConsistentTreeMap} with the specified
+ * name.
+ *
+ * @param name the treemap name
+ * @param serializer serializer
+ * @param <V> value type
+ * @return set backed {@code AsyncConsistentTreeMap} instance
+ */
+ <V> AsyncConsistentTreeMap<V> getAsyncTreeMap(String name,
+ Serializer serializer);
+
+ /**
+ * Returns an instance of {@code Topic} with specified name.
+ *
+ * @param <T> topic message type
+ * @param name topic name
+ * @param serializer serializer
+ *
+ * @return Topic instance
+ */
+ <T> Topic<T> getTopic(String name, Serializer serializer);
}
diff --git a/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java b/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java
index 14850ce..4d528e2 100644
--- a/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/store/service/StorageServiceAdapter.java
@@ -60,6 +60,11 @@
}
@Override
+ public DistributedLockBuilder lockBuilder() {
+ return null;
+ }
+
+ @Override
public LeaderElectorBuilder leaderElectorBuilder() {
return null;
}
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java b/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
index 4bbb123..36e9068 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/AbstractCriterionTranslator.java
@@ -112,7 +112,7 @@
}
break;
default:
- throw new RuntimeException("Unrecognized init type " + initType.name());
+ throw new IllegalArgumentException("Unrecognized init type " + initType.name());
}
return value;
}
@@ -129,7 +129,7 @@
mask = getMaskFromPrefixLength(prefixLength, value.size());
break;
default:
- throw new RuntimeException("Unrecognized init type " + initType.name());
+ throw new IllegalArgumentException("Unrecognized init type " + initType.name());
}
return Pair.of(value, mask);
@@ -150,7 +150,7 @@
case LPM:
break;
default:
- throw new RuntimeException("Unrecognized init type " + initType.name());
+ throw new IllegalArgumentException("Unrecognized init type " + initType.name());
}
return Pair.of(value, prefixLength);
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
index 430e5e1..3230f41 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
@@ -428,7 +428,7 @@
return fieldMatch;
default:
// Should never be here.
- throw new RuntimeException(
+ throw new IllegalArgumentException(
"Unrecognized match type " + fieldModel.matchType().name());
}
} catch (ByteSequenceTrimException e) {
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiUtils.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiUtils.java
index 78bca5f..6f8d33a 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiUtils.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiUtils.java
@@ -54,7 +54,8 @@
.orElse(null)
.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
- throw new RuntimeException(format("Unable to instantiate interpreter of pipeconf %s", pipeconf.id()));
+ throw new IllegalArgumentException(format("Unable to instantiate interpreter of pipeconf %s",
+ pipeconf.id()));
}
}
}
diff --git a/core/store/dist/pom.xml b/core/store/dist/pom.xml
index ff5831c..eee6724 100644
--- a/core/store/dist/pom.xml
+++ b/core/store/dist/pom.xml
@@ -35,7 +35,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
- <version>3.6.1</version>
</dependency>
<dependency>
@@ -100,17 +99,14 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
- <version>${netty4.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
- <version>${netty4.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
- <version>${netty4.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
@@ -120,7 +116,6 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
- <version>${netty4.version}</version>
</dependency>
</dependencies>
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
index a5c5f3b..d7e478b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
@@ -158,7 +158,7 @@
protected ClusterMetadataService clusterMetadataService;
@Activate
- public void activate() throws Exception {
+ public void activate() throws InterruptedException {
ControllerNode localNode = clusterMetadataService.getLocalNode();
getTlsParameters();
@@ -179,7 +179,7 @@
}
@Deactivate
- public void deactivate() throws Exception {
+ public void deactivate() {
if (started.get()) {
serverGroup.shutdownGracefully();
clientGroup.shutdownGracefully();
diff --git a/core/store/primitives/pom.xml b/core/store/primitives/pom.xml
index 5f4d799..5e2b75f 100644
--- a/core/store/primitives/pom.xml
+++ b/core/store/primitives/pom.xml
@@ -64,7 +64,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>${commons.io.version}</version>
</dependency>
<dependency>
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultDistributedLockBuilder.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultDistributedLockBuilder.java
new file mode 100644
index 0000000..fffebcc
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultDistributedLockBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.impl;
+
+import org.onosproject.store.primitives.DistributedPrimitiveCreator;
+import org.onosproject.store.service.AsyncDistributedLock;
+import org.onosproject.store.service.DistributedLockBuilder;
+
+/**
+ * Default implementation of DistributedLockBuilder.
+ */
+public class DefaultDistributedLockBuilder extends DistributedLockBuilder {
+
+ private final DistributedPrimitiveCreator primitiveCreator;
+
+ public DefaultDistributedLockBuilder(DistributedPrimitiveCreator primitiveCreator) {
+ this.primitiveCreator = primitiveCreator;
+ }
+
+ @Override
+ public AsyncDistributedLock build() {
+ return primitiveCreator.newAsyncDistributedLock(name());
+ }
+}
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/FederatedDistributedPrimitiveCreator.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/FederatedDistributedPrimitiveCreator.java
index 04b94ff..0e53f77 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/FederatedDistributedPrimitiveCreator.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/FederatedDistributedPrimitiveCreator.java
@@ -40,6 +40,7 @@
import org.onosproject.store.service.AsyncConsistentMap;
import org.onosproject.store.service.AsyncConsistentMultimap;
import org.onosproject.store.service.AsyncConsistentTreeMap;
+import org.onosproject.store.service.AsyncDistributedLock;
import org.onosproject.store.service.AsyncDistributedSet;
import org.onosproject.store.service.AsyncDocumentTree;
import org.onosproject.store.service.AsyncLeaderElector;
@@ -130,6 +131,11 @@
}
@Override
+ public AsyncDistributedLock newAsyncDistributedLock(String name) {
+ return getCreator(name).newAsyncDistributedLock(name);
+ }
+
+ @Override
public AsyncLeaderElector newAsyncLeaderElector(String name, long leaderTimeout, TimeUnit timeUnit) {
checkNotNull(name);
Map<PartitionId, AsyncLeaderElector> leaderElectors =
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
index 2474d74..de3229f 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageManager.java
@@ -47,6 +47,7 @@
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.ConsistentMultimapBuilder;
import org.onosproject.store.service.ConsistentTreeMapBuilder;
+import org.onosproject.store.service.DistributedLockBuilder;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.DocumentTreeBuilder;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
@@ -236,6 +237,12 @@
}
@Override
+ public DistributedLockBuilder lockBuilder() {
+ checkPermission(STORAGE_WRITE);
+ return new DefaultDistributedLockBuilder(federatedPrimitiveCreator);
+ }
+
+ @Override
public LeaderElectorBuilder leaderElectorBuilder() {
checkPermission(STORAGE_WRITE);
return new DefaultLeaderElectorBuilder(federatedPrimitiveCreator);
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
index 5d33e1c..9458ec5 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartition.java
@@ -40,6 +40,7 @@
import org.onosproject.store.primitives.resources.impl.AtomixConsistentSetMultimapService;
import org.onosproject.store.primitives.resources.impl.AtomixConsistentTreeMapService;
import org.onosproject.store.primitives.resources.impl.AtomixCounterService;
+import org.onosproject.store.primitives.resources.impl.AtomixDistributedLockService;
import org.onosproject.store.primitives.resources.impl.AtomixDocumentTreeService;
import org.onosproject.store.primitives.resources.impl.AtomixLeaderElectorService;
import org.onosproject.store.primitives.resources.impl.AtomixWorkQueueService;
@@ -78,6 +79,7 @@
() -> new AtomixDocumentTreeService(Ordering.NATURAL))
.put(String.format("%s-%s", DistributedPrimitive.Type.DOCUMENT_TREE.name(), Ordering.INSERTION),
() -> new AtomixDocumentTreeService(Ordering.INSERTION))
+ .put(DistributedPrimitive.Type.LOCK.name(), AtomixDistributedLockService::new)
.build();
public StoragePartition(
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
index 723dc51..c5d281a 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionClient.java
@@ -35,6 +35,7 @@
import org.onosproject.store.primitives.resources.impl.AtomixConsistentSetMultimap;
import org.onosproject.store.primitives.resources.impl.AtomixConsistentTreeMap;
import org.onosproject.store.primitives.resources.impl.AtomixCounter;
+import org.onosproject.store.primitives.resources.impl.AtomixDistributedLock;
import org.onosproject.store.primitives.resources.impl.AtomixDocumentTree;
import org.onosproject.store.primitives.resources.impl.AtomixIdGenerator;
import org.onosproject.store.primitives.resources.impl.AtomixLeaderElector;
@@ -47,6 +48,7 @@
import org.onosproject.store.service.AsyncConsistentMap;
import org.onosproject.store.service.AsyncConsistentMultimap;
import org.onosproject.store.service.AsyncConsistentTreeMap;
+import org.onosproject.store.service.AsyncDistributedLock;
import org.onosproject.store.service.AsyncDistributedSet;
import org.onosproject.store.service.AsyncDocumentTree;
import org.onosproject.store.service.AsyncLeaderElector;
@@ -260,6 +262,21 @@
}
@Override
+ public AsyncDistributedLock newAsyncDistributedLock(String name) {
+ return new AtomixDistributedLock(client.newProxyBuilder()
+ .withName(name)
+ .withServiceType(DistributedPrimitive.Type.LOCK.name())
+ .withReadConsistency(ReadConsistency.LINEARIZABLE)
+ .withCommunicationStrategy(CommunicationStrategy.LEADER)
+ .withMinTimeout(Duration.ofSeconds(1))
+ .withMaxTimeout(Duration.ofSeconds(5))
+ .withMaxRetries(MAX_RETRIES)
+ .build()
+ .open()
+ .join());
+ }
+
+ @Override
public AsyncLeaderElector newAsyncLeaderElector(String name, long leaderTimeout, TimeUnit timeUnit) {
AtomixLeaderElector leaderElector = new AtomixLeaderElector(client.newProxyBuilder()
.withName(name)
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLock.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLock.java
new file mode 100644
index 0000000..c5a4250
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLock.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import java.time.Duration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import io.atomix.protocols.raft.proxy.RaftProxy;
+import io.atomix.utils.concurrent.Futures;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.AsyncDistributedLock;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageException;
+import org.onosproject.store.service.Version;
+
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.LOCK;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.Lock;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.UNLOCK;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.Unlock;
+
+/**
+ * Atomix lock implementation.
+ */
+public class AtomixDistributedLock extends AbstractRaftPrimitive implements AsyncDistributedLock {
+ private static final Serializer SERIALIZER = Serializer.using(KryoNamespace.newBuilder()
+ .register(KryoNamespaces.BASIC)
+ .register(AtomixDistributedLockOperations.NAMESPACE)
+ .register(AtomixDistributedLockEvents.NAMESPACE)
+ .build());
+
+ private final Map<Integer, CompletableFuture<Version>> futures = new ConcurrentHashMap<>();
+ private final AtomicInteger id = new AtomicInteger();
+ private int lock;
+
+ public AtomixDistributedLock(RaftProxy proxy) {
+ super(proxy);
+ proxy.addStateChangeListener(this::handleStateChange);
+ proxy.addEventListener(AtomixDistributedLockEvents.LOCK, SERIALIZER::decode, this::handleLocked);
+ proxy.addEventListener(AtomixDistributedLockEvents.FAIL, SERIALIZER::decode, this::handleFailed);
+ }
+
+ private void handleLocked(LockEvent event) {
+ CompletableFuture<Version> future = futures.remove(event.id());
+ if (future != null) {
+ this.lock = event.id();
+ future.complete(new Version(event.version()));
+ }
+ }
+
+ private void handleFailed(LockEvent event) {
+ CompletableFuture<Version> future = futures.remove(event.id());
+ if (future != null) {
+ future.complete(null);
+ }
+ }
+
+ private void handleStateChange(RaftProxy.State state) {
+ if (state != RaftProxy.State.CONNECTED) {
+ Iterator<Map.Entry<Integer, CompletableFuture<Version>>> iterator = futures.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry<Integer, CompletableFuture<Version>> entry = iterator.next();
+ entry.getValue().completeExceptionally(new StorageException.Unavailable());
+ proxy.invoke(UNLOCK, SERIALIZER::encode, new Unlock(entry.getKey()));
+ iterator.remove();
+ }
+ lock = 0;
+ }
+ }
+
+ @Override
+ public CompletableFuture<Version> lock() {
+ RaftProxy.State state = proxy.getState();
+ if (state != RaftProxy.State.CONNECTED) {
+ return Futures.exceptionalFuture(new StorageException.Unavailable());
+ }
+
+ CompletableFuture<Version> future = new CompletableFuture<>();
+ int id = this.id.incrementAndGet();
+ futures.put(id, future);
+ proxy.invoke(LOCK, SERIALIZER::encode, new Lock(id, -1)).whenComplete((result, error) -> {
+ if (error != null) {
+ futures.remove(id);
+ future.completeExceptionally(error);
+ }
+ });
+ return future;
+ }
+
+ @Override
+ public CompletableFuture<Optional<Version>> tryLock() {
+ RaftProxy.State state = proxy.getState();
+ if (state != RaftProxy.State.CONNECTED) {
+ return Futures.exceptionalFuture(new StorageException.Unavailable());
+ }
+
+ CompletableFuture<Version> future = new CompletableFuture<>();
+ int id = this.id.incrementAndGet();
+ futures.put(id, future);
+ proxy.invoke(LOCK, SERIALIZER::encode, new Lock(id, 0)).whenComplete((result, error) -> {
+ if (error != null) {
+ futures.remove(id);
+ future.completeExceptionally(error);
+ }
+ });
+ return future.thenApply(Optional::ofNullable);
+ }
+
+ @Override
+ public CompletableFuture<Optional<Version>> tryLock(Duration timeout) {
+ RaftProxy.State state = proxy.getState();
+ if (state != RaftProxy.State.CONNECTED) {
+ return Futures.exceptionalFuture(new StorageException.Unavailable());
+ }
+
+ CompletableFuture<Version> future = new CompletableFuture<>();
+ int id = this.id.incrementAndGet();
+ futures.put(id, future);
+ proxy.invoke(LOCK, SERIALIZER::encode, new Lock(id, timeout.toMillis())).whenComplete((result, error) -> {
+ if (error != null) {
+ futures.remove(id);
+ future.completeExceptionally(error);
+ }
+ });
+ return future.thenApply(Optional::ofNullable);
+ }
+
+ @Override
+ public CompletableFuture<Void> unlock() {
+ int lock = this.lock;
+ this.lock = 0;
+ if (lock != 0) {
+ return proxy.invoke(UNLOCK, SERIALIZER::encode, new Unlock(lock));
+ }
+ return CompletableFuture.completedFuture(null);
+ }
+
+ /**
+ * Closes the lock.
+ *
+ * @return a future to be completed once the lock has been closed
+ */
+ public CompletableFuture<Void> close() {
+ return proxy.close();
+ }
+}
\ No newline at end of file
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockEvents.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockEvents.java
new file mode 100644
index 0000000..0ef9270
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockEvents.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import io.atomix.protocols.raft.event.EventType;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+
+/**
+ * Raft value events.
+ */
+public enum AtomixDistributedLockEvents implements EventType {
+ LOCK("lock"),
+ FAIL("fail");
+
+ private final String id;
+
+ AtomixDistributedLockEvents(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String id() {
+ return id;
+ }
+
+ public static final KryoNamespace NAMESPACE = KryoNamespace.newBuilder()
+ .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID + 50)
+ .register(LockEvent.class)
+ .register(byte[].class)
+ .build(AtomixDistributedLockEvents.class.getSimpleName());
+
+}
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockOperations.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockOperations.java
new file mode 100644
index 0000000..5cfbc84
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockOperations.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import io.atomix.protocols.raft.operation.OperationId;
+import io.atomix.protocols.raft.operation.OperationType;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * {@link org.onosproject.store.service.DistributedLock} operations.
+ * <p>
+ * WARNING: Do not refactor enum values. Only add to them.
+ * Changing values risk breaking the ability to backup/restore/upgrade clusters.
+ */
+public enum AtomixDistributedLockOperations implements OperationId {
+ LOCK(OperationType.COMMAND),
+ UNLOCK(OperationType.COMMAND);
+
+ private final OperationType type;
+
+ AtomixDistributedLockOperations(OperationType type) {
+ this.type = type;
+ }
+
+ @Override
+ public String id() {
+ return name();
+ }
+
+ @Override
+ public OperationType type() {
+ return type;
+ }
+
+ public static final KryoNamespace NAMESPACE = KryoNamespace.newBuilder()
+ .register(KryoNamespaces.BASIC)
+ .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID)
+ .register(Lock.class)
+ .register(Unlock.class)
+ .build(AtomixDistributedLockOperations.class.getSimpleName());
+
+ /**
+ * Abstract lock operation.
+ */
+ public abstract static class LockOperation {
+ @Override
+ public String toString() {
+ return toStringHelper(this).toString();
+ }
+ }
+
+ /**
+ * Lock command.
+ */
+ public static class Lock extends LockOperation {
+ private final int id;
+ private final long timeout;
+
+ public Lock() {
+ this(0, 0);
+ }
+
+ public Lock(int id, long timeout) {
+ this.id = id;
+ this.timeout = timeout;
+ }
+
+ /**
+ * Returns the lock identifier.
+ *
+ * @return the lock identifier
+ */
+ public int id() {
+ return id;
+ }
+
+ /**
+ * Returns the lock attempt timeout.
+ *
+ * @return the lock attempt timeout
+ */
+ public long timeout() {
+ return timeout;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id)
+ .add("timeout", timeout)
+ .toString();
+ }
+ }
+
+ /**
+ * Unlock command.
+ */
+ public static class Unlock extends LockOperation {
+ private final int id;
+
+ public Unlock(int id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the lock identifier.
+ *
+ * @return the lock identifier
+ */
+ public int id() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id)
+ .toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockService.java
new file mode 100644
index 0000000..a2dab95
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockService.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import java.time.Duration;
+import java.util.ArrayDeque;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Queue;
+
+import io.atomix.protocols.raft.service.AbstractRaftService;
+import io.atomix.protocols.raft.service.Commit;
+import io.atomix.protocols.raft.service.RaftServiceExecutor;
+import io.atomix.protocols.raft.session.RaftSession;
+import io.atomix.protocols.raft.storage.snapshot.SnapshotReader;
+import io.atomix.protocols.raft.storage.snapshot.SnapshotWriter;
+import io.atomix.utils.concurrent.Scheduled;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.Serializer;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockEvents.FAIL;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.LOCK;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.Lock;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.UNLOCK;
+import static org.onosproject.store.primitives.resources.impl.AtomixDistributedLockOperations.Unlock;
+
+/**
+ * Raft atomic value service.
+ */
+public class AtomixDistributedLockService extends AbstractRaftService {
+ private static final Serializer SERIALIZER = Serializer.using(KryoNamespace.newBuilder()
+ .register(KryoNamespaces.BASIC)
+ .register(AtomixDistributedLockOperations.NAMESPACE)
+ .register(AtomixDistributedLockEvents.NAMESPACE)
+ .register(LockHolder.class)
+ .register(ArrayDeque.class)
+ .build());
+
+ private LockHolder lock;
+ private Queue<LockHolder> queue = new ArrayDeque<>();
+ private final Map<Long, Scheduled> timers = new HashMap<>();
+
+ @Override
+ protected void configure(RaftServiceExecutor executor) {
+ executor.register(LOCK, SERIALIZER::decode, this::lock);
+ executor.register(UNLOCK, SERIALIZER::decode, this::unlock);
+ }
+
+ @Override
+ public void snapshot(SnapshotWriter writer) {
+ writer.writeObject(lock, SERIALIZER::encode);
+ writer.writeObject(queue, SERIALIZER::encode);
+ }
+
+ @Override
+ public void install(SnapshotReader reader) {
+ lock = reader.readObject(SERIALIZER::decode);
+ queue = reader.readObject(SERIALIZER::decode);
+ timers.values().forEach(Scheduled::cancel);
+ timers.clear();
+ for (LockHolder holder : queue) {
+ if (holder.expire > 0) {
+ timers.put(holder.index,
+ scheduler().schedule(Duration.ofMillis(holder.expire - wallClock().getTime().unixTimestamp()),
+ () -> {
+ timers.remove(holder.index);
+ queue.remove(holder);
+ RaftSession session = sessions().getSession(holder.session);
+ if (session != null && session.getState().active()) {
+ session.publish(FAIL, SERIALIZER::encode, new LockEvent(holder.id, holder.index));
+ }
+ }));
+ }
+ }
+ }
+
+ @Override
+ public void onExpire(RaftSession session) {
+ releaseSession(session);
+ }
+
+ @Override
+ public void onClose(RaftSession session) {
+ releaseSession(session);
+ }
+
+ /**
+ * Applies a lock commit.
+ *
+ * @param commit the lock commit
+ */
+ protected void lock(Commit<Lock> commit) {
+ if (lock == null) {
+ lock = new LockHolder(
+ commit.value().id(),
+ commit.index(),
+ commit.session().sessionId().id(),
+ 0);
+ commit.session().publish(
+ AtomixDistributedLockEvents.LOCK,
+ SERIALIZER::encode,
+ new LockEvent(commit.value().id(), commit.index()));
+ } else if (commit.value().timeout() == 0) {
+ commit.session().publish(FAIL, SERIALIZER::encode, new LockEvent(commit.value().id(), commit.index()));
+ } else if (commit.value().timeout() > 0) {
+ LockHolder holder = new LockHolder(
+ commit.value().id(),
+ commit.index(),
+ commit.session().sessionId().id(),
+ wallClock().getTime().unixTimestamp() + commit.value().timeout());
+ queue.add(holder);
+ timers.put(commit.index(), scheduler().schedule(Duration.ofMillis(commit.value().timeout()), () -> {
+ timers.remove(commit.index());
+ queue.remove(holder);
+ if (commit.session().getState().active()) {
+ commit.session().publish(
+ FAIL,
+ SERIALIZER::encode,
+ new LockEvent(commit.value().id(), commit.index()));
+ }
+ }));
+ } else {
+ LockHolder holder = new LockHolder(
+ commit.value().id(),
+ commit.index(),
+ commit.session().sessionId().id(),
+ 0);
+ queue.add(holder);
+ }
+ }
+
+ /**
+ * Applies an unlock commit.
+ *
+ * @param commit the unlock commit
+ */
+ protected void unlock(Commit<Unlock> commit) {
+ if (lock != null) {
+ if (lock.session != commit.session().sessionId().id()) {
+ return;
+ }
+
+ lock = queue.poll();
+ while (lock != null) {
+ Scheduled timer = timers.remove(lock.index);
+ if (timer != null) {
+ timer.cancel();
+ }
+
+ RaftSession session = sessions().getSession(lock.session);
+ if (session == null || session.getState() == RaftSession.State.EXPIRED
+ || session.getState() == RaftSession.State.CLOSED) {
+ lock = queue.poll();
+ } else {
+ session.publish(
+ AtomixDistributedLockEvents.LOCK,
+ SERIALIZER::encode,
+ new LockEvent(lock.id, commit.index()));
+ break;
+ }
+ }
+ }
+ }
+
+ private void releaseSession(RaftSession session) {
+ if (lock != null && lock.session == session.sessionId().id()) {
+ lock = queue.poll();
+ while (lock != null) {
+ if (lock.session == session.sessionId().id()) {
+ lock = queue.poll();
+ } else {
+ Scheduled timer = timers.remove(lock.index);
+ if (timer != null) {
+ timer.cancel();
+ }
+
+ RaftSession lockSession = sessions().getSession(lock.session);
+ if (lockSession == null || lockSession.getState() == RaftSession.State.EXPIRED
+ || lockSession.getState() == RaftSession.State.CLOSED) {
+ lock = queue.poll();
+ } else {
+ lockSession.publish(
+ AtomixDistributedLockEvents.LOCK,
+ SERIALIZER::encode,
+ new LockEvent(lock.id, lock.index));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private class LockHolder {
+ private final int id;
+ private final long index;
+ private final long session;
+ private final long expire;
+
+ public LockHolder(int id, long index, long session, long expire) {
+ this.id = id;
+ this.index = index;
+ this.session = session;
+ this.expire = expire;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id)
+ .add("index", index)
+ .add("session", session)
+ .add("expire", expire)
+ .toString();
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/LockEvent.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/LockEvent.java
new file mode 100644
index 0000000..cddb41f
--- /dev/null
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/LockEvent.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Locked event.
+ */
+public class LockEvent {
+ private final int id;
+ private final long version;
+
+ public LockEvent() {
+ this(0, 0);
+ }
+
+ public LockEvent(int id, long version) {
+ this.id = id;
+ this.version = version;
+ }
+
+ /**
+ * Returns the lock ID.
+ *
+ * @return The lock ID.
+ */
+ public int id() {
+ return id;
+ }
+
+ /**
+ * Returns the lock version.
+ *
+ * @return The lock version.
+ */
+ public long version() {
+ return version;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id)
+ .add("version", version)
+ .toString();
+ }
+}
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockServiceTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockServiceTest.java
new file mode 100644
index 0000000..69942a7
--- /dev/null
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockServiceTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import io.atomix.protocols.raft.ReadConsistency;
+import io.atomix.protocols.raft.cluster.MemberId;
+import io.atomix.protocols.raft.impl.RaftContext;
+import io.atomix.protocols.raft.operation.OperationType;
+import io.atomix.protocols.raft.protocol.RaftServerProtocol;
+import io.atomix.protocols.raft.service.ServiceId;
+import io.atomix.protocols.raft.service.ServiceType;
+import io.atomix.protocols.raft.service.impl.DefaultCommit;
+import io.atomix.protocols.raft.service.impl.DefaultServiceContext;
+import io.atomix.protocols.raft.session.SessionId;
+import io.atomix.protocols.raft.session.impl.RaftSessionContext;
+import io.atomix.protocols.raft.storage.RaftStorage;
+import io.atomix.protocols.raft.storage.snapshot.Snapshot;
+import io.atomix.protocols.raft.storage.snapshot.SnapshotReader;
+import io.atomix.protocols.raft.storage.snapshot.SnapshotStore;
+import io.atomix.protocols.raft.storage.snapshot.SnapshotWriter;
+import io.atomix.storage.StorageLevel;
+import io.atomix.time.WallClockTimestamp;
+import io.atomix.utils.concurrent.AtomixThreadFactory;
+import io.atomix.utils.concurrent.SingleThreadContextFactory;
+import io.atomix.utils.concurrent.ThreadContext;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.mock;
+import static org.easymock.EasyMock.replay;
+import static org.onosproject.store.service.DistributedPrimitive.Type.LEADER_ELECTOR;
+
+/**
+ * Distributed lock service test.
+ */
+public class AtomixDistributedLockServiceTest {
+ @Test
+ public void testSnapshot() throws Exception {
+ SnapshotStore store = new SnapshotStore(RaftStorage.newBuilder()
+ .withPrefix("test")
+ .withStorageLevel(StorageLevel.MEMORY)
+ .build());
+ Snapshot snapshot = store.newSnapshot(ServiceId.from(1), "test", 2, new WallClockTimestamp());
+
+ AtomicLong index = new AtomicLong();
+ DefaultServiceContext context = mock(DefaultServiceContext.class);
+ expect(context.serviceType()).andReturn(ServiceType.from(LEADER_ELECTOR.name())).anyTimes();
+ expect(context.serviceName()).andReturn("test").anyTimes();
+ expect(context.serviceId()).andReturn(ServiceId.from(1)).anyTimes();
+ expect(context.executor()).andReturn(mock(ThreadContext.class)).anyTimes();
+ expect(context.currentIndex()).andReturn(index.get()).anyTimes();
+ expect(context.currentOperation()).andReturn(OperationType.COMMAND).anyTimes();
+
+ RaftContext server = mock(RaftContext.class);
+ expect(server.getProtocol()).andReturn(mock(RaftServerProtocol.class));
+
+ replay(context, server);
+
+ AtomixDistributedLockService service = new AtomixDistributedLockService();
+ service.init(context);
+
+ RaftSessionContext session = new RaftSessionContext(
+ SessionId.from(1),
+ MemberId.from("1"),
+ "test",
+ ServiceType.from(LEADER_ELECTOR.name()),
+ ReadConsistency.LINEARIZABLE,
+ 100,
+ 5000,
+ System.currentTimeMillis(),
+ context,
+ server,
+ new SingleThreadContextFactory(new AtomixThreadFactory()));
+ session.open();
+
+ service.lock(new DefaultCommit<>(
+ index.incrementAndGet(),
+ AtomixDistributedLockOperations.LOCK,
+ new AtomixDistributedLockOperations.Lock(1, 0),
+ session,
+ System.currentTimeMillis()));
+
+ try (SnapshotWriter writer = snapshot.openWriter()) {
+ service.snapshot(writer);
+ }
+
+ snapshot.complete();
+
+ service = new AtomixDistributedLockService();
+ try (SnapshotReader reader = snapshot.openReader()) {
+ service.install(reader);
+ }
+
+ service.unlock(new DefaultCommit<>(
+ index.incrementAndGet(),
+ AtomixDistributedLockOperations.UNLOCK,
+ new AtomixDistributedLockOperations.Unlock(1),
+ session,
+ System.currentTimeMillis()));
+ }
+}
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockTest.java
new file mode 100644
index 0000000..cc32ba9
--- /dev/null
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDistributedLockTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.primitives.resources.impl;
+
+import java.time.Duration;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+import io.atomix.protocols.raft.proxy.RaftProxy;
+import io.atomix.protocols.raft.service.RaftService;
+import org.junit.Test;
+import org.onosproject.store.service.Version;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Raft lock test.
+ */
+public class AtomixDistributedLockTest extends AtomixTestBase<AtomixDistributedLock> {
+ @Override
+ protected RaftService createService() {
+ return new AtomixDistributedLockService();
+ }
+
+ @Override
+ protected AtomixDistributedLock createPrimitive(RaftProxy proxy) {
+ return new AtomixDistributedLock(proxy);
+ }
+
+ /**
+ * Tests locking and unlocking a lock.
+ */
+ @Test
+ public void testLockUnlock() throws Throwable {
+ AtomixDistributedLock lock = newPrimitive("test-lock-unlock");
+ lock.lock().join();
+ lock.unlock().join();
+ }
+
+ /**
+ * Tests releasing a lock when the client's session is closed.
+ */
+ @Test
+ public void testReleaseOnClose() throws Throwable {
+ AtomixDistributedLock lock1 = newPrimitive("test-lock-release-on-close");
+ AtomixDistributedLock lock2 = newPrimitive("test-lock-release-on-close");
+ lock1.lock().join();
+ CompletableFuture<Version> future = lock2.lock();
+ lock1.close();
+ future.join();
+ }
+
+ /**
+ * Tests attempting to acquire a lock.
+ */
+ @Test
+ public void testTryLockFail() throws Throwable {
+ AtomixDistributedLock lock1 = newPrimitive("test-try-lock-fail");
+ AtomixDistributedLock lock2 = newPrimitive("test-try-lock-fail");
+
+ lock1.lock().join();
+
+ assertFalse(lock2.tryLock().join().isPresent());
+ }
+
+ /**
+ * Tests attempting to acquire a lock.
+ */
+ @Test
+ public void testTryLockSucceed() throws Throwable {
+ AtomixDistributedLock lock = newPrimitive("test-try-lock-succeed");
+ assertTrue(lock.tryLock().join().isPresent());
+ }
+
+ /**
+ * Tests attempting to acquire a lock with a timeout.
+ */
+ @Test
+ public void testTryLockFailWithTimeout() throws Throwable {
+ AtomixDistributedLock lock1 = newPrimitive("test-try-lock-fail-with-timeout");
+ AtomixDistributedLock lock2 = newPrimitive("test-try-lock-fail-with-timeout");
+
+ lock1.lock().join();
+
+ assertFalse(lock2.tryLock(Duration.ofSeconds(1)).join().isPresent());
+ }
+
+ /**
+ * Tests attempting to acquire a lock with a timeout.
+ */
+ @Test
+ public void testTryLockSucceedWithTimeout() throws Throwable {
+ AtomixDistributedLock lock1 = newPrimitive("test-try-lock-succeed-with-timeout");
+ AtomixDistributedLock lock2 = newPrimitive("test-try-lock-succeed-with-timeout");
+
+ lock1.lock().join();
+
+ CompletableFuture<Optional<Version>> future = lock2.tryLock(Duration.ofSeconds(1));
+ lock1.unlock().join();
+ assertTrue(future.join().isPresent());
+ }
+
+ /**
+ * Tests unlocking a lock with a blocking call in the event thread.
+ */
+ @Test
+ public void testBlockingUnlock() throws Throwable {
+ AtomixDistributedLock lock1 = newPrimitive("test-blocking-unlock");
+ AtomixDistributedLock lock2 = newPrimitive("test-blocking-unlock");
+
+ lock1.lock().thenRun(() -> {
+ lock1.unlock().join();
+ }).join();
+
+ lock2.lock().join();
+ }
+}
diff --git a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
index 8839c59..d52c470 100644
--- a/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
+++ b/drivers/cisco/netconf/src/main/java/org/onosproject/drivers/cisco/CiscoIosDeviceDescription.java
@@ -49,7 +49,7 @@
try {
version = session.get(showVersionRequestBuilder());
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve version info.", e));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve version info.", e));
}
String[] details = TextBlockParserCisco.parseCiscoIosDeviceDetails(version);
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
index 38cc72b..f9c9f22 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
@@ -87,6 +87,7 @@
import static org.onosproject.net.flow.criteria.Criterion.Type.TUNNEL_ID;
import static org.onosproject.net.flow.criteria.Criterion.Type.VLAN_VID;
import static org.onosproject.net.group.GroupDescription.Type.ALL;
+import static org.onosproject.net.group.GroupDescription.Type.INDIRECT;
import static org.onosproject.net.group.GroupDescription.Type.SELECT;
import static org.slf4j.LoggerFactory.getLogger;
@@ -247,23 +248,34 @@
* a chain of groups. The simple Next Objective passed
* in by the application has to be broken up into a group chain
* comprising of an L3 Unicast Group that points to an L2 Interface
- * Group which in-turn points to an output port. In some cases, the simple
+ * Group which in-turn points to an output port or an MPLS Interface Group
+ * that points to an L2 Interface Group. In some cases, the simple
* next Objective can just be an L2 interface without the need for chaining.
+ * Further, if the label is set to the Next objective then the Group chain
+ * MPLS Swap - MPLS Interface - L2 Interface is created
*
* @param nextObj the nextObjective of type SIMPLE
*/
private void processSimpleNextObjective(NextObjective nextObj) {
TrafficTreatment treatment = nextObj.next().iterator().next();
- // determine if plain L2 or L3->L2
+ // determine if plain L2 or L3->L2 or MPLS Swap -> MPLS Interface -> L2
boolean plainL2 = true;
+ boolean mplsSwap = false;
+ MplsLabel mplsLabel = null;
for (Instruction ins : treatment.allInstructions()) {
if (ins.type() == Instruction.Type.L2MODIFICATION) {
L2ModificationInstruction l2ins = (L2ModificationInstruction) ins;
if (l2ins.subtype() == L2ModificationInstruction.L2SubType.ETH_DST ||
l2ins.subtype() == L2ModificationInstruction.L2SubType.ETH_SRC) {
plainL2 = false;
- break;
}
+ // mpls label in simple next objectives is used only to indicate
+ // a MPLS Swap group before the MPLS Interface Group
+ if (l2ins.subtype() == L2ModificationInstruction.L2SubType.MPLS_LABEL) {
+ mplsSwap = true;
+ mplsLabel = ((L2ModificationInstruction.ModMplsLabelInstruction) l2ins).label();
+ }
+
}
}
@@ -288,13 +300,59 @@
}
- if (!isPw) {
+ if (mplsSwap) {
+ log.debug("Creating a MPLS Swap - MPLS Interface - L2 Interface group chain.");
+
+ // break up simple next objective to GroupChain objects
+ GroupInfo groupInfo = createL2L3Chain(treatment, nextObj.id(),
+ nextObj.appId(), true,
+ nextObj.meta());
+ if (groupInfo == null) {
+ log.error("Could not process nextObj={} in dev:{}", nextObj.id(), deviceId);
+ fail(nextObj, ObjectiveError.BADPARAMS);
+ return;
+ }
+
+ Deque<GroupKey> gkeyChain = new ArrayDeque<>();
+ gkeyChain.addFirst(groupInfo.innerMostGroupDesc().appCookie());
+ gkeyChain.addFirst(groupInfo.nextGroupDesc().appCookie());
+
+ // creating the mpls swap group and adding it to the chain
+ GroupChainElem groupChainElem;
+ GroupKey groupKey;
+ GroupDescription groupDescription;
+ int nextGid = groupInfo.nextGroupDesc().givenGroupId();
+ int index = getNextAvailableIndex();
+
+ groupDescription = createMplsSwap(
+ nextGid,
+ OfdpaMplsGroupSubType.MPLS_SWAP_LABEL,
+ index,
+ mplsLabel,
+ nextObj.appId()
+ );
+
+ groupKey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(index));
+ groupChainElem = new GroupChainElem(groupDescription, 1, false, deviceId);
+ updatePendingGroups(groupInfo.nextGroupDesc().appCookie(), groupChainElem);
+ gkeyChain.addFirst(groupKey);
+
+ // create a new List from singletonList that is mutable
+ OfdpaNextGroup ofdpaGrp = new OfdpaNextGroup(Collections.singletonList(gkeyChain), nextObj);
+ updatePendingNextObjective(groupInfo.nextGroupDesc().appCookie(), ofdpaGrp);
+
+ // now we are ready to send the l2 groupDescription (inner), as all the stores
+ // that will get async replies have been updated. By waiting to update
+ // the stores, we prevent nasty race conditions.
+ groupService.addGroup(groupInfo.innerMostGroupDesc());
+ } else if (!isPw) {
// break up simple next objective to GroupChain objects
GroupInfo groupInfo = createL2L3Chain(treatment, nextObj.id(),
nextObj.appId(), isMpls,
nextObj.meta());
if (groupInfo == null) {
log.error("Could not process nextObj={} in dev:{}", nextObj.id(), deviceId);
+ fail(nextObj, ObjectiveError.BADPARAMS);
return;
}
// create object for local and distributed storage
@@ -352,6 +410,45 @@
}
/**
+ * Creates an Mpls group of type swap.
+ *
+ * @param nextGroupId the next group in the chain
+ * @param subtype the mpls swap label group subtype
+ * @param index the index of the group
+ * @param mplsLabel the mpls label to swap
+ * @param applicationId the application id
+ * @return the group description
+ */
+ protected GroupDescription createMplsSwap(int nextGroupId,
+ OfdpaMplsGroupSubType subtype,
+ int index,
+ MplsLabel mplsLabel,
+ ApplicationId applicationId) {
+
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+ treatment.setMpls(mplsLabel);
+
+ // We point the group to the next group.
+ treatment.group(new GroupId(nextGroupId));
+ GroupBucket groupBucket = DefaultGroupBucket
+ .createIndirectGroupBucket(treatment.build());
+ // Finally we build the group description.
+ int groupId = makeMplsLabelGroupId(subtype, index);
+ GroupKey groupKey = new DefaultGroupKey(
+ Ofdpa2Pipeline.appKryo.serialize(index)
+ );
+ return new DefaultGroupDescription(
+ deviceId,
+ INDIRECT,
+ new GroupBuckets(Collections.singletonList(groupBucket)),
+ groupKey,
+ groupId,
+ applicationId
+ );
+ }
+
+ /**
* Creates one of two possible group-chains from the treatment
* passed in. Depending on the MPLS boolean, this method either creates
* an L3Unicast Group --> L2Interface Group, if mpls is false;
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
index 383ba4d..ff9f2c0 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
@@ -100,9 +100,9 @@
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.*;
import static org.onosproject.net.flow.criteria.Criterion.Type.ETH_TYPE;
+import static org.onosproject.net.group.GroupDescription.Type.SELECT;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onosproject.net.flow.criteria.Criterion.Type.MPLS_BOS;
-import static org.onosproject.net.flowobjective.NextObjective.Type.HASHED;
/**
* Driver for Broadcom's OF-DPA v2.0 TTP.
@@ -1262,7 +1262,7 @@
List<Deque<GroupKey>> gkeys = appKryo.deserialize(next.data());
// we only need the top level group's key to point the flow to it
Group group = groupService.getGroup(deviceId, gkeys.get(0).peekFirst());
- if (isNotMplsBos(selector) && group.type().equals(HASHED)) {
+ if (isNotMplsBos(selector) && group.type().equals(SELECT)) {
log.warn("SR CONTINUE case cannot be handled as MPLS ECMP "
+ "is not implemented in OF-DPA yet. Aborting this flow {} -> next:{}"
+ "in this device {}", fwd.id(), fwd.nextId(), deviceId);
diff --git a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
index 04c9f01..eeaf2ab 100644
--- a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
+++ b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
@@ -83,8 +83,17 @@
public List<PortDescription> discoverPortDetails() {
log.info("Discovering port details on device {}", handler().data().deviceId());
+ String serverAddr = this.data().value(GNMI_SERVER_ADDR_KEY);
+ String serverPortString = this.data().value(GNMI_SERVER_PORT_KEY);
+
+ if (serverAddr == null || serverPortString == null ||
+ serverAddr.isEmpty() || serverPortString.isEmpty()) {
+ log.warn("gNMI server information not provided, can't discover ports");
+ return ImmutableList.of();
+ }
+
// Get the channel
- ManagedChannel channel = getChannel();
+ ManagedChannel channel = getChannel(serverAddr, serverPortString);
if (channel == null) {
return ImmutableList.of();
@@ -112,7 +121,7 @@
} catch (InterruptedException | ExecutionException | TimeoutException
| StatusRuntimeException e) {
log.warn("Unable to discover ports from {}: {}",
- data().deviceId(), e.getMessage());
+ data().deviceId(), e.getMessage());
log.debug("{}", e);
return ImmutableList.of();
} finally {
@@ -127,11 +136,9 @@
*
* @return the managed channel
*/
- private ManagedChannel getChannel() {
+ private ManagedChannel getChannel(String serverAddr, String serverPortString) {
DeviceId deviceId = handler().data().deviceId();
- String serverAddr = this.data().value(GNMI_SERVER_ADDR_KEY);
- String serverPortString = this.data().value(GNMI_SERVER_PORT_KEY);
GrpcController controller = handler().get(GrpcController.class);
ManagedChannel channel = null;
@@ -162,7 +169,7 @@
channel = controller.connectChannel(newChannelId, channelBuilder);
} catch (IOException e) {
log.warn("Unable to connect to gRPC server of {}: {}",
- deviceId, e.getMessage());
+ deviceId, e.getMessage());
}
}
return channel;
@@ -221,7 +228,7 @@
@Override
public void onError(Throwable throwable) {
log.warn("Error on stream channel for {}: {}",
- data().deviceId(), Status.fromThrowable(throwable));
+ data().deviceId(), Status.fromThrowable(throwable));
log.debug("{}", throwable);
}
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
index d4c09dc..cb07843 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/FlowRuleJuniperImpl.java
@@ -100,7 +100,7 @@
try {
reply = session.get(routingTableBuilder());
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.",
e));
}
Collection<StaticRoute> devicesStaticRoutes =
@@ -241,7 +241,7 @@
}
}
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.",
e));
}
return false;
@@ -335,7 +335,7 @@
try {
replay = session.get(commitBuilder());
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.",
e));
}
@@ -355,7 +355,7 @@
try {
replay = session.get(rollbackBuilder(0));
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.",
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.",
e));
}
diff --git a/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java b/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
index 966821e..4662219 100644
--- a/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
+++ b/drivers/oplink/src/main/java/org/onosproject/drivers/oplink/OplinkNetconfUtility.java
@@ -69,7 +69,7 @@
try {
reply = session.get(filter, null);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.", e));
}
return reply;
}
@@ -88,7 +88,7 @@
try {
reply = session.getConfig(DatastoreId.RUNNING, filter);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.", e));
}
return reply;
}
@@ -108,7 +108,7 @@
try {
reply = session.editConfig(DatastoreId.RUNNING, mode, cfg);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to edit configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to edit configuration.", e));
}
return reply;
}
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/power/OpenFlowPowerConfig.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/power/OpenFlowPowerConfig.java
new file mode 100644
index 0000000..9a8f6a6
--- /dev/null
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/power/OpenFlowPowerConfig.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2018 Open Networking Foundation
+ *
+ * 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.driver.optical.power;
+
+import com.google.common.collect.Range;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.behaviour.PowerConfig;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+
+import org.onosproject.openflow.controller.Dpid;
+import org.onosproject.openflow.controller.OpenFlowController;
+import org.onosproject.openflow.controller.OpenFlowSwitch;
+
+import org.projectfloodlight.openflow.protocol.OFPortConfig;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+import org.projectfloodlight.openflow.protocol.OFPortDescProp;
+import org.projectfloodlight.openflow.protocol.OFPortDescPropOptical;
+import org.projectfloodlight.openflow.protocol.OFPortMod;
+import org.projectfloodlight.openflow.protocol.OFPortModProp;
+import org.projectfloodlight.openflow.protocol.OFPortModPropOptical;
+import org.projectfloodlight.openflow.protocol.ver14.OFOpticalPortFeaturesSerializerVer14;
+import org.projectfloodlight.openflow.types.OFPort;
+
+import org.slf4j.Logger;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+
+import static org.onosproject.openflow.controller.Dpid.dpid;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Get current or target port/channel power from an openflow device.
+ * Set target port power or channel attenuation to an openflow device.
+ */
+public class OpenFlowPowerConfig<T> extends AbstractHandlerBehaviour
+ implements PowerConfig<T> {
+
+ private static final Logger log = getLogger(OpenFlowPowerConfig.class);
+
+ @Override
+ public Optional<Long> getTargetPower(PortNumber port, T component) {
+ // TODO: OpenFlow does not seem to have the concept of retrieving this
+ // information as only the current power is returned in the port stats
+ // reply. This can be different from the configured value. Perhaps, the
+ // settings in annotations or building a lookup table with the latest
+ // settings could be options.
+ return Optional.empty();
+ }
+
+ @Override
+ public void setTargetPower(PortNumber port, T component, long power) {
+ setPortTargetPower(port, power);
+ }
+
+ @Override
+ public Optional<Long> currentPower(PortNumber port, T component) {
+ // TODO: Ideally, this needs to read the port stats output for real-time
+ // data or as a short-term workaround, it could get the last read value
+ // from the port stats polling.
+ return null;
+ }
+
+ @Override
+ public Optional<Range<Long>> getTargetPowerRange(PortNumber port, T component) {
+ for (OFPortDesc pd : getPortDescs()) {
+ if (pd.getPortNo().getPortNumber() == port.toLong()) {
+ for (OFPortDescProp prop : pd.getProperties()) {
+ if (prop instanceof OFPortDescPropOptical) {
+ OFPortDescPropOptical oprop = (OFPortDescPropOptical) prop;
+ long txMin = oprop.getTxPwrMin();
+ long txMax = oprop.getTxPwrMax();
+ return Optional.of(Range.closed(txMin, txMax));
+ }
+ }
+ }
+ }
+ return Optional.empty();
+ }
+
+ private List<OFPortDesc> getPortDescs() {
+ final Dpid dpid = dpid(handler().data().deviceId().uri());
+ OpenFlowSwitch sw = handler().get(OpenFlowController.class).getSwitch(dpid);
+ return sw.getPorts();
+ }
+
+ @Override
+ public Optional<Range<Long>> getInputPowerRange(PortNumber port, T component) {
+ log.warn("Unsupported as OpenFlow does not seem to have the concept of input (presumably rx) power range.");
+ return Optional.empty();
+ }
+
+ @Override
+ public List<PortNumber> getPorts(T component) {
+ List<PortNumber> ports = new ArrayList<>();
+ for (OFPortDesc pd : getPortDescs()) {
+ for (OFPortDescProp prop : pd.getProperties()) {
+ // Note: Power monitor detection can actually be more complex
+ // than this. It is possible that the power is not
+ // configurable, but it is readable. In this case, the best
+ // bet is probably to check rx/tx power info valid in the
+ // port stats reply, unfortunately.
+ if (prop instanceof OFPortDescPropOptical) {
+ ports.add(PortNumber.portNumber(pd.getPortNo().getPortNumber()));
+ break;
+ }
+ }
+ }
+ return ports;
+ }
+
+ private OFPortMod.Builder makePortMod(OpenFlowSwitch sw, PortNumber portNumber,
+ boolean enable) {
+ OFPortMod.Builder pmb = sw.factory().buildPortMod();
+ OFPort port = OFPort.of((int) portNumber.toLong());
+ pmb.setPortNo(port);
+ Set<OFPortConfig> portConfig = EnumSet.noneOf(OFPortConfig.class);
+ if (!enable) {
+ portConfig.add(OFPortConfig.PORT_DOWN);
+ }
+ pmb.setConfig(portConfig);
+ Set<OFPortConfig> portMask = EnumSet.noneOf(OFPortConfig.class);
+ portMask.add(OFPortConfig.PORT_DOWN);
+ pmb.setMask(portMask);
+ pmb.setAdvertise(0x0);
+ for (OFPortDesc pd : sw.getPorts()) {
+ if (pd.getPortNo().equals(port)) {
+ pmb.setHwAddr(pd.getHwAddr());
+ break;
+ }
+ }
+ return pmb;
+ }
+
+ private boolean setPortTargetPower(PortNumber port, long power) {
+ DeviceId deviceId = handler().data().deviceId();
+ final Dpid dpid = dpid(deviceId.uri());
+ OpenFlowSwitch sw = handler().get(OpenFlowController.class).getSwitch(dpid);
+ if (sw == null || !sw.isConnected()) {
+ log.error("Failed to change port on device {}", deviceId);
+ return false;
+ }
+ boolean enable = false;
+ for (OFPortDesc pd : getPortDescs()) {
+ if (pd.getPortNo().getPortNumber() == port.toLong()) {
+ enable = pd.getConfig().contains(OFPortConfig.PORT_DOWN);
+ break;
+ }
+ }
+ OFPortMod.Builder pmb = makePortMod(sw, port, enable);
+ long configure = OFOpticalPortFeaturesSerializerVer14.TX_PWR_VAL;
+ OFPortModPropOptical.Builder property = sw.factory().buildPortModPropOptical();
+ property.setTxPwr(power);
+
+ List<OFPortModProp> properties = new ArrayList<>();
+ properties.add(property.build());
+ pmb.setProperties(properties);
+
+ sw.sendMsg(Collections.singletonList(pmb.build()));
+ // TODO: We would need to report false in case of port mod failure.
+ return true;
+ }
+}
diff --git a/drivers/optical/src/main/resources/optical-drivers.xml b/drivers/optical/src/main/resources/optical-drivers.xml
index 25be1a3..b1b98a2 100644
--- a/drivers/optical/src/main/resources/optical-drivers.xml
+++ b/drivers/optical/src/main/resources/optical-drivers.xml
@@ -99,6 +99,8 @@
impl="org.onosproject.net.optical.DefaultOpticalDevice"/>
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
impl="org.onosproject.driver.optical.handshaker.PolatisHandshaker"/>
+ <behaviour api="org.onosproject.net.behaviour.PowerConfig"
+ impl="org.onosproject.driver.optical.power.OpenFlowPowerConfig"/>
<!-- TODO use OF1.4 reported information when ready -->
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
impl="org.onosproject.driver.optical.query.ConfigLambdaQuery"/>
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeGroupProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeGroupProgrammable.java
index fb5e892..31ee45b 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeGroupProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeGroupProgrammable.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Maps;
import org.onosproject.drivers.p4runtime.mirror.P4RuntimeGroupMirror;
+import org.onosproject.drivers.p4runtime.mirror.TimedEntry;
import org.onosproject.net.DeviceId;
import org.onosproject.net.group.DefaultGroup;
import org.onosproject.net.group.Group;
@@ -71,6 +72,10 @@
// device mirror.
private boolean checkMirrorBeforeUpdate = true;
+ // If true, we avoid querying the device and return what's already known by
+ // the ONOS store.
+ private boolean ignoreDeviceWhenGet = true;
+
private GroupStore groupStore;
private P4RuntimeGroupMirror groupMirror;
private PiGroupTranslator translator;
@@ -104,10 +109,17 @@
if (!setupBehaviour()) {
return Collections.emptyList();
}
- return pipeconf.pipelineModel().actionProfiles().stream()
- .map(PiActionProfileModel::id)
- .flatMap(this::streamGroupsFromDevice)
- .collect(Collectors.toList());
+ if (!ignoreDeviceWhenGet) {
+ return pipeconf.pipelineModel().actionProfiles().stream()
+ .map(PiActionProfileModel::id)
+ .flatMap(this::streamGroupsFromDevice)
+ .collect(Collectors.toList());
+ } else {
+ return groupMirror.getAll(deviceId).stream()
+ .map(TimedEntry::entry)
+ .map(this::forgeGroupEntry)
+ .collect(Collectors.toList());
+ }
}
private void processGroupOp(DeviceId deviceId, GroupOperation groupOp) {
diff --git a/drivers/polatis/netconf/src/main/java/org/onosproject/drivers/polatis/netconf/PolatisNetconfUtility.java b/drivers/polatis/netconf/src/main/java/org/onosproject/drivers/polatis/netconf/PolatisNetconfUtility.java
index 6b8080b..1cb8031 100644
--- a/drivers/polatis/netconf/src/main/java/org/onosproject/drivers/polatis/netconf/PolatisNetconfUtility.java
+++ b/drivers/polatis/netconf/src/main/java/org/onosproject/drivers/polatis/netconf/PolatisNetconfUtility.java
@@ -82,7 +82,7 @@
try {
reply = session.get(filter, null);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.", e));
}
return reply;
}
@@ -100,7 +100,7 @@
try {
reply = session.getConfig(DatastoreId.RUNNING, filter);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to retrieve configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve configuration.", e));
}
return reply;
}
@@ -119,7 +119,7 @@
try {
reply = session.editConfig(DatastoreId.RUNNING, mode, cfg);
} catch (NetconfException e) {
- throw new RuntimeException(new NetconfException("Failed to edit configuration.", e));
+ throw new IllegalStateException(new NetconfException("Failed to edit configuration.", e));
}
return reply;
}
@@ -223,7 +223,7 @@
NetconfController controller = checkNotNull(handler.get(NetconfController.class));
NetconfSession session = controller.getNetconfDevice(handler.data().deviceId()).getSession();
if (session == null) {
- throw new RuntimeException(new NetconfException("Failed to retrieve the netconf device."));
+ throw new IllegalStateException(new NetconfException("Failed to retrieve the netconf device."));
}
return session;
}
diff --git a/incubator/net/pom.xml b/incubator/net/pom.xml
index 7467359..914b369 100644
--- a/incubator/net/pom.xml
+++ b/incubator/net/pom.xml
@@ -104,7 +104,6 @@
<dependency>
<groupId>com.googlecode.concurrent-trees</groupId>
<artifactId>concurrent-trees</artifactId>
- <version>2.6.0</version>
</dependency>
<dependency>
diff --git a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/PipeconfLoader.java b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/PipeconfLoader.java
index 1a5d4d2..8b5bf60 100644
--- a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/PipeconfLoader.java
+++ b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/PipeconfLoader.java
@@ -112,7 +112,7 @@
try {
return P4InfoParser.parse(p4InfoUrl);
} catch (P4InfoParserException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
}
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index e0ebbe8..c76fc65 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -103,8 +103,8 @@
table hashed {
key = {
fabric_metadata.next_id: exact;
- hdr.ethernet.dst_addr: selector;
- hdr.ethernet.src_addr: selector;
+ hdr.ipv4.dst_addr: selector;
+ hdr.ipv4.src_addr: selector;
fabric_metadata.ip_proto: selector;
fabric_metadata.l4_src_port: selector;
fabric_metadata.l4_dst_port: selector;
diff --git a/pipelines/fabric/src/main/resources/include/control/port_counter.p4 b/pipelines/fabric/src/main/resources/include/control/port_counter.p4
index 80ec64f..3e9ea00 100644
--- a/pipelines/fabric/src/main/resources/include/control/port_counter.p4
+++ b/pipelines/fabric/src/main/resources/include/control/port_counter.p4
@@ -20,8 +20,8 @@
#include "../header.p4"
control PortCountersControl(inout parsed_headers_t hdr, inout fabric_metadata_t fabric_metadata, inout standard_metadata_t standard_metadata) {
- counter(MAX_PORTS, CounterType.packets) egress_port_counter;
- counter(MAX_PORTS, CounterType.packets) ingress_port_counter;
+ counter(MAX_PORTS, CounterType.packets_and_bytes) egress_port_counter;
+ counter(MAX_PORTS, CounterType.packets_and_bytes) ingress_port_counter;
apply {
if (standard_metadata.egress_spec < MAX_PORTS) {
diff --git a/pipelines/fabric/src/main/resources/include/define.p4 b/pipelines/fabric/src/main/resources/include/define.p4
index 163c2ab..eb61f91 100644
--- a/pipelines/fabric/src/main/resources/include/define.p4
+++ b/pipelines/fabric/src/main/resources/include/define.p4
@@ -36,8 +36,15 @@
const bit<16> ETHERTYPE_IPV6 = 0x86dd;
const bit<16> ETHERTYPE_ARP = 0x0806;
-const bit<4> IP_VERSION_4 = 4;
-const bit<4> IP_VERSION_6 = 6;
+#ifndef IP_VER_LENGTH
+#define IP_VER_LENGTH 4
+#endif
+#ifndef IP_VERSION_4
+#define IP_VERSION_4 4
+#endif
+#ifndef IP_VERSION_6
+#define IP_VERSION_6 6
+#endif
const bit<8> PROTO_ICMP = 1;
const bit<8> PROTO_TCP = 6;
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index f4b3252..8b03da1 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -70,7 +70,7 @@
// There is only one MPLS label for this fabric.
// Assume header after MPLS header is IP/IPv6
// Lookup first 4 bits for version
- transition select(packet.lookahead<bit<4>>()) {
+ transition select(packet.lookahead<bit<IP_VER_LENGTH>>()) {
//The packet should be either IPv4 or IPv6.
IP_VERSION_4: parse_ipv4;
#ifdef WITH_IPV6
@@ -162,7 +162,7 @@
}
control FabricDeparser(packet_out packet, in parsed_headers_t hdr) {
- apply{
+ apply {
packet.emit(hdr.packet_in);
packet.emit(hdr.ethernet);
packet.emit(hdr.vlan_tag);
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json
index 2e38cf5..3b8aeed 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.json
@@ -313,12 +313,12 @@
"header_union_stacks" : [],
"field_lists" : [],
"errors" : [
- ["NoError", 1],
- ["PacketTooShort", 2],
- ["NoMatch", 3],
- ["StackOutOfBounds", 4],
- ["HeaderTooShort", 5],
- ["ParserTimeout", 6]
+ ["NoError", 0],
+ ["PacketTooShort", 1],
+ ["NoMatch", 2],
+ ["StackOutOfBounds", 3],
+ ["HeaderTooShort", 4],
+ ["ParserTimeout", 5]
],
"enums" : [],
"parsers" : [
@@ -842,7 +842,7 @@
"name" : "deparser",
"id" : 0,
"source_info" : {
- "filename" : "include/parser.p4",
+ "filename" : "./include/parser.p4",
"line" : 164,
"column" : 8,
"source_fragment" : "FabricDeparser"
@@ -922,9 +922,9 @@
"name" : "port_counters_control.egress_port_counter",
"id" : 11,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 23,
- "column" : 38,
+ "column" : 48,
"source_fragment" : "egress_port_counter"
},
"size" : 511,
@@ -934,9 +934,9 @@
"name" : "port_counters_control.ingress_port_counter",
"id" : 12,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 24,
- "column" : 38,
+ "column" : 48,
"source_fragment" : "ingress_port_counter"
},
"size" : 511,
@@ -949,7 +949,7 @@
"name" : "calc",
"id" : 0,
"source_info" : {
- "filename" : "include/checksum.p4",
+ "filename" : "./include/checksum.p4",
"line" : 56,
"column" : 8,
"source_fragment" : "verify_checksum(hdr.ipv4.isValid(), ..."
@@ -1006,7 +1006,7 @@
"name" : "calc_0",
"id" : 1,
"source_info" : {
- "filename" : "include/checksum.p4",
+ "filename" : "./include/checksum.p4",
"line" : 28,
"column" : 8,
"source_fragment" : "update_checksum(hdr.ipv4.isValid(), ..."
@@ -1063,7 +1063,7 @@
"name" : "calc_1",
"id" : 2,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 292,
"column" : 8,
"source_fragment" : "update_checksum(gtpu_ipv4.isValid(), ..."
@@ -1120,7 +1120,7 @@
"name" : "calc_2",
"id" : 3,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 311,
"column" : 8,
"source_fragment" : "update_checksum_with_payload(gtpu_udp.isValid(), ..."
@@ -1268,7 +1268,7 @@
"op" : "drop",
"parameters" : [],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "mark_to_drop()"
@@ -1278,7 +1278,7 @@
"op" : "exit",
"parameters" : [],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 34,
"column" : 8,
"source_fragment" : "exit"
@@ -1300,7 +1300,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 38,
"column" : 8,
"source_fragment" : "gtpu_ipv4.setInvalid()"
@@ -1315,7 +1315,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 39,
"column" : 8,
"source_fragment" : "gtpu_udp.setInvalid()"
@@ -1330,7 +1330,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 40,
"column" : 8,
"source_fragment" : "gtpu.setInvalid()"
@@ -1369,7 +1369,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 46,
"column" : 8,
"source_fragment" : "spgw_meta.teid = teid"
@@ -1388,7 +1388,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 47,
"column" : 8,
"source_fragment" : "spgw_meta.s1u_enb_addr = s1u_enb_addr"
@@ -1407,7 +1407,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 48,
"column" : 8,
"source_fragment" : "spgw_meta.s1u_sgw_addr = s1u_sgw_addr"
@@ -1430,7 +1430,7 @@
"op" : "drop",
"parameters" : [],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 31,
"column" : 8,
"source_fragment" : "mark_to_drop()"
@@ -1461,7 +1461,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 35,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
@@ -1488,7 +1488,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.setValid()"
@@ -1507,7 +1507,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 42,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.cfi = 0"
@@ -1526,7 +1526,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 43,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.pri = 0"
@@ -1545,7 +1545,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 44,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.ether_type = hdr.ethernet.ether_type"
@@ -1564,7 +1564,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 32,
"column" : 31,
"source_fragment" : "0x8100; ..."
@@ -1583,7 +1583,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 35,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id; ..."
@@ -1612,7 +1612,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress = true"
@@ -1643,7 +1643,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 53,
"column" : 8,
"source_fragment" : "fabric_metadata.fwd_type = fwd_type"
@@ -1660,7 +1660,7 @@
"op" : "drop",
"parameters" : [],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 37,
"column" : 8,
"source_fragment" : "mark_to_drop()"
@@ -1691,7 +1691,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1722,7 +1722,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1753,7 +1753,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1784,7 +1784,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1811,7 +1811,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.mpls.setInvalid()"
@@ -1830,7 +1830,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 46,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1856,7 +1856,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 50,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = 255"
@@ -1887,7 +1887,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num"
@@ -1922,7 +1922,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 37,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
@@ -1951,7 +1951,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 40,
"column" : 8,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress = false"
@@ -1970,7 +1970,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2009,7 +2009,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2028,7 +2028,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2047,7 +2047,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2086,7 +2086,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2105,7 +2105,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2124,7 +2124,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2159,7 +2159,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 59,
"column" : 8,
"source_fragment" : "standard_metadata.mcast_grp = gid"
@@ -2178,7 +2178,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2221,7 +2221,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2240,7 +2240,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2259,7 +2259,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2274,7 +2274,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -2293,7 +2293,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -2312,7 +2312,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -2331,7 +2331,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -2350,7 +2350,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -2369,8 +2369,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -2412,7 +2412,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2431,7 +2431,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2450,7 +2450,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2465,7 +2465,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -2484,7 +2484,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -2503,7 +2503,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -2522,7 +2522,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -2541,7 +2541,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -2560,8 +2560,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -2603,7 +2603,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2622,7 +2622,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2641,7 +2641,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2656,7 +2656,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -2675,7 +2675,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -2694,7 +2694,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -2713,7 +2713,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -2732,7 +2732,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -2751,8 +2751,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -2777,7 +2777,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 26,
"column" : 12,
"source_fragment" : "standard_metadata.egress_spec = hdr.packet_out.egress_port"
@@ -2792,7 +2792,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 27,
"column" : 12,
"source_fragment" : "hdr.packet_out.setInvalid()"
@@ -2878,7 +2878,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 152,
"column" : 12,
"source_fragment" : "spgw_meta.s1u_enb_addr = ipv4.src_addr"
@@ -2897,7 +2897,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 153,
"column" : 12,
"source_fragment" : "spgw_meta.s1u_sgw_addr = ipv4.dst_addr"
@@ -2916,7 +2916,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 154,
"column" : 17,
"source_fragment" : "= gtpu_ipv4; ..."
@@ -2935,7 +2935,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 155,
"column" : 16,
"source_fragment" : "= gtpu_udp; ..."
@@ -2971,7 +2971,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 159,
"column" : 16,
"source_fragment" : "spgw_meta.do_spgw = true"
@@ -2990,8 +2990,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 81,
+ "filename" : "./include/control/../define.p4",
+ "line" : 88,
"column" : 31,
"source_fragment" : "1w0; ..."
}
@@ -3086,7 +3086,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 163,
"column" : 12,
"source_fragment" : "spgw_meta.do_spgw = true"
@@ -3105,8 +3105,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 82,
+ "filename" : "./include/control/../define.p4",
+ "line" : 89,
"column" : 33,
"source_fragment" : "1w1; ..."
}
@@ -3164,7 +3164,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 146,
"column" : 8,
"source_fragment" : "spgw_meta.do_spgw = false"
@@ -3200,7 +3200,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 169,
"column" : 12,
"source_fragment" : "return"
@@ -3286,7 +3286,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 35,
"column" : 31,
"source_fragment" : "0x0800; ..."
@@ -3305,7 +3305,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 35,
"column" : 31,
"source_fragment" : "0x0800; ..."
@@ -3414,7 +3414,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 140,
"column" : 20,
"source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 1"
@@ -3466,7 +3466,7 @@
}
],
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 28,
"column" : 12,
"source_fragment" : "egress_port_counter.count((bit<32>)standard_metadata.egress_spec)"
@@ -3518,7 +3518,7 @@
}
],
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 31,
"column" : 12,
"source_fragment" : "ingress_port_counter.count((bit<32>)standard_metadata.ingress_port)"
@@ -3544,7 +3544,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 162,
"column" : 12,
"source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type"
@@ -3559,7 +3559,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 163,
"column" : 12,
"source_fragment" : "hdr.vlan_tag.setInvalid()"
@@ -3581,7 +3581,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 210,
"column" : 8,
"source_fragment" : "gtpu_ipv4.setValid()"
@@ -3600,10 +3600,10 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 39,
- "column" : 28,
- "source_fragment" : "4; ..."
+ "filename" : "./include/control/../spgw.p4",
+ "line" : 211,
+ "column" : 8,
+ "source_fragment" : "gtpu_ipv4.version = 4"
}
},
{
@@ -3619,8 +3619,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 47,
+ "filename" : "./include/control/../define.p4",
+ "line" : 54,
"column" : 28,
"source_fragment" : "5; ..."
}
@@ -3638,7 +3638,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 213,
"column" : 8,
"source_fragment" : "gtpu_ipv4.diffserv = 0"
@@ -3750,7 +3750,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 214,
"column" : 8,
"source_fragment" : "gtpu_ipv4.total_len = ((bit<16>)std_meta.packet_length ..."
@@ -3769,7 +3769,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 216,
"column" : 8,
"source_fragment" : "gtpu_ipv4.identification = 0x1513"
@@ -3788,7 +3788,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 217,
"column" : 8,
"source_fragment" : "gtpu_ipv4.flags = 0"
@@ -3807,7 +3807,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 218,
"column" : 8,
"source_fragment" : "gtpu_ipv4.frag_offset = 0"
@@ -3826,8 +3826,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 71,
+ "filename" : "./include/control/../define.p4",
+ "line" : 78,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -3845,8 +3845,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 44,
+ "filename" : "./include/control/../define.p4",
+ "line" : 51,
"column" : 25,
"source_fragment" : "17; ..."
}
@@ -3864,7 +3864,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 221,
"column" : 8,
"source_fragment" : "gtpu_ipv4.dst_addr = spgw_meta.s1u_enb_addr"
@@ -3883,7 +3883,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 222,
"column" : 8,
"source_fragment" : "gtpu_ipv4.src_addr = spgw_meta.s1u_sgw_addr"
@@ -3902,7 +3902,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 223,
"column" : 8,
"source_fragment" : "gtpu_ipv4.hdr_checksum = 0"
@@ -3917,7 +3917,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 225,
"column" : 8,
"source_fragment" : "gtpu_udp.setValid()"
@@ -3936,7 +3936,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 226,
"column" : 8,
"source_fragment" : "gtpu_udp.src_port = 2152"
@@ -3955,7 +3955,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 227,
"column" : 8,
"source_fragment" : "gtpu_udp.dst_port = 2152"
@@ -4047,7 +4047,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 228,
"column" : 8,
"source_fragment" : "gtpu_udp.len = ((bit<16>)std_meta.packet_length ..."
@@ -4066,7 +4066,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 230,
"column" : 8,
"source_fragment" : "gtpu_udp.checksum = 0"
@@ -4081,7 +4081,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 232,
"column" : 8,
"source_fragment" : "gtpu.setValid()"
@@ -4100,7 +4100,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 233,
"column" : 8,
"source_fragment" : "gtpu.version = 0x01"
@@ -4119,7 +4119,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 234,
"column" : 8,
"source_fragment" : "gtpu.pt = 0x01"
@@ -4138,7 +4138,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 235,
"column" : 8,
"source_fragment" : "gtpu.spare = 0"
@@ -4157,7 +4157,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 236,
"column" : 8,
"source_fragment" : "gtpu.ex_flag = 0"
@@ -4176,7 +4176,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 237,
"column" : 8,
"source_fragment" : "gtpu.seq_flag = 0"
@@ -4195,7 +4195,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 238,
"column" : 8,
"source_fragment" : "gtpu.npdu_flag = 0"
@@ -4214,7 +4214,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 239,
"column" : 8,
"source_fragment" : "gtpu.msgtype = 0xff"
@@ -4266,7 +4266,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 240,
"column" : 8,
"source_fragment" : "gtpu.msglen = ((bit<16>)std_meta.packet_length - 14"
@@ -4285,7 +4285,7 @@
}
],
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 241,
"column" : 8,
"source_fragment" : "gtpu.teid = spgw_meta.teid"
@@ -4307,7 +4307,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 39,
"column" : 12,
"source_fragment" : "hdr.packet_in.setValid()"
@@ -4326,7 +4326,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 40,
"column" : 12,
"source_fragment" : "hdr.packet_in.ingress_port = standard_metadata.ingress_port"
@@ -4472,7 +4472,7 @@
"name" : "spgw_ingress.s1u_filter_table",
"id" : 3,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 65,
"column" : 10,
"source_fragment" : "s1u_filter_table"
@@ -4577,7 +4577,7 @@
"name" : "spgw_ingress.ue_filter_table",
"id" : 7,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 55,
"column" : 10,
"source_fragment" : "ue_filter_table"
@@ -4728,7 +4728,7 @@
"name" : "spgw_ingress.dl_sess_lookup",
"id" : 13,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 124,
"column" : 10,
"source_fragment" : "dl_sess_lookup"
@@ -4833,7 +4833,7 @@
"name" : "spgw_ingress.ue_cdr_table",
"id" : 17,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 134,
"column" : 10,
"source_fragment" : "ue_cdr_table"
@@ -4869,7 +4869,7 @@
"name" : "filtering.ingress_port_vlan",
"id" : 18,
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 57,
"column" : 10,
"source_fragment" : "ingress_port_vlan"
@@ -4917,7 +4917,7 @@
"name" : "filtering.fwd_classifier",
"id" : 19,
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 76,
"column" : 10,
"source_fragment" : "fwd_classifier"
@@ -4962,7 +4962,7 @@
"name" : "forwarding.bridging",
"id" : 20,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 53,
"column" : 10,
"source_fragment" : "bridging"
@@ -5003,7 +5003,7 @@
"name" : "forwarding.mpls",
"id" : 21,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 65,
"column" : 10,
"source_fragment" : "mpls"
@@ -5062,7 +5062,7 @@
"name" : "forwarding.unicast_v4",
"id" : 23,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 76,
"column" : 10,
"source_fragment" : "unicast_v4"
@@ -5098,7 +5098,7 @@
"name" : "forwarding.multicast_v4",
"id" : 24,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 87,
"column" : 10,
"source_fragment" : "multicast_v4"
@@ -5139,7 +5139,7 @@
"name" : "forwarding.acl",
"id" : 25,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 127,
"column" : 10,
"source_fragment" : "acl"
@@ -5232,7 +5232,7 @@
"name" : "next.simple",
"id" : 26,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 89,
"column" : 10,
"source_fragment" : "simple"
@@ -5337,7 +5337,7 @@
"name" : "next.hashed",
"id" : 30,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 103,
"column" : 10,
"source_fragment" : "hashed"
@@ -5370,7 +5370,7 @@
"name" : "next.broadcast",
"id" : 31,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 126,
"column" : 10,
"source_fragment" : "broadcast"
@@ -5482,11 +5482,11 @@
"input" : [
{
"type" : "field",
- "value" : ["ethernet", "dst_addr"]
+ "value" : ["ipv4", "dst_addr"]
},
{
"type" : "field",
- "value" : ["ethernet", "src_addr"]
+ "value" : ["ipv4", "src_addr"]
},
{
"type" : "field",
@@ -5509,7 +5509,7 @@
"name" : "node_2",
"id" : 0,
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 25,
"column" : 12,
"source_fragment" : "hdr.packet_out.isValid()"
@@ -5532,7 +5532,7 @@
"name" : "node_5",
"id" : 1,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 147,
"column" : 12,
"source_fragment" : "gtpu.isValid()"
@@ -5589,7 +5589,7 @@
"name" : "node_17",
"id" : 4,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 167,
"column" : 12,
"source_fragment" : "!spgw_meta.do_spgw"
@@ -5643,7 +5643,7 @@
"name" : "node_20",
"id" : 6,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 172,
"column" : 12,
"source_fragment" : "spgw_meta.direction == DIR_UPLINK"
@@ -5669,7 +5669,7 @@
"name" : "node_22",
"id" : 7,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 189,
"column" : 12,
"source_fragment" : "spgw_meta.direction == DIR_DOWNLINK"
@@ -5695,7 +5695,7 @@
"name" : "node_26",
"id" : 8,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 190,
"column" : 16,
"source_fragment" : "!dl_sess_lookup.apply().hit"
@@ -5725,7 +5725,7 @@
"name" : "node_31",
"id" : 9,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 157,
"column" : 11,
"source_fragment" : "fabric_metadata.fwd_type == FWD_BRIDGING"
@@ -5751,7 +5751,7 @@
"name" : "node_33",
"id" : 10,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 158,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_MPLS"
@@ -5777,7 +5777,7 @@
"name" : "node_36",
"id" : 11,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 165,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
@@ -5803,7 +5803,7 @@
"name" : "node_38",
"id" : 12,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 166,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
@@ -5846,7 +5846,7 @@
"name" : "node_45",
"id" : 14,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 138,
"column" : 16,
"source_fragment" : "!hdr.mpls.isValid()"
@@ -5876,7 +5876,7 @@
"name" : "node_46",
"id" : 15,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 139,
"column" : 19,
"source_fragment" : "hdr.ipv4.isValid()"
@@ -5899,7 +5899,7 @@
"name" : "node_50",
"id" : 16,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 27,
"column" : 12,
"source_fragment" : "standard_metadata.egress_spec < 511"
@@ -5925,7 +5925,7 @@
"name" : "node_52",
"id" : 17,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 30,
"column" : 12,
"source_fragment" : "standard_metadata.ingress_port < 511"
@@ -5951,7 +5951,7 @@
"name" : "node_54",
"id" : 18,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 161,
"column" : 12,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress"
@@ -6059,7 +6059,7 @@
"name" : "node_58",
"id" : 19,
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 38,
"column" : 12,
"source_fragment" : "standard_metadata.egress_port == 255"
@@ -6085,7 +6085,7 @@
"name" : "node_61",
"id" : 20,
"source_info" : {
- "filename" : "include/spgw.p4",
+ "filename" : "./include/control/../spgw.p4",
"line" : 245,
"column" : 12,
"source_fragment" : "spgw_meta.do_spgw && spgw_meta.direction == DIR_DOWNLINK"
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info
index 73ad2f9..848d0c0 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric-spgw.p4info
@@ -706,7 +706,7 @@
alias: "egress_port_counter"
}
spec {
- unit: PACKETS
+ unit: BOTH
}
size: 511
}
@@ -717,7 +717,7 @@
alias: "ingress_port_counter"
}
spec {
- unit: PACKETS
+ unit: BOTH
}
size: 511
}
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
index 228ff23..afa7f48 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
@@ -254,12 +254,12 @@
"header_union_stacks" : [],
"field_lists" : [],
"errors" : [
- ["NoError", 1],
- ["PacketTooShort", 2],
- ["NoMatch", 3],
- ["StackOutOfBounds", 4],
- ["HeaderTooShort", 5],
- ["ParserTimeout", 6]
+ ["NoError", 0],
+ ["PacketTooShort", 1],
+ ["NoMatch", 2],
+ ["StackOutOfBounds", 3],
+ ["HeaderTooShort", 4],
+ ["ParserTimeout", 5]
],
"enums" : [],
"parsers" : [
@@ -672,7 +672,7 @@
"name" : "deparser",
"id" : 0,
"source_info" : {
- "filename" : "include/parser.p4",
+ "filename" : "./include/parser.p4",
"line" : 164,
"column" : 8,
"source_fragment" : "FabricDeparser"
@@ -746,9 +746,9 @@
"name" : "port_counters_control.egress_port_counter",
"id" : 10,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 23,
- "column" : 38,
+ "column" : 48,
"source_fragment" : "egress_port_counter"
},
"size" : 511,
@@ -758,9 +758,9 @@
"name" : "port_counters_control.ingress_port_counter",
"id" : 11,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 24,
- "column" : 38,
+ "column" : 48,
"source_fragment" : "ingress_port_counter"
},
"size" : 511,
@@ -773,7 +773,7 @@
"name" : "calc",
"id" : 0,
"source_info" : {
- "filename" : "include/checksum.p4",
+ "filename" : "./include/checksum.p4",
"line" : 56,
"column" : 8,
"source_fragment" : "verify_checksum(hdr.ipv4.isValid(), ..."
@@ -830,7 +830,7 @@
"name" : "calc_0",
"id" : 1,
"source_info" : {
- "filename" : "include/checksum.p4",
+ "filename" : "./include/checksum.p4",
"line" : 28,
"column" : 8,
"source_fragment" : "update_checksum(hdr.ipv4.isValid(), ..."
@@ -949,7 +949,7 @@
"op" : "drop",
"parameters" : [],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 31,
"column" : 8,
"source_fragment" : "mark_to_drop()"
@@ -980,7 +980,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 35,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
@@ -1007,7 +1007,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.setValid()"
@@ -1026,7 +1026,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 42,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.cfi = 0"
@@ -1045,7 +1045,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 43,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.pri = 0"
@@ -1064,7 +1064,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 44,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.ether_type = hdr.ethernet.ether_type"
@@ -1083,7 +1083,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 32,
"column" : 31,
"source_fragment" : "0x8100; ..."
@@ -1102,7 +1102,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 35,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id; ..."
@@ -1131,7 +1131,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress = true"
@@ -1162,7 +1162,7 @@
}
],
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 53,
"column" : 8,
"source_fragment" : "fabric_metadata.fwd_type = fwd_type"
@@ -1179,7 +1179,7 @@
"op" : "drop",
"parameters" : [],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 37,
"column" : 8,
"source_fragment" : "mark_to_drop()"
@@ -1210,7 +1210,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1241,7 +1241,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1272,7 +1272,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1303,7 +1303,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 41,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1330,7 +1330,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.mpls.setInvalid()"
@@ -1349,7 +1349,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 46,
"column" : 8,
"source_fragment" : "fabric_metadata.next_id = next_id"
@@ -1375,7 +1375,7 @@
}
],
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 50,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = 255"
@@ -1406,7 +1406,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num"
@@ -1441,7 +1441,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 37,
"column" : 8,
"source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
@@ -1470,7 +1470,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 40,
"column" : 8,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress = false"
@@ -1489,7 +1489,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -1528,7 +1528,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -1547,7 +1547,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -1566,7 +1566,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -1605,7 +1605,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -1624,7 +1624,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -1643,7 +1643,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -1678,7 +1678,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 59,
"column" : 8,
"source_fragment" : "standard_metadata.mcast_grp = gid"
@@ -1697,7 +1697,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -1740,7 +1740,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -1759,7 +1759,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -1778,7 +1778,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -1793,7 +1793,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -1812,7 +1812,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -1831,7 +1831,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -1850,7 +1850,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -1869,7 +1869,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -1888,8 +1888,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -1931,7 +1931,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -1950,7 +1950,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -1969,7 +1969,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -1984,7 +1984,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -2003,7 +2003,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -2022,7 +2022,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -2041,7 +2041,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -2060,7 +2060,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -2079,8 +2079,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -2122,7 +2122,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 45,
"column" : 8,
"source_fragment" : "hdr.ethernet.src_addr = smac; ..."
@@ -2141,7 +2141,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 49,
"column" : 8,
"source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
@@ -2160,7 +2160,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 33,
"column" : 8,
"source_fragment" : "standard_metadata.egress_spec = port_num; ..."
@@ -2175,7 +2175,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 65,
"column" : 8,
"source_fragment" : "hdr.mpls.setValid()"
@@ -2194,7 +2194,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 33,
"column" : 31,
"source_fragment" : "0x8847; ..."
@@ -2213,7 +2213,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 67,
"column" : 8,
"source_fragment" : "hdr.mpls.label = label; ..."
@@ -2232,7 +2232,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 68,
"column" : 8,
"source_fragment" : "hdr.mpls.tc = tc; ..."
@@ -2251,7 +2251,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 69,
"column" : 8,
"source_fragment" : "hdr.mpls.bos = 1w1"
@@ -2270,8 +2270,8 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
- "line" : 60,
+ "filename" : "./include/control/../define.p4",
+ "line" : 67,
"column" : 32,
"source_fragment" : "64; ..."
}
@@ -2296,7 +2296,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 26,
"column" : 12,
"source_fragment" : "standard_metadata.egress_spec = hdr.packet_out.egress_port"
@@ -2311,7 +2311,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 27,
"column" : 12,
"source_fragment" : "hdr.packet_out.setInvalid()"
@@ -2337,7 +2337,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 35,
"column" : 31,
"source_fragment" : "0x0800; ..."
@@ -2356,7 +2356,7 @@
}
],
"source_info" : {
- "filename" : "include/control/../define.p4",
+ "filename" : "./include/control/../define.p4",
"line" : 35,
"column" : 31,
"source_fragment" : "0x0800; ..."
@@ -2465,7 +2465,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 140,
"column" : 20,
"source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 1"
@@ -2517,7 +2517,7 @@
}
],
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 28,
"column" : 12,
"source_fragment" : "egress_port_counter.count((bit<32>)standard_metadata.egress_spec)"
@@ -2569,7 +2569,7 @@
}
],
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 31,
"column" : 12,
"source_fragment" : "ingress_port_counter.count((bit<32>)standard_metadata.ingress_port)"
@@ -2595,7 +2595,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 162,
"column" : 12,
"source_fragment" : "hdr.ethernet.ether_type = hdr.vlan_tag.ether_type"
@@ -2610,7 +2610,7 @@
}
],
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 163,
"column" : 12,
"source_fragment" : "hdr.vlan_tag.setInvalid()"
@@ -2632,7 +2632,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 39,
"column" : 12,
"source_fragment" : "hdr.packet_in.setValid()"
@@ -2651,7 +2651,7 @@
}
],
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 40,
"column" : 12,
"source_fragment" : "hdr.packet_in.ingress_port = standard_metadata.ingress_port"
@@ -2699,7 +2699,7 @@
"name" : "filtering.ingress_port_vlan",
"id" : 1,
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 57,
"column" : 10,
"source_fragment" : "ingress_port_vlan"
@@ -2747,7 +2747,7 @@
"name" : "filtering.fwd_classifier",
"id" : 2,
"source_info" : {
- "filename" : "include/control/filtering.p4",
+ "filename" : "./include/control/filtering.p4",
"line" : 76,
"column" : 10,
"source_fragment" : "fwd_classifier"
@@ -2792,7 +2792,7 @@
"name" : "forwarding.bridging",
"id" : 3,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 53,
"column" : 10,
"source_fragment" : "bridging"
@@ -2833,7 +2833,7 @@
"name" : "forwarding.mpls",
"id" : 4,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 65,
"column" : 10,
"source_fragment" : "mpls"
@@ -2892,7 +2892,7 @@
"name" : "forwarding.unicast_v4",
"id" : 6,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 76,
"column" : 10,
"source_fragment" : "unicast_v4"
@@ -2928,7 +2928,7 @@
"name" : "forwarding.multicast_v4",
"id" : 7,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 87,
"column" : 10,
"source_fragment" : "multicast_v4"
@@ -2969,9 +2969,9 @@
"name" : "forwarding.acl",
"id" : 8,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 127,
- "column" : 10,
+ "column" : 7,
"source_fragment" : "acl"
},
"key" : [
@@ -3062,7 +3062,7 @@
"name" : "next.simple",
"id" : 9,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 89,
"column" : 10,
"source_fragment" : "simple"
@@ -3167,7 +3167,7 @@
"name" : "next.hashed",
"id" : 13,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 103,
"column" : 10,
"source_fragment" : "hashed"
@@ -3200,7 +3200,7 @@
"name" : "next.broadcast",
"id" : 14,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 126,
"column" : 10,
"source_fragment" : "broadcast"
@@ -3312,11 +3312,11 @@
"input" : [
{
"type" : "field",
- "value" : ["ethernet", "dst_addr"]
+ "value" : ["ipv4", "dst_addr"]
},
{
"type" : "field",
- "value" : ["ethernet", "src_addr"]
+ "value" : ["ipv4", "src_addr"]
},
{
"type" : "field",
@@ -3339,7 +3339,7 @@
"name" : "node_2",
"id" : 0,
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 25,
"column" : 12,
"source_fragment" : "hdr.packet_out.isValid()"
@@ -3362,7 +3362,7 @@
"name" : "node_6",
"id" : 1,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 157,
"column" : 11,
"source_fragment" : "fabric_metadata.fwd_type == FWD_BRIDGING"
@@ -3388,7 +3388,7 @@
"name" : "node_8",
"id" : 2,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 158,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_MPLS"
@@ -3414,7 +3414,7 @@
"name" : "node_11",
"id" : 3,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 165,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
@@ -3440,7 +3440,7 @@
"name" : "node_13",
"id" : 4,
"source_info" : {
- "filename" : "include/control/forwarding.p4",
+ "filename" : "./include/control/forwarding.p4",
"line" : 166,
"column" : 17,
"source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
@@ -3483,7 +3483,7 @@
"name" : "node_20",
"id" : 6,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 138,
"column" : 16,
"source_fragment" : "!hdr.mpls.isValid()"
@@ -3513,7 +3513,7 @@
"name" : "node_21",
"id" : 7,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 139,
"column" : 19,
"source_fragment" : "hdr.ipv4.isValid()"
@@ -3536,7 +3536,7 @@
"name" : "node_25",
"id" : 8,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 27,
"column" : 12,
"source_fragment" : "standard_metadata.egress_spec < 511"
@@ -3562,7 +3562,7 @@
"name" : "node_27",
"id" : 9,
"source_info" : {
- "filename" : "include/control/port_counter.p4",
+ "filename" : "./include/control/port_counter.p4",
"line" : 30,
"column" : 12,
"source_fragment" : "standard_metadata.ingress_port < 511"
@@ -3588,7 +3588,7 @@
"name" : "node_29",
"id" : 10,
"source_info" : {
- "filename" : "include/control/next.p4",
+ "filename" : "./include/control/next.p4",
"line" : 161,
"column" : 12,
"source_fragment" : "fabric_metadata.pop_vlan_at_egress"
@@ -3650,7 +3650,7 @@
"name" : "node_33",
"id" : 11,
"source_info" : {
- "filename" : "include/control/packetio.p4",
+ "filename" : "./include/control/packetio.p4",
"line" : 38,
"column" : 12,
"source_fragment" : "standard_metadata.egress_port == 255"
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
index 80e0880..d028872 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
@@ -579,7 +579,7 @@
alias: "egress_port_counter"
}
spec {
- unit: PACKETS
+ unit: BOTH
}
size: 511
}
@@ -590,7 +590,7 @@
alias: "ingress_port_counter"
}
spec {
- unit: PACKETS
+ unit: BOTH
}
size: 511
}
diff --git a/pom.xml b/pom.xml
index 9b68af7..0c2eeb2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,7 +250,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpNotificationMsgVer4.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpNotificationMsgVer4.java
index 355dbed..3857470 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpNotificationMsgVer4.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpNotificationMsgVer4.java
@@ -52,7 +52,7 @@
static final int PACKET_MINIMUM_LENGTH = 2;
static final BgpType MSG_TYPE = BgpType.NOTIFICATION;
static final byte DEFAULT_ERRORSUBCODE = 0;
- static final byte[] MARKER = {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ private static final byte[] MARKER = {(byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff };
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
index 44c5269..61486ed 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/ver4/BgpOpenMsgVer4.java
@@ -77,7 +77,7 @@
public static final byte SAFI = 71;
public static final byte RES = 0;
public static final int FOUR_OCTET_AS_NUM_CAPA_TYPE = 65;
- public static final byte[] MARKER = new byte[]{(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ private static final byte[] MARKER = new byte[]{(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
public static final BgpHeader DEFAULT_OPEN_HEADER = new BgpHeader(MARKER,
diff --git a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
index e9a1f64..acd1c7b 100644
--- a/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
+++ b/protocols/bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java
@@ -129,7 +129,7 @@
cg.add(serverChannel);
log.info("Listening for Peer connection on {}", sa);
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
diff --git a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
index 6deadfd..e8dc9f0 100644
--- a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
+++ b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
@@ -206,7 +206,7 @@
* @param json posted json
* @return list of processes configured
*/
- private List<IsisProcess> getConfig(JsonNode json) throws Exception {
+ private List<IsisProcess> getConfig(JsonNode json) {
List<IsisProcess> isisProcessesList = new ArrayList<>();
JsonNode jsonNodes = json;
if (jsonNodes == null) {
diff --git a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/IsisLspQueueConsumer.java b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/IsisLspQueueConsumer.java
index a43f424..ddee647 100644
--- a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/IsisLspQueueConsumer.java
+++ b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/IsisLspQueueConsumer.java
@@ -82,7 +82,7 @@
*
* @param wrapper LSP wrapper instance
*/
- private void processRefreshLsp(LspWrapper wrapper) throws Exception {
+ private void processRefreshLsp(LspWrapper wrapper) {
if (wrapper.isSelfOriginated()) { //self originated
DefaultIsisInterface isisInterface = (DefaultIsisInterface) wrapper.isisInterface();
Channel channel = isisInterface.channel();
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/IsisMessageReader.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/IsisMessageReader.java
index c1d5f81..09cac03 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/IsisMessageReader.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/IsisMessageReader.java
@@ -105,7 +105,7 @@
* @return ISIS header
* @throws Exception
*/
- private IsisHeader getIsisHeader(ChannelBuffer channelBuffer) throws Exception {
+ private IsisHeader getIsisHeader(ChannelBuffer channelBuffer) {
IsisHeader isisHeader = new IsisHeader();
isisHeader.setIrpDiscriminator(channelBuffer.readByte());
diff --git a/protocols/lisp/ctl/pom.xml b/protocols/lisp/ctl/pom.xml
index 28af7cf..523e3cf 100644
--- a/protocols/lisp/ctl/pom.xml
+++ b/protocols/lisp/ctl/pom.xml
@@ -71,7 +71,6 @@
<dependency>
<groupId>com.googlecode.concurrent-trees</groupId>
<artifactId>concurrent-trees</artifactId>
- <version>2.6.0</version>
</dependency>
</dependencies>
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerBootstrap.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerBootstrap.java
index 9b05097..8e6bcf9 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerBootstrap.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/impl/LispControllerBootstrap.java
@@ -70,8 +70,8 @@
f.sync();
}
- } catch (Exception e) {
- throw new RuntimeException(e);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
}
}
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/authentication/LispMacAuthentication.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/authentication/LispMacAuthentication.java
index a6af0b6..20a2f2a 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/authentication/LispMacAuthentication.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/authentication/LispMacAuthentication.java
@@ -75,10 +75,10 @@
return mac.doFinal(data);
} catch (NoSuchAlgorithmException e) {
log.warn(NOT_SUPPORT_ALGORITHM_MSG, algorithm, e.getMessage());
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
} catch (InvalidKeyException e) {
log.warn(INVALID_KEY_MSG, key, e.getMessage());
- throw new RuntimeException(e);
+ throw new IllegalArgumentException(e);
}
}
}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java
index a11af4e..e80e214 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfStreamThread.java
@@ -293,7 +293,7 @@
}
} catch (IOException e) {
log.warn("Error in reading from the session for device {} ", netconfDeviceInfo, e);
- throw new RuntimeException(new NetconfException("Error in reading from the session for device {}" +
+ throw new IllegalStateException(new NetconfException("Error in reading from the session for device {}" +
netconfDeviceInfo, e));
//TODO should we send a socket closed message to listeners ?
}
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
index 24a51b6..3b38f48 100644
--- a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
@@ -327,7 +327,7 @@
this.agent.transitionToMasterSwitch(dpid);
synchronized (messagesPendingMastership) {
List<OFMessage> messages = messagesPendingMastership.get();
- if (messages != null) {
+ if (messages != null && !messages.isEmpty()) {
// Cannot use sendMsg here. It will only append to pending list.
sendMsgsOnChannel(messages);
log.debug("Sending {} pending messages to switch {}",
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
index 99f47f8..578dae0 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/Controller.java
@@ -18,7 +18,6 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
-
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
@@ -29,7 +28,6 @@
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.util.concurrent.GlobalEventExecutor;
-
import org.onlab.util.ItemNotFoundException;
import org.onosproject.net.DeviceId;
import org.onosproject.net.driver.DefaultDriverData;
@@ -50,9 +48,15 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import java.io.FileInputStream;
+import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
+import java.security.KeyManagementException;
import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.List;
@@ -147,7 +151,6 @@
*/
public void run() {
- try {
final ServerBootstrap bootstrap = createServerBootStrap();
bootstrap.option(ChannelOption.SO_REUSEADDR, true);
bootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);
@@ -164,10 +167,6 @@
log.info("Listening for switch connections on {}", port);
});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
}
private ServerBootstrap createServerBootStrap() {
@@ -236,13 +235,9 @@
cg = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
- try {
- getTlsParameters();
- if (enableOfTls) {
- initSsl();
- }
- } catch (Exception ex) {
- log.error("SSL init failed: {}", ex.getMessage());
+ getTlsParameters();
+ if (enableOfTls) {
+ initSsl();
}
}
@@ -274,19 +269,24 @@
}
}
- private void initSsl() throws Exception {
- TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- KeyStore ts = KeyStore.getInstance("JKS");
- ts.load(new FileInputStream(tsLocation), tsPwd);
- tmFactory.init(ts);
+ private void initSsl() {
+ try {
+ TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ KeyStore ts = KeyStore.getInstance("JKS");
+ ts.load(new FileInputStream(tsLocation), tsPwd);
+ tmFactory.init(ts);
- KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(new FileInputStream(ksLocation), ksPwd);
- kmf.init(ks, ksPwd);
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(new FileInputStream(ksLocation), ksPwd);
+ kmf.init(ks, ksPwd);
- sslContext = SSLContext.getInstance("TLS");
- sslContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
+ sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(kmf.getKeyManagers(), tmFactory.getTrustManagers(), null);
+ } catch (NoSuchAlgorithmException | KeyStoreException | CertificateException |
+ IOException | KeyManagementException | UnrecoverableKeyException ex) {
+ log.error("SSL init failed: {}", ex.getMessage());
+ }
}
// **************
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
index 414bd89..a9455b6 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
@@ -1357,9 +1357,9 @@
return getSwitchInfoString();
}
- protected void channelIdle(ChannelHandlerContext ctx,
+ private void channelIdle(ChannelHandlerContext ctx,
IdleStateEvent e)
- throws Exception {
+ throws IOException {
OFMessage m = factory.buildEchoRequest().build();
log.debug("Sending Echo Request on idle channel: {}",
ctx.channel());
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFMessageEncoder.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFMessageEncoder.java
index 4c875ac..c541a9b 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFMessageEncoder.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFMessageEncoder.java
@@ -56,7 +56,7 @@
@Override
public void write(ChannelHandlerContext ctx,
Object msg,
- ChannelPromise promise) throws Exception {
+ ChannelPromise promise) {
ByteBuf buf = null;
try {
diff --git a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfArea.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfArea.java
index 64cf9a7..a66160d 100644
--- a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfArea.java
+++ b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfArea.java
@@ -145,9 +145,8 @@
* with a new sequence number.
*
* @param ospfInterface interface instance
- * @throws Exception might throw exception
*/
- void refreshArea(OspfInterface ospfInterface) throws Exception;
+ void refreshArea(OspfInterface ospfInterface);
/**
* Verifies no neighbor is in exchange process.
@@ -191,10 +190,8 @@
* @param ospfLsa LSA instance
* @param isSelfOriginated true if the LSA is self originated else false
* @param ospfInterface interface instance
- * @throws Exception might throws exception
*/
- void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface)
- throws Exception;
+ void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface);
/**
* Adds the received LSA to LSDB,this method creates an LSA wrapper for the LSA.
@@ -202,9 +199,8 @@
*
* @param ospfLsa LSA instance
* @param ospfInterface interface instance
- * @throws Exception might throws exception
*/
- void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface) throws Exception;
+ void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface);
/**
* Sets router sequence number for router LSA.
@@ -229,8 +225,7 @@
* @param linkStateID link state id to form the key
* @param advertisingRouter advertising router to form the key
* @return LSA wrapper instance which contains the LSA
- * @throws Exception might throws exception
*/
- LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter) throws Exception;
+ LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter);
}
\ No newline at end of file
diff --git a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfInterface.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfInterface.java
index 0e9f4d0..1c05ad5 100644
--- a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfInterface.java
+++ b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfInterface.java
@@ -243,16 +243,13 @@
*
* @param ospfMessage received OSPF message
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
*/
- void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception;
+ void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx);
/**
* Represents an interface is up and connected.
- *
- * @throws Exception might throws exception
*/
- void interfaceUp() throws Exception;
+ void interfaceUp();
/**
* Starts the timer which waits for configured seconds and sends Delayed Ack Packet.
diff --git a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfMessage.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfMessage.java
index 9949146..460457f 100644
--- a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfMessage.java
+++ b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfMessage.java
@@ -17,6 +17,7 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
+import org.onosproject.ospf.exceptions.OspfParseException;
/**
* Representation of an OSPF message.
@@ -48,9 +49,9 @@
* Reads from ChannelBuffer and initializes the type of LSA.
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
- void readFrom(ChannelBuffer channelBuffer) throws Exception;
+ void readFrom(ChannelBuffer channelBuffer) throws OspfParseException;
/**
* Returns OSPFMessage as byte array.
diff --git a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfNbr.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfNbr.java
index 2d7121c..9a62fad 100644
--- a/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfNbr.java
+++ b/protocols/ospf/api/src/main/java/org/onosproject/ospf/controller/OspfNbr.java
@@ -158,9 +158,8 @@
* retransmission timer.
*
* @param ch netty channel instance
- * @throws Exception might throw exception
*/
- void badLSReq(Channel ch) throws Exception;
+ void badLSReq(Channel ch);
/**
* Gets the LS request list.
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/exceptions/OspfParseException.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/exceptions/OspfParseException.java
similarity index 100%
rename from protocols/ospf/protocol/src/main/java/org/onosproject/ospf/exceptions/OspfParseException.java
rename to protocols/ospf/api/src/main/java/org/onosproject/ospf/exceptions/OspfParseException.java
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/trafficcontrol/package-info.java b/protocols/ospf/api/src/main/java/org/onosproject/ospf/exceptions/package-info.java
similarity index 76%
rename from core/api/src/test/java/org/onosproject/net/behaviour/trafficcontrol/package-info.java
rename to protocols/ospf/api/src/main/java/org/onosproject/ospf/exceptions/package-info.java
index 63c5f92..db2cc81 100644
--- a/core/api/src/test/java/org/onosproject/net/behaviour/trafficcontrol/package-info.java
+++ b/protocols/ospf/api/src/main/java/org/onosproject/ospf/exceptions/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-present Open Networking Foundation
+ * Copyright 2016-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,6 @@
*/
/**
- * Test class for traffic control behaviors and related classes.
+ * Implementation of the OSPF exception types.
*/
-package org.onosproject.net.behaviour.trafficcontrol;
+package org.onosproject.ospf.exceptions;
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaImpl.java
index b598d86..7a74637 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaImpl.java
@@ -29,6 +29,7 @@
import org.onosproject.ospf.controller.OspfNeighborState;
import org.onosproject.ospf.controller.impl.OspfNbrImpl;
import org.onosproject.ospf.controller.lsdb.OspfLsdbImpl;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.LsaHeader;
import org.onosproject.ospf.protocol.lsa.subtypes.OspfLsaLink;
import org.onosproject.ospf.protocol.lsa.types.NetworkLsa;
@@ -41,6 +42,7 @@
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -203,9 +205,9 @@
* @param interfaceIp interface IP address
* @param mask interface network mask
* @return NetworkLsa instance
- * @throws Exception might throws exception
+ * @throws OspfParseException might throws exception
*/
- public NetworkLsa buildNetworkLsa(Ip4Address interfaceIp, Ip4Address mask) throws Exception {
+ public NetworkLsa buildNetworkLsa(Ip4Address interfaceIp, Ip4Address mask) throws OspfParseException {
// generate the Router-LSA for this Area.
NetworkLsa networkLsa = new NetworkLsa();
networkLsa.setAdvertisingRouter(routerId);
@@ -254,9 +256,9 @@
*
* @param ospfInterface Interface instance
* @return routerLsa Router LSA instance
- * @throws Exception might throws exception
+ * @throws OspfParseException might throws exception
*/
- public RouterLsa buildRouterLsa(OspfInterface ospfInterface) throws Exception {
+ public RouterLsa buildRouterLsa(OspfInterface ospfInterface) throws OspfParseException {
// generate the Router-LSA for this Area.
RouterLsa routerLsa = new RouterLsa();
routerLsa.setAdvertisingRouter(routerId);
@@ -480,17 +482,22 @@
* @param linkStateID link state id to form the key
* @param advertisingRouter advertising router to form the key
* @return lsa wrapper instance which contains the Lsa
- * @throws Exception might throws exception
*/
- public LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter) throws Exception {
+ public LsaWrapper getLsa(int lsType, String linkStateID, String advertisingRouter) {
String lsaKey = lsType + "-" + linkStateID + "-" + advertisingRouter;
if (lsType == OspfParameters.LINK_LOCAL_OPAQUE_LSA || lsType == OspfParameters.AREA_LOCAL_OPAQUE_LSA ||
lsType == OspfParameters.AS_OPAQUE_LSA) {
- byte[] linkStateAsBytes = InetAddress.getByName(linkStateID).getAddress();
- int opaqueType = linkStateAsBytes[0];
- int opaqueId = OspfUtil.byteToInteger(Arrays.copyOfRange(linkStateAsBytes, 1,
+ try {
+ byte[] linkStateAsBytes = InetAddress.getByName(linkStateID).getAddress();
+
+ int opaqueType = linkStateAsBytes[0];
+ int opaqueId = OspfUtil.byteToInteger(Arrays.copyOfRange(linkStateAsBytes, 1,
linkStateAsBytes.length));
- lsaKey = lsType + "-" + opaqueType + opaqueId + "-" + advertisingRouter;
+ lsaKey = lsType + "-" + opaqueType + opaqueId + "-" + advertisingRouter;
+ } catch (UnknownHostException uhe) {
+ log.warn("Can't resolve host in Lsa wrapper", uhe);
+ return null;
+ }
}
return database.findLsa(lsType, lsaKey);
}
@@ -524,9 +531,8 @@
*
* @param ospfLsa OSPF LSA instance
* @param ospfInterface OSPF interface instance
- * @throws Exception on error
*/
- public void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface) throws Exception {
+ public void addLsa(OspfLsa ospfLsa, OspfInterface ospfInterface) {
//second param is false as lsa from network
database.addLsa((LsaHeader) ospfLsa, false, ospfInterface);
}
@@ -537,10 +543,8 @@
* @param ospfLsa OSPF LSA instance
* @param isSelfOriginated true if the LSA is self originated. Else false
* @param ospfInterface OSPF interface instance
- * @throws Exception on error
*/
- public void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface)
- throws Exception {
+ public void addLsa(OspfLsa ospfLsa, boolean isSelfOriginated, OspfInterface ospfInterface) {
database.addLsa((LsaHeader) ospfLsa, isSelfOriginated, ospfInterface);
}
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
index 7c1626b..be503c2 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
@@ -40,6 +40,7 @@
import org.onosproject.ospf.controller.lsdb.OspfLsdbImpl;
import org.onosproject.ospf.controller.util.OspfEligibleRouter;
import org.onosproject.ospf.controller.util.OspfInterfaceType;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.LsaHeader;
import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
import org.onosproject.ospf.protocol.ospfpacket.OspfMessageWriter;
@@ -517,11 +518,9 @@
/**
* Represents an interface is up and connected.
- *
- * @throws Exception might throws exception
*/
@Override
- public void interfaceUp() throws Exception {
+ public void interfaceUp() {
log.debug("OSPFInterfaceChannelHandler::interfaceUp...!!!");
if (interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) {
setState(OspfInterfaceState.POINT2POINT);
@@ -552,9 +551,8 @@
* Gets called when a BDR was detected before the wait timer expired.
*
* @param ch channel instance
- * @throws Exception might throws exception
*/
- public void backupSeen(Channel ch) throws Exception {
+ public void backupSeen(Channel ch) {
log.debug("OSPFInterfaceChannelHandler::backupSeen ");
if (state() == OspfInterfaceState.WAITING) {
electRouter(ch);
@@ -565,9 +563,8 @@
* Gets called when no hello message received for particular period.
*
* @param ch channel instance
- * @throws Exception might throws exception
*/
- public void waitTimer(Channel ch) throws Exception {
+ public void waitTimer(Channel ch) {
log.debug("OSPFInterfaceChannelHandler::waitTimer ");
//According to RFC-2328 section 9.4
if (state() == OspfInterfaceState.WAITING) {
@@ -579,9 +576,8 @@
* Initiates DR election process.
*
* @param ch netty channel instance
- * @throws Exception might throws exception
*/
- public void callDrElection(Channel ch) throws Exception {
+ public void callDrElection(Channel ch) {
log.debug("OSPFInterfaceChannelHandler::callDrElection ");
//call when timer expired
//no hello message received for particular interval
@@ -592,10 +588,8 @@
/**
* Neighbor change event is triggered when the router priority gets changed.
- *
- * @throws Exception might throws exception
*/
- public void neighborChange() throws Exception {
+ public void neighborChange() {
log.debug("OSPFInterfaceChannelHandler::neighborChange ");
if (state() == OspfInterfaceState.DR || state() == OspfInterfaceState.BDR ||
state() == OspfInterfaceState.DROTHER) {
@@ -623,35 +617,38 @@
*
* @param ospfMessage received OSPF message
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
*/
@Override
- public void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ public void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) {
log.debug("OspfChannelHandler::processOspfMessage...!!!");
if (!validateMessage(ospfMessage)) {
return;
}
- switch (ospfMessage.ospfMessageType().value()) {
- case OspfParameters.HELLO:
- processHelloMessage(ospfMessage, ctx);
- break;
- case OspfParameters.DD:
- processDdMessage(ospfMessage, ctx);
- break;
- case OspfParameters.LSREQUEST:
- processLsRequestMessage(ospfMessage, ctx);
- break;
- case OspfParameters.LSUPDATE:
- processLsUpdateMessage(ospfMessage, ctx);
- break;
- case OspfParameters.LSACK:
- processLsAckMessage(ospfMessage, ctx);
- break;
- default:
- log.debug("Unknown packet to process...!!!");
- break;
+ try {
+ switch (ospfMessage.ospfMessageType().value()) {
+ case OspfParameters.HELLO:
+ processHelloMessage(ospfMessage, ctx);
+ break;
+ case OspfParameters.DD:
+ processDdMessage(ospfMessage, ctx);
+ break;
+ case OspfParameters.LSREQUEST:
+ processLsRequestMessage(ospfMessage, ctx);
+ break;
+ case OspfParameters.LSUPDATE:
+ processLsUpdateMessage(ospfMessage, ctx);
+ break;
+ case OspfParameters.LSACK:
+ processLsAckMessage(ospfMessage, ctx);
+ break;
+ default:
+ log.debug("Unknown packet to process...!!!");
+ break;
+ }
+ } catch (OspfParseException ope) {
+ log.debug("Error parsing packet", ope);
}
}
@@ -660,9 +657,8 @@
*
* @param ospfMessage OSPF message.
* @return true if it is a valid else false.
- * @throws Exception might throws exception
*/
- private boolean validateMessage(OspfMessage ospfMessage) throws Exception {
+ private boolean validateMessage(OspfMessage ospfMessage) {
boolean isValid = true;
OspfPacketHeader header = (OspfPacketHeader) ospfMessage;
@@ -688,7 +684,7 @@
}
//According to RFC-2328 (8.2)
- /**
+ /*
* ABR should receive packets from backbone 0.0.0.0 as we are not acting as ABR
* we are rejecting the packet.
*/
@@ -715,9 +711,8 @@
*
* @param ospfMessage OSPF message instance.
* @param ctx context instance.
- * @throws Exception might throws exception
*/
- void processHelloMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ void processHelloMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) {
Channel channel = ctx.getChannel();
log.debug("OspfChannelHandler::processHelloMessage...!!!");
HelloPacket helloPacket = (HelloPacket) ospfMessage;
@@ -902,9 +897,8 @@
*
* @param ospfMessage OSPF message instance.
* @param ctx channel handler context instance
- * @throws Exception might throws exception
*/
- void processDdMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ void processDdMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) {
log.debug("OspfChannelHandler::processDdMessage...!!!");
Channel channel = ctx.getChannel();
DdPacket ddPacket = (DdPacket) ospfMessage;
@@ -1075,9 +1069,8 @@
*
* @param ospfMessage OSPF message instance.
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
*/
- void processLsRequestMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ void processLsRequestMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) {
log.debug("OspfChannelHandler::processLsRequestMessage...!!!");
Channel channel = ctx.getChannel();
LsRequest lsrPacket = (LsRequest) ospfMessage;
@@ -1114,18 +1107,20 @@
// to verify length of the LSA
LsaWrapper wrapper = ospfArea.getLsa(lsRequest.lsType(), lsRequest.linkStateId(),
lsRequest.ownRouterId());
- OspfLsa ospflsa = wrapper.ospfLsa();
- if ((currentLength + ((LsaWrapperImpl) wrapper).lsaHeader().lsPacketLen()) >= maxSize) {
- listItr.previous();
- break;
- }
- if (ospflsa != null) {
- lsupdate.addLsa(ospflsa);
- noLsa++;
+ if (wrapper != null) {
+ OspfLsa ospflsa = wrapper.ospfLsa();
+ if ((currentLength + ((LsaWrapperImpl) wrapper).lsaHeader().lsPacketLen()) >= maxSize) {
+ listItr.previous();
+ break;
+ }
+ if (ospflsa != null) {
+ lsupdate.addLsa(ospflsa);
+ noLsa++;
- currentLength = currentLength + ((LsaWrapperImpl) wrapper).lsaHeader().lsPacketLen();
- } else {
- nbr.badLSReq(channel);
+ currentLength = currentLength + ((LsaWrapperImpl) wrapper).lsaHeader().lsPacketLen();
+ } else {
+ nbr.badLSReq(channel);
+ }
}
}
lsupdate.setNumberOfLsa(noLsa);
@@ -1149,9 +1144,9 @@
*
* @param ospfMessage OSPF message instance.
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
+ * @throws OspfParseException on parsing error
*/
- void processLsUpdateMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ void processLsUpdateMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws OspfParseException {
log.debug("OspfChannelHandler::processLsUpdateMessage");
LsUpdate lsUpdate = (LsUpdate) ospfMessage;
String neighbourId = lsUpdate.routerId().toString();
@@ -1182,9 +1177,8 @@
*
* @param ospfMessage OSPF message instance.
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
*/
- void processLsAckMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ void processLsAckMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) {
log.debug("OspfChannelHandler::processLsAckMessage");
LsAcknowledge lsAckPacket = (LsAcknowledge) ospfMessage;
//check it is present in listOfNeighbors
@@ -1307,9 +1301,8 @@
* Performs DR election.
*
* @param ch Netty Channel instance.
- * @throws Exception might throws exception
*/
- public void electRouter(Channel ch) throws Exception {
+ public void electRouter(Channel ch) {
Ip4Address currentDr = dr();
Ip4Address currentBdr = bdr();
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/Controller.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/Controller.java
index 3816806..8e8e5f3 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/Controller.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/Controller.java
@@ -78,9 +78,8 @@
* Updates the processes configuration.
*
* @param ospfProcesses list of OSPF process instances
- * @throws Exception might throws parse exception
*/
- public void updateConfig(List<OspfProcess> ospfProcesses) throws Exception {
+ public void updateConfig(List<OspfProcess> ospfProcesses) {
log.debug("Controller::UpdateConfig called");
configPacket = new byte[OspfUtil.CONFIG_LENGTH];
byte numberOfInterface = 0; // number of interfaces to configure
@@ -343,7 +342,7 @@
try {
peerBootstrap.connect(connectToSocket).addListener(new ChannelFutureListener() {
@Override
- public void operationComplete(ChannelFuture future) throws Exception {
+ public void operationComplete(ChannelFuture future) {
if (!future.isSuccess()) {
connectRetryCounter++;
log.error("Connection failed, ConnectRetryCounter {} remote host {}", connectRetryCounter,
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandler.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandler.java
index 1a47a0c..5ac63b1 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandler.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandler.java
@@ -69,10 +69,8 @@
/**
* Initializes the interface map with interface details.
- *
- * @throws Exception might throws exception
*/
- public void initializeInterfaceMap() throws Exception {
+ public void initializeInterfaceMap() {
for (OspfProcess process : processes) {
for (OspfArea area : process.areas()) {
for (OspfInterface ospfInterface : area.ospfInterfaceList()) {
@@ -99,9 +97,8 @@
* Updates the interface map with interface details.
*
* @param ospfProcesses updated process instances
- * @throws Exception might throws exception
*/
- public void updateInterfaceMap(List<OspfProcess> ospfProcesses) throws Exception {
+ public void updateInterfaceMap(List<OspfProcess> ospfProcesses) {
for (OspfProcess ospfUpdatedProcess : ospfProcesses) {
for (OspfArea updatedArea : ospfUpdatedProcess.areas()) {
for (OspfInterface ospfUpdatedInterface : updatedArea.ospfInterfaceList()) {
@@ -152,7 +149,7 @@
/**
* Initialize channel, start hello sender and initialize LSDB.
*/
- private void initialize() throws Exception {
+ private void initialize() {
log.debug("OspfChannelHandler initialize..!!!");
if (configPacket != null) {
log.debug("OspfChannelHandler initialize -> sentConfig packet of length ::"
@@ -163,7 +160,7 @@
}
@Override
- public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt) throws Exception {
+ public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent evt) {
log.info("OSPF channelConnected from {}", evt.getChannel().getRemoteAddress());
this.channel = evt.getChannel();
initialize();
@@ -187,8 +184,7 @@
}
@Override
- public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent
- e) throws Exception {
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
log.debug("[exceptionCaught]: " + e.toString());
if (e.getCause() instanceof ReadTimeoutException) {
log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress());
@@ -213,8 +209,7 @@
}
@Override
- public void messageReceived(ChannelHandlerContext ctx, MessageEvent
- e) throws Exception {
+ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
log.debug("OspfChannelHandler::messageReceived...!!!");
Object message = e.getMessage();
if (message instanceof List) {
@@ -239,10 +234,9 @@
*
* @param ospfMessage received OSPF message
* @param ctx channel handler context instance.
- * @throws Exception might throws exception
*/
- public void processOspfMessage(OspfMessage
- ospfMessage, ChannelHandlerContext ctx) throws Exception {
+ private void processOspfMessage(OspfMessage
+ ospfMessage, ChannelHandlerContext ctx) {
log.debug("OspfChannelHandler::processOspfMessage...!!!");
int interfaceIndex = ospfMessage.interfaceIndex();
OspfInterface ospfInterface = ospfInterfaceMap.get(interfaceIndex);
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java
index 621ebc3..0446e09 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageDecoder.java
@@ -21,6 +21,7 @@
import org.jboss.netty.handler.codec.frame.FrameDecoder;
import org.onlab.packet.Ip4Address;
import org.onosproject.ospf.controller.OspfMessage;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.ospfpacket.OspfMessageReader;
import org.onosproject.ospf.protocol.util.OspfUtil;
import org.slf4j.Logger;
@@ -37,7 +38,8 @@
private static final Logger log = LoggerFactory.getLogger(OspfMessageDecoder.class);
@Override
- protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
+ protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer)
+ throws OspfParseException {
log.debug("OspfMessageDecoder::Message received <:> length {}", buffer.readableBytes());
if (!channel.isConnected()) {
log.info("Channel is not connected.");
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageEncoder.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageEncoder.java
index 98b6a6d..c457725 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageEncoder.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfMessageEncoder.java
@@ -32,7 +32,7 @@
private static final Logger log = LoggerFactory.getLogger(OspfMessageEncoder.class);
@Override
- protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
+ protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) {
byte[] byteMsg = (byte[]) msg;
log.debug("Encoding ospfMessage of length {}", byteMsg.length);
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfNbrImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfNbrImpl.java
index ff3f75b..0f7a91c 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfNbrImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfNbrImpl.java
@@ -38,6 +38,7 @@
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
import org.onosproject.ospf.controller.lsdb.LsaWrapperImpl;
import org.onosproject.ospf.controller.util.OspfInterfaceType;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.LsaHeader;
import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
import org.onosproject.ospf.protocol.lsa.types.OpaqueLsa10;
@@ -144,23 +145,23 @@
/**
* The list of LSAs that have to be flooded.
*/
- private Map<String, OspfLsa> reTxList = new LinkedHashMap();
+ private Map<String, OspfLsa> reTxList = new LinkedHashMap<>();
/**
* The list of LSAs that have been flooded but not yet acknowledged on this adjacency.
*/
- private Map<String, OspfLsa> pendingReTxList = new LinkedHashMap();
+ private Map<String, OspfLsa> pendingReTxList = new LinkedHashMap<>();
/**
* List of LSAs which are failed to received ACK.
*/
- private Map failedTxList = new HashMap();
+ private Map failedTxList = new HashMap<>();
/**
* The complete list of LSAs that make up the area link-state database, at the moment the.
* neighbor goes into Database Exchange state (EXCHANGE).
*/
- private List<LsaHeader> ddSummaryList = new CopyOnWriteArrayList();
+ private List<LsaHeader> ddSummaryList = new CopyOnWriteArrayList<>();
/**
* LSA Request List from Neighbor.
@@ -283,9 +284,8 @@
*
* @param ospfMessage ospf message instance
* @param channel netty channel instance
- * @throws Exception might throws exception
*/
- public void twoWayReceived(OspfMessage ospfMessage, Channel channel) throws Exception {
+ public void twoWayReceived(OspfMessage ospfMessage, Channel channel) {
log.debug("OSPFNbr::twoWayReceived...!!!");
stopInactivityTimeCheck();
startInactivityTimeCheck();
@@ -367,10 +367,9 @@
* @param neighborIsMaster neighbor is master or slave
* @param payload contains the LSAs to add in Dd Packet
* @param ch netty channel instance
- * @throws Exception might throws exception
*/
public void negotiationDone(OspfMessage ospfMessage,
- boolean neighborIsMaster, List payload, Channel ch) throws Exception {
+ boolean neighborIsMaster, List payload, Channel ch) {
stopRxMtDdTimer();
OspfPacketHeader packet = (OspfPacketHeader) ospfMessage;
DdPacket ddPacketForCheck = (DdPacket) packet;
@@ -461,9 +460,8 @@
* Process the LSA Headers received in the last received Database Description OSPFMessage.
*
* @param ddPayload LSA headers to process
- * @throws Exception might throws exception
*/
- public void processLsas(List ddPayload) throws Exception {
+ public void processLsas(List ddPayload) {
log.debug("OSPFNbr::processLsas...!!!");
OspfLsa nextLsa;
Iterator lsas = ddPayload.iterator();
@@ -503,9 +501,8 @@
*
* @param reason a string represents the mismatch reason
* @return OSPF message instance
- * @throws Exception might throws exception
*/
- public OspfMessage seqNumMismatch(String reason) throws Exception {
+ public OspfMessage seqNumMismatch(String reason) {
log.debug("OSPFNbr::seqNumMismatch...{} ", reason);
stopRxMtDdTimer();
@@ -560,10 +557,9 @@
* In addition, stop the possibly activated re transmission timer.
*
* @param ch netty channel instance
- * @throws Exception on error
*/
@Override
- public void badLSReq(Channel ch) throws Exception {
+ public void badLSReq(Channel ch) {
log.debug("OSPFNbr::badLSReq...!!!");
if (state.getValue() >= OspfNeighborState.EXCHANGE.getValue()) {
@@ -622,10 +618,9 @@
* @param neighborIsMaster true if neighbor is master else false
* @param dataDescPkt DdPacket instance
* @param ch netty channel instance
- * @throws Exception might throws exception
*/
public void processDdPacket(boolean neighborIsMaster, DdPacket dataDescPkt,
- Channel ch) throws Exception {
+ Channel ch) {
log.debug("OSPFNbr::neighborIsMaster.{}", neighborIsMaster);
if (!neighborIsMaster) {
@@ -902,9 +897,9 @@
* @param lsUpdPkt LS Update Packet received while Neighbor state was EXCHANGE or
* LOADING
* @param ch netty channel instance
- * @throws Exception might throws exception
+ * @throws OspfParseException on parsing error
*/
- public void processLsUpdate(LsUpdate lsUpdPkt, Channel ch) throws Exception {
+ public void processLsUpdate(LsUpdate lsUpdPkt, Channel ch) throws OspfParseException {
stopRxMtLsrTimer();
log.debug("OSPFNbr::processLsUpdate...!!!");
@@ -946,10 +941,8 @@
/***
* Method gets called when no more ls request list and moving to FULL State.
- *
- * @throws Exception might throws exception
*/
- public void loadingDone() throws Exception {
+ public void loadingDone() {
stopRxMtLsrTimer();
stopRxMtDdTimer();
log.debug("OSPFNbr::loadingDone...!!!");
@@ -1051,12 +1044,12 @@
* @param receivedViaFlooding received via flooding or not
* @param ch channel instance
* @param sourceIp source of this Lsa
+ * @throws OspfParseException on parsing error
* @return true to remove it from lsReqList else false
- * @throws Exception might throws exception
*/
public boolean processReceivedLsa(LsaHeader recLsa,
boolean receivedViaFlooding, Channel ch, Ip4Address sourceIp)
- throws Exception {
+ throws OspfParseException {
log.debug("OSPFNbr::processReceivedLsa(recLsa, receivedViaFlooding, ch)...!!!");
//Validate the lsa checksum RFC 2328 13 (1)
@@ -1282,10 +1275,8 @@
/**
* RFC 2328 section 13.4
* Processing self-originated LSAs.
- *
- * @throws Exception might throws exception
*/
- public void processSelfOriginatedLsa() throws Exception {
+ public void processSelfOriginatedLsa() {
ospfArea.refreshArea(ospfInterface);
}
@@ -1349,10 +1340,8 @@
/**
* Called when neighbor is down.
- *
- * @throws Exception might throws exception
*/
- public void neighborDown() throws Exception {
+ public void neighborDown() {
log.debug("Neighbor Down {} and NeighborId {}", neighborIpAddr,
neighborId);
stopInactivityTimeCheck();
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfPipelineFactory.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfPipelineFactory.java
index cb1829a..f98f54c 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfPipelineFactory.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfPipelineFactory.java
@@ -35,7 +35,7 @@
}
@Override
- public ChannelPipeline getPipeline() throws Exception {
+ public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("encoder", new OspfMessageDecoder());
pipeline.addLast("decoder", new OspfMessageEncoder());
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/TopologyForDeviceAndLinkImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/TopologyForDeviceAndLinkImpl.java
index 1aae861..710e6a8 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/TopologyForDeviceAndLinkImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/TopologyForDeviceAndLinkImpl.java
@@ -608,7 +608,7 @@
for (OspfLsaLink link : ospfLsaLinkList) {
if (link.linkType() == 1 || link.linkType() == 2) {
if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) ||
- (link.equals(ospfArea.routerId()))) {
+ (link.linkId().equals(ospfArea.routerId().toString()))) {
log.debug("OspfInterface information will not display in web ");
} else {
String key = routerLsa.advertisingRouter() + "-" + link.linkData();
@@ -643,7 +643,7 @@
for (OspfLsaLink link : ospfLsaLinkList) {
if (link.linkType() == 1 || link.linkType() == 2) {
if ((routerLsa.advertisingRouter().equals(ospfArea.routerId())) ||
- (link.equals(ospfArea.routerId()))) {
+ (link.linkId().equals(ospfArea.routerId().toString()))) {
log.debug("OspfInterface information will not display in web ");
} else {
String key = routerLsa.advertisingRouter() + "-" + link.linkData();
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumer.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumer.java
index 02a4fb1..94d232c 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumer.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumer.java
@@ -22,6 +22,7 @@
import org.onosproject.ospf.controller.OspfLsaType;
import org.onosproject.ospf.controller.area.OspfAreaImpl;
import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.LsaHeader;
import org.onosproject.ospf.protocol.lsa.types.NetworkLsa;
import org.onosproject.ospf.protocol.lsa.types.RouterLsa;
@@ -97,7 +98,7 @@
*
* @param wrapper LSA wrapper instance
*/
- private void processVerifyChecksum(LsaWrapper wrapper) throws Exception {
+ private void processVerifyChecksum(LsaWrapper wrapper) throws OspfParseException {
ChecksumCalculator checkSum = new ChecksumCalculator();
if (!checkSum.isValidLsaCheckSum(wrapper.ospfLsa(), ((LsaWrapperImpl) wrapper).lsaHeader().lsType(),
OspfUtil.LSAPACKET_CHECKSUM_POS1,
@@ -116,7 +117,7 @@
*
* @param wrapper LSA wrapper instance
*/
- private void processRefreshLsa(LsaWrapper wrapper) throws Exception {
+ private void processRefreshLsa(LsaWrapper wrapper) throws OspfParseException {
if (wrapper.isSelfOriginated()) { //self originated
//set the destination
OspfInterface ospfInterface = wrapper.ospfInterface();
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkId.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkId.java
index 015f2dc..e530097 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkId.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkId.java
@@ -26,6 +26,7 @@
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
+import java.net.UnknownHostException;
/**
* Representation of link id value of link tlv of Traffic Engineering.
@@ -58,14 +59,14 @@
* Reads bytes from channel buffer.
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
try {
byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
this.setLinkId(InetAddress.getByAddress(tempByteArray).getHostName());
- } catch (Exception e) {
+ } catch (UnknownHostException e) {
log.debug("Error::LinkId:: {}", e.getMessage());
throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR,
OspfErrorType.BAD_MESSAGE);
@@ -76,9 +77,9 @@
* Returns instance as byte array.
*
* @return instance as bytes
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] asBytes() throws Exception {
+ public byte[] asBytes() throws OspfParseException {
byte[] linkSubType = null;
byte[] linkSubTlvHeader = getTlvHeaderAsByteArray();
@@ -92,9 +93,9 @@
* Gets byte array of link id sub tlv body.
*
* @return gets the body as byte array
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] getLinkSubTypeTlvBodyAsByteArray() throws Exception {
+ public byte[] getLinkSubTypeTlvBodyAsByteArray() throws OspfParseException {
byte[] linkSubTypeBody = null;
try {
linkSubTypeBody = InetAddress.getByName(this.linkId).getAddress();
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkType.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkType.java
index 4b5c6f4..a1a2ac9 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkType.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LinkType.java
@@ -63,9 +63,9 @@
* Reads from channel buffer.
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
try {
int len = channelBuffer.readableBytes();
byte[] tempByteArray = new byte[len];
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LocalInterfaceIpAddress.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LocalInterfaceIpAddress.java
index 92c3183..0214ccc 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LocalInterfaceIpAddress.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/LocalInterfaceIpAddress.java
@@ -26,6 +26,7 @@
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
@@ -69,15 +70,15 @@
* Reads bytes from channel buffer.
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) {
try {
byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
this.addLocalInterfaceIPAddress(InetAddress.getByAddress(tempByteArray).getHostName());
- } catch (Exception e) {
+ } catch (UnknownHostException e) {
log.debug("Error::readFrom:: {}", e.getMessage());
throw new OspfParseException(OspfErrorType.OSPF_MESSAGE_ERROR,
OspfErrorType.BAD_MESSAGE);
@@ -89,9 +90,9 @@
* Gets local interface ip address as byte array.
*
* @return local interface ip address as byte array
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] asBytes() throws Exception {
+ public byte[] asBytes() throws OspfParseException {
byte[] linkSubType = null;
byte[] linkSubTlvHeader = getTlvHeaderAsByteArray();
@@ -105,9 +106,9 @@
* Gets byte array of local interface ip address.
*
* @return byte array of local interface ip address
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] getLinkSubTypeTlvBodyAsByteArray() throws Exception {
+ public byte[] getLinkSubTypeTlvBodyAsByteArray() throws OspfParseException {
List<Byte> linkSubTypeBody = new ArrayList<>();
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/RemoteInterfaceIpAddress.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/RemoteInterfaceIpAddress.java
index 07d1cdb..7aaf9d9 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/RemoteInterfaceIpAddress.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/linksubtype/RemoteInterfaceIpAddress.java
@@ -69,9 +69,9 @@
* Reads bytes from channel buffer .
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
while (channelBuffer.readableBytes() >= OspfUtil.FOUR_BYTES) {
try {
byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
@@ -89,9 +89,9 @@
* Gets byte array of remote interface ip address .
*
* @return byte array of remote interface ip address
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] asBytes() throws Exception {
+ public byte[] asBytes() throws OspfParseException {
byte[] linkSubType = null;
byte[] linkSubTlvHeader = getTlvHeaderAsByteArray();
@@ -105,9 +105,9 @@
* Gets byte array of remote interface ip address.
*
* @return byte array of remote interface ip address
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] getLinkSubTypeTlvBodyAsByteArray() throws Exception {
+ public byte[] getLinkSubTypeTlvBodyAsByteArray() throws OspfParseException {
List<Byte> linkSubTypeBody = new ArrayList<>();
for (String remoteAddress : this.remoteInterfaceAddress) {
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/LinkTlv.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/LinkTlv.java
index acc72e3..6521ab2 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/LinkTlv.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/LinkTlv.java
@@ -18,6 +18,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.primitives.Bytes;
import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.TlvHeader;
import org.onosproject.ospf.protocol.lsa.linksubtype.AdministrativeGroup;
import org.onosproject.ospf.protocol.lsa.linksubtype.LinkId;
@@ -66,9 +67,9 @@
* Reads bytes from channel buffer .
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
while (channelBuffer.readableBytes() > 0) {
TlvHeader tlvHeader = new TlvHeader();
tlvHeader.setTlvType(channelBuffer.readUnsignedShort());
@@ -126,9 +127,9 @@
* Gets link tlv as byte array.
*
* @return link tlv as byte array
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException if the packet can't be parsed
*/
- public byte[] asBytes() throws Exception {
+ public byte[] asBytes() throws OspfParseException {
byte[] lsaMessage = null;
byte[] tlvHeader = getTlvHeaderAsByteArray();
@@ -142,9 +143,9 @@
* Gets tlv body as byte array.
*
* @return tlv body as byte array
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
- public byte[] getTlvBodyAsByteArray() throws Exception {
+ public byte[] getTlvBodyAsByteArray() throws OspfParseException {
List<Byte> bodyLst = new ArrayList<>();
for (LinkSubType tlv : subTlv) {
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/RouterTlv.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/RouterTlv.java
index 83bf918..8ac443b 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/RouterTlv.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/tlvtypes/RouterTlv.java
@@ -71,9 +71,9 @@
* Reads bytes from channel buffer .
*
* @param channelBuffer channel buffer instance
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
- public void readFrom(ChannelBuffer channelBuffer) throws Exception {
+ public void readFrom(ChannelBuffer channelBuffer) throws OspfParseException {
try {
byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/types/OpaqueLsa10.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/types/OpaqueLsa10.java
index d87dfc5..b0fd4b6 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/types/OpaqueLsa10.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/types/OpaqueLsa10.java
@@ -131,9 +131,9 @@
* Returns instance as bytes.
*
* @return instance as bytes
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] asBytes() throws Exception {
+ public byte[] asBytes() throws OspfParseException {
byte[] lsaMessage = null;
byte[] lsaHeader = getOpaqueLsaHeaderAsByteArray();
@@ -147,9 +147,9 @@
* Gets the LSA body as byte array.
*
* @return the lsa body as byte array
- * @throws Exception might throws exception while parsing packet
+ * @throws OspfParseException might throws exception while parsing packet
*/
- public byte[] getLsaBodyAsByteArray() throws Exception {
+ public byte[] getLsaBodyAsByteArray() throws OspfParseException {
List<Byte> bodyLst = new ArrayList<>();
if (this.opaqueId() == 1) {
for (TopLevelTlv tlv : this.topLevelValues) {
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/ospfpacket/OspfMessageReader.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/ospfpacket/OspfMessageReader.java
index b7ac7a8..e51672f 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/ospfpacket/OspfMessageReader.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/ospfpacket/OspfMessageReader.java
@@ -42,10 +42,10 @@
*
* @param channelBuffer channel buffer instance.
* @return OSPF message instance.
- * @throws Exception might throws exception while parsing buffer
+ * @throws OspfParseException might throws exception while parsing buffer
*/
public OspfMessage readFromBuffer(ChannelBuffer channelBuffer)
- throws Exception {
+ throws OspfParseException {
try {
OspfPacketHeader ospfHeader = getOspfHeader(channelBuffer);
@@ -97,7 +97,7 @@
* @param channelBuffer channel buffer instance.
* @return Ospf Header instance.
*/
- private OspfPacketHeader getOspfHeader(ChannelBuffer channelBuffer) throws Exception {
+ private OspfPacketHeader getOspfHeader(ChannelBuffer channelBuffer) {
OspfPacketHeader ospfPacketHeader = new OspfPacketHeader();
// Determine OSPF version & Packet Type
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/ChecksumCalculator.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/ChecksumCalculator.java
index f346f45..bddb853 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/ChecksumCalculator.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/ChecksumCalculator.java
@@ -17,6 +17,7 @@
import org.onosproject.ospf.controller.OspfLsa;
import org.onosproject.ospf.controller.OspfLsaType;
+import org.onosproject.ospf.exceptions.OspfParseException;
import org.onosproject.ospf.protocol.lsa.types.AsbrSummaryLsa;
import org.onosproject.ospf.protocol.lsa.types.ExternalLsa;
import org.onosproject.ospf.protocol.lsa.types.NetworkLsa;
@@ -31,14 +32,19 @@
import org.onosproject.ospf.protocol.ospfpacket.types.LsAcknowledge;
import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
+import org.slf4j.Logger;
import java.util.Arrays;
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Calculates checksum for different types of OSPF packets.
*/
public class ChecksumCalculator {
+ private static final Logger log = getLogger(ChecksumCalculator.class);
+
/**
* Converts given string to sixteen bits integer.
* If hexasum is more than 16 bit value, needs to be reduced to 16 bit value.
@@ -98,11 +104,12 @@
* @param lsType lsa type
* @param lsaChecksumPos1 lsa checksum position in packet
* @param lsaChecksumPos2 lsa checksum position in packet
+ * @throws OspfParseException if packet can't be parsed
* @return true if valid else false
- * @throws Exception might throw exception while processing
*/
public boolean isValidLsaCheckSum(OspfLsa ospfLsa, int lsType, int lsaChecksumPos1,
- int lsaChecksumPos2) throws Exception {
+ int lsaChecksumPos2) throws OspfParseException {
+
if (lsType == OspfLsaType.ROUTER.value()) {
RouterLsa lsa = (RouterLsa) ospfLsa;
return validateLsaCheckSum(lsa.asBytes(), lsaChecksumPos1, lsaChecksumPos2);
@@ -129,6 +136,7 @@
return validateLsaCheckSum(lsa.asBytes(), lsaChecksumPos1, lsaChecksumPos2);
}
+
return false;
}
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/OspfUtil.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/OspfUtil.java
index fa15cdb..182b827 100644
--- a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/OspfUtil.java
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/util/OspfUtil.java
@@ -26,6 +26,7 @@
import javax.xml.bind.DatatypeConverter;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Collections;
@@ -93,10 +94,8 @@
* @param ip2 IP address
* @param mask network mask
* @return true if both are in same network else false
- * @throws Exception might throws exception while parsing ip address
*/
- public static boolean sameNetwork(Ip4Address ip1, Ip4Address ip2, Ip4Address mask)
- throws Exception {
+ public static boolean sameNetwork(Ip4Address ip1, Ip4Address ip2, Ip4Address mask) {
byte[] a1 = ip1.toOctets();
byte[] a2 = ip2.toOctets();
@@ -195,9 +194,8 @@
*
* @param channelBuffer channel buffer instance
* @return LSA header instance.
- * @throws Exception might throws exception while parsing buffer
*/
- public static LsaHeader readLsaHeader(ChannelBuffer channelBuffer) throws Exception {
+ public static LsaHeader readLsaHeader(ChannelBuffer channelBuffer) {
//add all the LSA Headers - one header is of 20 bytes
LsaHeader lsaHeader = null;
if (channelBuffer.readableBytes() >= OspfUtil.LSA_HEADER_LENGTH) {
@@ -230,7 +228,11 @@
header.setLsType(tempBuffer.readByte());
byte[] tempByteArray = new byte[OspfUtil.FOUR_BYTES];
channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
- header.setLinkStateId(InetAddress.getByAddress(tempByteArray).getHostName());
+ try {
+ header.setLinkStateId(InetAddress.getByAddress(tempByteArray).getHostName());
+ } catch (UnknownHostException uhe) {
+ log.warn("Can't look up host", uhe);
+ }
tempByteArray = new byte[OspfUtil.FOUR_BYTES];
channelBuffer.readBytes(tempByteArray, 0, OspfUtil.FOUR_BYTES);
header.setAdvertisingRouter(Ip4Address.valueOf(tempByteArray));
diff --git a/protocols/pcep/server/ctl/src/main/java/org/onosproject/pcep/server/impl/Controller.java b/protocols/pcep/server/ctl/src/main/java/org/onosproject/pcep/server/impl/Controller.java
index c85e22a..f7f596c 100644
--- a/protocols/pcep/server/ctl/src/main/java/org/onosproject/pcep/server/impl/Controller.java
+++ b/protocols/pcep/server/ctl/src/main/java/org/onosproject/pcep/server/impl/Controller.java
@@ -205,7 +205,7 @@
cg.add(bootstrap.bind(sa));
log.debug("Listening for PCC connection on {}", sa);
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
index 2f97c7d..4ba8a2c 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/StorageServiceAdapter.java
@@ -25,6 +25,7 @@
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.ConsistentMultimapBuilder;
import org.onosproject.store.service.ConsistentTreeMapBuilder;
+import org.onosproject.store.service.DistributedLockBuilder;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.DocumentTreeBuilder;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
@@ -80,6 +81,11 @@
}
@Override
+ public DistributedLockBuilder lockBuilder() {
+ return null;
+ }
+
+ @Override
public LeaderElectorBuilder leaderElectorBuilder() {
return null;
}
diff --git a/protocols/restconf/client/ctl/pom.xml b/protocols/restconf/client/ctl/pom.xml
index 943d588..09e5cf8 100644
--- a/protocols/restconf/client/ctl/pom.xml
+++ b/protocols/restconf/client/ctl/pom.xml
@@ -59,7 +59,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
diff --git a/protocols/restconf/server/rpp/pom.xml b/protocols/restconf/server/rpp/pom.xml
index 07e2f8b..7d86daf 100644
--- a/protocols/restconf/server/rpp/pom.xml
+++ b/protocols/restconf/server/rpp/pom.xml
@@ -87,7 +87,6 @@
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
- <version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
@@ -97,13 +96,11 @@
<dependency>
<groupId>org.glassfish.jersey.test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
- <version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jetty</artifactId>
- <version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -111,16 +108,15 @@
<artifactId>onlab-misc</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.8</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-rest</artifactId>
diff --git a/providers/general/device/pom.xml b/providers/general/device/pom.xml
index d598c0e..e7d08e3 100644
--- a/providers/general/device/pom.xml
+++ b/providers/general/device/pom.xml
@@ -45,7 +45,6 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/providers/netconf/device/pom.xml b/providers/netconf/device/pom.xml
index 102e546..646c357 100644
--- a/providers/netconf/device/pom.xml
+++ b/providers/netconf/device/pom.xml
@@ -54,7 +54,6 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
index c35682c..99c8ebd 100644
--- a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
+++ b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
@@ -582,7 +582,7 @@
providerService.deviceDisconnected(deviceId);
}
deviceKeyAdminService.removeKey(DeviceKeyId.deviceKeyId(deviceId.toString()));
- throw new RuntimeException(new NetconfException(
+ throw new IllegalStateException(new NetconfException(
"Can't connect to NETCONF device " + deviceId, e));
}
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
index b489c52..66ded21 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -1004,7 +1004,7 @@
sigType = CltSignalType.CLT_100GBE;
break;
default:
- throw new RuntimeException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
+ throw new IllegalArgumentException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
}
SparseAnnotations annotations = buildOduCltAnnotation(port);
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceValueMapper.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceValueMapper.java
index 28ebb3c..789e7e5 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceValueMapper.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceValueMapper.java
@@ -51,7 +51,7 @@
*/
private static <I, O> O lookup(BiMap<I, O> map, I input, Class<O> cls) {
if (!map.containsKey(input)) {
- throw new RuntimeException(
+ throw new IllegalArgumentException(
String.format("No mapping found for %s when converting to %s", input, cls.getName()));
}
diff --git a/providers/openflow/message/src/main/java/org/onosproject/provider/of/message/impl/OpenFlowControlMessageMapper.java b/providers/openflow/message/src/main/java/org/onosproject/provider/of/message/impl/OpenFlowControlMessageMapper.java
index 582484d..5b73e0f 100644
--- a/providers/openflow/message/src/main/java/org/onosproject/provider/of/message/impl/OpenFlowControlMessageMapper.java
+++ b/providers/openflow/message/src/main/java/org/onosproject/provider/of/message/impl/OpenFlowControlMessageMapper.java
@@ -59,7 +59,7 @@
*/
private static <I, O> O lookup(BiMap<I, O> map, I input, Class<O> cls) {
if (!map.containsKey(input)) {
- throw new RuntimeException(
+ throw new IllegalArgumentException(
String.format("No mapping found for %s when converting to %s",
input, cls.getName()));
}
diff --git a/tools/dev/p4vm/install-p4-tools.sh b/tools/dev/p4vm/install-p4-tools.sh
index fb88e7e..f3df6a4 100755
--- a/tools/dev/p4vm/install-p4-tools.sh
+++ b/tools/dev/p4vm/install-p4-tools.sh
@@ -63,7 +63,6 @@
libjudy-dev \
libpcap-dev \
libpcre3-dev \
- libprotobuf-c-dev \
libreadline6 \
libreadline6-dev \
libssl-dev \
@@ -94,11 +93,16 @@
dpkg-dev \
g++-4.9 \
gcc-4.9 \
- libboost-iostreams-dev
+ cmake \
+ libbz2-dev
# Needed for p4c.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
+
+ if [ -z "$(ldconfig -p | grep libboost_iostreams.so.1.58.0)" ]; then
+ do_boost
+ fi
}
function do_requirements_1604 {
@@ -106,7 +110,37 @@
sudo apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
- libboost-iostreams1.58-dev
+ libboost-iostreams1.58-dev \
+ libprotobuf-c-dev
+}
+
+function do_boost {
+ cd ${BUILD_DIR}
+ wget https://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download -O boost_1_58_0.tar.bz2
+ tar --bzip2 -xf boost_1_58_0.tar.bz2
+ cd boost_1_58_0
+
+ ./bootstrap.sh --with-libraries=iostreams
+ sudo ./b2 install
+ sudo ldconfig
+
+ cd ..
+ sudo rm -rf boost_1_58_0
+}
+
+function do_protobuf-c {
+ cd ${BUILD_DIR}
+ git clone https://github.com/protobuf-c/protobuf-c.git
+ cd protobuf-c
+
+ ./autogen.sh
+ ./configure --prefix=/usr
+ make -j${NUM_CORES}
+ sudo make install
+ sudo ldconfig
+
+ cd ..
+ sudo rm -rf protobuf-c
}
function do_protobuf {
@@ -155,7 +189,7 @@
git fetch
git checkout ${LIBYANG_COMMIT}
- mkdir build
+ mkdir -p build
cd build
cmake ..
make -j${NUM_CORES}
@@ -163,7 +197,16 @@
sudo ldconfig
}
+function do_sysrepo_deps {
+ RELEASE=`lsb_release -rs`
+ if version_ge $RELEASE 14.04 && [ -z "$(ldconfig -p | grep libprotobuf-c)" ]; then
+ do_protobuf-c
+ fi
+}
+
function do_sysrepo {
+ do_sysrepo_deps
+
cd ${BUILD_DIR}
if [ ! -d sysrepo ]; then
git clone https://github.com/sysrepo/sysrepo.git
@@ -172,7 +215,7 @@
git fetch
git checkout ${SYSREPO_COMMIT}
- mkdir build
+ mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=Off \
-DCALL_TARGET_BINS_DIRECTLY=Off ..
diff --git a/tools/package/bin/onos-form-cluster b/tools/package/bin/onos-form-cluster
index 9286d0c..e677873 100755
--- a/tools/package/bin/onos-form-cluster
+++ b/tools/package/bin/onos-form-cluster
@@ -2,8 +2,9 @@
# -----------------------------------------------------------------------------
# Forms ONOS cluster using REST API of each separate instance.
# -----------------------------------------------------------------------------
-
-[ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1
+function usage() {
+ echo "usage: $(basename $0)[-x] [-u user] [-p password] [-s partitionSize] ip1 ip2..." && exit 1
+}
# Scan arguments for user/password or other options...
while getopts u:p:s: o; do
@@ -11,6 +12,7 @@
u) user=$OPTARG;;
p) password=$OPTARG;;
s) partitionsize=$OPTARG;;
+ *) usage;;
esac
done
ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos'
@@ -20,6 +22,8 @@
let OPC=$OPTIND-1
shift $OPC
+[ $# -lt 2 ] && usage
+
ip=$1
shift
nodes=$*
diff --git a/tools/package/maven-plugin/pom.xml b/tools/package/maven-plugin/pom.xml
index 54c0e6d..0b33262 100644
--- a/tools/package/maven-plugin/pom.xml
+++ b/tools/package/maven-plugin/pom.xml
@@ -13,7 +13,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
diff --git a/tools/package/runtime/bin/onos-diagnostics b/tools/package/runtime/bin/onos-diagnostics
new file mode 100755
index 0000000..51b3f8c
--- /dev/null
+++ b/tools/package/runtime/bin/onos-diagnostics
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+#
+# Copyright 2015-present Open Networking Foundation
+#
+# 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.
+#
+
+# -----------------------------------------------------------------------------
+# Tool to collect cluster-wide diagnostics into a single tar stream.
+# -----------------------------------------------------------------------------
+function usage() {
+ echo "usage: $(basename $0) [-x] [-n name] [-u user] [-p password] [ip1 ip2...]"
+ echo ""
+ echo "Environment Variables:"
+ echo " ONOS_INSTANCES IPs or hostnames of ONOS cluster machines"
+ echo " ONOS_WEB_USER username for REST API"
+ echo " ONOS_WEB_PASS password for REST API"
+ echo ""
+ echo "Example Usages:"
+ echo " # Collect compressed diagnostics for the cluster."
+ echo " # REST API user and password are drawn from environment variables."
+ echo " # Collection archive will be named /tmp/onos-diags.tar.gz"
+ echo " # The cluster node IPs will be drawn from ONOS_INSTANCES variable."
+ echo " > $(basename $0) "
+ echo ""
+ echo " # Collect diagnostics for the cluster and leave them extracted. "
+ echo " # Collection directory will be named /tmp/prague-diags/"
+ echo " # Collection archive will be named /tmp/prague-diags.tar.gz."
+ echo " # REST API user name is 'onos' and password is 'rules'."
+ echo " # The cluster node IPs will be drawn from ONOS_INSTANCES variable."
+ echo " > $(basename $0) -x -n prague -u onos -p rules"
+ echo ""
+ echo " # Collect compressed diagnostics for a cluster."
+ echo " # REST API user name is 'onos' and password is 'rules'."
+ echo " # Collection archive will be named /tmp/onos-diags.tar.gz"
+ echo " # The cluster node IPs are listed explicitly."
+ echo " > $(basename $0) -u onos -p rules 172.17.0.11 172.17.0.12 172.17.0.13"
+
+ exit 1
+}
+
+CLI_COMMANDS=(
+ "feature:list"
+ "bundle:list"
+ "scr:list"
+
+ "summary"
+ "nodes"
+ "apps -s"
+ "netcfg"
+ "cfg get"
+
+ "devices"
+ "links"
+ "hosts"
+
+ "ports -e"
+ "portstats -nz"
+
+ "intents"
+ "flows -s"
+ "groups"
+
+ "roles"
+ "masters"
+
+ "routes"
+ "obj-next-ids"
+ "obj-pending-nexts"
+
+ "log:display -l WARN"
+)
+
+# Scan arguments for user/password or other options...
+while getopts n:u:p:x?h o; do
+ case "$o" in
+ n) name=$OPTARG;;
+ u) user=$OPTARG;;
+ p) password=$OPTARG;;
+ x) extract=true;;
+ *) usage;;
+ esac
+done
+ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos'
+ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
+user=${user:-$ONOS_WEB_USER}
+password=${password:-$ONOS_WEB_PASS}
+let OPC=$OPTIND-1
+shift $OPC
+
+[ $# -lt 1 -a -z "$ONOS_INSTANCES" ] && usage;
+
+diags=/tmp/${name:-onos}-diags
+rm -fr $diags $diags.tar.gz; mkdir -p $diags
+
+[ -z $1 ] && nodes=$ONOS_INSTANCES || nodes=$*
+
+# Collect diagnostics from each cluster node
+for node in $nodes; do
+ printf "Collecting diagnostics on $node..."
+
+ # Prepare a clean place for collecting the node diagnostic data
+ cd $diags; rm -fr $node; mkdir -p $node; cd $node;
+
+ # Acquire locally obtained diagnostics via REST API and extract them
+ printf "logs "
+ curl -sS --fail --user $user:$password \
+ http://$node:8181/onos/v1/diagnostics > ../$node.tar.gz
+ tar zxf ../$node.tar.gz
+
+ # Acquire remotely obtained diagnostics via ssh CLI
+ for cmd in "${CLI_COMMANDS[@]}"; do
+ cmdLog="$(echo $cmd | cut -d\ -f1 | sed 's/:/-/g').txt"
+ printf "$cmdLog "
+ onos $node $cmd 2>/dev/null >$cmdLog
+ done
+
+ # Tar-up local and remote diagnostics together
+ printf " Done.\n"
+ tar zcf ../$node.tar.gz *
+done
+
+# Tar-up diagnostics from all the nodes
+cd $diags
+tar zcf $diags.tar.gz *
+[ -z $extract ] && rm -fr $diags
diff --git a/tools/package/runtime/bin/onos-node-diagnostics b/tools/package/runtime/bin/onos-node-diagnostics
new file mode 100755
index 0000000..1cb18b5
--- /dev/null
+++ b/tools/package/runtime/bin/onos-node-diagnostics
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+#
+# Copyright 2015-present Open Networking Foundation
+#
+# 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.
+#
+
+# -----------------------------------------------------------------------------
+# Tool to collect node-specific diagnostics into a single tar stream.
+# -----------------------------------------------------------------------------
+
+# If ONOS_HOME is set, respect its value.
+# If ONOS_HOME is not set (e.g. in the init or service environment),
+# set it based on this script's path.
+ONOS_HOME=${ONOS_HOME:-$(cd $(dirname $0)/.. >/dev/null 2>&1 && pwd)}
+
+diag=/tmp/diag$$
+mkdir -p $diag; cd $diag
+
+# Collect application state
+ls -l $ONOS_HOME/apps/* > apps-dir.txt
+
+# Collect the karaf logs
+cp $ONOS_HOME/apache-karaf-*/data/log/* .
+
+# Tar-up the collected information
+tar zcf ../onos-node-diags.tar.gz *
+rm -fr $diag
+
+
diff --git a/tools/test/bin/onos-disrupt b/tools/test/bin/onos-disrupt
index c8e343f..3829250 100755
--- a/tools/test/bin/onos-disrupt
+++ b/tools/test/bin/onos-disrupt
@@ -18,7 +18,7 @@
echo " ARGS The command arguments"
echo " [-h | --help] Print this help"
echo
- echo "COMMAND: <crash | partition | partition-halves | partition-bridge | heal | delay | drop | reorder | duplicate | corrupt | restore>"
+ echo "COMMAND: <crash | partition | isolate | partition-halves | partition-bridge | heal | delay | drop | reorder | duplicate | corrupt | restore>"
echo
echo " crash Crashes the given host using \"kill -9\""
echo
@@ -46,6 +46,14 @@
echo " $command_name 10.127.10.111 partition 10.127.10.111"
echo " $command_name 10.127.10.111 partition 10.127.10.112 10.127.10.113"
echo
+ echo " isolate Isolate the given host from all other hosts"
+ echo
+ echo " Syntax:"
+ echo " $command_name <HOST> isolate"
+ echo
+ echo " Examples:"
+ echo " $command_name 10.127.10.111 isolate"
+ echo
echo " partition-halves Splits the cluster into two partitions - this is only recommended for clusters with an odd number of nodes"
echo
echo " Syntax:"
@@ -306,6 +314,25 @@
done
;;
+ # Isolates the node from all other nodes
+ isolate)
+
+ # Default to ONOS nodes.
+ if [ -z "${1}" ]; then
+ nodes=$(onos_nodes)
+ else
+ nodes="${*}"
+ fi
+
+ # Iterate through all ONOS nodes and partition the host from them.
+ for node in ${nodes}; do
+ if [[ $node != $host ]]; then
+ partition ${host} ${node}
+ partition ${node} ${host}
+ fi
+ done
+ ;;
+
# Splits the cluster into two halves, preserving the provided host as a bridge between the two halves.
partition-bridge)
@@ -338,7 +365,9 @@
# Iterate through all provided nodes and heal partitions.
for node in $nodes; do
- heal ${host} ${node}
+ if [[ $node != $host ]]; then
+ heal ${host} ${node}
+ fi
done
;;
diff --git a/tools/test/scenarios/dist-lock.xml b/tools/test/scenarios/dist-lock.xml
new file mode 100644
index 0000000..cf9ec3c
--- /dev/null
+++ b/tools/test/scenarios/dist-lock.xml
@@ -0,0 +1,62 @@
+<!--
+ ~ Copyright 2018-present Open Networking Foundation
+ ~
+ ~ 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.
+ -->
+
+<scenario name="distributed-lock-test"
+ description="ONOS DistributedLock distributed primitive Test">
+ <group name="Distributed-Primitive-Lock" if="${OC2}">
+
+ <step name="Distributed-Primitive-Lock.Test-Lock-1"
+ exec="onos ${OC1} lock-test test-lock lock"/>
+
+ <step name="Distributed-Primitive-Lock.Test-Lock-2"
+ exec="onos ${OC2} lock-test test-lock lock"
+ requires="Distributed-Primitive-Lock.Test-Lock-1"/>
+
+ <step name="Distributed-Primitive-Lock.Test-Unlock-1"
+ exec="onos ${OC1} lock-test test-lock unlock"
+ requires="Distributed-Primitive-Lock.Test-Lock-1"/>
+
+ <step name="Distributed-Primitive-Lock.Test-TryLock-3"
+ exec="onos-execute-expect ${OC1} lock-test test-lock tryLock --expect false"
+ requires="Distributed-Primitive-Lock.Test-Unlock-1"/>
+
+ <step name="Distributed-Primitive-Lock.Test-TryLock-4"
+ exec="onos-execute-expect ${OC1} lock-test test-lock tryLock 5000 --expect true"
+ requires="Distributed-Primitive-Lock.Test-TryLock-3"/>
+
+ <step name="Distributed-Primitive-Lock.Test-Unlock-2"
+ exec="onos ${OC2} lock-test test-lock unlock"
+ requires="Distributed-Primitive-Lock.Test-TryLock-3"/>
+
+ <step name="Distributed-Primitive-Lock.Test-Unlock-4"
+ exec="onos ${OC2} lock-test test-lock unlock"
+ requires="Distributed-Primitive-Lock.Test-Unlock-2"/>
+
+ <group name="Distributed-Primitive-Lock.Check-Log-Exceptions"
+ requires="Distributed-Primitive-Lock.Test-Unlock-4">
+ <parallel var="${OC#}">
+ <step name="Distributed-Primitive-Lock.Check-Log-Exceptions-${#}"
+ exec="onos-check-logs ${OC#}"/>
+ </parallel>
+ </group>
+
+ </group>
+
+ <group name="Single-Node-NA" unless="${OC2}">
+ <step name="No-Op" exec="echo Scenario not supported for this cell size"/>
+ </group>
+</scenario>
+
diff --git a/tools/test/scenarios/dist-test.xml b/tools/test/scenarios/dist-test.xml
index 9f1e6d4..b0b9a17 100644
--- a/tools/test/scenarios/dist-test.xml
+++ b/tools/test/scenarios/dist-test.xml
@@ -38,6 +38,9 @@
<import file="${ONOS_SCENARIOS}/dist-leader.xml"/>
<dependency name="Distributed-Primitive-Leader"/>
+ <import file="${ONOS_SCENARIOS}/dist-lock.xml"/>
+ <dependency name="Distributed-Primitive-Lock"/>
+
<import file="${ONOS_SCENARIOS}/dist-work-queue.xml"/>
<dependency name="Distributed-Primitive-WorkQueue"/>
diff --git a/tools/test/topos/uk.py b/tools/test/topos/uk.py
index 2ed1765..aabd0b7 100644
--- a/tools/test/topos/uk.py
+++ b/tools/test/topos/uk.py
@@ -7,6 +7,11 @@
class UkTopo( Topo ):
"""Switches projected onto the UK map"""
+ def addSwitch( self, name, **opts ):
+ kwargs = { 'protocols' : 'OpenFlow13' }
+ kwargs.update( opts )
+ return super(UkTopo, self).addSwitch( name, **kwargs )
+
def __init__( self ):
"""Create a topology."""
@@ -56,29 +61,29 @@
self.addLink( ABYSTW, ABYSTW_host )
# add edges between switches
- self.addLink( BIRMHM, LIVRPL, bw=10, delay='1.0ms')
- self.addLink( BIRMHM, YORK, bw=10, delay='1.0ms')
- self.addLink( BRISTL, ABYSTW, bw=10, delay='1.0ms')
- self.addLink( BRISTL, BIRMHM, bw=10, delay='1.0ms')
- self.addLink( BRISTL, PLYMTH, bw=10, delay='1.0ms')
- self.addLink( DOVER, BRGHTN, bw=10, delay='1.0ms')
- self.addLink( DOVER, NRWICH, bw=10, delay='1.0ms')
- self.addLink( LIVRPL, ABYSTW, bw=10, delay='1.0ms')
- self.addLink( LIVRPL, EDBUGH, bw=10, delay='1.0ms')
- self.addLink( LONDON, BIRMHM, bw=10, delay='1.0ms')
- self.addLink( LONDON, BRGHTN, bw=10, delay='1.0ms')
- self.addLink( LONDON, BRISTL, bw=10, delay='1.0ms')
- self.addLink( LONDON, BRISTL, bw=10, delay='1.0ms')
- self.addLink( LONDON, DOVER, bw=10, delay='1.0ms')
- self.addLink( LONDON, NRWICH, bw=10, delay='1.0ms')
- self.addLink( LONDON, PLYMTH, bw=10, delay='1.0ms')
- self.addLink( LONDON, YORK, bw=10, delay='1.0ms')
- self.addLink( LONDON, YORK, bw=10, delay='1.0ms')
- self.addLink( NWCSTL, EDBUGH, bw=10, delay='1.0ms')
- self.addLink( NWCSTL, LIVRPL, bw=10, delay='1.0ms')
- self.addLink( NWCSTL, YORK, bw=10, delay='1.0ms')
- self.addLink( YORK, LIVRPL, bw=10, delay='1.0ms')
- self.addLink( YORK, NRWICH, bw=10, delay='1.0ms')
+ self.addLink( BIRMHM, LIVRPL )
+ self.addLink( BIRMHM, YORK )
+ self.addLink( BRISTL, ABYSTW )
+ self.addLink( BRISTL, BIRMHM )
+ self.addLink( BRISTL, PLYMTH )
+ self.addLink( DOVER, BRGHTN )
+ self.addLink( DOVER, NRWICH )
+ self.addLink( LIVRPL, ABYSTW )
+ self.addLink( LIVRPL, EDBUGH )
+ self.addLink( LONDON, BIRMHM )
+ self.addLink( LONDON, BRGHTN )
+ self.addLink( LONDON, BRISTL )
+ self.addLink( LONDON, BRISTL )
+ self.addLink( LONDON, DOVER )
+ self.addLink( LONDON, NRWICH )
+ self.addLink( LONDON, PLYMTH )
+ self.addLink( LONDON, YORK )
+ self.addLink( LONDON, YORK )
+ self.addLink( NWCSTL, EDBUGH )
+ self.addLink( NWCSTL, LIVRPL )
+ self.addLink( NWCSTL, YORK )
+ self.addLink( YORK, LIVRPL )
+ self.addLink( YORK, NRWICH )
topos = { 'uk': ( lambda: UkTopo() ) }
diff --git a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6ClientIdOption.java b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6ClientIdOption.java
index 5623e71..f4f3fc8 100644
--- a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6ClientIdOption.java
+++ b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6ClientIdOption.java
@@ -49,7 +49,7 @@
Dhcp6Duid duid = Dhcp6Duid.deserializer().deserialize(data, 0, data.length);
this.setDuid(duid);
} catch (DeserializationException e) {
- throw new RuntimeException("Invalid DUID");
+ throw new IllegalArgumentException("Invalid DUID");
}
}
diff --git a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Duid.java b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Duid.java
index c8ca3bd..80675e2 100644
--- a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Duid.java
+++ b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Duid.java
@@ -51,7 +51,7 @@
case 3:
return DUID_LL;
default:
- throw new RuntimeException("Unknown type: " + type);
+ throw new IllegalArgumentException("Unknown type: " + type);
}
}
}
@@ -139,7 +139,7 @@
byteBuffer.put(linkLayerAddress);
break;
default:
- throw new RuntimeException("Unknown duidType: " + duidType.toString());
+ throw new IllegalArgumentException("Unknown duidType: " + duidType.toString());
}
return byteBuffer.array();
}
@@ -171,7 +171,7 @@
byteBuffer.get(duid.linkLayerAddress);
break;
default:
- throw new RuntimeException("Unknown type: " + duidType);
+ throw new IllegalArgumentException("Unknown type: " + duidType);
}
return duid;
};
diff --git a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Option.java b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Option.java
index f19f735..8202b30 100644
--- a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Option.java
+++ b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6Option.java
@@ -74,7 +74,7 @@
try {
this.payload = Data.deserializer().deserialize(data, 0, data.length);
} catch (DeserializationException e) {
- throw new RuntimeException("Invalid data");
+ throw new IllegalArgumentException("Invalid data");
}
}
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index bf9bea0..4b2cac9 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -388,7 +388,7 @@
try {
Thread.sleep(ms);
} catch (InterruptedException e) {
- throw new RuntimeException("Interrupted", e);
+ throw new IllegalStateException("Interrupted", e);
}
}
@@ -460,7 +460,7 @@
try {
Thread.sleep(random.nextInt(ms));
} catch (InterruptedException e) {
- throw new RuntimeException("Interrupted", e);
+ throw new IllegalStateException("Interrupted", e);
}
}
@@ -474,7 +474,7 @@
try {
Thread.sleep(ms, nanos);
} catch (InterruptedException e) {
- throw new RuntimeException("Interrupted", e);
+ throw new IllegalStateException("Interrupted", e);
}
}
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/CoreWebApplication.java b/web/api/src/main/java/org/onosproject/rest/resources/CoreWebApplication.java
index 6cd7884..4677844 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/CoreWebApplication.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/CoreWebApplication.java
@@ -52,7 +52,8 @@
VirtualNetworkWebResource.class,
MastershipWebResource.class,
InvalidConfigExceptionMapper.class,
- DpisWebResource.class
+ DpisWebResource.class,
+ DiagnosticsWebResource.class
);
}
}
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/DiagnosticsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/DiagnosticsWebResource.java
new file mode 100644
index 0000000..6b951e0
--- /dev/null
+++ b/web/api/src/main/java/org/onosproject/rest/resources/DiagnosticsWebResource.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2015-present Open Networking Foundation
+ *
+ * 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.rest.resources;
+
+import org.onosproject.rest.AbstractWebResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import static com.google.common.io.ByteStreams.toByteArray;
+
+/**
+ * Provides stream of diagnostic information.
+ */
+@Path("diagnostics")
+public class DiagnosticsWebResource extends AbstractWebResource {
+
+ private static final String COMMAND = "../bin/onos-node-diagnostics";
+ private static final String DIAGS = "/tmp/onos-node-diags.tar.gz";
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ /**
+ * Get tar.gz stream of node diagnostic information.
+ *
+ * @return 200 OK with a tar.gz stream of diagnostic data
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ public Response getDiagnostics() {
+ try {
+ execute(COMMAND);
+ return ok(new FileInputStream(DIAGS)).build();
+ } catch (IOException e) {
+ return Response.serverError().build();
+ }
+ }
+
+ // Executes the given command arguments as a system command.
+ private void execute(String command) throws IOException {
+ try {
+ Process process = Runtime.getRuntime().exec(command);
+ byte[] output = toByteArray(process.getInputStream());
+ byte[] error = toByteArray(process.getErrorStream());
+ int code = process.waitFor();
+ if (code != 0) {
+ log.info("Command failed: status={}, output={}, error={}",
+ code, new String(output), new String(error));
+ }
+ } catch (InterruptedException e) {
+ log.error("Interrupted executing command {}", command, e);
+ }
+ }
+}
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_nl.properties
new file mode 100644
index 0000000..f6d8f7b
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_nl.properties
@@ -0,0 +1,37 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+# Present Tense
+install=Installeer
+start=Start
+pause=Pauseer
+resume=Hervatten
+stop=Stop
+uninstall=Verwijder
+activate=Activeer
+deactivate=Deactiveer
+show=Toon
+hide=Verberg
+enable=Aanzetten van
+disable=Uitzetten van
+select=Selecteer
+
+# Past Tense
+purged=verwijderd
+withdrawn=ingetrokken
+resubmitted=opnieuw ingediend
+added=toegevoegd
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_nl.properties
new file mode 100644
index 0000000..3c122d1
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Network_nl.properties
@@ -0,0 +1,63 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+# --- Elements (Singular)
+node=Instantie
+topology=Topologie
+network=Netwerk
+region=Regio
+device=Schakelelement
+host=Eindpunt
+link=Verbinding
+intent=Intentie
+tunnel=Tunnel
+flow=Pad
+port=Poort
+
+# --- Elements (Plural)
+nodes=Instanties
+topologies=Topologieën
+topology_sccs=Topologie SCCs
+networks=Netwerken
+regions=Regio's
+devices=Schakelelementen
+hosts=Eindpunten
+links=Verbindingen
+intents=Intenties
+tunnels=Tunnels
+flows=Paden
+ports=Poorten
+
+# --- Element IDs
+node_id=Instantie ID
+region_id=Regio ID
+device_id=Schakelelement ID
+host_id=Eindpunt ID
+link_id=Verbinding ID
+intent_id=Intentie ID
+tunnel_id=Tunnel ID
+flow_id=Pad ID
+port_id=Poort ID
+
+# --- Protocol terms
+protocol=Protocol
+ip=IP
+ip_address=IP Adres
+tcp_port=TCP Poort
+mac=MAC
+mac_address=MAC Adres
+uri=URI
+vlan=VLAN
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_nl.properties
new file mode 100644
index 0000000..87b4521
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Props_nl.properties
@@ -0,0 +1,39 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+# Typically used as table column headers or property labels
+
+chassis_id=Chassis ID
+hw_version=Hardware Versie
+sw_version=Software Versie
+serial_number=Serie Nr.
+app_id=App ID
+
+type=Type
+vendor=Organisatie
+icon=Icoon
+title=Titel
+state=Staat
+category=Categorie
+version=Versie
+origin=Herkomst
+role=Rol
+
+latitude=Breedtegraad
+longitude=Lengtegraad
+grid_y=Raster Y
+grid_x=Raster X
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_nl.properties
new file mode 100644
index 0000000..e5af578
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/State_nl.properties
@@ -0,0 +1,34 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+total=in totaal
+active=Actief
+started=Gestart
+stopped=Gestopt
+
+last_updated=Laatst bijgewerkt
+last_modified=Laatst veranderd
+
+visible=zichtbaar
+hidden=verborgen
+
+# VLAN id == NONE (-1)
+vlan_none=Geen
+
+# lower case values, please
+expected=verwacht
+not_expected=niet verwacht
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_nl.properties
new file mode 100644
index 0000000..2c17462
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_nl.properties
@@ -0,0 +1,33 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+# Common button text
+ok=OK
+cancel=Annuleer
+close=Sluiten
+
+# Gesture text
+click=klik
+click_row=klik op de rij
+scroll_down=naar beneden scrollen
+shift_click=Shift + klik
+drag=slepen
+cmd_scroll=Alt + scrollen
+cmd_drag=Alt + slepen
+
+# Common control button tooltips
+tt_ctl_auto_refresh=Automatisch verversen aan/uit
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_nl.properties
new file mode 100644
index 0000000..3c70081
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/DeviceEnums_nl.properties
@@ -0,0 +1,34 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+
+# display names for Device.Type constants
+switch=switch
+router=router
+roadm=roadm
+otn=otn
+roadm_otn=roadm otn
+firewall=firewall
+balancer=balancer
+ips=ips
+ids=ids
+controller=controller
+virtual=virtuele
+fiber_switch=glasvezel switch
+microwave=microgolf
+olt=olt
+onu=onu
+optical_amplifier=optische versterker
+other=overig
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_nl.properties
new file mode 100644
index 0000000..6cfd11b
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/enums/LinkEnums_nl.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+
+# display names for Link.Type constants
+direct=direct
+indirect=indirect
+edge=eind
+tunnel=tunnel
+optical=optisch
+virtual=virtueel
+
+# display names for Link.State constants
+active=actief
+inactive=inactief
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_nl.properties
new file mode 100644
index 0000000..2508eee
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_nl.properties
@@ -0,0 +1,32 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+# Localization strings for Masthead
+
+# Tooltip for context-sensitive help button [?]
+tt_help=Toon de hulppagina voor het huidige scherm
+
+# unknown user
+unknown_user=(geen)
+
+# Logout button
+logout=Afmelden
+
+# UI components added/removed, etc.
+uicomp_added=Nieuwe schermcomponenten zijn toegevoegd.
+uicomp_removed=Enkele schermcomponenten zijn verwijderd.
+ui_ok_to_update=Druk op OK om het scherm te vernieuwen.
+confirm_refresh_title=Bevestig verversen scherm.
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Nav_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Nav_nl.properties
new file mode 100644
index 0000000..bdadb5b
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Nav_nl.properties
@@ -0,0 +1,29 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+# Localization strings for Navigation Panel
+
+# Category headers
+cat_platform=Platform
+cat_network=Netwerk
+cat_other=Overig
+
+# Note that contributed views will be adding their own localized titles
+# for their nav item, with a property key "nav_item_{viewID}".
+#
+# E.g. in the Device view properties bundle there will be:
+#
+# nav_item_device=Devices
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/QuickHelp_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/QuickHelp_nl.properties
new file mode 100644
index 0000000..3f2da6c
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/QuickHelp_nl.properties
@@ -0,0 +1,32 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+# Common text in the Quick Help panel
+
+# Panel title
+qh_title=Hulpwijzer
+
+# Hint for \ and / keys
+qh_hint_show_hide_qh=Toon of verberg Hulpwijzer
+
+# Escape key hint
+qh_hint_esc=Dialoog of selecties annuleren
+
+# T key hint : toggle the ui theme (between light / dark)
+qh_hint_t=Licht/donker scherm wisselen
+
+# Common for a lot of views adding their own escape-key handler
+qh_hint_close_detail=Detailscherm sluiten
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_nl.properties
new file mode 100644
index 0000000..6c271a8
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_nl.properties
@@ -0,0 +1,46 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+# Text that appears in the navigation panel
+nav_item_app=Applicaties
+
+# View title
+title_apps=Applicaties
+
+# Control button tooltips
+tt_ctl_upload=Applicatie invoegen (.oar bestand)
+tt_ctl_activate=Activeer geselecteerde applicatie
+tt_ctl_deactivate=Deactiveer geselecteerde applicatie
+tt_ctl_uninstall=Verwijder geselecteerde applicatie
+tt_ctl_download=Download geselecteerde applicatie (.oar bestand)
+
+# Quick-Help panel
+qh_hint_esc=Deselecteer applicatie
+qh_hint_click_row=Selecteer / deselecteer applicatie
+qh_hint_scroll_down=Bekijk meer applicaties
+
+# App details panel
+dp_features=Eigenschappen
+dp_required_apps=Vereiste applicaties
+dp_permissions=Permissies
+
+# App dialog panel
+dlg_confirm_action=Actie bevestigen
+
+dlg_warn_deactivate=Het deactiveren of verwijderen van dit onderdeel \
+ kan ernstige negatieve gevolgen hebben!
+dlg_warn_own_risk=** DOE DIT OP EIGEN RISICO **
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Cluster_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Cluster_nl.properties
new file mode 100644
index 0000000..8e6dc1e
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Cluster_nl.properties
@@ -0,0 +1,27 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+# Cluster view specific text
+
+# Text that appears in the navigation panel
+nav_item_cluster=Cluster instanties
+
+# View title
+title_cluster_nodes=Cluster instanties
+
+# Quick-Help panel
+qh_hint_click=Selecteer een regel voor het tonen van de instantie details
+qh_hint_scroll_down=Toon de beschikbare cluster instanties.
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_nl.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_nl.properties
new file mode 100644
index 0000000..15408c4
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_nl.properties
@@ -0,0 +1,145 @@
+#
+# Copyright 2017-present Open Networking Foundation
+#
+# 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.
+#
+#
+
+# Text that appears in the navigation panel
+nav_item_topo=Topologie
+
+# Message when no devices are connected
+no_devices_are_connected=Geen apparaten verbonden
+
+# Action Key Toolbar Tooltips ...
+tbtt_tog_instances=Toon/verberg ONOS Instanties-paneel
+tbtt_tog_summary=Toon/verberg ONOS Overzichtspaneel
+tbtt_tog_use_detail=Toon/verberg Details-paneel
+tbtt_tog_host=Toon/verberg eindpunten
+tbtt_tog_offline=Toon/verberg onbereikbare apparaten
+tbtt_tog_porthi=Toon/verberg poortinformatie
+tbtt_bad_links=Toon/verberg slechte verbindingen
+tbtt_tog_map=Toon/verberg geografische achtergrondkaart
+tbtt_sel_map=Selecteer geografische achtergrondkaart
+tbtt_tog_sprite=Toon/verberg afbeeldingslaag
+tbtt_reset_loc=Herstel knooppuntlocaties
+tbtt_tog_oblique=Toon/verberg doorzichtige lagen (experimenteel)
+tbtt_cyc_layers=Doorloop apparaatlagen
+tbtt_cyc_dev_labs=Doorloop apparaatlabels
+tbtt_cyc_host_labs=Doorloop eindpuntlabels
+tbtt_unpin_node=Maak node los (beweeg er met de muiswijzer overheen)
+tbtt_reset_zoom=Herstel verschuiven/zoom
+tbtt_tog_toolbar=Toon/verberg taakbalk
+tbtt_eq_master=Herverdeel eigenaarschap
+
+# Quick Help Gestures
+qh_gest_click=Selecteer het onderdeel en toon details
+qh_gest_shift_click=Wijzig selectiestatus
+qh_gest_drag=Herpositioneer apparaat of eindpunt
+qh_gest_cmd_scroll=Zoom in/uit
+qh_gest_cmd_drag=Verschuif
+
+# Flash Messages
+fl_background_map=achtergrondkaart
+fl_sprite_layer=afbeeldingslaag
+fl_pan_zoom_reset=Verschuiven en zoomen ongedaan gemaakt
+fl_eq_masters=Eigenaarschap herverdeeld
+
+fl_device_labels_hide=Verberg apparaatlabels
+fl_device_labels_show_friendly=Toon korte apparaatlabels
+fl_device_labels_show_id=Toon apparaat ID-labels
+fl_host_labels_show_friendly=Toon korte eindpuntlabels
+fl_host_labels_show_ip=Toon eindpunt IP-adressen
+fl_host_labels_show_mac=Toon eindpunt MAC-adressen
+fl_host_labels_hide=Verberg eindpuntlabels
+
+fl_offline_devices=Onbereikbare apparaten
+fl_bad_links=Slechte verbindingen
+fl_reset_node_locations=Herstel Instantielocaties
+
+fl_layer_all=Alle lagen aan
+fl_layer_pkt=Pakket laag aan
+fl_layer_opt=Optische laag aan
+
+fl_panel_instances=Instanties-paneel
+fl_panel_summary=Overzichtspaneel
+fl_panel_details=Details-paneel
+
+fl_port_highlighting=poortinformatie
+
+fl_oblique_view=Doorzichtige lagen aan
+fl_normal_view=Normaal beeld
+
+fl_monitoring_canceled=Monitoren geannuleerd
+fl_selecting_intent=Intentie selecteren
+
+# Core Overlays
+ov_tt_protected_intents=Beschermde Intenties bovenlaag
+ov_tt_traffic=Verkeersbovenlaag
+ov_tt_none=Verberg bovenlaag
+
+# Traffic Overlay
+tr_btn_create_h2h_flow=Creëer pad van eindpunt naar eindpunt
+tr_btn_create_msrc_flow=Creëer Multi-Bron pad
+tr_btn_show_device_flows=Toon apparaatpaden
+tr_btn_show_related_traffic=Toon gerelateerd verkeer
+tr_btn_cancel_monitoring=Annuleer monitoren van verkeer
+tr_btn_monitor_all=Monitor al het verkeer
+tr_btn_show_dev_link_flows=Toon paden over apparaatverbindingen
+tr_btn_show_all_rel_intents=Toon alle gerelateerde intenties
+tr_btn_show_prev_rel_intent=Toon vorige gerelateerde intentie
+tr_btn_show_next_rel_intent=Toon volgende gerelateerde intentie
+tr_btn_monitor_sel_intent=Monitor verkeer van de geselecteerde intentie
+tr_fl_fstats_bytes=Pad statistieken (bytes)
+tr_fl_pstats_bits=Poort statistieken (bits per seconde)
+tr_fl_pstats_pkts=Poort statistieken (pakketten per seconde)
+tr_fl_dev_flows=Apparaatpaden
+tr_fl_rel_paths=Gerelateerde intenties
+tr_fl_prev_rel_int=Vorige gerelateerde intentie
+tr_fl_next_rel_int=Volgende gerelateerde intentie
+tr_fl_traf_on_path=Verkeer op de geselecteerde intentie
+tr_fl_h2h_flow_added=Pad van eindpunt naar eindpunt toegevoegd
+tr_fl_multisrc_flow=Multi-Bron pad
+
+# Button tooltips
+btn_show_view_device=Naar apparaatlijst
+btn_show_view_flow=Naar padlijst van dit apparaat
+btn_show_view_port=Naar poortlijst van dit apparaat
+btn_show_view_group=Naar groeplijst van dit apparaat
+btn_show_view_meter=Naar meterlijst van dit apparaat
+
+# Panel Titles
+title_select_map=Selecteer een kaart
+title_panel_summary=ONOS Overzicht
+title_selected_items=Geselecteerde onderdelen
+title_edge_link=Eindverbinding
+title_infra_link=Infrastructuurverbinding
+
+# Custom Panel Labels / Values
+lp_label_friendly=Korte naam
+
+lp_label_a_type=A type
+lp_label_a_id=A ID
+lp_label_a_friendly=A naam
+lp_label_a_port=A poort
+
+lp_label_b_type=B type
+lp_label_b_id=B ID
+lp_label_b_friendly=B naam
+lp_label_b_port=B poort
+
+lp_label_a2b=A naar B
+lp_label_b2a=B naar A
+
+lp_value_no_link=[geen verbinding]
+