Skip to content

Commit

Permalink
Obtains the external patch port by referring to gateway bridge name
Browse files Browse the repository at this point in the history
Change-Id: I1a6b5f97af3454c6fb36e08d673240b553e36392
  • Loading branch information
gunine committed Mar 25, 2021
1 parent b6dc08f commit 63f191f
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -547,13 +546,13 @@ public static KubevirtRouter getRouterForKubevirtNetwork(KubevirtRouterService r
* @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))
Expand Down

0 comments on commit 63f191f

Please sign in to comment.