diff --git a/go-controller/pkg/cni/types/types.go b/go-controller/pkg/cni/types/types.go index 442b1a6c76d..01efb56ee00 100644 --- a/go-controller/pkg/cni/types/types.go +++ b/go-controller/pkg/cni/types/types.go @@ -50,6 +50,8 @@ type NetConf struct { // restart. AllowPersistentIPs bool `json:"allowPersistentIPs,omitempty"` + Alias string `json:"localnetPortAlias,omitempty"` + // PciAddrs in case of using sriov or Auxiliry device name in case of SF DeviceID string `json:"deviceID,omitempty"` // LogFile to log all the messages from cni shim binary to diff --git a/go-controller/pkg/ovn/secondary_localnet_network_controller.go b/go-controller/pkg/ovn/secondary_localnet_network_controller.go index 12901c1d49c..d0070fb871c 100644 --- a/go-controller/pkg/ovn/secondary_localnet_network_controller.go +++ b/go-controller/pkg/ovn/secondary_localnet_network_controller.go @@ -280,9 +280,7 @@ func (oc *SecondaryLocalnetNetworkController) Init() error { Name: oc.GetNetworkScopedName(types.OVNLocalnetPort), Addresses: []string{"unknown"}, Type: "localnet", - Options: map[string]string{ - "network_name": oc.GetNetworkName(), - }, + Options: oc.localnetPortNetworkNameOptions(), } intVlanID := int(oc.Vlan()) if intVlanID != 0 { @@ -342,3 +340,13 @@ func (oc *SecondaryLocalnetNetworkController) newRetryFramework( resourceHandler, ) } + +func (oc *SecondaryLocalnetNetworkController) localnetPortNetworkNameOptions() map[string]string { + localnetLSPOptions := map[string]string{ + "network_name": oc.GetNetworkName(), + } + if oc.PhysicalNetworkNameAlias() != "" { + localnetLSPOptions["network_name"] = oc.PhysicalNetworkNameAlias() + } + return localnetLSPOptions +} diff --git a/go-controller/pkg/util/multi_network.go b/go-controller/pkg/util/multi_network.go index a33097bda68..c64700105eb 100644 --- a/go-controller/pkg/util/multi_network.go +++ b/go-controller/pkg/util/multi_network.go @@ -42,6 +42,7 @@ type BasicNetInfo interface { JoinSubnets() []*net.IPNet Vlan() uint AllowsPersistentIPs() bool + PhysicalNetworkNameAlias() string // utility methods Equals(BasicNetInfo) bool @@ -258,6 +259,10 @@ func (nInfo *DefaultNetInfo) AllowsPersistentIPs() bool { return false } +func (nInfo *DefaultNetInfo) PhysicalNetworkNameAlias() string { + return "" +} + // SecondaryNetInfo holds the network name information for secondary network if non-nil type secondaryNetInfo struct { netName string @@ -278,6 +283,8 @@ type secondaryNetInfo struct { // to be plumbed for this network sync.Mutex nadNames sets.Set[string] + + localnetAlias string } // GetNetworkName returns the network name @@ -416,6 +423,10 @@ func (nInfo *secondaryNetInfo) AllowsPersistentIPs() bool { return nInfo.allowPersistentIPs } +func (nInfo *secondaryNetInfo) PhysicalNetworkNameAlias() string { + return nInfo.localnetAlias +} + // IPMode returns the ipv4/ipv6 mode func (nInfo *secondaryNetInfo) IPMode() (bool, bool) { return nInfo.ipv4mode, nInfo.ipv6mode @@ -513,6 +524,7 @@ func (nInfo *secondaryNetInfo) copy() *secondaryNetInfo { excludeSubnets: nInfo.excludeSubnets, joinSubnets: nInfo.joinSubnets, nadNames: nInfo.nadNames.Clone(), + localnetAlias: nInfo.localnetAlias, } return c @@ -579,6 +591,7 @@ func newLocalnetNetConfInfo(netconf *ovncnitypes.NetConf) (NetInfo, error) { vlan: uint(netconf.VLANID), allowPersistentIPs: netconf.AllowPersistentIPs, nadNames: sets.Set[string]{}, + localnetAlias: netconf.Alias, } ni.ipv4mode, ni.ipv6mode = getIPMode(subnets) return ni, nil