@@ -15,35 +15,35 @@ type ConfigDB struct {
1515 ACLRules map [string ]ACLRule `json:"ACL_RULE,omitempty"`
1616 ACLTables map [string ]ACLTable `json:"ACL_TABLE,omitempty"`
1717 Breakouts map [string ]BreakoutConfig `json:"BREAKOUT_CFG,omitempty"`
18- DeviceMetadata `json:"DEVICE_METADATA"`
19- DNSNameservers map [string ]DNSNameserver `json:"DNS_NAMESERVER,omitempty"`
20- Features map [string ]Feature `json:"FEATURE,omitempty"`
21- Interfaces map [string ]Interface `json:"INTERFACE,omitempty"`
22- LLDP `json:"LLDP"`
18+ DeviceMetadata DeviceMetadata `json:"DEVICE_METADATA"`
19+ DNSNameservers map [string ]DNSNameserver `json:"DNS_NAMESERVER,omitempty"`
20+ Features map [string ]Feature `json:"FEATURE,omitempty"`
21+ Interfaces map [string ]Interface `json:"INTERFACE,omitempty"`
22+ LLDP LLDP `json:"LLDP"`
2323 LoopbackInterface map [string ]struct {} `json:"LOOPBACK_INTERFACE,omitempty"`
2424 MCLAGDomains map [string ]MCLAGDomain `json:"MCLAG_DOMAIN,omitempty"`
2525 MCLAGInterfaces map [string ]MCLAGInterface `json:"MCLAG_INTERFACE,omitempty"`
2626 MCLAGUniqueIPs map [string ]MCLAGUniqueIP `json:"MCLAG_UNIQUE_IP,omitempty"`
2727 MgmtInterfaces map [string ]MgmtInterface `json:"MGMT_INTERFACE,omitempty"`
2828 MgmtPorts map [string ]MgmtPort `json:"MGMT_PORT,omitempty"`
29- MgmtVRFConfig `json:"MGMT_VRF_CONFIG"`
30- NTP `json:"NTP"`
31- NTPServers map [string ]struct {} `json:"NTP_SERVER,omitempty"`
32- Ports map [string ]Port `json:"PORT,omitempty"`
33- PortChannels map [string ]PortChannel `json:"PORTCHANNEL,omitempty"`
34- PortChannelMembers map [string ]struct {} `json:"PORTCHANNEL_MEMBER,omitempty"`
35- SAG * SAG `json:"SAG,omitempty"`
36- VLANs map [string ]VLAN `json:"VLAN,omitempty"`
37- VLANInterfaces map [string ]VLANInterface `json:"VLAN_INTERFACE,omitempty"`
38- VLANMembers map [string ]VLANMember `json:"VLAN_MEMBER,omitempty"`
39- VRFs map [string ]VRF `json:"VRF,omitempty"`
40- VXLANEVPN `json:"VXLAN_EVPN_NVO"`
41- VXLANTunnels map [string ]VXLANTunnel `json:"VXLAN_TUNNEL,omitempty"`
42- VXLANTunnelMap `json:"VXLAN_TUNNEL_MAP,omitempty"`
29+ MgmtVRFConfig MgmtVRFConfig `json:"MGMT_VRF_CONFIG"`
30+ NTP NTP `json:"NTP"`
31+ NTPServers map [string ]struct {} `json:"NTP_SERVER,omitempty"`
32+ Ports map [string ]Port `json:"PORT,omitempty"`
33+ PortChannels map [string ]PortChannel `json:"PORTCHANNEL,omitempty"`
34+ PortChannelMembers map [string ]struct {} `json:"PORTCHANNEL_MEMBER,omitempty"`
35+ SAG * SAG `json:"SAG,omitempty"`
36+ VLANs map [string ]VLAN `json:"VLAN,omitempty"`
37+ VLANInterfaces map [string ]VLANInterface `json:"VLAN_INTERFACE,omitempty"`
38+ VLANMembers map [string ]VLANMember `json:"VLAN_MEMBER,omitempty"`
39+ VRFs map [string ]VRF `json:"VRF,omitempty"`
40+ VXLANEVPN VXLANEVPN `json:"VXLAN_EVPN_NVO"`
41+ VXLANTunnels map [string ]VXLANTunnel `json:"VXLAN_TUNNEL,omitempty"`
42+ VXLANTunnelMap VXLANTunnelMap `json:"VXLAN_TUNNEL_MAP,omitempty"`
4343}
4444
4545func GenerateConfigDB (input * values.Values , platform * p.Platform , currentDeviceMetadata DeviceMetadata ) (* ConfigDB , error ) {
46- ports , breakouts , err := getPortsAndBreakouts (input .Ports , input .Breakouts , input . PortsDefaultFEC , input . PortsDefaultMTU , platform )
46+ ports , breakouts , err := getPortsAndBreakouts (input .Ports , input .Breakouts , platform )
4747 if err != nil {
4848 return nil , err
4949 }
@@ -63,7 +63,7 @@ func GenerateConfigDB(input *values.Values, platform *p.Platform, currentDeviceM
6363 DeviceMetadata : * deviceMetadata ,
6464 DNSNameservers : getDNSNameservers (input .Nameservers ),
6565 Features : features ,
66- Interfaces : getInterfaces (input .Ports , input .BGPPorts ),
66+ Interfaces : getInterfaces (input .Ports , input .BGPPorts , input . Interconnects ),
6767 LLDP : LLDP {
6868 Global : LLDPGlobal {
6969 HelloTime : fmt .Sprintf ("%d" , input .LLDPHelloTime ),
@@ -76,7 +76,7 @@ func GenerateConfigDB(input *values.Values, platform *p.Platform, currentDeviceM
7676 MCLAGDomains : getMCLAGDomains (input .MCLAG ),
7777 MCLAGInterfaces : getMCLAGInterfaces (input .MCLAG ),
7878 MCLAGUniqueIPs : getMCLAGUniqueIPs (input .MCLAG ),
79- MgmtInterfaces : getMgmtInterfaces (input .MgmtIfIP , input . MgmtIfGateway ),
79+ MgmtInterfaces : getMgmtInterfaces (input .MgmtInterface ),
8080 MgmtPorts : map [string ]MgmtPort {
8181 "eth0" : {
8282 AdminStatus : AdminStatusUp ,
@@ -96,8 +96,8 @@ func GenerateConfigDB(input *values.Values, platform *p.Platform, currentDeviceM
9696 },
9797 NTPServers : getNTPServers (input .NTPServers ),
9898 Ports : ports ,
99- PortChannels : getPortChannels (input .PortChannels , input . PortChannelsDefaultMTU ),
100- PortChannelMembers : getPortChannelMembers (input .PortChannels ),
99+ PortChannels : getPortChannels (input .PortChannels ),
100+ PortChannelMembers : getPortChannelMembers (input .PortChannels . List ),
101101 SAG : getSAG (input .SAG ),
102102 VLANs : getVLANs (input .VLANs ),
103103 VLANInterfaces : getVLANInterfaces (input .VLANs ),
@@ -234,10 +234,10 @@ func getFeatures(features map[string]values.Feature) map[string]Feature {
234234 return configFeatures
235235}
236236
237- func getInterfaces (ports [] values.Port , bgpPorts []string ) map [string ]Interface {
237+ func getInterfaces (ports values.Ports , bgpPorts []string , interconnects map [ string ]values. Interconnect ) map [string ]Interface {
238238 interfaces := make (map [string ]Interface )
239239
240- for _ , port := range ports {
240+ for _ , port := range ports . List {
241241 if len (port .IPs ) == 0 && port .VRF == "" && ! slices .Contains (bgpPorts , port .Name ) {
242242 continue
243243 }
@@ -257,6 +257,15 @@ func getInterfaces(ports []values.Port, bgpPorts []string) map[string]Interface
257257 }
258258 }
259259
260+ for _ , interconnect := range interconnects {
261+ for _ , intf := range interconnect .UnnumberedInterfaces {
262+ interfaces [intf ] = Interface {
263+ IPv6UseLinkLocalOnly : IPv6UseLinkLocalOnlyModeEnable ,
264+ VRFName : interconnect .VRF ,
265+ }
266+ }
267+ }
268+
260269 return interfaces
261270}
262271
@@ -303,19 +312,19 @@ func getMCLAGUniqueIPs(mclag values.MCLAG) map[string]MCLAGUniqueIP {
303312 }
304313}
305314
306- func getMgmtInterfaces (mgmtIfIP , mgmtIfGateway string ) map [string ]MgmtInterface {
307- if mgmtIfIP == "" {
315+ func getMgmtInterfaces (mgmtif values. MgmtInterface ) map [string ]MgmtInterface {
316+ if mgmtif . IP == "" {
308317 return nil
309318 }
310319
311320 mgmtInterfaces := make (map [string ]MgmtInterface )
312321
313322 eth0 := MgmtInterface {}
314- if mgmtIfGateway != "" {
315- eth0 .GWAddr = mgmtIfGateway
323+ if mgmtif . GatewayAddress != "" {
324+ eth0 .GWAddr = mgmtif . GatewayAddress
316325 }
317326
318- mgmtInterfaces ["eth0|" + mgmtIfIP ] = eth0
327+ mgmtInterfaces ["eth0|" + mgmtif . IP ] = eth0
319328
320329 return mgmtInterfaces
321330}
@@ -330,13 +339,13 @@ func getNTPServers(servers []string) map[string]struct{} {
330339 return ntpServers
331340}
332341
333- func getPortChannels (portChannels [] values.PortChannel , defaultPortChannelMTU int ) map [string ]PortChannel {
342+ func getPortChannels (portChannels values.PortChannels ) map [string ]PortChannel {
334343 configPortChannels := make (map [string ]PortChannel )
335344
336- for _ , pc := range portChannels {
345+ for _ , pc := range portChannels . List {
337346 mtu := defaultMTU
338- if defaultPortChannelMTU != 0 {
339- mtu = defaultPortChannelMTU
347+ if portChannels . DefaultMTU != 0 {
348+ mtu = portChannels . DefaultMTU
340349 }
341350 if pc .MTU != 0 {
342351 mtu = pc .MTU
@@ -368,13 +377,13 @@ func getPortChannelMembers(portchannels []values.PortChannel) map[string]struct{
368377 return portchannelMembers
369378}
370379
371- func getPortsAndBreakouts (ports [] values.Port , breakouts map [string ]string , defaultFECMode values. FECMode , defaultMTU int , platform * p.Platform ) (map [string ]Port , map [string ]BreakoutConfig , error ) {
380+ func getPortsAndBreakouts (ports values.Ports , breakouts map [string ]string , platform * p.Platform ) (map [string ]Port , map [string ]BreakoutConfig , error ) {
372381 configPorts := make (map [string ]Port )
373382 configBreakouts := make (map [string ]BreakoutConfig )
374383
375384 defaultBreakouts := platform .GetDefaultBreakoutConfig ()
376385 for portName , breakout := range defaultBreakouts {
377- breakoutPorts , err := getPortsFromBreakout (portName , breakout , defaultFECMode , defaultMTU , platform )
386+ breakoutPorts , err := getPortsFromBreakout (portName , breakout , ports . DefaultFEC , ports . DefaultMTU , platform )
378387 if err != nil {
379388 return nil , nil , err
380389 }
@@ -386,7 +395,7 @@ func getPortsAndBreakouts(ports []values.Port, breakouts map[string]string, defa
386395 }
387396
388397 for portName , breakout := range breakouts {
389- breakoutPorts , err := getPortsFromBreakout (portName , breakout , defaultFECMode , defaultMTU , platform )
398+ breakoutPorts , err := getPortsFromBreakout (portName , breakout , ports . DefaultFEC , ports . DefaultMTU , platform )
390399 if err != nil {
391400 return nil , nil , err
392401 }
@@ -397,7 +406,7 @@ func getPortsAndBreakouts(ports []values.Port, breakouts map[string]string, defa
397406 }
398407 }
399408
400- for _ , port := range ports {
409+ for _ , port := range ports . List {
401410 configPort , ok := configPorts [port .Name ]
402411 if ! ok {
403412 return nil , nil , fmt .Errorf ("invalid port name %s; if you think it should be available please check your breakout configuration" , port .Name )
@@ -499,7 +508,7 @@ func getVLANMembers(vlans []values.VLAN, addVlanMembers bool) map[string]VLANMem
499508 return vlanMembers
500509}
501510
502- func getVRFs (interconnects map [string ]values.Interconnect , ports [] values.Port , vlans []values.VLAN ) map [string ]VRF {
511+ func getVRFs (interconnects map [string ]values.Interconnect , ports values.Ports , vlans []values.VLAN ) map [string ]VRF {
503512 vrfs := make (map [string ]VRF )
504513
505514 for _ , interconnect := range interconnects {
@@ -508,7 +517,7 @@ func getVRFs(interconnects map[string]values.Interconnect, ports []values.Port,
508517 }
509518 }
510519
511- for _ , port := range ports {
520+ for _ , port := range ports . List {
512521 if port .VRF == "" {
513522 continue
514523 }
0 commit comments