Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ k8s_resource(new_name='bgp-import-policy', objects=['bgp-import-policy:routingpo
k8s_yaml('./config/samples/cisco/nx/v1alpha1_vpcdomain.yaml')
k8s_resource(new_name='vpcdomain', objects=['leaf1-vpcdomain:vpcdomain', 'leaf1-vrfvpckeepalive:vrf', 'eth1-30:interface', 'vpc-peer-link:interfaceconfig', 'eth1-31:interface','eth1-32:interface', 'po1:interface'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])

k8s_yaml('./config/samples/cisco/nx/v1alpha1_system.yaml')
k8s_resource(new_name='nxsystem', objects=['leaf1:system'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])

k8s_yaml('./config/samples/cisco/nx/v1alpha1_interfaceconfig.yaml')
k8s_resource(new_name='spanning-tree-network', objects=['spanning-tree-network:interfaceconfig'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])
k8s_resource(new_name='lacp-vpc', objects=['lacp-vpc:interfaceconfig'], trigger_mode=TRIGGER_MODE_MANUAL, auto_init=False, labels=['samples'])
Expand Down
9 changes: 9 additions & 0 deletions api/cisco/nx/v1alpha1/system_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ type SystemSpec struct {
// +optional
// +kubebuilder:default=false
VlanLongName bool `json:"vlanLongName"`

// RelayServerIDOverrideDisable enables the global command
// "ip dhcp relay information option server-id-override-disable".
// It prevents the DHCP relay agent from overriding the Server-ID (Option 54) in
// relayed requests, which otherwise causes DHCP servers to drop the request.
// Disabled by default. Requires the dhcp feature, which is enabled automatically.
// +optional
// +kubebuilder:default=false
RelayServerIDOverrideDisable bool `json:"relayServerIdOverrideDisable"`
}

// SystemStatus defines the observed state of System.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/samples/cisco/nx/v1alpha1_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ spec:
jumboMtu: 9214
reservedVlan: 3850
vlanLongName: true
relayServerIdOverrideDisable: true
1 change: 1 addition & 0 deletions docs/api-reference/index.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/provider/cisco/nxos/dhcprelay.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
var (
_ gnmiext.DataElement = (*DHCPRelayConfig)(nil)
_ gnmiext.DataElement = (*DHCPRelay)(nil)
_ gnmiext.DataElement = (*DHCPRelayServerIDOverrideDisable)(nil)
_ gnmiext.Defaultable = (*DHCPRelayServerIDOverrideDisable)(nil)
)

// DHCPRelayConfig represents the complete DHCP relay configuration tree.
Expand Down Expand Up @@ -49,3 +51,14 @@ type DHCPRelayServer struct {
func (d *DHCPRelayServer) Key() netip.Addr {
return d.Address
}

// DHCPRelayServerIDOverrideDisable toggles the global
// "ip dhcp relay information option server-id-override-disable" command.
// Modeled as the YANG uint32 0..1 toggle; 0 is the platform default.
type DHCPRelayServerIDOverrideDisable uint32

func (*DHCPRelayServerIDOverrideDisable) XPath() string {
return "System/dhcp-items/inst-items/relayInformationOptionServerIdOverrideDisableEnabled"
}

func (d *DHCPRelayServerIDOverrideDisable) Default() { *d = 0 }
9 changes: 9 additions & 0 deletions internal/provider/cisco/nxos/dhcprelay_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-FileCopyrightText: SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package nxos

func init() {
sidod := DHCPRelayServerIDOverrideDisable(1)
Register("dhcprelayserveridoverride", &sidod)
}
3 changes: 3 additions & 0 deletions internal/provider/cisco/nxos/feat.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ var (
_ gnmiext.Defaultable = (*Feature)(nil)
)

// FeatureDHCP is the NX-OS feature name for DHCP.
const FeatureDHCP = "dhcp"

// Feature represents a dynamic feature configuration on a NX-OS device.
type Feature struct {
Name string `json:"-"`
Expand Down
13 changes: 11 additions & 2 deletions internal/provider/cisco/nxos/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3372,7 +3372,15 @@ func (p *Provider) EnsureSystemSettings(ctx context.Context, s *nxv1alpha1.Syste
sys := new(SystemJumboMTU)
*sys = SystemJumboMTU(s.Spec.JumboMTU)

return p.client.Patch(ctx, long, res, sys)
sidod := new(DHCPRelayServerIDOverrideDisable)
if s.Spec.RelayServerIDOverrideDisable {
*sidod = 1
if err := p.client.Patch(ctx, &Feature{Name: FeatureDHCP, AdminSt: AdminStEnabled}); err != nil {
return err
}
}

return p.client.Patch(ctx, long, res, sys, sidod)
}

func (p *Provider) ResetSystemSettings(ctx context.Context) error {
Expand All @@ -3381,6 +3389,7 @@ func (p *Provider) ResetSystemSettings(ctx context.Context) error {
new(VLANSystem),
new(VLANReservation),
new(SystemJumboMTU),
new(DHCPRelayServerIDOverrideDisable),
)
}

Expand Down Expand Up @@ -3994,7 +4003,7 @@ func (p *Provider) EnsureDHCPRelay(ctx context.Context, req *provider.DHCPRelayR
sb := new(gnmiext.SetBuilder).Limit(maxSetOperations)

f := new(Feature)
f.Name = "dhcp"
f.Name = FeatureDHCP
f.AdminSt = AdminStEnabled
sb.Update(f)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dhcp-items": {
"inst-items": {
"relayInformationOptionServerIdOverrideDisableEnabled": 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ spec:
"inst-items": {
"systemJumboMtu": 9214
}
},
"dhcp-items": {
"inst-items": {
"relayInformationOptionServerIdOverrideDisableEnabled": 0
}
}
}
}
Expand All @@ -66,6 +71,11 @@ spec:
"inst-items": {
"systemJumboMtu": 9216
}
},
"dhcp-items": {
"inst-items": {
"relayInformationOptionServerIdOverrideDisableEnabled": 0
}
}
}
}
Loading