Skip to content

Commit 36cc0e5

Browse files
committed
address review comments
1 parent 2484803 commit 36cc0e5

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

configdb/configdb.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,14 @@ func getLLDP(interval int) *LLDP {
268268
}
269269

270270
func getLoopbackInterface(loopback string) map[string]struct{} {
271-
loopbackInterface := map[string]struct{}{
272-
"Loopback0": {},
271+
if loopback == "" {
272+
return nil
273273
}
274274

275-
if loopback != "" {
276-
loopbackInterface[fmt.Sprintf("Loopback0|%s/32", loopback)] = struct{}{}
275+
return map[string]struct{}{
276+
"Loopback0": {},
277+
fmt.Sprintf("Loopback0|%s/32", loopback): {},
277278
}
278-
279-
return loopbackInterface
280279
}
281280

282281
func getMCLAGDomains(mclag values.MCLAG) map[string]MCLAGDomain {
@@ -564,7 +563,11 @@ func getVRFs(interconnects map[string]values.Interconnect, ports values.Ports, v
564563
}
565564

566565
func getVXLAN(vtep values.VTEP, loopback string) (*VXLANEVPN, map[string]VXLANTunnel, VXLANTunnelMap) {
567-
if !vtep.AddVTEP && len(vtep.VXLANTunnelMaps) == 0 {
566+
if !vtep.Enabled && len(vtep.VXLANTunnelMaps) == 0 {
567+
return nil, nil, nil
568+
}
569+
570+
if loopback == "" {
568571
return nil, nil, nil
569572
}
570573

tests/2/sonic-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ vlans:
5757
- id: 4001
5858

5959
vtep:
60-
add_vtep: true
60+
enabled: true

tests/3/expected.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@
187187
"vrf_name": "VrfInternet"
188188
}
189189
},
190-
"LOOPBACK_INTERFACE": {
191-
"Loopback0": {}
192-
},
193190
"MGMT_PORT": {
194191
"eth0": {
195192
"admin_status": "up",
@@ -719,13 +716,5 @@
719716
},
720717
"VRF": {
721718
"VrfInternet": {}
722-
},
723-
"VXLAN_EVPN_NVO": {
724-
"nvo": {
725-
"source_vtep": "vtep"
726-
}
727-
},
728-
"VXLAN_TUNNEL": {
729-
"vtep": {}
730719
}
731720
}

tests/3/sonic-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ vlans:
4545
- id: 4009
4646

4747
vtep:
48-
add_vtep: true
48+
enabled: true

values/values.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type VLAN struct {
123123
}
124124

125125
type VTEP struct {
126-
AddVTEP bool `yaml:"add_vtep"`
126+
Enabled bool `yaml:"enabled"`
127127
VXLANTunnelMaps []VXLANTunnelMap `yaml:"vxlan_tunnel_maps"`
128128
}
129129

0 commit comments

Comments
 (0)