Implement default kubevirt pipeline, support provider network
Change-Id: I82eaaed05668067090703ec3c10ae6151c2ea815
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/Constants.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/Constants.java
new file mode 100644
index 0000000..ca0eecd
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/Constants.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021-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.kubevirtnetworking.api;
+
+import org.onlab.packet.MacAddress;
+
+/**
+ * Provides constants used in KubevirtNetworking.
+ */
+public final class Constants {
+
+ private Constants() {
+ }
+
+ public static final String KUBEVIRT_NETWORKING_APP_ID =
+ "org.onosproject.kubevirtnetworking";
+ public static final String DEFAULT_GATEWAY_MAC_STR = "fe:00:00:00:00:02";
+ public static final MacAddress DEFAULT_GATEWAY_MAC =
+ MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
+
+ // flow table index
+ public static final int STAT_INBOUND_TABLE = 0;
+ public static final int VTAP_INBOUND_TABLE = 1;
+ public static final int STAT_FLAT_OUTBOUND_TABLE = 10;
+ public static final int DHCP_TABLE = 5;
+ public static final int VTAG_TABLE = 30;
+ public static final int PRE_FLAT_TABLE = 31;
+ public static final int FLAT_TABLE = 32;
+ public static final int ARP_TABLE = 35;
+ public static final int ACL_EGRESS_TABLE = 40;
+ public static final int ACL_INGRESS_TABLE = 44;
+ public static final int CT_TABLE = 45;
+ public static final int ACL_RECIRC_TABLE = 43;
+ public static final int JUMP_TABLE = 50;
+ public static final int ROUTING_TABLE = 60;
+ public static final int STAT_OUTBOUND_TABLE = 70;
+ public static final int VTAP_OUTBOUND_TABLE = 71;
+ public static final int FORWARDING_TABLE = 80;
+ public static final int ERROR_TABLE = 100;
+
+ // flow rule priority
+ public static final int PRIORITY_SWITCHING_RULE = 30000;
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtFlowRuleService.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtFlowRuleService.java
new file mode 100644
index 0000000..e9196c8
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtFlowRuleService.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2021-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.kubevirtnetworking.api;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.flow.TrafficSelector;
+import org.onosproject.net.flow.TrafficTreatment;
+
+/**
+ * Service for setting flow rules.
+ */
+public interface KubevirtFlowRuleService {
+
+ /**
+ * Sets the flow rule.
+ *
+ * @param appId application ID
+ * @param deviceId device ID
+ * @param selector matches of the flow rule
+ * @param treatment actions of the flow rule
+ * @param priority priority of the flow rule
+ * @param tableType table number to put the flow rule
+ * @param install add the rule if true, remove it otherwise
+ */
+ void setRule(ApplicationId appId,
+ DeviceId deviceId,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ int priority,
+ int tableType,
+ boolean install);
+
+ /**
+ * Install table miss entry (drop rule) in the table.
+ *
+ * @param deviceId device ID
+ * @param table table number
+ */
+ void setUpTableMissEntry(DeviceId deviceId, int table);
+
+ /**
+ * Install a flor rule for transition from table A to table B.
+ *
+ * @param deviceId device Id
+ * @param fromTable table number of table A
+ * @param toTable table number of table B
+ */
+ void connectTables(DeviceId deviceId, int fromTable, int toTable);
+}