vRouter: ignore routes that don't come from Quagga
Change-Id: I1a67a18b7f5f0a4e43156c017b92c12789e81104
diff --git a/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java b/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
new file mode 100644
index 0000000..0b2ba09
--- /dev/null
+++ b/apps/routing/src/main/java/org/onosproject/routing/fpm/protocol/RtProtocol.java
@@ -0,0 +1,141 @@
+/*
+ * 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.routing.fpm.protocol;
+
+/**
+ * RtNetlink protocol value.
+ * <p>
+ * This is a subset of the protocol values used in rtnetlink.
+ * Taken from linux/rtnetlink.h
+ * </p>
+ */
+public enum RtProtocol {
+ /**
+ * Unspecified.
+ */
+ UNSPEC((short) 0),
+
+ /**
+ * Route installed by ICMP redirects.
+ */
+ REDIRECT((short) 1),
+
+ /**
+ * Route installed by kernel.
+ */
+ KERNEL((short) 2),
+
+ /**
+ * Route installed during boot.
+ */
+ BOOT((short) 3),
+
+ /**
+ * Route installed by administrator.
+ */
+ STATIC((short) 4),
+
+ /**
+ * GateD.
+ */
+ GATED((short) 8),
+
+ /**
+ * RDISC/ND router advertisements.
+ */
+ RA((short) 9),
+
+ /**
+ * Merit MRT.
+ */
+ MRT((short) 10),
+
+ /**
+ * Zebra.
+ */
+ ZEBRA((short) 11),
+
+ /**
+ * BIRD.
+ */
+ BIRD((short) 12),
+
+ /**
+ * DECnet routing daemon.
+ */
+ DNROUTED((short) 13),
+
+ /**
+ * XORP.
+ */
+ XORP((short) 14),
+
+ /**
+ * Netsukuku.
+ */
+ NTK((short) 15),
+
+ /**
+ * DHCP client.
+ */
+ DHCP((short) 16),
+
+ /**
+ * Multicast daemon.
+ */
+ MROUTED((short) 17),
+
+ /**
+ * Unknown.
+ */
+ UNKNOWN((short) 0);
+
+ private final short value;
+
+ /**
+ * Constructor.
+ *
+ * @param value value
+ */
+ RtProtocol(short value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the value.
+ *
+ * @return value
+ */
+ public short value() {
+ return value;
+ }
+
+ /**
+ * Gets the RtProtocol for the given integer value.
+ *
+ * @param value value
+ * @return RtProtocol, or null if unsupported type value
+ */
+ public static RtProtocol get(short value) {
+ for (RtProtocol p : RtProtocol.values()) {
+ if (p.value() == value) {
+ return p;
+ }
+ }
+ return UNKNOWN;
+ }
+}