[ONOS-7905] Add a set of interfaces for k8s-networking data model

Change-Id: I18b2e718705999da61f26e1c482942d424c7c1c0
diff --git a/apps/k8s-networking/BUILD b/apps/k8s-networking/BUILD
new file mode 100644
index 0000000..866fca6
--- /dev/null
+++ b/apps/k8s-networking/BUILD
@@ -0,0 +1,15 @@
+BUNDLES = [
+    "//apps/k8s-networking/api:onos-apps-k8s-networking-api",
+    "//apps/k8s-networking/app:onos-apps-k8s-networking-app",
+]
+
+onos_app(
+    category = "Integration",
+    description = "SONA Kubernetes Networking Application.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.k8s-node",
+    ],
+    title = "Kubernetes Networking Application",
+    url = "https://wiki.onosproject.org/display/ONOS/SONA%3A+DC+Network+Virtualization",
+)
diff --git a/apps/k8s-networking/api/BUILD b/apps/k8s-networking/api/BUILD
new file mode 100644
index 0000000..36d2da1
--- /dev/null
+++ b/apps/k8s-networking/api/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//core/api:onos-api-tests",
+    "//core/common:onos-core-common-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpam.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpam.java
new file mode 100644
index 0000000..57f2130
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpam.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * Representation of kubernetes IPAM.
+ */
+public interface K8sIpam {
+
+    /**
+     * Returns the IP address.
+     *
+     * @return IP address
+     */
+    IpAddress ipaddress();
+
+    /**
+     * Returns the kubernetes network ID.
+     *
+     * @return kubernetes network ID
+     */
+    String networkId();
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamAdminService.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamAdminService.java
new file mode 100644
index 0000000..f34421a
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamAdminService.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * IP Address Management admin service for kubernetes network.
+ */
+public interface K8sIpamAdminService extends K8sIpamService {
+
+    /**
+     * Allocates a new IP address with the given network.
+     *
+     * @param networkId network identifier
+     * @return allocated IP address
+     */
+    IpAddress allocateIp(String networkId);
+
+    /**
+     * Leases the IP address from the given network.
+     *
+     * @param networkId network identifier
+     * @return leased IP address
+     */
+    IpAddress leaseIp(String networkId);
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamEvent.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamEvent.java
new file mode 100644
index 0000000..a2fa06f
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamEvent.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * Describes kubernetes IPAM service event.
+ */
+public class K8sIpamEvent extends AbstractEvent<K8sIpamEvent.Type, K8sIpam> {
+
+    /**
+     * Creates an event of a given type for the specified IPAM.
+     *
+     * @param type      kubernetes IPAM event type
+     * @param subject   kubernetes IPAM
+     */
+    protected K8sIpamEvent(Type type, K8sIpam subject) {
+        super(type, subject);
+    }
+
+    /**
+     * kubernetes IPAM events.
+     */
+    public enum Type {
+        /**
+         * Signifies that a new IP address was allocated.
+         */
+        K8S_IP_ALLOCATED,
+
+        /**
+         * Signifies that an existing IP address was released.
+         */
+        K8S_IP_RELEASED,
+    }
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamListener.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamListener.java
new file mode 100644
index 0000000..2436564
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for kubernetes IPAM event.
+ */
+public interface K8sIpamListener extends EventListener<K8sIpamEvent> {
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamService.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamService.java
new file mode 100644
index 0000000..23da934
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.event.ListenerService;
+
+import java.util.Set;
+
+/**
+ * IP Address Management service for kubernetes network.
+ */
+public interface K8sIpamService extends ListenerService<K8sIpamEvent, K8sIpamListener> {
+
+    /**
+     * Returns the already allocated IP addresses.
+     *
+     * @param networkId network identifier
+     * @return allocated IP addresses
+     */
+    Set<IpAddress> allocatedIps(String networkId);
+
+    /**
+     * Returns the available IP addresses.
+     *
+     * @param networkId network identifier
+     * @return available IP addresses
+     */
+    Set<IpAddress> availableIps(String networkId);
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStore.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStore.java
new file mode 100644
index 0000000..bcd1d1f
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStore.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+import org.onosproject.store.Store;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of instance IPAM; not intended for direct use.
+ */
+public interface K8sIpamStore extends Store<K8sIpamEvent, K8sIpamStoreDelegate> {
+
+    /**
+     * Allocates a new IP address.
+     *
+     * @param networkId network identifier
+     * @return newly allocated IP address
+     */
+    IpAddress allocateIp(String networkId);
+
+    /**
+     * Leases the existing IP address.
+     *
+     * @param networkId network identifier
+     * @return leased IP address
+     */
+    IpAddress leaseIp(String networkId);
+
+    /**
+     * Initializes a new IP pool with the given network.
+     *
+     * @param networkId network identifier
+     */
+    void initializeIpPool(String networkId);
+
+    /**
+     * Purges an existing IP pool associated with the given network.
+     *
+     * @param networkId network identifier
+     */
+    void purgeIpPool(String networkId);
+
+    /**
+     * Returns the already allocated IP addresses.
+     *
+     * @param networkId network identifier
+     * @return allocated IP addresses
+     */
+    Set<IpAddress> allocatedIps(String networkId);
+
+    /**
+     * Returns the available IP addresses.
+     *
+     * @param networkId network identifier
+     * @return available IP addresses
+     */
+    Set<IpAddress> availableIps(String networkId);
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStoreDelegate.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStoreDelegate.java
new file mode 100644
index 0000000..cadd8f3
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sIpamStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * IPAM store delegate abstraction.
+ */
+public interface K8sIpamStoreDelegate extends StoreDelegate<K8sIpamEvent> {
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetwork.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetwork.java
new file mode 100644
index 0000000..f971cb9
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetwork.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+
+/**
+ * Representation of kubernetes network.
+ */
+public interface K8sNetwork {
+
+    /**
+     * Lists of network type.
+     */
+    enum Type {
+
+        /**
+         * VXLAN typed virtual network.
+         */
+        VXLAN,
+
+        /**
+         * GRE typed virtual network.
+         */
+        GRE,
+
+        /**
+         * GENEVE typed virtual network.
+         */
+        GENEVE,
+    }
+
+    /**
+     * Returns the kubernetes network ID.
+     *
+     * @return kubernetes network ID
+     */
+    String networkId();
+
+    /**
+     * Returns kubernetes network type.
+     *
+     * @return kubernetes network type
+     */
+    Type type();
+
+    /**
+     * Returns maximum transmission unit (MTU) value to address fragmentation.
+     *
+     * @return maximum transmission unit (MTU) value to address fragmentation
+     */
+    Integer mtu();
+
+    /**
+     * Returns segmentation ID.
+     *
+     * @return segmentation ID
+     */
+    String segmentId();
+
+    /**
+     * Returns gateway IP address.
+     *
+     * @return gateway IP address
+     */
+    IpAddress gatewayIp();
+
+    /**
+     * Returns network CIDR.
+     *
+     * @return network CIDR
+     */
+    String cidr();
+
+    /**
+     * Builder of new network.
+     */
+    interface Builder {
+
+        /**
+         * Builds an immutable network instance.
+         *
+         * @return kubernetes network
+         */
+        K8sNetwork build();
+
+        /**
+         * Returns network builder with supplied network ID.
+         *
+         * @param networkId network ID
+         * @return network builder
+         */
+        Builder networkId(String networkId);
+
+        /**
+         * Returns network builder with supplied network type.
+         *
+         * @param type network type
+         * @return network builder
+         */
+        Builder type(Type type);
+
+        /**
+         * Returns network builder with supplied MTU.
+         *
+         * @param mtu maximum transmission unit
+         * @return network builder
+         */
+        Builder mtu(Integer mtu);
+
+        /**
+         * Returns network builder with supplied segment ID.
+         *
+         * @param segmentId segment ID
+         * @return network builder
+         */
+        Builder segmentId(String segmentId);
+
+        /**
+         * Returns network builder with supplied gateway IP address.
+         *
+         * @param ipAddress gateway IP address
+         * @return network builder
+         */
+        Builder gatewayIp(IpAddress ipAddress);
+
+        /**
+         * Returns network builder with supplied network CIDR.
+         *
+         * @param cidr Classless Inter-Domain Routing
+         * @return network builder
+         */
+        Builder cidr(String cidr);
+    }
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkAdminService.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkAdminService.java
new file mode 100644
index 0000000..e7f5c18
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkAdminService.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+/**
+ * Service for administering the inventory of kubernetes network, subnet.
+ */
+public interface K8sNetworkAdminService extends K8sNetworkService {
+
+    /**
+     * Creates a kubernetes network with the given information.
+     *
+     * @param network the new network
+     */
+    void createNetwork(K8sNetwork network);
+
+    /**
+     * Updates the kubernetes network with the given information.
+     *
+     * @param network the updated network
+     */
+    void updateNetwork(K8sNetwork network);
+
+    /**
+     * Removes the network.
+     *
+     * @param networkId network identifier
+     * @return removed network; null if the network does not exist
+     */
+    K8sNetwork removeNetwork(String networkId);
+
+    /**
+     * Creates a kubernetes port with the given information.
+     *
+     * @param port the new port
+     */
+    void createPort(K8sPort port);
+
+    /**
+     * Updates the kubernetes port with the given information.
+     *
+     * @param port the updated port
+     */
+    void updatePort(K8sPort port);
+
+    /**
+     * Removes the port.
+     *
+     * @param portId port identifier
+     * @return removed port; null if the port does not exist
+     */
+    K8sPort removePort(String portId);
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkEvent.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkEvent.java
new file mode 100644
index 0000000..ea097bc
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkEvent.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * Describes kubernetes network service event.
+ */
+public class K8sNetworkEvent extends AbstractEvent<K8sNetworkEvent.Type, K8sNetwork> {
+
+    /**
+     * Creates an event of a given type for the specified network.
+     *
+     * @param type kubernetes network event type
+     * @param subject kubernetes network
+     */
+    protected K8sNetworkEvent(Type type, K8sNetwork subject) {
+        super(type, subject);
+    }
+
+    /**
+     * Kubernetes network events.
+     */
+    public enum Type {
+
+        /**
+         * Signifies that a new kubernetes network is created.
+         */
+        K8S_NETWORK_CREATED,
+
+        /**
+         * Signifies that the kubernetes network is updated.
+         */
+        K8S_NETWORK_UPDATED,
+
+        /**
+         * Signifies that the kubernetes network is removed.
+         */
+        K8S_NETWORK_REMOVED,
+    }
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkListener.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkListener.java
new file mode 100644
index 0000000..2a1aec5
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for kubernetes network event.
+ */
+public interface K8sNetworkListener extends EventListener<K8sNetworkEvent> {
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkService.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkService.java
new file mode 100644
index 0000000..1a8f84e
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkService.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.event.ListenerService;
+import org.onosproject.k8snetworking.api.K8sNetwork.Type;
+import org.onosproject.k8snetworking.api.K8sPort.State;
+
+import java.util.Set;
+
+/**
+ * Service for interacting with the inventory of kubernetes network.
+ */
+public interface K8sNetworkService
+        extends ListenerService<K8sNetworkEvent, K8sNetworkListener> {
+
+    /**
+     * Returns the kubernetes network with the supplied network identifier.
+     *
+     * @param networkId network identifier
+     * @return kubernetes network
+     */
+    K8sNetwork network(String networkId);
+
+    /**
+     * Returns all kubernetes networks registered in the service.
+     *
+     * @return set of kubernetes networks
+     */
+    Set<K8sNetwork> networks();
+
+    /**
+     * Returns the kubernetes networks with the given network type.
+     *
+     * @param type virtual network type
+     * @return set of kubernetes networks
+     */
+    Set<K8sNetwork> networks(Type type);
+
+    /**
+     * Returns the kubernetes port with the supplied network identifier.
+     *
+     * @param portId port identifier
+     * @return kubernetes port
+     */
+    K8sPort port(String portId);
+
+    /**
+     * Returns all kubernetes ports registered in the service.
+     *
+     * @return set of kubernetes ports
+     */
+    Set<K8sPort> ports();
+
+    /**
+     * Returns the kubernetes ports with the given port state.
+     *
+     * @param state port state
+     * @return set of kubernetes ports
+     */
+    Set<K8sPort> ports(State state);
+
+    /**
+     * Returns the kubernetes ports belongs to the given network.
+     *
+     * @param networkId network identifier
+     * @return kubernetes ports
+     */
+    Set<K8sPort> ports(String networkId);
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStore.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStore.java
new file mode 100644
index 0000000..a5255ff
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStore.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.store.Store;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of kubernetes network states; not intended for direct use.
+ */
+public interface K8sNetworkStore extends Store<K8sNetworkEvent, K8sNetworkStoreDelegate> {
+
+    /**
+     * Creates the new kubernetes network.
+     *
+     * @param network kubernetes network
+     */
+    void createNetwork(K8sNetwork network);
+
+    /**
+     * Update the kubernetes network.
+     *
+     * @param network kubernetes network
+     */
+    void updateNetwork(K8sNetwork network);
+
+    /**
+     * Removes the kubernetes network with the given network identifier.
+     *
+     * @param networkId network identifier
+     * @return removed kubernetes network; null if failed
+     */
+    K8sNetwork removeNetwork(String networkId);
+
+    /**
+     * Returns the kubernetes network with the given network identifier.
+     *
+     * @param networkId network identifier
+     * @return network; null if not found
+     */
+    K8sNetwork network(String networkId);
+
+    /**
+     * Returns all kubernetes networks.
+     *
+     * @return set of kubernetes networks
+     */
+    Set<K8sNetwork> networks();
+
+    /**
+     * Removes all kubernetes networks.
+     */
+    void clear();
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStoreDelegate.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStoreDelegate.java
new file mode 100644
index 0000000..c8db036
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sNetworkStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * Kubernetes network store delegate abstraction.
+ */
+public interface K8sNetworkStoreDelegate extends StoreDelegate<K8sNetworkEvent> {
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sPort.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sPort.java
new file mode 100644
index 0000000..13f5c47
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/K8sPort.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2019-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.k8snetworking.api;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+
+/**
+ * Representation of virtual port.
+ */
+public interface K8sPort {
+
+    /**
+     * List of instance port state.
+     */
+    enum State {
+
+        /**
+         * Signifies that the given port is in active state.
+         */
+        ACTIVE,
+
+        /**
+         * Signifies that the given port is in inactive state.
+         */
+        INACTIVE,
+    }
+
+    /**
+     * Returns the kubernetes network ID that the port is associated with.
+     *
+     * @return kubernetes network ID
+     */
+    String networkId();
+
+    /**
+     * Returns the kubernetes port ID.
+     *
+     * @return kubernetes port ID
+     */
+    String portId();
+
+    /**
+     * Returns the MAC address of the port.
+     *
+     * @return MAC address
+     */
+    MacAddress macAddress();
+
+    /**
+     * Returns the IP address of the port.
+     *
+     * @return IP address
+     */
+    IpAddress ipAddress();
+
+    /**
+     * Returns the device ID of the port.
+     *
+     * @return device ID
+     */
+    DeviceId deviceId();
+
+    /**
+     * Returns the port number of the port.
+     *
+     * @return port number
+     */
+    PortNumber portNumber();
+
+    /**
+     * Returns the state of the port.
+     *
+     * @return state of port
+     */
+    State state();
+
+    /**
+     * Returns new port instance with the given state.
+     *
+     * @param newState updated state
+     * @return updated port
+     */
+    K8sPort updateState(State newState);
+
+    /**
+     * Builder of new port.
+     */
+    interface Builder {
+
+        /**
+         * Builds an immutable port instance.
+         *
+         * @return kubernetes port
+         */
+        K8sPort build();
+
+        /**
+         * Returns port builder with supplied network ID.
+         *
+         * @param networkId network ID
+         * @return port builder
+         */
+        Builder networkId(String networkId);
+
+        /**
+         * Returns port builder with supplied port ID.
+         *
+         * @param portId port ID
+         * @return port builder
+         */
+        Builder portId(String portId);
+
+        /**
+         * Returns port builder with supplied MAC address.
+         *
+         * @param macAddress MAC address
+         * @return port builder
+         */
+        Builder macAddress(MacAddress macAddress);
+
+        /**
+         * Returns port builder with supplied IP address.
+         *
+         * @param ipAddress IP address
+         * @return port builder
+         */
+        Builder ipAddress(IpAddress ipAddress);
+
+        /**
+         * Returns port builder with supplied device ID.
+         *
+         * @param deviceId device ID
+         * @return port builder
+         */
+        Builder deviceId(DeviceId deviceId);
+
+        /**
+         * Returns port builder with supplied port number.
+         *
+         * @param portNumber port number
+         * @return port builder
+         */
+        Builder portNumber(PortNumber portNumber);
+
+        /**
+         * Returns port builder with supplied port state.
+         *
+         * @param state port state
+         * @return port builder
+         */
+        Builder state(State state);
+    }
+}
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/package-info.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/package-info.java
new file mode 100644
index 0000000..c02a8dd
--- /dev/null
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * APIs for kubernetes CNI related functions including IPAM, etc.
+ */
+package org.onosproject.k8snetworking.api;
\ No newline at end of file
diff --git a/apps/k8s-networking/app/BUILD b/apps/k8s-networking/app/BUILD
new file mode 100644
index 0000000..06da173
--- /dev/null
+++ b/apps/k8s-networking/app/BUILD
@@ -0,0 +1,16 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + REST + [
+    "//core/store/serializers:onos-core-serializers",
+    "//apps/k8s-node/api:onos-apps-k8s-node-api",
+    "//apps/k8s-networking/api:onos-apps-k8s-networking-api",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//core/api:onos-api-tests",
+    "//core/common:onos-core-common-tests",
+]
+
+osgi_jar_with_tests(
+    karaf_command_packages = ["org.onosproject.k8snetworking.cli"],
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/package-info.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/package-info.java
new file mode 100644
index 0000000..18cd1ad
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * CLI implementation for kubernetes integration.
+ */
+package org.onosproject.k8snetworking.cli;
\ No newline at end of file
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/codec/package-info.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/codec/package-info.java
new file mode 100644
index 0000000..8362358
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/codec/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * Implementations of the codec broker and kubernetes networking entity JSON codecs.
+ */
+package org.onosproject.k8snetworking.codec;
\ No newline at end of file
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/package-info.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/package-info.java
new file mode 100644
index 0000000..5a869cf
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * Implements kubernetes integration.
+ */
+package org.onosproject.k8snetworking.impl;
\ No newline at end of file
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/web/package-info.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/web/package-info.java
new file mode 100644
index 0000000..392c803
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/web/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2019-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.
+ */
+
+/**
+ * Kubernetes networking web implementation.
+ */
+package org.onosproject.k8snetworking.web;
\ No newline at end of file