Inter-connect k8s external and openstack integration bridge
Change-Id: Ibd889e9fd4a10a06056b823d6c01254429d5cdc4
(cherry picked from commit a4d8fba801d1514d01d7a2c1ccfb59722a433583)
diff --git a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/Constants.java b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/Constants.java
index 59a5715..b928b5f 100644
--- a/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/Constants.java
+++ b/apps/k8s-node/api/src/main/java/org/onosproject/k8snode/api/Constants.java
@@ -38,8 +38,10 @@
public static final String ROUTER = "router";
public static final String INTEGRATION_TO_TUN_BRIDGE = "int-tun";
public static final String TUN_TO_INTEGRATION_BRIDGE = "tun-int";
- public static final String OS_TO_K8S_BRIDGE = "os-k8s";
- public static final String K8S_TO_OS_BRIDGE = "k8s-os";
+ public static final String OS_TO_K8S_INTEGRATION_BRIDGE = "os-k8s-int";
+ public static final String K8S_INTEGRATION_TO_OS_BRIDGE = "k8s-int-os";
+ public static final String OS_TO_K8S_EXTERNAL_BRIDGE = "os-k8s-ext";
+ public static final String K8S_EXTERNAL_TO_OS_BRIDGE = "k8s-ext-os";
public static final String VXLAN_TUNNEL = "vxlan";
public static final String GRE_TUNNEL = "gre";
public static final String GENEVE_TUNNEL = "geneve";
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 09f4097..88cec08 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
@@ -43,10 +43,12 @@
import static org.onosproject.k8snode.api.Constants.INTEGRATION_TO_EXTERNAL_BRIDGE;
import static org.onosproject.k8snode.api.Constants.INTEGRATION_TO_LOCAL_BRIDGE;
import static org.onosproject.k8snode.api.Constants.INTEGRATION_TO_TUN_BRIDGE;
-import static org.onosproject.k8snode.api.Constants.K8S_TO_OS_BRIDGE;
+import static org.onosproject.k8snode.api.Constants.K8S_EXTERNAL_TO_OS_BRIDGE;
+import static org.onosproject.k8snode.api.Constants.K8S_INTEGRATION_TO_OS_BRIDGE;
import static org.onosproject.k8snode.api.Constants.LOCAL_BRIDGE;
import static org.onosproject.k8snode.api.Constants.LOCAL_TO_INTEGRATION_BRIDGE;
-import static org.onosproject.k8snode.api.Constants.OS_TO_K8S_BRIDGE;
+import static org.onosproject.k8snode.api.Constants.OS_TO_K8S_EXTERNAL_BRIDGE;
+import static org.onosproject.k8snode.api.Constants.OS_TO_K8S_INTEGRATION_BRIDGE;
import static org.onosproject.k8snode.api.Constants.PHYSICAL_EXTERNAL_BRIDGE;
import static org.onosproject.k8snode.api.Constants.ROUTER;
import static org.onosproject.k8snode.api.Constants.ROUTER_TO_EXTERNAL;
@@ -592,7 +594,7 @@
@Override
public String intgEntryPortName() {
if (mode == PASSTHROUGH) {
- return k8sToOsIntgPatchPortName();
+ return k8sIntgToOsPatchPortName();
} else {
return intgBridgeName();
}
@@ -601,7 +603,7 @@
@Override
public PortNumber intgEntryPortNum() {
if (mode == PASSTHROUGH) {
- return portNumber(intgBridge, k8sToOsIntgPatchPortName());
+ return portNumber(intgBridge, k8sIntgToOsPatchPortName());
} else {
return intgBridgePortNum();
}
@@ -725,20 +727,38 @@
}
@Override
- public String k8sToOsIntgPatchPortName() {
+ public String k8sIntgToOsPatchPortName() {
if (mode == PASSTHROUGH) {
- return K8S_TO_OS_BRIDGE + "-" + uniqueString(5);
+ return K8S_INTEGRATION_TO_OS_BRIDGE + "-" + uniqueString(5);
} else {
- return K8S_TO_OS_BRIDGE;
+ return K8S_INTEGRATION_TO_OS_BRIDGE;
+ }
+ }
+
+ @Override
+ public String k8sExtToOsPatchPortName() {
+ if (mode == PASSTHROUGH) {
+ return K8S_EXTERNAL_TO_OS_BRIDGE + "-" + uniqueString(5);
+ } else {
+ return K8S_EXTERNAL_TO_OS_BRIDGE;
}
}
@Override
public String osToK8sIntgPatchPortName() {
if (mode == PASSTHROUGH) {
- return OS_TO_K8S_BRIDGE + "-" + uniqueString(5);
+ return OS_TO_K8S_INTEGRATION_BRIDGE + "-" + uniqueString(5);
} else {
- return OS_TO_K8S_BRIDGE;
+ return OS_TO_K8S_INTEGRATION_BRIDGE;
+ }
+ }
+
+ @Override
+ public String osToK8sExtPatchPortName() {
+ if (mode == PASSTHROUGH) {
+ return OS_TO_K8S_EXTERNAL_BRIDGE + "-" + uniqueString(5);
+ } else {
+ return OS_TO_K8S_EXTERNAL_BRIDGE;
}
}
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 9b695eb..6631e55 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
@@ -354,7 +354,14 @@
*
* @return kubernetes to openstack integration patch port name
*/
- String k8sToOsIntgPatchPortName();
+ String k8sIntgToOsPatchPortName();
+
+ /**
+ * Returns kubernetes external to openstack patch port name.
+ *
+ * @return kubernetes external to openstack patch port name
+ */
+ String k8sExtToOsPatchPortName();
/**
* Returns openstack to kubernetes integration patch port name.
@@ -364,6 +371,13 @@
String osToK8sIntgPatchPortName();
/**
+ * Returns openstack to kubernetes external patch port name.
+ *
+ * @return openstack to kubernetes external patch port name
+ */
+ String osToK8sExtPatchPortName();
+
+ /**
* Returns router to external bridge patch port name.
*
* @return router to external bridge patch port name
diff --git a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sHostHandler.java b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sHostHandler.java
index 3827e21..2fc26be 100644
--- a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sHostHandler.java
+++ b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sHostHandler.java
@@ -286,10 +286,18 @@
DefaultPatchDescription.builder()
.deviceId(OS_INTEGRATION_BRIDGE)
.ifaceName(k8sNode.osToK8sIntgPatchPortName())
- .peer(k8sNode.k8sToOsIntgPatchPortName())
+ .peer(k8sNode.k8sIntgToOsPatchPortName())
.build();
+ ifaceConfig.addPatchMode(k8sNode.osToK8sIntgPatchPortName(), osIntK8sIntPatchDesc);
- ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), osIntK8sIntPatchDesc);
+ // openstack integration bridge -> k8s external bridge
+ PatchDescription osIntK8sExPatchDesc =
+ DefaultPatchDescription.builder()
+ .deviceId(OS_INTEGRATION_BRIDGE)
+ .ifaceName(k8sNode.osToK8sExtPatchPortName())
+ .peer(k8sNode.k8sExtToOsPatchPortName())
+ .build();
+ ifaceConfig.addPatchMode(k8sNode.osToK8sExtPatchPortName(), osIntK8sExPatchDesc);
}
private void createRouterPatchInterfaces(DeviceId ovsdb, K8sBridge bridge, K8sNode k8sNode) {
diff --git a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sNodeHandler.java b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sNodeHandler.java
index 62db27d..46f56a6 100644
--- a/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sNodeHandler.java
+++ b/apps/k8s-node/app/src/main/java/org/onosproject/k8snode/impl/DefaultK8sNodeHandler.java
@@ -413,10 +413,19 @@
PatchDescription k8sIntOsIntPatchDesc =
DefaultPatchDescription.builder()
.deviceId(k8sNode.intgBridgeName())
- .ifaceName(k8sNode.k8sToOsIntgPatchPortName())
+ .ifaceName(k8sNode.k8sIntgToOsPatchPortName())
.peer(k8sNode.osToK8sIntgPatchPortName())
.build();
- ifaceConfig.addPatchMode(k8sNode.k8sToOsIntgPatchPortName(), k8sIntOsIntPatchDesc);
+ ifaceConfig.addPatchMode(k8sNode.k8sIntgToOsPatchPortName(), k8sIntOsIntPatchDesc);
+
+ // k8s external bridge -> openstack integration bridge
+ PatchDescription k8sExtOsIntPatchDesc =
+ DefaultPatchDescription.builder()
+ .deviceId(k8sNode.extBridgeName())
+ .ifaceName(k8sNode.k8sExtToOsPatchPortName())
+ .peer(k8sNode.osToK8sExtPatchPortName())
+ .build();
+ ifaceConfig.addPatchMode(k8sNode.k8sExtToOsPatchPortName(), k8sExtOsIntPatchDesc);
// external bridge -> router bridge
PatchDescription extRouterPatchDesc =