Skip to content

Commit 9fc8edb

Browse files
committed
sag pointer
1 parent e0bcec5 commit 9fc8edb

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

configdb/configdb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ func getPortsAndBreakouts(ports values.Ports, breakouts map[string]string, platf
497497
return configPorts, configBreakouts, nil
498498
}
499499

500-
func getSAG(sag values.SAG, version *v.Version) (*SAG, error) {
501-
if version.Branch != string(v.Branch202211) && sag.MAC != "" {
500+
func getSAG(sag *values.SAG, version *v.Version) (*SAG, error) {
501+
if version.Branch != string(v.Branch202211) && sag != nil {
502502
return nil, fmt.Errorf("sag configuration only works with sonic versions from the ec202211 branch")
503503
}
504504

configdb/configdb_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,16 +556,14 @@ func Test_getVRFs(t *testing.T) {
556556
func Test_getSAG(t *testing.T) {
557557
tests := []struct {
558558
name string
559-
sag values.SAG
559+
sag *values.SAG
560560
version *v.Version
561561
want *SAG
562562
wantErr bool
563563
}{
564564
{
565565
name: "wrong version",
566-
sag: values.SAG{
567-
MAC: "11:11:11:11:11:11",
568-
},
566+
sag: &values.SAG{},
569567
version: &v.Version{
570568
Branch: string(v.Branch202111),
571569
},
@@ -574,7 +572,7 @@ func Test_getSAG(t *testing.T) {
574572
},
575573
{
576574
name: "empty mac",
577-
sag: values.SAG{},
575+
sag: &values.SAG{},
578576
version: &v.Version{
579577
Branch: string(v.Branch202211),
580578
},
@@ -583,7 +581,7 @@ func Test_getSAG(t *testing.T) {
583581
},
584582
{
585583
name: "valid",
586-
sag: values.SAG{
584+
sag: &values.SAG{
587585
MAC: "11:11:11:11:11:11",
588586
},
589587
version: &v.Version{

values/values.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ type Values struct {
106106
NTP NTP `yaml:"ntp"`
107107
PortChannels PortChannels `yaml:"portchannels"`
108108
Ports Ports `yaml:"ports"`
109-
SAG SAG `yaml:"sag"`
109+
SAG *SAG `yaml:"sag"`
110110
SSHSourceranges []string `yaml:"ssh_sourceranges"`
111111
VLANs []VLAN `yaml:"vlans"`
112112
VLANSubinterfaces []VLANSubinterface `yaml:"vlan_subinterfaces"`

0 commit comments

Comments
 (0)