Implement east-west communication for k8s network
Change-Id: Ibac91b7a856e35a26cf0e0f23d6d01f65197625d
diff --git a/apps/k8s-node/BUILD b/apps/k8s-node/BUILD
index 83aaf44..b17a604 100644
--- a/apps/k8s-node/BUILD
+++ b/apps/k8s-node/BUILD
@@ -7,6 +7,10 @@
category = "Integration",
description = "SONA Kubernetes Node Application.",
included_bundles = BUNDLES,
+ required_apps = [
+ "org.onosproject.ovsdb-base",
+ "org.onosproject.drivers.ovsdb",
+ ],
title = "Kubernetes Node Application",
url = "https://wiki.onosproject.org/display/ONOS/SONA%3A+DC+Network+Virtualization",
)
diff --git a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/DefaultK8sNode.java b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/DefaultK8sNode.java
index 60c02b4..5f22f70 100644
--- a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/DefaultK8sNode.java
+++ b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/DefaultK8sNode.java
@@ -28,6 +28,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static org.onosproject.k8snode.api.Constants.GENEVE_TUNNEL;
import static org.onosproject.k8snode.api.Constants.GRE_TUNNEL;
+import static org.onosproject.k8snode.api.Constants.INTEGRATION_BRIDGE;
import static org.onosproject.k8snode.api.Constants.VXLAN_TUNNEL;
import static org.onosproject.net.AnnotationKeys.PORT_NAME;
@@ -130,6 +131,16 @@
}
@Override
+ public PortNumber intBridgePortNum() {
+ DeviceService deviceService = DefaultServiceDirectory.getService(DeviceService.class);
+ Port port = deviceService.getPorts(intgBridge).stream()
+ .filter(p -> p.isEnabled() &&
+ Objects.equals(p.annotations().value(PORT_NAME), INTEGRATION_BRIDGE))
+ .findAny().orElse(null);
+ return port != null ? port.number() : null;
+ }
+
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
diff --git a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/K8sNode.java b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/K8sNode.java
index 13b1f47..4abc2cb 100644
--- a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/K8sNode.java
+++ b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/K8sNode.java
@@ -118,6 +118,13 @@
PortNumber genevePortNum();
/**
+ * Returns the host port number.
+ *
+ * @return host port number; null if the host port does not exist
+ */
+ PortNumber intBridgePortNum();
+
+ /**
* Builder of new node entity.
*/
interface Builder {