Skip to content

Commit

Permalink
Make VXLAN device learning attribute configurable
Browse files Browse the repository at this point in the history
allow user to configure VXLAN device learning attribute
  • Loading branch information
vincentmli committed Jun 22, 2019
1 parent 09ddc50 commit 3e31d3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/vxlan/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type vxlanDeviceAttrs struct {
vtepAddr net.IP
vtepPort int
gbp bool
learning bool
}

type vxlanDevice struct {
Expand All @@ -51,7 +52,7 @@ func newVXLANDevice(devAttrs *vxlanDeviceAttrs) (*vxlanDevice, error) {
VtepDevIndex: devAttrs.vtepIndex,
SrcAddr: devAttrs.vtepAddr,
Port: devAttrs.vtepPort,
Learning: false,
Learning: devAttrs.learning,
GBP: devAttrs.gbp,
}

Expand Down
4 changes: 3 additions & 1 deletion backend/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
VNI int
Port int
GBP bool
Learning bool
DirectRouting bool
}{
VNI: defaultVNI,
Expand All @@ -117,7 +118,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
return nil, fmt.Errorf("error decoding VXLAN backend config: %v", err)
}
}
log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v DirectRouting=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.DirectRouting)
log.Infof("VXLAN config: VNI=%d Port=%d GBP=%v Learning=%v DirectRouting=%v", cfg.VNI, cfg.Port, cfg.GBP, cfg.Learning, cfg.DirectRouting)

devAttrs := vxlanDeviceAttrs{
vni: uint32(cfg.VNI),
Expand All @@ -126,6 +127,7 @@ func (be *VXLANBackend) RegisterNetwork(ctx context.Context, wg sync.WaitGroup,
vtepAddr: be.extIface.IfaceAddr,
vtepPort: cfg.Port,
gbp: cfg.GBP,
learning: cfg.Learning,
}

dev, err := newVXLANDevice(&devAttrs)
Expand Down

0 comments on commit 3e31d3b

Please sign in to comment.