ONOS-2739 - OSPF Basic Packet Structures , which includes encoding and decoding

Change-Id: I3f09176ad4ccc330b8989f13b12f74dc86f53ae4
diff --git a/protocols/ospf/protocol/src/test/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestinationTest.java b/protocols/ospf/protocol/src/test/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestinationTest.java
new file mode 100644
index 0000000..947f34a
--- /dev/null
+++ b/protocols/ospf/protocol/src/test/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestinationTest.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ospf.protocol.lsa.subtypes;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+
+import java.net.InetAddress;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+/**
+ * Unit test class for OspfRouterId.
+ */
+public class OspfExternalDestinationTest {
+
+    private OspfExternalDestination ospfExternalDestination;
+
+    @Before
+    public void setUp() throws Exception {
+        ospfExternalDestination = new OspfExternalDestination();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        ospfExternalDestination = null;
+    }
+
+    /**
+     * Tests isType1orType2Metric() getter method.
+     */
+    @Test
+    public void testIsType1orType2Metric() throws Exception {
+        ospfExternalDestination.setType1orType2Metric(true);
+        assertThat(ospfExternalDestination.isType1orType2Metric(), is(true));
+    }
+
+    /**
+     * Tests isType1orType2Metric() setter method.
+     */
+    @Test
+    public void testSetType1orType2Metric() throws Exception {
+        ospfExternalDestination.setType1orType2Metric(true);
+        assertThat(ospfExternalDestination.isType1orType2Metric(), is(true));
+    }
+
+    /**
+     * Tests metric() getter method.
+     */
+    @Test
+    public void testGetMetric() throws Exception {
+        ospfExternalDestination.setMetric(100);
+        assertThat(ospfExternalDestination.metric(), is(100));
+    }
+
+    /**
+     * Tests metric() setter method.
+     */
+    @Test
+    public void testSetMetric() throws Exception {
+        ospfExternalDestination.setMetric(100);
+        assertThat(ospfExternalDestination.metric(), is(100));
+    }
+
+    /**
+     * Tests forwardingAddress() getter method.
+     */
+    @Test
+    public void testGetForwardingAddress() throws Exception {
+        ospfExternalDestination.setForwardingAddress(Ip4Address.valueOf(InetAddress.getLocalHost()));
+        assertThat(ospfExternalDestination.forwardingAddress(), is(Ip4Address.valueOf(InetAddress.getLocalHost())));
+
+    }
+
+    /**
+     * Tests forwardingAddress() setter method.
+     */
+    @Test
+    public void testSetForwardingAddress() throws Exception {
+        ospfExternalDestination.setForwardingAddress(Ip4Address.valueOf(InetAddress.getLocalHost()));
+        assertThat(ospfExternalDestination.forwardingAddress(), is(Ip4Address.valueOf(InetAddress.getLocalHost())));
+    }
+
+    /**
+     * Tests externalRouterTag() getter method.
+     */
+    @Test
+    public void testGetExternalRouterTag() throws Exception {
+        ospfExternalDestination.setExternalRouterTag(100);
+        assertThat(ospfExternalDestination.externalRouterTag(), is(100));
+    }
+
+    /**
+     * Tests externalRouterTag() setter method.
+     */
+    @Test
+    public void testSetExternalRouterTag() throws Exception {
+        ospfExternalDestination.setExternalRouterTag(100);
+        assertThat(ospfExternalDestination.externalRouterTag(), is(100));
+    }
+
+    /**
+     * Tests to string method.
+     */
+    @Test
+    public void testToString() throws Exception {
+        assertThat(ospfExternalDestination.toString(), is(notNullValue()));
+    }
+}
\ No newline at end of file