Initial implementation of kubevirt network with CRUD ops support
Change-Id: I6a366fcd301e67f62a74fb828eea1ac67f2a2128
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/DefaultKubevirtNetwork.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/DefaultKubevirtNetwork.java
new file mode 100644
index 0000000..dc221ab
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/DefaultKubevirtNetwork.java
@@ -0,0 +1,248 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableSet;
+import org.onlab.packet.IpAddress;
+
+import java.util.Objects;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.onosproject.kubevirtnetworking.api.KubevirtNetwork.Type.FLAT;
+
+/**
+ * Default implementation class of kubevirt network.
+ */
+public final class DefaultKubevirtNetwork implements KubevirtNetwork {
+
+ private static final String NOT_NULL_MSG = "Network % cannot be null";
+
+ private final String networkId;
+ private final Type type;
+ private final String name;
+ private final Integer mtu;
+ private final String segmentId;
+ private final IpAddress gatewayIp;
+ private final String cidr;
+ private final Set<KubevirtHostRoute> hostRouts;
+ private final KubevirtIpPool ipPool;
+
+ /**
+ * Default constructor.
+ *
+ * @param networkId network identifier
+ * @param type type of network
+ * @param name network name
+ * @param mtu network MTU
+ * @param segmentId segment identifier
+ * @param gatewayIp gateway IP address
+ * @param cidr CIDR of network
+ * @param hostRouts a set of host routes
+ * @param ipPool IP pool
+ */
+ public DefaultKubevirtNetwork(String networkId, Type type, String name,
+ Integer mtu, String segmentId, IpAddress gatewayIp,
+ String cidr, Set<KubevirtHostRoute> hostRouts,
+ KubevirtIpPool ipPool) {
+ this.networkId = networkId;
+ this.type = type;
+ this.name = name;
+ this.mtu = mtu;
+ this.segmentId = segmentId;
+ this.gatewayIp = gatewayIp;
+ this.cidr = cidr;
+ this.hostRouts = hostRouts;
+ this.ipPool = ipPool;
+ }
+
+ @Override
+ public String networkId() {
+ return networkId;
+ }
+
+ @Override
+ public Type type() {
+ return type;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public Integer mtu() {
+ return mtu;
+ }
+
+ @Override
+ public String segmentId() {
+ return segmentId;
+ }
+
+ @Override
+ public IpAddress gatewayIp() {
+ return gatewayIp;
+ }
+
+ @Override
+ public String cidr() {
+ return cidr;
+ }
+
+ @Override
+ public Set<KubevirtHostRoute> hostRouts() {
+ return ImmutableSet.copyOf(hostRouts);
+ }
+
+ @Override
+ public KubevirtIpPool ipPool() {
+ return ipPool;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ DefaultKubevirtNetwork that = (DefaultKubevirtNetwork) o;
+ return networkId.equals(that.networkId) && type == that.type &&
+ name.equals(that.name) && mtu.equals(that.mtu) &&
+ gatewayIp.equals(that.gatewayIp) &&
+ cidr.equals(that.cidr) && hostRouts.equals(that.hostRouts) &&
+ ipPool.equals(that.ipPool);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(networkId, type, name, mtu, segmentId, gatewayIp,
+ cidr, hostRouts, ipPool);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("networkId", networkId)
+ .add("type", type)
+ .add("name", name)
+ .add("mtu", mtu)
+ .add("segmentId", segmentId)
+ .add("gatewayIp", gatewayIp)
+ .add("cidr", cidr)
+ .add("hostRouts", hostRouts)
+ .add("ipPool", ipPool)
+ .toString();
+ }
+
+ /**
+ * Returns new builder instance.
+ *
+ * @return kubevirt port builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder implements KubevirtNetwork.Builder {
+
+ private String networkId;
+ private Type type;
+ private String name;
+ private Integer mtu;
+ private String segmentId;
+ private IpAddress gatewayIp;
+ private String cidr;
+ private Set<KubevirtHostRoute> hostRouts;
+ private KubevirtIpPool ipPool;
+
+ @Override
+ public KubevirtNetwork build() {
+ checkArgument(networkId != null, NOT_NULL_MSG, "networkId");
+ checkArgument(type != null, NOT_NULL_MSG, "type");
+ checkArgument(name != null, NOT_NULL_MSG, "name");
+ checkArgument(mtu != null, NOT_NULL_MSG, "mtu");
+ checkArgument(gatewayIp != null, NOT_NULL_MSG, "gatewayIp");
+ checkArgument(cidr != null, NOT_NULL_MSG, "cidr");
+ checkArgument(ipPool != null, NOT_NULL_MSG, "ipPool");
+
+ if (type != FLAT) {
+ checkArgument(segmentId != null, NOT_NULL_MSG, "segmentId");
+ }
+
+ return new DefaultKubevirtNetwork(networkId, type, name, mtu, segmentId,
+ gatewayIp, cidr, hostRouts, ipPool);
+ }
+
+ @Override
+ public Builder networkId(String networkId) {
+ this.networkId = networkId;
+ return this;
+ }
+
+ @Override
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ @Override
+ public Builder type(Type type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public Builder mtu(Integer mtu) {
+ this.mtu = mtu;
+ return this;
+ }
+
+ @Override
+ public Builder segmentId(String segmentId) {
+ this.segmentId = segmentId;
+ return this;
+ }
+
+ @Override
+ public Builder gatewayIp(IpAddress ipAddress) {
+ this.gatewayIp = ipAddress;
+ return this;
+ }
+
+ @Override
+ public Builder cidr(String cidr) {
+ this.cidr = cidr;
+ return this;
+ }
+
+ @Override
+ public Builder ipPool(KubevirtIpPool ipPool) {
+ this.ipPool = ipPool;
+ return this;
+ }
+
+ @Override
+ public Builder hostRoutes(Set<KubevirtHostRoute> hostRoutes) {
+ this.hostRouts = hostRoutes;
+ return this;
+ }
+ }
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtHostRoute.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtHostRoute.java
new file mode 100644
index 0000000..37cfc6b
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtHostRoute.java
@@ -0,0 +1,85 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+
+import java.util.Objects;
+
+/**
+ * HostRoute class.
+ */
+public class KubevirtHostRoute {
+ private final IpPrefix destination;
+ private final IpAddress nexthop;
+
+ /**
+ * Default constructor.
+ *
+ * @param destination destination CIDR
+ * @param nexthop nexthop IP address
+ */
+ public KubevirtHostRoute(IpPrefix destination, IpAddress nexthop) {
+ this.destination = destination;
+ this.nexthop = nexthop;
+ }
+
+ /**
+ * Returns the destination CIDR.
+ *
+ * @return destination CIDR
+ */
+ public IpPrefix getDestination() {
+ return destination;
+ }
+
+ /**
+ * Returns the nexthop IP address.
+ *
+ * @return nexthop IP address
+ */
+ public IpAddress getNexthop() {
+ return nexthop;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ KubevirtHostRoute kubevirtHostRoute = (KubevirtHostRoute) o;
+ return destination.equals(kubevirtHostRoute.destination) &&
+ nexthop.equals(kubevirtHostRoute.nexthop);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(destination, nexthop);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("destination", destination)
+ .add("nexthop", nexthop)
+ .toString();
+ }
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtIpPool.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtIpPool.java
new file mode 100644
index 0000000..9b42b61
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtIpPool.java
@@ -0,0 +1,84 @@
+/*
+ * 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 com.google.common.base.MoreObjects;
+import org.onlab.packet.IpAddress;
+
+import java.util.Objects;
+
+/**
+ * Kubevirt IP Pool.
+ */
+public class KubevirtIpPool {
+
+ private final IpAddress start;
+ private final IpAddress end;
+
+ /**
+ * Default constructor.
+ *
+ * @param start start address of IP pool
+ * @param end end address of IP pool
+ */
+ public KubevirtIpPool(IpAddress start, IpAddress end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ /**
+ * Returns the start address of IP pool.
+ *
+ * @return start address of IP pool
+ */
+ public IpAddress getStart() {
+ return start;
+ }
+
+ /**
+ * Returns the end address of IP pool.
+ *
+ * @return end address of IP pool
+ */
+ public IpAddress getEnd() {
+ return end;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ KubevirtIpPool that = (KubevirtIpPool) o;
+ return start.equals(that.start) && end.equals(that.end);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(start, end);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("start", start)
+ .add("end", end)
+ .toString();
+ }
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetwork.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetwork.java
new file mode 100644
index 0000000..5492c9f
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetwork.java
@@ -0,0 +1,200 @@
+/*
+ * 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.IpAddress;
+
+import java.util.Set;
+
+/**
+ * Representation of kubevirt network.
+ */
+public interface KubevirtNetwork {
+
+ /**
+ * Lists of network type.
+ */
+ enum Type {
+
+ /**
+ * VXLAN typed virtual network.
+ */
+ VXLAN,
+
+ /**
+ * GRE typed virtual network.
+ */
+ GRE,
+
+ /**
+ * GENEVE typed virtual network.
+ */
+ GENEVE,
+
+ /**
+ * FLAT typed provider network.
+ */
+ FLAT,
+ }
+
+ /**
+ * Returns the kubernetes network ID.
+ *
+ * @return kubernetes network ID
+ */
+ String networkId();
+
+ /**
+ * Returns kubernetes network type.
+ *
+ * @return kubernetes network type
+ */
+ Type type();
+
+ /**
+ * Returns kubernetes network name.
+ *
+ * @return kubernetes network name
+ */
+ String name();
+
+ /**
+ * 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();
+
+ /**
+ * Returns host routes.
+ *
+ * @return host routes
+ */
+ Set<KubevirtHostRoute> hostRouts();
+
+ /**
+ * Returns the IP pool.
+ *
+ * @return IP pool
+ */
+ KubevirtIpPool ipPool();
+
+ /**
+ * Builder of new network.
+ */
+ interface Builder {
+
+ /**
+ * Builds an immutable network instance.
+ *
+ * @return kubernetes network
+ */
+ KubevirtNetwork 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 name.
+ *
+ * @param name network name
+ * @return network builder
+ */
+ Builder name(String name);
+
+ /**
+ * 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);
+
+ /**
+ * Returns the IP pool.
+ *
+ * @param ipPool IP pool
+ * @return network builder
+ */
+ Builder ipPool(KubevirtIpPool ipPool);
+
+ /**
+ * Returns host routes.
+ *
+ * @param hostRoutes host routes
+ * @return network builder
+ */
+ Builder hostRoutes(Set<KubevirtHostRoute> hostRoutes);
+ }
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkAdminService.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkAdminService.java
new file mode 100644
index 0000000..f0fa716
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkAdminService.java
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+public interface KubevirtNetworkAdminService extends KubevirtNetworkService {
+
+ /**
+ * Creates a kubevirt network with the given information.
+ *
+ * @param network the new network
+ */
+ void createNetwork(KubevirtNetwork network);
+
+ /**
+ * Updates the kubevirt network with the given information.
+ *
+ * @param network the updated network
+ */
+ void updateNetwork(KubevirtNetwork network);
+
+ /**
+ * Removes the network.
+ *
+ * @param networkId network identifier
+ */
+ void removeNetwork(String networkId);
+
+ void clear();
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkEvent.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkEvent.java
new file mode 100644
index 0000000..ee3487f
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkEvent.java
@@ -0,0 +1,49 @@
+/*
+ * 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.event.AbstractEvent;
+
+/**
+ * Describes kubevirt network service event.
+ */
+public class KubevirtNetworkEvent extends AbstractEvent<KubevirtNetworkEvent.Type, KubevirtNetwork> {
+
+ public KubevirtNetworkEvent(Type type, KubevirtNetwork subject) {
+ super(type, subject);
+ }
+
+ /**
+ * kubevirt network events.
+ */
+ public enum Type {
+
+ /**
+ * Signifies that a new kubevirt network is created.
+ */
+ KUBEVIRT_NETWORK_CREATED,
+
+ /**
+ * Signifies that the kubevirt network is updated.
+ */
+ KUBEVIRT_NETWORK_UPDATED,
+
+ /**
+ * Signifies that the kubevirt network is removed.
+ */
+ KUBEVIRT_NETWORK_REMOVED,
+ }
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkListener.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkListener.java
new file mode 100644
index 0000000..5faaf9b
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkListener.java
@@ -0,0 +1,24 @@
+/*
+ * 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.event.EventListener;
+
+/**
+ * Listener for kubevirt network event.
+ */
+public interface KubevirtNetworkListener extends EventListener<KubevirtNetworkEvent> {
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkService.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkService.java
new file mode 100644
index 0000000..574f365
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkService.java
@@ -0,0 +1,51 @@
+/*
+ * 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.event.ListenerService;
+import org.onosproject.kubevirtnetworking.api.KubevirtNetwork.Type;
+
+import java.util.Set;
+
+/**
+ * Service for interacting with the inventory of kubevirt network.
+ */
+public interface KubevirtNetworkService
+ extends ListenerService<KubevirtNetworkEvent, KubevirtNetworkListener> {
+
+ /**
+ * Returns the kubevirt network with the supplied network identifier.
+ *
+ * @param networkId network identifier
+ * @return kubevirt network
+ */
+ KubevirtNetwork network(String networkId);
+
+ /**
+ * Returns all kubevirt networks registered in the service.
+ *
+ * @return set of kubevirt networks
+ */
+ Set<KubevirtNetwork> networks();
+
+ /**
+ * Returns the kubevirt networks with the given network type.
+ *
+ * @param type virtual network type
+ * @return set of kubevirt networks
+ */
+ Set<KubevirtNetwork> networks(Type type);
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStore.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStore.java
new file mode 100644
index 0000000..7452de8
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStore.java
@@ -0,0 +1,69 @@
+/*
+ * 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.store.Store;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of kubevirt network states; not intended for direct use.
+ */
+public interface KubevirtNetworkStore
+ extends Store<KubevirtNetworkEvent, KubevirtNetworkStoreDelegate> {
+
+ /**
+ * Creates the new kubevirt network.
+ *
+ * @param network kubevirt network
+ */
+ void createNetwork(KubevirtNetwork network);
+
+ /**
+ * Update the kubevirt network.
+ *
+ * @param network kubevirt network
+ */
+ void updateNetwork(KubevirtNetwork network);
+
+ /**
+ * Removes the kubevirt network with the given network identifier.
+ *
+ * @param networkId network identifier
+ * @return removed kubevirt network; null if failed
+ */
+ KubevirtNetwork removeNetwork(String networkId);
+
+ /**
+ * Returns the kubevirt network with the given network identifier.
+ *
+ * @param networkId network identifier
+ * @return network; null if not found
+ */
+ KubevirtNetwork network(String networkId);
+
+ /**
+ * Returns all kubevirt networks.
+ *
+ * @return set of kubevirt networks
+ */
+ Set<KubevirtNetwork> networks();
+
+ /**
+ * Removes all kubevirt networks.
+ */
+ void clear();
+}
diff --git a/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStoreDelegate.java b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStoreDelegate.java
new file mode 100644
index 0000000..e375b6a
--- /dev/null
+++ b/apps/kubevirt-networking/api/src/main/java/org/onosproject/kubevirtnetworking/api/KubevirtNetworkStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * 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.store.StoreDelegate;
+
+/**
+ * Kubevirt network store delegate abstraction.
+ */
+public interface KubevirtNetworkStoreDelegate extends StoreDelegate<KubevirtNetworkEvent> {
+}