ONOS-2739 - OSPF Basic Packet Structures , which includes encoding and decoding
Change-Id: I3f09176ad4ccc330b8989f13b12f74dc86f53ae4
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestination.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestination.java
new file mode 100644
index 0000000..fd4882f
--- /dev/null
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfExternalDestination.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2014-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 com.google.common.base.MoreObjects;
+import org.onlab.packet.Ip4Address;
+
+/**
+ * Defines the OSPF external destination.
+ */
+public class OspfExternalDestination {
+
+ private boolean isType1orType2Metric;
+ private int metric;
+ private Ip4Address forwardingAddress;
+ private int externalRouterTag;
+
+ /**
+ * Gets whether type1 or type 2 metric.
+ *
+ * @return true if Type1 or false if Type2 metric
+ */
+ public boolean isType1orType2Metric() {
+ return isType1orType2Metric;
+ }
+
+ /**
+ * Sets whether type1 or Type2 metric.
+ *
+ * @param isType1orType2Metric is type 1 or type 2 metric
+ */
+ public void setType1orType2Metric(boolean isType1orType2Metric) {
+ this.isType1orType2Metric = isType1orType2Metric;
+ }
+
+ /**
+ * Gets the metric value.
+ *
+ * @return metric value
+ */
+ public int metric() {
+ return metric;
+ }
+
+ /**
+ * Sets the metric value.
+ *
+ * @param metric metric value
+ */
+ public void setMetric(int metric) {
+ this.metric = metric;
+ }
+
+ /**
+ * Gets forwarding address.
+ *
+ * @return forwarding address
+ */
+ public Ip4Address forwardingAddress() {
+ return forwardingAddress;
+ }
+
+ /**
+ * Sets forwarding address.
+ *
+ * @param forwardingAddress forwarding address
+ */
+ public void setForwardingAddress(Ip4Address forwardingAddress) {
+ this.forwardingAddress = forwardingAddress;
+ }
+
+ /**
+ * Gets external router tag.
+ *
+ * @return external router tag
+ */
+ public int externalRouterTag() {
+ return externalRouterTag;
+ }
+
+ /**
+ * Sets external router tag.
+ *
+ * @param externalRouterTag external router tag
+ */
+ public void setExternalRouterTag(int externalRouterTag) {
+ this.externalRouterTag = externalRouterTag;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .omitNullValues()
+ .add("isType1orType2Metric", isType1orType2Metric)
+ .add("metric", metric)
+ .add("forwardingAddress", forwardingAddress)
+ .add("externalRouterTag", externalRouterTag)
+ .toString();
+ }
+}
\ No newline at end of file
diff --git a/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfLsaLink.java b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfLsaLink.java
new file mode 100644
index 0000000..5db5648
--- /dev/null
+++ b/protocols/ospf/protocol/src/main/java/org/onosproject/ospf/protocol/lsa/subtypes/OspfLsaLink.java
@@ -0,0 +1,132 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+
+/**
+ * Representation of an OSPF LSA link.
+ */
+public class OspfLsaLink {
+
+ public String linkId;
+ public String linkData;
+ public int linkType;
+ public int metric;
+ public int tos;
+
+ /**
+ * Gets link id.
+ *
+ * @return link id
+ */
+ public String linkId() {
+ return linkId;
+ }
+
+ /**
+ * Sets link id.
+ *
+ * @param linkId link id
+ */
+ public void setLinkId(String linkId) {
+ this.linkId = linkId;
+ }
+
+ /**
+ * Gets link data.
+ *
+ * @return link data
+ */
+ public String linkData() {
+ return linkData;
+ }
+
+ /**
+ * Sets link data.
+ *
+ * @param linkData link data
+ */
+ public void setLinkData(String linkData) {
+ this.linkData = linkData;
+ }
+
+ /**
+ * Gets link type.
+ *
+ * @return link type
+ */
+ public int linkType() {
+ return linkType;
+ }
+
+ /**
+ * Sets link type.
+ *
+ * @param linkType link type
+ */
+ public void setLinkType(int linkType) {
+ this.linkType = linkType;
+ }
+
+ /**
+ * Gets metric value.
+ *
+ * @return metric.
+ */
+ public int metric() {
+ return metric;
+ }
+
+ /**
+ * Sets metric value.
+ *
+ * @param metric metric
+ */
+ public void setMetric(int metric) {
+ this.metric = metric;
+ }
+
+ /**
+ * Gets tos.
+ *
+ * @return tos
+ */
+ public int tos() {
+ return tos;
+ }
+
+ /**
+ * Sets tos.
+ *
+ * @param tos tos
+ */
+ public void setTos(int tos) {
+ this.tos = tos;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .omitNullValues()
+ .add("linkID", linkId)
+ .add("linkData", linkData)
+ .add("linkType", linkType)
+ .add("metric", metric)
+ .add("tos", tos)
+ .toString();
+ }
+}
\ No newline at end of file