Obtains the external patch port by referring to gateway bridge name
Change-Id: I1a6b5f97af3454c6fb36e08d673240b553e36392
diff --git a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/util/KubevirtNetworkingUtil.java b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/util/KubevirtNetworkingUtil.java
index 4ee8fa2..a6ac229 100644
--- a/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/util/KubevirtNetworkingUtil.java
+++ b/apps/kubevirt-networking/app/src/main/java/org/onosproject/kubevirtnetworking/util/KubevirtNetworkingUtil.java
@@ -42,7 +42,6 @@
import org.onosproject.kubevirtnode.api.KubevirtApiConfigService;
import org.onosproject.kubevirtnode.api.KubevirtNode;
import org.onosproject.kubevirtnode.api.KubevirtNodeService;
-import org.onosproject.kubevirtnode.api.KubevirtPhyInterface;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Port;
import org.onosproject.net.PortNumber;
@@ -547,13 +546,13 @@
* @return external patch port number
*/
public static PortNumber externalPatchPortNum(DeviceService deviceService, KubevirtNode gatewayNode) {
- KubevirtPhyInterface intf = gatewayNode.phyIntfs().stream().findFirst().orElse(null);
- if (intf == null) {
+ String gatewayBridgeName = gatewayNode.gatewayBridgeName();
+ if (gatewayBridgeName == null) {
log.warn("No external interface is attached to gateway {}", gatewayNode.hostname());
return null;
}
- String patchPortName = "int-to-" + intf.network();
+ String patchPortName = "int-to-" + gatewayBridgeName;
Port port = deviceService.getPorts(gatewayNode.intgBridge()).stream()
.filter(p -> p.isEnabled() &&
Objects.equals(p.annotations().value(PORT_NAME), patchPortName))