Skip to content

Commit bf15306

Browse files
committed
add lldp time again
1 parent 1f9d54f commit bf15306

File tree

12 files changed

+51
-9
lines changed

12 files changed

+51
-9
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,12 @@ sonic-confidb-utils generate
1313

1414
Check the [template-values.yaml](template-values.yaml) file to see examples for all accepted variables.
1515

16-
Supported SONiC Version: https://github.com/metal-stack/sonic-build
16+
## Supported version and limitations
17+
18+
`sonic-configdb-utils` was only tested with our own [build](https://github.com/metal-stack/sonic-build) of SONiC.
19+
20+
### Limitations
21+
22+
Open source SONiC does not support configuring LLDP.
23+
To enable configuring the LLDP `hello_time` a patch was added to our build.
24+
However, for the LLDP config to become effective the `lldp` container needs to be restarted, e.g. with `systemctl restart lldp` or `config reload -y`.

configdb/configdb.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ type ConfigDB struct {
1414
ACLRules map[string]ACLRule `json:"ACL_RULE,omitempty"`
1515
ACLTables map[string]ACLTable `json:"ACL_TABLE,omitempty"`
1616
Breakouts map[string]BreakoutConfig `json:"BREAKOUT_CFG,omitempty"`
17-
DeviceMetadata `json:"DEVICE_METADATA,omitempty"`
18-
Features map[string]Feature `json:"FEATURE,omitempty"`
19-
Interfaces map[string]Interface `json:"INTERFACE,omitempty"`
17+
DeviceMetadata `json:"DEVICE_METADATA"`
18+
Features map[string]Feature `json:"FEATURE,omitempty"`
19+
Interfaces map[string]Interface `json:"INTERFACE,omitempty"`
20+
LLDP `json:"LLDP"`
2021
LoopbackInterface map[string]struct{} `json:"LOOPBACK_INTERFACE,omitempty"`
2122
MCLAGDomains map[string]MCLAGDomain `json:"MCLAG_DOMAIN,omitempty"`
2223
MCLAGInterfaces map[string]MCLAGInterface `json:"MCLAG_INTERFACE,omitempty"`
2324
MCLAGUniqueIPs map[string]MCLAGUniqueIP `json:"MCLAG_UNIQUE_IP,omitempty"`
2425
MgmtInterfaces map[string]MgmtInterface `json:"MGMT_INTERFACE,omitempty"`
2526
MgmtPorts map[string]MgmtPort `json:"MGMT_PORT,omitempty"`
26-
MgmtVRFConfig `json:"MGMT_VRF_CONFIG,omitempty"`
27-
NTP `json:"NTP,omitempty"`
27+
MgmtVRFConfig `json:"MGMT_VRF_CONFIG"`
28+
NTP `json:"NTP"`
2829
NTPServers map[string]struct{} `json:"NTP_SERVER,omitempty"`
2930
Ports map[string]Port `json:"PORT,omitempty"`
3031
PortChannels map[string]PortChannel `json:"PORTCHANNEL,omitempty"`
@@ -34,7 +35,7 @@ type ConfigDB struct {
3435
VLANInterfaces map[string]VLANInterface `json:"VLAN_INTERFACE,omitempty"`
3536
VLANMembers map[string]VLANMember `json:"VLAN_MEMBER,omitempty"`
3637
VRFs map[string]VRF `json:"VRF,omitempty"`
37-
VXLANEVPN `json:"VXLAN_EVPN_NVO,omitempty"`
38+
VXLANEVPN `json:"VXLAN_EVPN_NVO"`
3839
VXLANTunnels map[string]VXLANTunnel `json:"VXLAN_TUNNEL,omitempty"`
3940
VXLANTunnelMap `json:"VXLAN_TUNNEL_MAP,omitempty"`
4041
}
@@ -66,6 +67,11 @@ func GenerateConfigDB(input *values.Values, platform *p.Platform) (*ConfigDB, er
6667
},
6768
},
6869
Interfaces: getInterfaces(input.Ports, input.BGPPorts),
70+
LLDP: LLDP{
71+
Global: LLDPGlobal{
72+
HelloTime: fmt.Sprintf("%d", input.LLDPHelloTime),
73+
},
74+
},
6975
LoopbackInterface: map[string]struct{}{
7076
"Loopback0": {},
7177
"Loopback0|" + input.LoopbackAddress + "/32": {},

configdb/fields.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ const (
8080
LACPKeyModeAuto LACPKeyMode = "auto"
8181
)
8282

83+
type LLDP struct {
84+
Global LLDPGlobal `json:"GLOBAL"`
85+
}
86+
87+
type LLDPGlobal struct {
88+
HelloTime string `json:"hello_time,omitempty"`
89+
}
90+
8391
type MCLAGDomain struct {
8492
MCLAGSystemID string `json:"mclag_system_id,omitempty"`
8593
PeerIP string `json:"peer_ip,omitempty"`

template-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# vrf: VrfMpls
1616

1717
# hostname: leaf01
18+
# lldp_hello_time: 10
1819
# loopback_address: 10.7.7.7
1920

2021
# mclag:

tests/1/expected.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@
163163
"vrf_name": "VrfInternet"
164164
}
165165
},
166+
"LLDP": {
167+
"GLOBAL": {
168+
"hello_time": "10"
169+
}
170+
},
166171
"LOOPBACK_INTERFACE": {
167172
"Loopback0": {},
168173
"Loopback0|10.7.7.7/32": {}

tests/1/sonic-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ interconnects:
1616
vrf: VrfInternet
1717

1818
hostname: leaf01
19+
lldp_hello_time: 10
1920
loopback_address: 10.7.7.7
2021

2122
mclag:

tests/2/expected.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@
158158
"ipv6_use_link_local_only": "enable"
159159
}
160160
},
161+
"LLDP": {
162+
"GLOBAL": {
163+
"hello_time": "10"
164+
}
165+
},
161166
"LOOPBACK_INTERFACE": {
162167
"Loopback0": {},
163168
"Loopback0|10.7.7.7/32": {}

tests/2/sonic-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docker_routing_config_mode: split
99
frr_mgmt_framework_config: false
1010

1111
hostname: leaf01
12+
lldp_hello_time: 10
1213
loopback_address: 10.7.7.7
1314

1415
mgmtif_gateway: 10.7.10.1

tests/3/expected.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@
229229
"ipv6_use_link_local_only": "enable"
230230
}
231231
},
232+
"LLDP": {
233+
"GLOBAL": {
234+
"hello_time": "10"
235+
}
236+
},
232237
"LOOPBACK_INTERFACE": {
233238
"Loopback0": {},
234239
"Loopback0|10.7.7.7/32": {}

tests/3/sonic-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interconnects:
1717
vrf: VrfInternet
1818

1919
hostname: leaf01
20+
lldp_hello_time: 10
2021
loopback_address: 10.7.7.7
2122

2223
mclag:

0 commit comments

Comments
 (0)