Skip to content
Open
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
5 changes: 5 additions & 0 deletions api/core/v1alpha1/evpninstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ type EVPNInstanceSpec struct {
// +optional
// +kubebuilder:validation:XValidation:rule="self.name == oldSelf.name",message="VRFRef is immutable"
VRFRef *LocalObjectReference `json:"vrfRef,omitempty"`

// SuppressARP overrides the NVE-level ARP suppression setting for this VNI.
// When unset, the NVE-level SuppressARP setting takes precedence.
// +optional
SuppressARP *bool `json:"suppressARP,omitempty"`
}

// EVPNInstanceType defines the type of EVPN instance.
Expand Down
5 changes: 5 additions & 0 deletions api/core/v1alpha1/zz_generated.deepcopy.go

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.

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

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.

7 changes: 7 additions & 0 deletions internal/provider/cisco/nxos/nve.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ func (n *NVE) XPath() string {
return "System/eps-items/epId-items/Ep-list[epId=1]"
}

const (
suppressARPOff = "off"
suppressARPEnabled = "enabled"
suppressARPDisabled = "disabled"
)

type VNI struct {
AssociateVrfFlag bool `json:"associateVrfFlag"`
McastGroup Option[string] `json:"mcastGroup"`
Vni int32 `json:"vni"`
SuppressARP string `json:"suppressARP"`
Comment on lines +67 to +77

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const (
suppressARPOff = "off"
suppressARPEnabled = "enabled"
suppressARPDisabled = "disabled"
)
type VNI struct {
AssociateVrfFlag bool `json:"associateVrfFlag"`
McastGroup Option[string] `json:"mcastGroup"`
Vni int32 `json:"vni"`
SuppressARP string `json:"suppressARP"`
type SuppressARP string
const (
SuppressARPOff SuppressARP = "off"
SuppressARPEnabled SuppressARP = "enabled"
SuppressARPDisabled SuppressARP = "disabled"
)
type VNI struct {
AssociateVrfFlag bool `json:"associateVrfFlag"`
McastGroup Option[string] `json:"mcastGroup"`
Vni int32 `json:"vni"`
SuppressARP SuppressARP `json:"suppressARP"`

could we make this a real string enumeration?

}

func (*VNI) IsListItem() {}
Expand Down
17 changes: 15 additions & 2 deletions internal/provider/cisco/nxos/nve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,23 @@ func init() {
Register("nve", nve)

vni := &VNI{
Vni: 100010,
McastGroup: NewOption("239.1.1.100"),
Vni: 100010,
McastGroup: NewOption("239.1.1.100"),
SuppressARP: suppressARPOff,
}
Register("vni", vni)

vniSuppressARPTrue := &VNI{
Vni: 100011,
SuppressARP: suppressARPEnabled,
}
Register("vni_suppress_arp_true", vniSuppressARPTrue)

vniSuppressARPFalse := &VNI{
Vni: 100012,
SuppressARP: suppressARPDisabled,
}
Register("vni_suppress_arp_false", vniSuppressARPFalse)
nveInfraVLANs := &NVEInfraVLANs{
InfraVLANList: []*NVEInfraVLAN{
{ID: 4052},
Expand Down
8 changes: 8 additions & 0 deletions internal/provider/cisco/nxos/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,14 @@ func (p *Provider) EnsureEVPNInstance(ctx context.Context, req *provider.EVPNIns
if req.EVPNInstance.Spec.MulticastGroupAddress != "" {
vni.McastGroup = NewOption(req.EVPNInstance.Spec.MulticastGroupAddress)
}
switch {
case req.EVPNInstance.Spec.SuppressARP == nil:
vni.SuppressARP = suppressARPOff
case *req.EVPNInstance.Spec.SuppressARP:
vni.SuppressARP = suppressARPEnabled
default:
vni.SuppressARP = suppressARPDisabled
}
sb.Update(vni)

switch req.EVPNInstance.Spec.Type {
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/cisco/nxos/testdata/vni.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
{
"associateVrfFlag": false,
"mcastGroup": "239.1.1.100",
"vni": 100010
"vni": 100010,
"suppressARP": "off"
}
]
}
Expand Down
23 changes: 23 additions & 0 deletions internal/provider/cisco/nxos/testdata/vni_suppress_arp_false.json

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I don't think we need a variant for each of the different values for each fiel. The internal/provider/cisco/nxos/testdata/vni.json would already be sufficient in my view to showcase that we set this payload. Exact string values are easily checkable from the code itself.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"eps-items": {
"epId-items": {
"Ep-list": [
{
"epId": "1",
"nws-items": {
"vni-items": {
"Nw-list": [
{
"associateVrfFlag": false,
"mcastGroup": "DME_UNSET_PROPERTY_MARKER",
"vni": 100012,
"suppressARP": "disabled"
}
]
}
}
}
]
}
}
}
23 changes: 23 additions & 0 deletions internal/provider/cisco/nxos/testdata/vni_suppress_arp_true.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"eps-items": {
"epId-items": {
"Ep-list": [
{
"epId": "1",
"nws-items": {
"vni-items": {
"Nw-list": [
{
"associateVrfFlag": false,
"mcastGroup": "DME_UNSET_PROPERTY_MARKER",
"vni": 100011,
"suppressARP": "enabled"
}
]
}
}
}
]
}
}
}
3 changes: 2 additions & 1 deletion test/gnmi/testdata/cisco-nxos-gnmi/evpninstance.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ spec:
{
"associateVrfFlag": false,
"mcastGroup": "DME_UNSET_PROPERTY_MARKER",
"vni": 10100
"vni": 10100,
"suppressARP": "off"
}
]
}
Expand Down