forked from sonic-net/sonic-utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
700 lines (584 loc) · 21 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
#!/usr/bin/env python3
import click
from swsscommon.swsscommon import ConfigDBConnector
from tabulate import tabulate
from sonic_py_common import multi_asic
from utilities_common.general import load_db_config
from utilities_common import multi_asic as multi_asic_util
class Crm:
def __init__(self, db=None):
self.cli_mode = None
self.addr_family = None
self.res_type = None
self.db = None
self.cfgdb = db
self.multi_asic = multi_asic_util.MultiAsic()
@multi_asic_util.run_on_multi_asic
def config(self, attr, val):
"""
CRM handler for 'config' CLI commands.
"""
if self.cfgdb:
self.config_db = self.cfgdb
self.config_db.mod_entry("CRM", 'Config', {attr: val})
def show_summary(self):
"""
CRM Handler to display general information.
"""
configdb = self.cfgdb
if configdb is None:
# Get the namespace list
namespaces = multi_asic.get_namespace_list()
configdb = ConfigDBConnector(namespace=namespaces[0])
configdb.connect()
crm_info = configdb.get_entry('CRM', 'Config')
if crm_info:
try:
click.echo('\nPolling Interval: ' + crm_info['polling_interval'] + ' second(s)\n')
except KeyError:
click.echo('\nError! Could not get CRM configuration.\n')
click.echo('\nError! Please configure polling interval.\n')
else:
click.echo('\nError! Could not get CRM configuration.\n')
def show_thresholds(self, resource):
"""
CRM Handler to display thresholds information.
"""
configdb = self.cfgdb
if configdb is None:
# Get the namespace list
namespaces = multi_asic.get_namespace_list()
configdb = ConfigDBConnector(namespace=namespaces[0])
configdb.connect()
crm_info = configdb.get_entry('CRM', 'Config')
header = ("Resource Name", "Threshold Type", "Low Threshold", "High Threshold")
data = []
if crm_info:
if resource == 'all':
for res in ["ipv4_route", "ipv6_route", "ipv4_nexthop", "ipv6_nexthop", "ipv4_neighbor", "ipv6_neighbor",
"nexthop_group_member", "nexthop_group", "acl_table", "acl_group", "acl_entry",
"acl_counter", "fdb_entry", "ipmc_entry", "snat_entry", "dnat_entry", "mpls_inseg",
"mpls_nexthop","srv6_nexthop", "srv6_my_sid_entry"]:
try:
data.append([res, crm_info[res + "_threshold_type"], crm_info[res + "_low_threshold"], crm_info[res + "_high_threshold"]])
except KeyError:
pass
else:
try:
data.append([resource, crm_info[resource + "_threshold_type"], crm_info[resource + "_low_threshold"], crm_info[resource + "_high_threshold"]])
except KeyError:
pass
else:
click.echo('\nError! Could not get CRM configuration.')
click.echo()
click.echo(tabulate(data, headers=header, tablefmt="simple", missingval=""))
click.echo()
def get_resources(self, resource):
"""
CRM Handler to get resources information.
"""
crm_stats = self.db.get_all(self.db.COUNTERS_DB, 'CRM:STATS')
data = []
if crm_stats:
if resource == 'all':
for res in ["ipv4_route", "ipv6_route", "ipv4_nexthop", "ipv6_nexthop", "ipv4_neighbor", "ipv6_neighbor",
"nexthop_group_member", "nexthop_group", "fdb_entry", "ipmc_entry", "snat_entry", "dnat_entry",
"mpls_inseg", "mpls_nexthop","srv6_nexthop", "srv6_my_sid_entry"]:
if 'crm_stats_' + res + "_used" in crm_stats.keys() and 'crm_stats_' + res + "_available" in crm_stats.keys():
data.append([res, crm_stats['crm_stats_' + res + "_used"], crm_stats['crm_stats_' + res + "_available"]])
else:
if 'crm_stats_' + resource + "_used" in crm_stats.keys() and 'crm_stats_' + resource + "_available" in crm_stats.keys():
data.append([resource, crm_stats['crm_stats_' + resource + "_used"], crm_stats['crm_stats_' + resource + "_available"]])
return data
def get_acl_resources(self):
"""
CRM Handler to get ACL recources information.
"""
data = []
for stage in ["INGRESS", "EGRESS"]:
for bind_point in ["PORT", "LAG", "VLAN", "RIF", "SWITCH"]:
crm_stats = self.db.get_all(self.db.COUNTERS_DB, 'CRM:ACL_STATS:{0}:{1}'.format(stage, bind_point))
if crm_stats:
for res in ["acl_group", "acl_table"]:
data.append([
stage, bind_point, res,
crm_stats['crm_stats_' + res + "_used"],
crm_stats['crm_stats_' + res + "_available"]
])
return data
def get_acl_table_resources(self):
"""
CRM Handler to display ACL table information.
"""
# Retrieve all ACL table keys from CRM:ACL_TABLE_STATS
crm_acl_keys = self.db.keys(self.db.COUNTERS_DB, 'CRM:ACL_TABLE_STATS*')
data = []
for key in crm_acl_keys or [None]:
if key:
id = key.replace('CRM:ACL_TABLE_STATS:', '')
crm_stats = self.db.get_all(self.db.COUNTERS_DB, key)
for res in ['acl_entry', 'acl_counter']:
if ('crm_stats_' + res + '_used' in crm_stats) and ('crm_stats_' + res + '_available' in crm_stats):
data.append([id, res, crm_stats['crm_stats_' + res + '_used'], crm_stats['crm_stats_' + res + '_available']])
return data
@multi_asic_util.run_on_multi_asic
def show_resources(self, resource):
"""
CRM Handler to display resources information.
"""
if multi_asic.is_multi_asic():
header = (self.multi_asic.current_namespace.upper() + "\n\nResource Name", "\n\nUsed Count", "\n\nAvailable Count")
err_msg = '\nCRM counters are not ready for '+ self.multi_asic.current_namespace.upper() + '. They would be populated after the polling interval.'
else:
header = ("Resource Name", "Used Count", "Available Count")
err_msg = '\nCRM counters are not ready. They would be populated after the polling interval.'
data = []
data = self.get_resources(resource)
if data:
click.echo()
click.echo(tabulate(data, headers=header, tablefmt="simple", missingval=""))
click.echo()
else:
click.echo(err_msg)
@multi_asic_util.run_on_multi_asic
def show_acl_resources(self):
"""
CRM Handler to display ACL recources information.
"""
if multi_asic.is_multi_asic():
header = (self.multi_asic.current_namespace.upper() + "\n\nStage", "\n\nBind Point", "\n\nResource Name", "\n\nUsed Count", "\n\nAvailable Count")
else:
header = ("Stage", "Bind Point", "Resource Name", "Used Count", "Available Count")
data = []
data = self.get_acl_resources()
click.echo()
click.echo(tabulate(data, headers=header, tablefmt="simple", missingval=""))
click.echo()
@multi_asic_util.run_on_multi_asic
def show_acl_table_resources(self):
"""
CRM Handler to display ACL table information.
"""
if multi_asic.is_multi_asic():
header = (self.multi_asic.current_namespace.upper() + "\n\nTable ID", "\n\nResource Name", "\n\nUsed Count", "\n\nAvailable Count")
else:
header = ("Table ID", "Resource Name", "Used Count", "Available Count")
data = []
data = self.get_acl_table_resources()
click.echo()
click.echo(tabulate(data, headers=header, tablefmt="simple", missingval=""))
click.echo()
@click.group()
@click.pass_context
def cli(ctx):
"""
Utility entry point.
"""
# Use the db object if given as input.
db = None if ctx.obj is None else ctx.obj.cfgdb
# Load database config files
load_db_config()
context = {
"crm": Crm(db)
}
ctx.obj = context
@cli.group()
@click.pass_context
def config(ctx):
"""CRM related configuration"""
pass
@config.group()
@click.pass_context
def polling(ctx):
"""CRM polling configuration"""
pass
@polling.command()
@click.pass_context
@click.argument('interval', type=click.IntRange(1, 9999))
def interval(ctx, interval):
"""CRM polling interval configuration in seconds (range: 1-9999)"""
ctx.obj["crm"].config('polling_interval', interval)
@config.group()
@click.pass_context
def thresholds(ctx):
"""CRM thresholds configuration"""
pass
@thresholds.group()
@click.pass_context
def ipv4(ctx):
"""CRM resource IPv4 address-family"""
ctx.obj["crm"].addr_family = 'ipv4'
@thresholds.group()
@click.pass_context
def ipv6(ctx):
"""CRM resource IPv6 address-family"""
ctx.obj["crm"].addr_family = 'ipv6'
@thresholds.group()
@click.pass_context
def mpls(ctx):
"""CRM resource MPLS address-family"""
ctx.obj["crm"].addr_family = 'mpls'
@mpls.group()
@click.pass_context
def inseg(ctx):
"""CRM configuration for in-segment resource"""
ctx.obj["crm"].res_type = 'inseg'
@ipv4.group()
@click.pass_context
def route(ctx):
"""CRM configuration for route resource"""
ctx.obj["crm"].res_type = 'route'
@ipv4.group()
@click.pass_context
def neighbor(ctx):
"""CRM configuration for neigbor resource"""
ctx.obj["crm"].res_type = 'neighbor'
@ipv4.group()
@click.pass_context
def nexthop(ctx):
"""CRM configuration for nexthop resource"""
ctx.obj["crm"].res_type = 'nexthop'
@route.command()
@click.argument('value', type=click.Choice(['percentage', 'used', 'free']))
@click.pass_context
def type(ctx, value):
"""CRM threshold type configuration"""
attr = ''
if ctx.obj["crm"].addr_family != None:
attr += ctx.obj["crm"].addr_family + '_'
attr += ctx.obj["crm"].res_type + '_' + 'threshold_type'
ctx.obj["crm"].config(attr, value)
@route.command()
@click.argument('value', type=click.INT)
@click.pass_context
def low(ctx, value):
"""CRM low threshold configuration"""
attr = ''
if ctx.obj["crm"].addr_family != None:
attr += ctx.obj["crm"].addr_family + '_'
attr += ctx.obj["crm"].res_type + '_' + 'low_threshold'
ctx.obj["crm"].config(attr, value)
@route.command()
@click.argument('value', type=click.INT)
@click.pass_context
def high(ctx, value):
"""CRM high threshold configuration"""
attr = ''
if ctx.obj["crm"].addr_family != None:
attr += ctx.obj["crm"].addr_family + '_'
attr += ctx.obj["crm"].res_type + '_' + 'high_threshold'
ctx.obj["crm"].config(attr, value)
neighbor.add_command(type)
neighbor.add_command(low)
neighbor.add_command(high)
nexthop.add_command(type)
nexthop.add_command(low)
nexthop.add_command(high)
inseg.add_command(type)
inseg.add_command(low)
inseg.add_command(high)
ipv6.add_command(route)
ipv6.add_command(neighbor)
ipv6.add_command(nexthop)
mpls.add_command(nexthop)
@thresholds.group()
@click.pass_context
def nexthop(ctx):
"""CRM configuration for nexthop resource"""
pass
@nexthop.group()
@click.pass_context
def group(ctx):
"""CRM configuration for nexthop group resource"""
pass
@group.group()
@click.pass_context
def member(ctx):
"""CRM configuration for nexthop group member resource"""
ctx.obj["crm"].res_type = 'nexthop_group_member'
@group.group()
@click.pass_context
def object(ctx):
"""CRM configuration for nexthop group resource"""
ctx.obj["crm"].res_type = 'nexthop_group'
member.add_command(type)
member.add_command(low)
member.add_command(high)
object.add_command(type)
object.add_command(low)
object.add_command(high)
@thresholds.group()
@click.pass_context
def fdb(ctx):
"""CRM configuration for FDB resource"""
ctx.obj["crm"].res_type = 'fdb_entry'
fdb.add_command(type)
fdb.add_command(low)
fdb.add_command(high)
@thresholds.group()
@click.pass_context
def ipmc(ctx):
"""CRM configuration for IPMC resource"""
ctx.obj["crm"].res_type = 'ipmc_entry'
ipmc.add_command(type)
ipmc.add_command(low)
ipmc.add_command(high)
@thresholds.group()
@click.pass_context
def snat(ctx):
"""CRM configuration for Source NAT resource"""
ctx.obj["crm"].res_type = 'snat_entry'
snat.add_command(type)
snat.add_command(low)
snat.add_command(high)
@thresholds.group()
@click.pass_context
def dnat(ctx):
"""CRM configuration for Destination NAT resource"""
ctx.obj["crm"].res_type = 'dnat_entry'
dnat.add_command(type)
dnat.add_command(low)
dnat.add_command(high)
@thresholds.group()
@click.pass_context
def acl(ctx):
"""CRM configuration for ACL resource"""
pass
@acl.group()
@click.pass_context
def table(ctx):
"""CRM configuration for ACL table resource"""
ctx.obj["crm"].res_type = 'acl_table'
table.add_command(type)
table.add_command(low)
table.add_command(high)
@acl.group()
@click.pass_context
def group(ctx):
"""CRM configuration for ACL group resource"""
ctx.obj["crm"].res_type = 'acl_group'
group.add_command(type)
group.add_command(low)
group.add_command(high)
@group.group()
@click.pass_context
def entry(ctx):
"""CRM configuration for ACL entry resource"""
ctx.obj["crm"].res_type = 'acl_entry'
entry.add_command(type)
entry.add_command(low)
entry.add_command(high)
@group.group()
@click.pass_context
def counter(ctx):
"""CRM configuration for ACL counter resource"""
ctx.obj["crm"].res_type = 'acl_counter'
counter.add_command(type)
counter.add_command(low)
counter.add_command(high)
@thresholds.group()
@click.pass_context
def srv6_nexthop(ctx):
"""CRM configuration for SRV6 Nexthop resource"""
ctx.obj["crm"].res_type = 'srv6_nexthop'
srv6_nexthop.add_command(type)
srv6_nexthop.add_command(low)
srv6_nexthop.add_command(high)
@thresholds.group()
@click.pass_context
def srv6_my_sid_entry(ctx):
"""CRM configuration for SRV6 MY_SID resource"""
ctx.obj["crm"].res_type = 'srv6_my_sid_entry'
srv6_my_sid_entry.add_command(type)
srv6_my_sid_entry.add_command(low)
srv6_my_sid_entry.add_command(high)
@cli.group()
@click.pass_context
def show(ctx):
"""Show CRM related information"""
pass
@show.command()
@click.pass_context
def summary(ctx):
"""Show CRM general information"""
ctx.obj["crm"].show_summary()
@show.group()
@click.pass_context
def resources(ctx):
"""Show CRM resources information"""
ctx.obj["crm"].cli_mode = 'resources'
@show.group()
@click.pass_context
def thresholds(ctx):
"""Show CRM thresholds information"""
ctx.obj["crm"].cli_mode = 'thresholds'
@resources.command()
@click.pass_context
def all(ctx):
"""Show CRM information for all resources"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('all')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('all')
ctx.obj["crm"].show_acl_resources()
ctx.obj["crm"].show_acl_table_resources()
@resources.group()
@click.pass_context
def ipv4(ctx):
"""CRM resource IPv4 address family"""
ctx.obj["crm"].addr_family = 'ipv4'
@resources.group()
@click.pass_context
def ipv6(ctx):
"""CRM resource IPv6 address family"""
ctx.obj["crm"].addr_family = 'ipv6'
@resources.group()
@click.pass_context
def mpls(ctx):
"""CRM resource MPLS address family"""
ctx.obj["crm"].addr_family = 'mpls'
@mpls.command()
@click.pass_context
def inseg(ctx):
"""Show CRM information for in-segment resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('{0}_inseg'.format(ctx.obj["crm"].addr_family))
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('{0}_inseg'.format(ctx.obj["crm"].addr_family))
@ipv4.command()
@click.pass_context
def route(ctx):
"""Show CRM information for route resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('{0}_route'.format(ctx.obj["crm"].addr_family))
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('{0}_route'.format(ctx.obj["crm"].addr_family))
@ipv4.command()
@click.pass_context
def neighbor(ctx):
"""Show CRM information for neighbor resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('{0}_neighbor'.format(ctx.obj["crm"].addr_family))
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('{0}_neighbor'.format(ctx.obj["crm"].addr_family))
@ipv4.command()
@click.pass_context
def nexthop(ctx):
"""Show CRM information for nexthop resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('{0}_nexthop'.format(ctx.obj["crm"].addr_family))
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('{0}_nexthop'.format(ctx.obj["crm"].addr_family))
ipv6.add_command(route)
ipv6.add_command(neighbor)
ipv6.add_command(nexthop)
mpls.add_command(nexthop)
@resources.group()
@click.pass_context
def nexthop(ctx):
"""Show CRM information for nexthop resource"""
pass
@nexthop.group()
@click.pass_context
def group(ctx):
"""Show CRM information for nexthop group resource"""
pass
@group.command()
@click.pass_context
def member(ctx):
"""Show CRM information for nexthop group member resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('nexthop_group_member')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('nexthop_group_member')
@group.command()
@click.pass_context
def object(ctx):
"""Show CRM information for nexthop group resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('nexthop_group')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('nexthop_group')
@resources.group()
@click.pass_context
def acl(ctx):
"""Show CRM information for acl resource"""
pass
@acl.command()
@click.pass_context
def table(ctx):
"""Show CRM information for acl table resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('acl_table')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_acl_table_resources()
@acl.command()
@click.pass_context
def group(ctx):
"""Show CRM information for acl group resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('acl_group')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_acl_resources()
@resources.command()
@click.pass_context
def fdb(ctx):
"""Show CRM information for fdb resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('fdb_entry')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('fdb_entry')
@resources.command()
@click.pass_context
def ipmc(ctx):
"""Show CRM information for IPMC resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('ipmc_entry')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('ipmc_entry')
@resources.command()
@click.pass_context
def snat(ctx):
"""Show CRM information for SNAT resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('snat_entry')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('snat_entry')
@resources.command()
@click.pass_context
def dnat(ctx):
"""Show CRM information for DNAT resource"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('dnat_entry')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('dnat_entry')
@resources.command()
@click.pass_context
def srv6_nexthop(ctx):
"""Show CRM information for SRV6 Nexthop"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('srv6_nexthop')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('srv6_nexthop')
@resources.command()
@click.pass_context
def srv6_my_sid_entry(ctx):
"""Show CRM information for SRV6 MY_SID entry"""
if ctx.obj["crm"].cli_mode == 'thresholds':
ctx.obj["crm"].show_thresholds('srv6_my_sid_entry')
elif ctx.obj["crm"].cli_mode == 'resources':
ctx.obj["crm"].show_resources('srv6_my_sid_entry')
thresholds.add_command(acl)
thresholds.add_command(all)
thresholds.add_command(fdb)
thresholds.add_command(ipv4)
thresholds.add_command(ipv6)
thresholds.add_command(mpls)
thresholds.add_command(nexthop)
thresholds.add_command(ipmc)
thresholds.add_command(snat)
thresholds.add_command(dnat)
thresholds.add_command(srv6_nexthop)
thresholds.add_command(srv6_my_sid_entry)
if __name__ == '__main__':
cli()