ONOS-2740,ONOS-2741,from ONOS-3032 - to ONOS 3071 , OSPF Protocol Implementation
Change-Id: Ie8cccca4aaf2641ab1e332ed367ddfc9b725a35c
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfEligibleRouter.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfEligibleRouter.java
new file mode 100755
index 0000000..b1087d4
--- /dev/null
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfEligibleRouter.java
@@ -0,0 +1,128 @@
+/*
+ * 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.controller.util;
+
+import org.onlab.packet.Ip4Address;
+
+/**
+ * Represents a router who is eligible for DR election.
+ */
+public class OspfEligibleRouter {
+
+ private Ip4Address ipAddress;
+ private Ip4Address routerId;
+ private int routerPriority;
+ private boolean isDr;
+ private boolean isBdr;
+
+ /**
+ * Creates an instance.
+ * Initialize IP address of eligible router.
+ */
+ public OspfEligibleRouter() {
+ ipAddress = Ip4Address.valueOf("0.0.0.0");
+ }
+
+ /**
+ * Gets the value of IP address.
+ *
+ * @return IP address
+ */
+ public Ip4Address getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * Sets the value of IP address.
+ *
+ * @param ipAddress IP address
+ */
+ public void setIpAddress(Ip4Address ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ /**
+ * Gets the value of router id.
+ *
+ * @return router id.
+ */
+ public Ip4Address getRouterId() {
+ return routerId;
+ }
+
+ /**
+ * Sets the value of router id.
+ *
+ * @param routerId router id
+ */
+ public void setRouterId(Ip4Address routerId) {
+ this.routerId = routerId;
+ }
+
+ /**
+ * Gets the value of router priority.
+ *
+ * @return router priority.
+ */
+ public int getRouterPriority() {
+ return routerPriority;
+ }
+
+ /**
+ * Sets the value of router priority.
+ *
+ * @param routerPriority router priority
+ */
+ public void setRouterPriority(int routerPriority) {
+ this.routerPriority = routerPriority;
+ }
+
+ /**
+ * Gets whether the router is DR.
+ *
+ * @return boolean true if router is DR else return false.
+ */
+ public boolean isDr() {
+ return isDr;
+ }
+
+ /**
+ * Sets the router is DR or not.
+ *
+ * @param isDr router is DR or not
+ */
+ public void setIsDr(boolean isDr) {
+ this.isDr = isDr;
+ }
+
+ /**
+ * Gets whether the router is BDR or not.
+ *
+ * @return boolean true if router is Bdr else return false.
+ */
+ public boolean isBdr() {
+ return isBdr;
+ }
+
+ /**
+ * Sets the router is BDR or not.
+ *
+ * @param isBdr the router is BDR or not
+ */
+ public void setIsBdr(boolean isBdr) {
+ this.isBdr = isBdr;
+ }
+}
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfInterfaceType.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfInterfaceType.java
new file mode 100755
index 0000000..e34ea43
--- /dev/null
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfInterfaceType.java
@@ -0,0 +1,46 @@
+/*
+ * 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.controller.util;
+
+/**
+ * Enum represents OSPF interface types.
+ */
+public enum OspfInterfaceType {
+
+ POINT_TO_POINT(1),
+ BROADCAST(2),
+ VIRTUAL(3);
+
+ private int value;
+
+ /**
+ * Creates an instance.
+ *
+ * @param value value represents interface type
+ */
+ OspfInterfaceType(int value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets value represents interface type.
+ *
+ * @return value represents interface type
+ */
+ public int value() {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfLinkType.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfLinkType.java
new file mode 100755
index 0000000..aa6270a
--- /dev/null
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/OspfLinkType.java
@@ -0,0 +1,42 @@
+/*
+ * 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.controller.util;
+
+/**
+ * Enum represents OSPF link type.
+ */
+public enum OspfLinkType {
+
+ /**
+ * Indicates a point-to-point connection to another router.
+ */
+ POINT_TO_POINT,
+
+ /**
+ * Indicates a connection to a transit network.
+ */
+ TO_TRANSIT_NET,
+
+ /**
+ * Indicates a connection to a stub network.
+ */
+ TO_STUB_NET,
+
+ /**
+ * Indicates a Virtual link to another area border router.
+ */
+ VIRTUAL_LINK;
+}
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/package-info.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/package-info.java
new file mode 100755
index 0000000..b36992f
--- /dev/null
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/util/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of the OSPF utilities.
+ */
+package org.onosproject.ospf.controller.util;
\ No newline at end of file