Remove deprecated APIs and add basic unit test
Change-Id: I6b4302dea27b3f2e61cfd48e2cd34aa850f11fb6
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java
index d231721..0b39d9c 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultTunnelDescription.java
@@ -42,30 +42,6 @@
/**
* Creates a tunnel description using the supplied information.
*
- * @param src TunnelPoint source
- * @param dst TunnelPoint destination
- * @param type tunnel type
- * @param tunnelName tunnel name
- * @param annotations optional key/value annotations
- * @deprecated version 1.7.0 - Hummingbird
- */
- @Deprecated
- public DefaultTunnelDescription(TunnelEndPoint src,
- TunnelEndPoint dst, Type type,
- TunnelName tunnelName,
- SparseAnnotations... annotations) {
- super(annotations);
- this.deviceId = Optional.empty();
- this.local = Optional.ofNullable(src);
- this.remote = Optional.ofNullable(dst);
- this.type = type;
- this.ifaceName = tunnelName.value();
- this.key = Optional.empty();
- }
-
- /**
- * Creates a tunnel description using the supplied information.
- *
* @param ifaceName tunnel interface ifaceName
* @param local source tunnel endpoint
* @param remote destination tunnel endpoint
@@ -98,18 +74,6 @@
return ifaceName;
}
- @Deprecated
- @Override
- public TunnelEndPoint src() {
- return local.isPresent() ? local.get() : null;
- }
-
- @Deprecated
- @Override
- public TunnelEndPoint dst() {
- return remote.isPresent() ? remote.get() : null;
- }
-
@Override
public Type type() {
return type;
@@ -130,12 +94,6 @@
return key;
}
- @Deprecated
- @Override
- public TunnelName tunnelName() {
- return TunnelName.tunnelName(ifaceName);
- }
-
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java
index 1d61f90..c78ab57 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/TunnelDescription.java
@@ -102,33 +102,6 @@
Optional<TunnelKey> key();
/**
- * Returns the connection point source.
- *
- * @deprecated version 1.7.0 - Hummingbird; use local instead
- * @return tunnel source ConnectionPoint
- */
- @Deprecated
- TunnelEndPoint src();
-
- /**
- * Returns the connection point destination.
- *
- * @deprecated version 1.7.0 - Hummingbird; use remote instead
- * @return tunnel destination
- */
- @Deprecated
- TunnelEndPoint dst();
-
- /**
- * Return the name of a tunnel.
- *
- * @deprecated version 1.7.0 - Hummingbird; use ifaceName instead
- * @return Tunnel Name
- */
- @Deprecated
- TunnelName tunnelName();
-
- /**
* Builder of tunnel interface description entities.
*/
interface Builder {
diff --git a/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java
new file mode 100644
index 0000000..5cd339f
--- /dev/null
+++ b/core/api/src/test/java/org/onosproject/net/behaviour/DefaultTunnelDescriptionTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package org.onosproject.net.behaviour;
+
+import org.junit.Test;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.SparseAnnotations;
+
+import com.google.common.testing.EqualsTester;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+
+public class DefaultTunnelDescriptionTest {
+
+ private static final String DID_1 = "device1";
+ private static final String IFACE_NAME_1 = "eth1";
+ private static final TunnelKey<Long> KEY_1 = new TunnelKey<>(1L);
+ private static final TunnelEndPoint<Long> LOCAL_1 =
+ new TunnelEndPoint<>(11L);
+ private static final TunnelEndPoint<Long> REMOTE_1 =
+ new TunnelEndPoint<>(12L);
+ private static final SparseAnnotations ANNOTATIONS_1 =
+ DefaultAnnotations.builder()
+ .set("AAA", "AAA")
+ .build();
+
+ private TunnelDescription tunnelDescription1 =
+ DefaultTunnelDescription.builder()
+ .deviceId(DID_1)
+ .ifaceName(IFACE_NAME_1)
+ .key(KEY_1)
+ .type(TunnelDescription.Type.GRE)
+ .local(LOCAL_1)
+ .remote(REMOTE_1)
+ .otherConfigs(ANNOTATIONS_1)
+ .build();
+
+ private TunnelDescription tunnelDescription2 =
+ DefaultTunnelDescription.builder()
+ .deviceId(DID_1)
+ .ifaceName(IFACE_NAME_1)
+ .key(KEY_1)
+ .type(TunnelDescription.Type.GRE)
+ .remote(LOCAL_1)
+ .local(REMOTE_1)
+ .build();
+
+ @Test
+ public void testConstruction() {
+ assertTrue(tunnelDescription1.deviceId().isPresent());
+ assertThat(tunnelDescription1.deviceId().get(), is(DID_1));
+ assertThat(tunnelDescription1.ifaceName(), is(IFACE_NAME_1));
+ assertTrue(tunnelDescription1.key().isPresent());
+ assertThat(tunnelDescription1.key().get(), is(KEY_1));
+ assertThat(tunnelDescription1.type(), is(TunnelDescription.Type.GRE));
+ assertTrue(tunnelDescription1.local().isPresent());
+ assertThat(tunnelDescription1.local().get(), is(LOCAL_1));
+ assertTrue(tunnelDescription1.remote().isPresent());
+ assertThat(tunnelDescription1.remote().get(), is(REMOTE_1));
+ }
+
+ @Test
+ public void testEquals() {
+ new EqualsTester()
+ .addEqualityGroup(tunnelDescription1)
+ .addEqualityGroup(tunnelDescription2)
+ .testEquals();
+ }
+}