Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions internal/provider/cisco/nxos/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
return err
}

sb.Update(p)
sb.Patch(p)

case v1alpha1.InterfaceTypeLoopback:
lb := new(Loopback)
Expand All @@ -1348,7 +1348,7 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
lb.AdminSt = AdminStUp
}
lb.RtvrfMbrItems = NewVrfMember(name, vrf)
sb.Update(lb)
sb.Patch(lb)

case v1alpha1.InterfaceTypeAggregate:
f := new(Feature)
Expand Down Expand Up @@ -1462,13 +1462,13 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
}
}

sb.Update(pc)
sb.Patch(pc)

if req.MultiChassisID != nil {
v := new(VPCIf)
v.ID = int(*req.MultiChassisID)
v.SetPortChannel(name)
sb.Update(v)
sb.Patch(v)
}

case v1alpha1.InterfaceTypeRoutedVLAN:
Expand All @@ -1491,7 +1491,7 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
}
svi.VlanID = req.VLAN.Spec.ID
svi.RtvrfMbrItems = NewVrfMember(name, vrf)
sb.Update(svi)
sb.Patch(svi)

fwif := new(FabricFwdIf)
fwif.ID = name
Expand All @@ -1508,7 +1508,7 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte

fwif.AdminSt = AdminStEnabled
fwif.Mode = FwdModeAnycastGateway
sb.Update(fwif)
sb.Patch(fwif)
default:
sb.Delete(fwif)
}
Expand Down Expand Up @@ -1550,7 +1550,7 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
s.Medium = MediumPointToPoint
}

sb.Update(s)
sb.Patch(s)

default:
return apistatus.NewUnsupportedFieldError(apistatus.FieldViolation{
Expand Down Expand Up @@ -1589,27 +1589,27 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
}
}
}
sb.Update(stp)
sb.Patch(stp)
}

// Add the address items last, as they depend on the interface being created first.
if addr != nil {
sb.Update(addr)
sb.Patch(addr)
}

switch {
case req.Interface.Spec.BFD != nil && req.Interface.Spec.BFD.Enabled:
f := new(Feature)
f.Name = "bfd"
f.AdminSt = AdminStEnabled
sb.Update(f)
sb.Patch(f)

// Disable ICMP redirect messages on BFD-enabled interfaces.
// See: https://www.cisco.com/c/en/us/td/docs/dcn/nx-os/nexus9000/106x/configuration/interfaces/cisco-nexus-9000-series-nx-os-interfaces-configuration-guide-release-106x/b-cisco-nexus-9000-nx-os-interfaces-configuration-guide-93x_chapter_01111.html
icmp := new(ICMPIf)
icmp.ID = name
icmp.Ctrl = "port-unreachable"
sb.Update(icmp)
sb.Patch(icmp)

bfd := new(BFD)
bfd.ID = name
Expand All @@ -1629,18 +1629,18 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
if err := bfd.Validate(); err != nil {
return err
}
sb.Update(bfd)
sb.Patch(bfd)

case req.Interface.Spec.BFD != nil && !req.Interface.Spec.BFD.Enabled:
f := new(Feature)
f.Name = "bfd"
f.AdminSt = AdminStEnabled
sb.Update(f)
sb.Patch(f)

bfd := new(BFD)
bfd.ID = name
bfd.AdminSt = AdminStDisabled
sb.Update(bfd)
sb.Patch(bfd)

default:
// BFD not specified — clean up any leftover BFD config on the interface.
Expand All @@ -1659,10 +1659,10 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
sb.Delete(icmp)
case v1alpha1.InterfaceTypeLoopback:
icmp.Ctrl = "port-unreachable,redirect"
sb.Update(icmp)
sb.Patch(icmp)
case v1alpha1.InterfaceTypeRoutedVLAN:
icmp.Ctrl = "port-unreachable"
sb.Update(icmp)
sb.Patch(icmp)
}
}

Expand Down
Loading