6
6
"github.com/spf13/viper"
7
7
)
8
8
9
+ // Config represents the main application configuration structure
10
+ // that contains all sub-configurations for SNMP, Redis, OLT, and individual PON boards.
9
11
type Config struct {
10
12
SnmpCfg SnmpConfig
11
13
RedisCfg RedisConfig
@@ -44,12 +46,16 @@ type Config struct {
44
46
Board2Pon16 Board2Pon16
45
47
}
46
48
49
+ // SnmpConfig contains configuration parameters for SNMP connection
50
+ // including target IP address, port, and community string.
47
51
type SnmpConfig struct {
48
- Ip string `mapstructure:"ip"`
52
+ IP string `mapstructure:"ip"` // Target IP address of the SNMP device
49
53
Port uint16 `mapstructure:"port"`
50
54
Community string `mapstructure:"community"`
51
55
}
52
56
57
+ // RedisConfig contains configuration parameters for Redis connection
58
+ // including host, port, authentication, and connection pooling settings.
53
59
type RedisConfig struct {
54
60
Host string `mapstructure:"host"`
55
61
Port string `mapstructure:"port"`
@@ -61,13 +67,17 @@ type RedisConfig struct {
61
67
PoolTimeout int `mapstructure:"pool_timeout"`
62
68
}
63
69
70
+ // OltConfig contains base OID configurations for OLT device management
71
+ // including common OIDs for ONU identification and type mapping.
64
72
type OltConfig struct {
65
73
BaseOID1 string `mapstructure:"base_oid_1"`
66
74
BaseOID2 string `mapstructure:"base_oid_2"`
67
75
OnuIDNameAllPon string `mapstructure:"onu_id_name"`
68
76
OnuTypeAllPon string `mapstructure:"onu_type"`
69
77
}
70
78
79
+ // Board1Pon1 contains OID configurations for Board 1 Port 1 ONU management
80
+ // including identifiers, status, power levels, and diagnostic information.
71
81
type Board1Pon1 struct {
72
82
OnuIDNameOID string `mapstructure:"onu_id_name"`
73
83
OnuTypeOID string `mapstructure:"onu_type"`
@@ -83,6 +93,7 @@ type Board1Pon1 struct {
83
93
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
84
94
}
85
95
96
+ // Board1Pon2 contains OID configurations for Board 1 Port 2 ONU management.
86
97
type Board1Pon2 struct {
87
98
OnuIDNameOID string `mapstructure:"onu_id_name"`
88
99
OnuTypeOID string `mapstructure:"onu_type"`
@@ -98,6 +109,7 @@ type Board1Pon2 struct {
98
109
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
99
110
}
100
111
112
+ // Board1Pon3 contains OID configurations for Board 1 Port 3 ONU management.
101
113
type Board1Pon3 struct {
102
114
OnuIDNameOID string `mapstructure:"onu_id_name"`
103
115
OnuTypeOID string `mapstructure:"onu_type"`
@@ -113,6 +125,7 @@ type Board1Pon3 struct {
113
125
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
114
126
}
115
127
128
+ // Board1Pon4 contains OID configurations for Board 1 Port 4 ONU management.
116
129
type Board1Pon4 struct {
117
130
OnuIDNameOID string `mapstructure:"onu_id_name"`
118
131
OnuTypeOID string `mapstructure:"onu_type"`
@@ -128,6 +141,7 @@ type Board1Pon4 struct {
128
141
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
129
142
}
130
143
144
+ // Board1Pon5 contains OID configurations for Board 1 Port 5 ONU management.
131
145
type Board1Pon5 struct {
132
146
OnuIDNameOID string `mapstructure:"onu_id_name"`
133
147
OnuTypeOID string `mapstructure:"onu_type"`
@@ -143,6 +157,7 @@ type Board1Pon5 struct {
143
157
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
144
158
}
145
159
160
+ // Board1Pon6 contains OID configurations for Board 1 Port 6 ONU management.
146
161
type Board1Pon6 struct {
147
162
OnuIDNameOID string `mapstructure:"onu_id_name"`
148
163
OnuTypeOID string `mapstructure:"onu_type"`
@@ -158,6 +173,7 @@ type Board1Pon6 struct {
158
173
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
159
174
}
160
175
176
+ // Board1Pon7 contains OID configurations for Board 1 Port 7 ONU management.
161
177
type Board1Pon7 struct {
162
178
OnuIDNameOID string `mapstructure:"onu_id_name"`
163
179
OnuTypeOID string `mapstructure:"onu_type"`
@@ -173,6 +189,7 @@ type Board1Pon7 struct {
173
189
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
174
190
}
175
191
192
+ // Board1Pon8 contains OID configurations for Board 1 Port 8 ONU management.
176
193
type Board1Pon8 struct {
177
194
OnuIDNameOID string `mapstructure:"onu_id_name"`
178
195
OnuTypeOID string `mapstructure:"onu_type"`
@@ -188,6 +205,7 @@ type Board1Pon8 struct {
188
205
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
189
206
}
190
207
208
+ // Board1Pon9 contains OID configurations for Board 1 Port 9 ONU management.
191
209
type Board1Pon9 struct {
192
210
OnuIDNameOID string `mapstructure:"onu_id_name"`
193
211
OnuTypeOID string `mapstructure:"onu_type"`
@@ -203,6 +221,7 @@ type Board1Pon9 struct {
203
221
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
204
222
}
205
223
224
+ // Board1Pon10 contains OID configurations for Board 1 Port 10 ONU management.
206
225
type Board1Pon10 struct {
207
226
OnuIDNameOID string `mapstructure:"onu_id_name"`
208
227
OnuTypeOID string `mapstructure:"onu_type"`
@@ -218,6 +237,7 @@ type Board1Pon10 struct {
218
237
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
219
238
}
220
239
240
+ // Board1Pon11 contains OID configurations for Board 1 Port 11 ONU management.
221
241
type Board1Pon11 struct {
222
242
OnuIDNameOID string `mapstructure:"onu_id_name"`
223
243
OnuTypeOID string `mapstructure:"onu_type"`
@@ -233,6 +253,7 @@ type Board1Pon11 struct {
233
253
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
234
254
}
235
255
256
+ // Board1Pon12 contains OID configurations for Board 1 Port 12 ONU management.
236
257
type Board1Pon12 struct {
237
258
OnuIDNameOID string `mapstructure:"onu_id_name"`
238
259
OnuTypeOID string `mapstructure:"onu_type"`
@@ -248,6 +269,7 @@ type Board1Pon12 struct {
248
269
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
249
270
}
250
271
272
+ // Board1Pon13 contains OID configurations for Board 1 Port 13 ONU management.
251
273
type Board1Pon13 struct {
252
274
OnuIDNameOID string `mapstructure:"onu_id_name"`
253
275
OnuTypeOID string `mapstructure:"onu_type"`
@@ -263,6 +285,7 @@ type Board1Pon13 struct {
263
285
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
264
286
}
265
287
288
+ // Board1Pon14 contains OID configurations for Board 1 Port 14 ONU management.
266
289
type Board1Pon14 struct {
267
290
OnuIDNameOID string `mapstructure:"onu_id_name"`
268
291
OnuTypeOID string `mapstructure:"onu_type"`
@@ -278,6 +301,7 @@ type Board1Pon14 struct {
278
301
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
279
302
}
280
303
304
+ // Board1Pon15 contains OID configurations for Board 1 Port 15 ONU management.
281
305
type Board1Pon15 struct {
282
306
OnuIDNameOID string `mapstructure:"onu_id_name"`
283
307
OnuTypeOID string `mapstructure:"onu_type"`
@@ -293,6 +317,7 @@ type Board1Pon15 struct {
293
317
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
294
318
}
295
319
320
+ // Board1Pon16 contains OID configurations for Board 1 Port 16 ONU management.
296
321
type Board1Pon16 struct {
297
322
OnuIDNameOID string `mapstructure:"onu_id_name"`
298
323
OnuTypeOID string `mapstructure:"onu_type"`
@@ -307,6 +332,8 @@ type Board1Pon16 struct {
307
332
OnuLastOfflineReasonOID string `mapstructure:"onu_last_offline_reason"`
308
333
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
309
334
}
335
+
336
+ // Board2Pon1 contains OID configurations for Board 2 Port 1 ONU management.
310
337
type Board2Pon1 struct {
311
338
OnuIDNameOID string `mapstructure:"onu_id_name"`
312
339
OnuTypeOID string `mapstructure:"onu_type"`
@@ -322,6 +349,7 @@ type Board2Pon1 struct {
322
349
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
323
350
}
324
351
352
+ // Board2Pon2 contains OID configurations for Board 2 Port 2 ONU management.
325
353
type Board2Pon2 struct {
326
354
OnuIDNameOID string `mapstructure:"onu_id_name"`
327
355
OnuTypeOID string `mapstructure:"onu_type"`
@@ -337,6 +365,7 @@ type Board2Pon2 struct {
337
365
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
338
366
}
339
367
368
+ // Board2Pon3 contains OID configurations for Board 2 Port 3 ONU management.
340
369
type Board2Pon3 struct {
341
370
OnuIDNameOID string `mapstructure:"onu_id_name"`
342
371
OnuTypeOID string `mapstructure:"onu_type"`
@@ -352,6 +381,7 @@ type Board2Pon3 struct {
352
381
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
353
382
}
354
383
384
+ // Board2Pon4 contains OID configurations for Board 2 Port 4 ONU management.
355
385
type Board2Pon4 struct {
356
386
OnuIDNameOID string `mapstructure:"onu_id_name"`
357
387
OnuTypeOID string `mapstructure:"onu_type"`
@@ -367,6 +397,7 @@ type Board2Pon4 struct {
367
397
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
368
398
}
369
399
400
+ // Board2Pon5 contains OID configurations for Board 2 Port 5 ONU management.
370
401
type Board2Pon5 struct {
371
402
OnuIDNameOID string `mapstructure:"onu_id_name"`
372
403
OnuTypeOID string `mapstructure:"onu_type"`
@@ -382,6 +413,7 @@ type Board2Pon5 struct {
382
413
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
383
414
}
384
415
416
+ // Board2Pon6 contains OID configurations for Board 2 Port 6 ONU management.
385
417
type Board2Pon6 struct {
386
418
OnuIDNameOID string `mapstructure:"onu_id_name"`
387
419
OnuTypeOID string `mapstructure:"onu_type"`
@@ -397,6 +429,7 @@ type Board2Pon6 struct {
397
429
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
398
430
}
399
431
432
+ // Board2Pon7 contains OID configurations for Board 2 Port 7 ONU management.
400
433
type Board2Pon7 struct {
401
434
OnuIDNameOID string `mapstructure:"onu_id_name"`
402
435
OnuTypeOID string `mapstructure:"onu_type"`
@@ -412,6 +445,7 @@ type Board2Pon7 struct {
412
445
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
413
446
}
414
447
448
+ // Board2Pon8 contains OID configurations for Board 2 Port 8 ONU management.
415
449
type Board2Pon8 struct {
416
450
OnuIDNameOID string `mapstructure:"onu_id_name"`
417
451
OnuTypeOID string `mapstructure:"onu_type"`
@@ -427,6 +461,7 @@ type Board2Pon8 struct {
427
461
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
428
462
}
429
463
464
+ // Board2Pon9 contains OID configurations for Board 2 Port 9 ONU management.
430
465
type Board2Pon9 struct {
431
466
OnuIDNameOID string `mapstructure:"onu_id_name"`
432
467
OnuTypeOID string `mapstructure:"onu_type"`
@@ -442,6 +477,7 @@ type Board2Pon9 struct {
442
477
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
443
478
}
444
479
480
+ // Board2Pon10 contains OID configurations for Board 2 Port 10 ONU management.
445
481
type Board2Pon10 struct {
446
482
OnuIDNameOID string `mapstructure:"onu_id_name"`
447
483
OnuTypeOID string `mapstructure:"onu_type"`
@@ -457,6 +493,7 @@ type Board2Pon10 struct {
457
493
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
458
494
}
459
495
496
+ // Board2Pon11 contains OID configurations for Board 2 Port 11 ONU management.
460
497
type Board2Pon11 struct {
461
498
OnuIDNameOID string `mapstructure:"onu_id_name"`
462
499
OnuTypeOID string `mapstructure:"onu_type"`
@@ -472,6 +509,7 @@ type Board2Pon11 struct {
472
509
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
473
510
}
474
511
512
+ // Board2Pon12 contains OID configurations for Board 2 Port 12 ONU management.
475
513
type Board2Pon12 struct {
476
514
OnuIDNameOID string `mapstructure:"onu_id_name"`
477
515
OnuTypeOID string `mapstructure:"onu_type"`
@@ -487,6 +525,7 @@ type Board2Pon12 struct {
487
525
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
488
526
}
489
527
528
+ // Board2Pon13 contains OID configurations for Board 2 Port 13 ONU management.
490
529
type Board2Pon13 struct {
491
530
OnuIDNameOID string `mapstructure:"onu_id_name"`
492
531
OnuTypeOID string `mapstructure:"onu_type"`
@@ -502,6 +541,7 @@ type Board2Pon13 struct {
502
541
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
503
542
}
504
543
544
+ // Board2Pon14 contains OID configurations for Board 2 Port 14 ONU management.
505
545
type Board2Pon14 struct {
506
546
OnuIDNameOID string `mapstructure:"onu_id_name"`
507
547
OnuTypeOID string `mapstructure:"onu_type"`
@@ -517,6 +557,7 @@ type Board2Pon14 struct {
517
557
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
518
558
}
519
559
560
+ // Board2Pon15 contains OID configurations for Board 2 Port 15 ONU management.
520
561
type Board2Pon15 struct {
521
562
OnuIDNameOID string `mapstructure:"onu_id_name"`
522
563
OnuTypeOID string `mapstructure:"onu_type"`
@@ -532,6 +573,7 @@ type Board2Pon15 struct {
532
573
OnuGponOpticalDistanceOID string `mapstructure:"onu_gpon_optical_distance"`
533
574
}
534
575
576
+ // Board2Pon16 contains OID configurations for Board 2 Port 16 ONU management.
535
577
type Board2Pon16 struct {
536
578
OnuIDNameOID string `mapstructure:"onu_id_name"`
537
579
OnuTypeOID string `mapstructure:"onu_type"`
0 commit comments