[ONOS-7914] Hostprovider support for kubernetes network
Change-Id: I1bbc08b7c819875932d0b72fa4bdee4de47c35dd
diff --git a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/Constants.java b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/Constants.java
index a47f295..eb3592f 100644
--- a/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/Constants.java
+++ b/apps/k8s-networking/api/src/main/java/org/onosproject/k8snetworking/api/Constants.java
@@ -34,6 +34,8 @@
public static final MacAddress DEFAULT_GATEWAY_MAC =
MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
+ public static final String PORT_NAME_PREFIX_CONTAINER = "veth";
+
public static final String ANNOTATION_NETWORK_ID = "networkId";
public static final String ANNOTATION_PORT_ID = "portId";
public static final String ANNOTATION_CREATE_TIME = "createTime";
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sNetworkListCommand.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sNetworkListCommand.java
new file mode 100644
index 0000000..82904a6
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sNetworkListCommand.java
@@ -0,0 +1,72 @@
+/*
+ * 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.cli;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.google.common.collect.Lists;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.k8snetworking.api.K8sNetwork;
+import org.onosproject.k8snetworking.api.K8sNetworkService;
+
+import java.util.Comparator;
+import java.util.List;
+
+import static org.onosproject.k8snetworking.util.K8sNetworkingUtil.prettyJson;
+
+/**
+ * Lists kubernetes networks.
+ */
+@Service
+@Command(scope = "onos", name = "k8s-networks",
+ description = "Lists all kubernetes networks")
+public class K8sNetworkListCommand extends AbstractShellCommand {
+
+ private static final String FORMAT = "%-40s%-20s%-20s%-20s%-16s";
+
+ @Override
+ protected void doExecute() {
+ K8sNetworkService service = get(K8sNetworkService.class);
+ List<K8sNetwork> networks = Lists.newArrayList(service.networks());
+ networks.sort(Comparator.comparing(K8sNetwork::name));
+
+ if (outputJson()) {
+ print("%s", json(networks));
+ } else {
+ print(FORMAT, "ID", "Name", "Type", "SegId", "Gateway");
+
+ for (K8sNetwork net: networks) {
+ print(FORMAT, net.networkId(),
+ net.name(),
+ net.type().toString(),
+ net.segmentId(),
+ net.gatewayIp() == null ? "" : net.gatewayIp().toString());
+ }
+ }
+ }
+
+ private String json(List<K8sNetwork> networks) {
+ ObjectMapper mapper = new ObjectMapper();
+ ArrayNode result = mapper.createArrayNode();
+
+ for (K8sNetwork network : networks) {
+ result.add(jsonForEntity(network, K8sNetwork.class));
+ }
+ return prettyJson(mapper, result.toString());
+ }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sPortListCommand.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sPortListCommand.java
new file mode 100644
index 0000000..307736b
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sPortListCommand.java
@@ -0,0 +1,82 @@
+/*
+ * 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.cli;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.k8snetworking.api.K8sNetwork;
+import org.onosproject.k8snetworking.api.K8sNetworkService;
+import org.onosproject.k8snetworking.api.K8sPort;
+
+import java.util.Comparator;
+import java.util.List;
+
+import static org.onosproject.k8snetworking.util.K8sNetworkingUtil.prettyJson;
+
+/**
+ * Lists kubernetes ports.
+ */
+@Service
+@Command(scope = "onos", name = "k8s-ports",
+ description = "Lists all kubernetes ports")
+public class K8sPortListCommand extends AbstractShellCommand {
+
+ private static final String FORMAT = "%-40s%-20s%-20s%-8s";
+
+ @Argument(name = "networkId", description = "Network ID")
+ private String networkId = null;
+
+ @Override
+ protected void doExecute() {
+ K8sNetworkService service = get(K8sNetworkService.class);
+
+ List<K8sPort> ports = Lists.newArrayList(service.ports());
+ ports.sort(Comparator.comparing(K8sPort::networkId));
+
+ if (!Strings.isNullOrEmpty(networkId)) {
+ ports.removeIf(port -> !port.networkId().equals(networkId));
+ }
+
+ if (outputJson()) {
+ print("%s", json(ports));
+ } else {
+ print(FORMAT, "ID", "Network", "MAC", "Fixed IPs");
+ for (K8sPort port: ports) {
+ K8sNetwork k8sNet = service.network(port.networkId());
+ print(FORMAT, port.portId(),
+ k8sNet.name(),
+ port.macAddress(),
+ port.ipAddress() == null ? "" : port.ipAddress().toString());
+ }
+ }
+ }
+
+ private String json(List<K8sPort> ports) {
+ ObjectMapper mapper = new ObjectMapper();
+ ArrayNode result = mapper.createArrayNode();
+
+ for (K8sPort port : ports) {
+ result.add(jsonForEntity(port, K8sPort.class));
+ }
+ return prettyJson(mapper, result.toString());
+ }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sSwitchingHostProvider.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sSwitchingHostProvider.java
new file mode 100644
index 0000000..f7f78c9
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sSwitchingHostProvider.java
@@ -0,0 +1,375 @@
+/*
+ * 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.impl;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.VlanId;
+import org.onlab.util.Tools;
+import org.onosproject.core.CoreService;
+import org.onosproject.k8snetworking.api.K8sNetwork;
+import org.onosproject.k8snetworking.api.K8sNetworkService;
+import org.onosproject.k8snetworking.api.K8sPort;
+import org.onosproject.k8snode.api.K8sNode;
+import org.onosproject.k8snode.api.K8sNodeEvent;
+import org.onosproject.k8snode.api.K8sNodeListener;
+import org.onosproject.k8snode.api.K8sNodeService;
+import org.onosproject.mastership.MastershipService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.Host;
+import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.Port;
+import org.onosproject.net.device.DeviceEvent;
+import org.onosproject.net.device.DeviceListener;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.host.DefaultHostDescription;
+import org.onosproject.net.host.HostDescription;
+import org.onosproject.net.host.HostProvider;
+import org.onosproject.net.host.HostProviderRegistry;
+import org.onosproject.net.host.HostProviderService;
+import org.onosproject.net.host.HostService;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.k8snetworking.api.Constants.ANNOTATION_CREATE_TIME;
+import static org.onosproject.k8snetworking.api.Constants.ANNOTATION_NETWORK_ID;
+import static org.onosproject.k8snetworking.api.Constants.ANNOTATION_PORT_ID;
+import static org.onosproject.k8snetworking.api.Constants.ANNOTATION_SEGMENT_ID;
+import static org.onosproject.k8snetworking.api.Constants.K8S_NETWORKING_APP_ID;
+import static org.onosproject.k8snetworking.api.Constants.PORT_NAME_PREFIX_CONTAINER;
+import static org.onosproject.k8snetworking.util.K8sNetworkingUtil.isContainer;
+import static org.onosproject.net.AnnotationKeys.PORT_NAME;
+
+/**
+ * A provider used to feed host information for kubernetes.
+ */
+@Component(immediate = true, service = HostProvider.class)
+public class K8sSwitchingHostProvider extends AbstractProvider implements HostProvider {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private static final String ERR_ADD_HOST = "Failed to add host: ";
+ private static final String SONA_HOST_SCHEME = "sona";
+ private static final int PORT_PREFIX_LENGTH = 3;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected CoreService coreService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected DeviceService deviceService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected HostProviderRegistry hostProviderRegistry;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected HostService hostService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected MastershipService mastershipService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected K8sNetworkService k8sNetworkService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected K8sNodeService k8sNodeService;
+
+ private HostProviderService hostProviderService;
+
+ private final ExecutorService executor = Executors.newSingleThreadExecutor(
+ groupedThreads(this.getClass().getSimpleName(), "device-event"));
+ private final InternalDeviceListener internalDeviceListener =
+ new InternalDeviceListener();
+ private final InternalK8sNodeListener internalK8sNodeListener =
+ new InternalK8sNodeListener();
+
+ /**
+ * Creates kubernetes switching host provider.
+ */
+ public K8sSwitchingHostProvider() {
+ super(new ProviderId(SONA_HOST_SCHEME, K8S_NETWORKING_APP_ID));
+ }
+
+ @Activate
+ protected void activate() {
+ coreService.registerApplication(K8S_NETWORKING_APP_ID);
+ deviceService.addListener(internalDeviceListener);
+ k8sNodeService.addListener(internalK8sNodeListener);
+ hostProviderService = hostProviderRegistry.register(this);
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ hostProviderRegistry.unregister(this);
+ k8sNodeService.removeListener(internalK8sNodeListener);
+ deviceService.removeListener(internalDeviceListener);
+
+ executor.shutdown();
+
+ log.info("Stopped");
+ }
+
+
+ @Override
+ public void triggerProbe(Host host) {
+ // no probe is required
+ }
+
+ /**
+ * Processes port addition event.
+ *
+ * @param port port object used in ONOS
+ */
+ private void processPortAdded(Port port) {
+ K8sPort k8sPort = portToK8sPort(port);
+ if (k8sPort == null) {
+ log.warn(ERR_ADD_HOST + "Kubernetes port for {} not found", port);
+ return;
+ }
+
+ K8sNetwork k8sNet = k8sNetworkService.network(k8sPort.networkId());
+ if (k8sNet == null) {
+ log.warn(ERR_ADD_HOST + "Kubernetes network {} not found",
+ k8sPort.networkId());
+ return;
+ }
+
+ MacAddress mac = k8sPort.macAddress();
+ HostId hostId = HostId.hostId(mac);
+
+ // connect point is the combination of switch ID with port number where
+ // the host is attached to
+ ConnectPoint connectPoint = new ConnectPoint(port.element().id(), port.number());
+
+ long createTime = System.currentTimeMillis();
+
+ // we check whether the host already attached to same locations
+ Host host = hostService.getHost(hostId);
+
+ // build host annotations to include a set of meta info from neutron
+ DefaultAnnotations.Builder annotations = DefaultAnnotations.builder()
+ .set(ANNOTATION_NETWORK_ID, k8sPort.networkId())
+ .set(ANNOTATION_PORT_ID, k8sPort.portId())
+ .set(ANNOTATION_CREATE_TIME, String.valueOf(createTime))
+ .set(ANNOTATION_SEGMENT_ID, k8sNet.segmentId());
+
+ HostDescription hostDesc = new DefaultHostDescription(
+ mac,
+ VlanId.NONE,
+ new HostLocation(connectPoint, createTime),
+ ImmutableSet.of(k8sPort.ipAddress()),
+ annotations.build());
+
+ if (host != null) {
+ Set<HostLocation> locations = host.locations().stream()
+ .filter(l -> l.deviceId().equals(connectPoint.deviceId()))
+ .filter(l -> l.port().equals(connectPoint.port()))
+ .collect(Collectors.toSet());
+
+ // newly added location is not in the existing location list,
+ // therefore, we simply add this into the location list
+ if (locations.isEmpty()) {
+ hostProviderService.addLocationToHost(hostId,
+ new HostLocation(connectPoint, createTime));
+ }
+
+ // newly added location is in the existing location list,
+ // the hostDetected method invocation in turn triggers host Update event
+ if (locations.size() == 1) {
+ hostProviderService.hostDetected(hostId, hostDesc, false);
+ }
+ } else {
+ hostProviderService.hostDetected(hostId, hostDesc, false);
+ }
+ }
+
+ /**
+ * Processes port removal event.
+ *
+ * @param port ONOS port
+ */
+ private void processPortRemoved(Port port) {
+ ConnectPoint connectPoint = new ConnectPoint(port.element().id(), port.number());
+
+ Set<Host> hosts = hostService.getConnectedHosts(connectPoint);
+
+ hosts.forEach(h -> hostProviderService.hostVanished(h.id()));
+ }
+
+ /**
+ * Converts ONOS port to kubernetes port.
+ *
+ * @param port ONOS port
+ * @return mapped kubernetes port
+ */
+ private K8sPort portToK8sPort(Port port) {
+ String portName = port.annotations().value(PORT_NAME);
+ if (Strings.isNullOrEmpty(portName)) {
+ return null;
+ }
+
+ if (isContainer(portName)) {
+ return k8sNetworkService.ports().stream()
+ .filter(p -> p.portId().contains(portName.substring(PORT_PREFIX_LENGTH)))
+ .findAny().orElse(null);
+ } else {
+ return null;
+ }
+ }
+
+ private class InternalDeviceListener implements DeviceListener {
+
+ @Override
+ public boolean isRelevant(DeviceEvent event) {
+ Port port = event.port();
+ if (port == null) {
+ return false;
+ }
+
+ String portName = port.annotations().value(PORT_NAME);
+
+ return !Strings.isNullOrEmpty(portName) &&
+ portName.startsWith(PORT_NAME_PREFIX_CONTAINER);
+ }
+
+ private boolean isRelevantHelper(DeviceEvent event) {
+ return mastershipService.isLocalMaster(event.subject().id());
+ }
+
+ @Override
+ public void event(DeviceEvent event) {
+ log.info("Device event occurred with type {}", event.type());
+
+ switch (event.type()) {
+ case PORT_UPDATED:
+ executor.execute(() -> processPortUpdate(event));
+ break;
+ case PORT_ADDED:
+ executor.execute(() -> processPortAddition(event));
+ break;
+ case PORT_REMOVED:
+ executor.execute(() -> processPortRemoval(event));
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void processPortUpdate(DeviceEvent event) {
+ if (!isRelevantHelper(event)) {
+ return;
+ }
+
+ if (!event.port().isEnabled()) {
+ processPortRemoval(event);
+ } else if (event.port().isEnabled()) {
+ processPortAddition(event);
+ }
+ }
+
+ private void processPortAddition(DeviceEvent event) {
+ if (!isRelevantHelper(event)) {
+ return;
+ }
+
+ processPortAddition(event);
+ }
+
+ private void processPortRemoval(DeviceEvent event) {
+ if (!isRelevantHelper(event)) {
+ return;
+ }
+
+ processPortRemoval(event);
+ }
+ }
+
+ private class InternalK8sNodeListener implements K8sNodeListener {
+
+ private boolean isRelevantHelper(K8sNodeEvent event) {
+ // do not allow to proceed without mastership
+ Device device = deviceService.getDevice(event.subject().intgBridge());
+ if (device == null) {
+ return false;
+ }
+ return mastershipService.isLocalMaster(device.id());
+ }
+
+ @Override
+ public void event(K8sNodeEvent event) {
+ K8sNode k8sNode = event.subject();
+
+ switch (event.type()) {
+ case K8S_NODE_COMPLETE:
+ executor.execute(() -> processCompleteNode(event, event.subject()));
+ break;
+ case K8S_NODE_INCOMPLETE:
+ log.warn("{} is changed to INCOMPLETE state", k8sNode);
+ break;
+ case K8S_NODE_CREATED:
+ case K8S_NODE_UPDATED:
+ case K8S_NODE_REMOVED:
+ default:
+ break;
+ }
+ }
+
+ private void processCompleteNode(K8sNodeEvent event, K8sNode k8sNode) {
+ if (!isRelevantHelper(event)) {
+ return;
+ }
+
+ log.info("COMPLETE node {} is detected", k8sNode.hostname());
+
+ deviceService.getPorts(k8sNode.intgBridge()).stream()
+ .filter(port -> isContainer(port.annotations().value(PORT_NAME)))
+ .filter(Port::isEnabled)
+ .forEach(port -> {
+ log.debug("Container port {} is detected from {}",
+ port.annotations().value(PORT_NAME),
+ k8sNode.hostname());
+ processPortAdded(port);
+ });
+
+ Tools.stream(hostService.getHosts())
+ .filter(host -> deviceService.getPort(
+ host.location().deviceId(),
+ host.location().port()) == null)
+ .forEach(host -> {
+ log.info("Remove stale host {}", host.id());
+ hostProviderService.hostVanished(host.id());
+ });
+ }
+ }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/K8sNetworkingUtil.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/K8sNetworkingUtil.java
new file mode 100644
index 0000000..ad8c842
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/K8sNetworkingUtil.java
@@ -0,0 +1,71 @@
+/*
+ * 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.util;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.onosproject.k8snetworking.api.Constants.PORT_NAME_PREFIX_CONTAINER;
+
+/**
+ * An utility that used in kubernetes networking app.
+ */
+public final class K8sNetworkingUtil {
+
+ private static final Logger log = LoggerFactory.getLogger(K8sNetworkingUtil.class);
+
+ private K8sNetworkingUtil() {
+ }
+
+ /**
+ * Checks that whether the port is associated with container interface.
+ *
+ * @param portName port name
+ * @return true if the port is associated with container; false otherwise
+ */
+ public static boolean isContainer(String portName) {
+ return PORT_NAME_PREFIX_CONTAINER.equals(portName);
+ }
+
+ /**
+ * Prints out the JSON string in pretty format.
+ *
+ * @param mapper Object mapper
+ * @param jsonString JSON string
+ * @return pretty formatted JSON string
+ */
+ public static String prettyJson(ObjectMapper mapper, String jsonString) {
+ try {
+ Object jsonObject = mapper.readValue(jsonString, Object.class);
+ return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonObject);
+ } catch (JsonParseException e) {
+ log.debug("JsonParseException caused by {}", e);
+ } catch (JsonMappingException e) {
+ log.debug("JsonMappingException caused by {}", e);
+ } catch (JsonProcessingException e) {
+ log.debug("JsonProcessingException caused by {}", e);
+ } catch (IOException e) {
+ log.debug("IOException caused by {}", e);
+ }
+ return null;
+ }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/package-info.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/package-info.java
new file mode 100644
index 0000000..cb4d862
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/util/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 utility package.
+ */
+package org.onosproject.k8snetworking.util;
\ No newline at end of file