@@ -12,34 +12,35 @@ import (
1212)
1313
1414type ConfigDB struct {
15- ACLRules map [string ]ACLRule `json:"ACL_RULE,omitempty"`
16- ACLTables map [string ]ACLTable `json:"ACL_TABLE,omitempty"`
17- Breakouts map [string ]BreakoutConfig `json:"BREAKOUT_CFG,omitempty"`
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,omitempty"`
23- LoopbackInterface map [string ]struct {} `json:"LOOPBACK_INTERFACE,omitempty"`
24- MCLAGDomains map [string ]MCLAGDomain `json:"MCLAG_DOMAIN,omitempty"`
25- MCLAGInterfaces map [string ]MCLAGInterface `json:"MCLAG_INTERFACE,omitempty"`
26- MCLAGUniqueIPs map [string ]MCLAGUniqueIP `json:"MCLAG_UNIQUE_IP,omitempty"`
27- MgmtInterfaces map [string ]MgmtInterface `json:"MGMT_INTERFACE,omitempty"`
28- MgmtPorts map [string ]MgmtPort `json:"MGMT_PORT,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,omitempty"`
41- VXLANTunnels map [string ]VXLANTunnel `json:"VXLAN_TUNNEL,omitempty"`
42- VXLANTunnelMap VXLANTunnelMap `json:"VXLAN_TUNNEL_MAP,omitempty"`
15+ ACLRules map [string ]ACLRule `json:"ACL_RULE,omitempty"`
16+ ACLTables map [string ]ACLTable `json:"ACL_TABLE,omitempty"`
17+ Breakouts map [string ]BreakoutConfig `json:"BREAKOUT_CFG,omitempty"`
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,omitempty"`
23+ LoopbackInterface map [string ]struct {} `json:"LOOPBACK_INTERFACE,omitempty"`
24+ MCLAGDomains map [string ]MCLAGDomain `json:"MCLAG_DOMAIN,omitempty"`
25+ MCLAGInterfaces map [string ]MCLAGInterface `json:"MCLAG_INTERFACE,omitempty"`
26+ MCLAGUniqueIPs map [string ]MCLAGUniqueIP `json:"MCLAG_UNIQUE_IP,omitempty"`
27+ MgmtInterfaces map [string ]MgmtInterface `json:"MGMT_INTERFACE,omitempty"`
28+ MgmtPorts map [string ]MgmtPort `json:"MGMT_PORT,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+ VLANSubinterfaces map [string ]VLANSubinterface `json:"VLAN_SUB_INTERFACE,omitempty"`
40+ VRFs map [string ]VRF `json:"VRF,omitempty"`
41+ VXLANEVPN * VXLANEVPN `json:"VXLAN_EVPN_NVO,omitempty"`
42+ VXLANTunnels map [string ]VXLANTunnel `json:"VXLAN_TUNNEL,omitempty"`
43+ VXLANTunnelMap VXLANTunnelMap `json:"VXLAN_TUNNEL_MAP,omitempty"`
4344}
4445
4546func GenerateConfigDB (input * values.Values , platform * p.Platform , currentDeviceMetadata DeviceMetadata ) (* ConfigDB , error ) {
@@ -99,6 +100,7 @@ func GenerateConfigDB(input *values.Values, platform *p.Platform, currentDeviceM
99100 VLANs : getVLANs (input .VLANs ),
100101 VLANInterfaces : getVLANInterfaces (input .VLANs ),
101102 VLANMembers : getVLANMembers (input .VLANs ),
103+ VLANSubinterfaces : getVLANSubinterfaces (input .VLANSubinterfaces ),
102104 VRFs : getVRFs (input .Interconnects , input .Ports , input .VLANs ),
103105 VXLANEVPN : vxlanevpn ,
104106 VXLANTunnels : vxlanTunnel ,
@@ -530,6 +532,25 @@ func getVLANMembers(vlans []values.VLAN) map[string]VLANMember {
530532 return vlanMembers
531533}
532534
535+ func getVLANSubinterfaces (subinterfaces []values.VLANSubinterface ) map [string ]VLANSubinterface {
536+ vlanSubinterfaces := make (map [string ]VLANSubinterface )
537+
538+ for _ , sub := range subinterfaces {
539+ newSubinterface := VLANSubinterface {
540+ AdminStatus : AdminStatusUp ,
541+ }
542+
543+ if sub .VRF != "" {
544+ newSubinterface .VRFName = sub .VRF
545+ }
546+
547+ vlanSubinterfaces [fmt .Sprintf ("%s.%s" , sub .Port , sub .VLAN )] = newSubinterface
548+ vlanSubinterfaces [fmt .Sprintf ("%s.%s|%s" , sub .Port , sub .VLAN , sub .CIDR )] = VLANSubinterface {}
549+ }
550+
551+ return vlanSubinterfaces
552+ }
553+
533554func getVRFs (interconnects map [string ]values.Interconnect , ports values.Ports , vlans []values.VLAN ) map [string ]VRF {
534555 vrfs := make (map [string ]VRF )
535556
0 commit comments