Skip to content

Commit

Permalink
updated based on yang-model review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh-agrawal committed Feb 21, 2025
1 parent df096dc commit df91a3f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
50 changes: 18 additions & 32 deletions config/plugins/sonic-fine-grained-ecmp_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,28 +219,23 @@ def FG_NHG():
)
@click.option(
"--bucket-size",
help="total hash bucket size desired, recommended value of Lowest Common Multiple of 1..\
{max # of next-hops}[mandatory]",
help="total hash bucket size desired, recommended value of Lowest Common
Multiple of 1..{max # of next-hops}[mandatory]",
)
@click.option(
"--match-mode",
help="The filtering method used to identify when to use Fine Grained vs regular route handling. \
nexthop-based looks to next-hop IP to filter routes and uses fine grained ecmp when nexthop \
IPs matches FG_NHG_MEMBER IPs. route-based looks to prefix to filter routes, and uses fine \
grained ecmp when the route prefix matches the FG_NHG_PREFIX prefix.[mandatory]",
)
@click.option(
"--nhg-mode",
help="static-nhg : List of nexthops needs to be statically configured in FG_NHG_MEMBER table. \
dynamic-nhg : List of nexthops will be dynamically derived from the route updates.",
help="The filtering method used to identify when to use Fine Grained vs regular route handling.
-- nexthop-based filters on nexthop IPs only.
-- route-based filters on both prefix and nexthop IPs.
-- prefix-based filters on prefix only.[mandatory]",
)
@click.option(
"--max-next-hops",
help="Applicable only when nhg_mode = dynamic-nhg. Maximum number of nexthops that will be \
received in route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.",
help="Applicable only for match_mode = prefix-based. Maximum number of nexthops that will be
received in route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.[mandatory]",
)
@clicommon.pass_db
def FG_NHG_add(db, name, bucket_size, match_mode, nhg_mode, max_next_hops):
def FG_NHG_add(db, name, bucket_size, match_mode, max_next_hops):
""" Add object in FG_NHG. """

table = "FG_NHG"
Expand All @@ -250,8 +245,6 @@ def FG_NHG_add(db, name, bucket_size, match_mode, nhg_mode, max_next_hops):
data["bucket_size"] = bucket_size
if match_mode is not None:
data["match_mode"] = match_mode
if nhg_mode is not None:
data["nhg_mode"] = nhg_mode
if max_next_hops is not None:
data["max_next_hops"] = max_next_hops

Expand All @@ -269,28 +262,23 @@ def FG_NHG_add(db, name, bucket_size, match_mode, nhg_mode, max_next_hops):
)
@click.option(
"--bucket-size",
help="total hash bucket size desired, recommended value of Lowest Common Multiple of 1..\
{max # of next-hops}[mandatory]",
help="total hash bucket size desired, recommended value of Lowest Common
Multiple of 1..{max # of next-hops}[mandatory]",
)
@click.option(
"--match-mode",
help="The filtering method used to identify when to use Fine Grained vs regular route handling. \
nexthop-based looks to next-hop IP to filter routes and uses fine grained ecmp when nexthop \
IPs matches FG_NHG_MEMBER IPs. route-based looks to prefix to filter routes, and uses fine grained \
ecmp when the route prefix matches the FG_NHG_PREFIX prefix.[mandatory]",
)
@click.option(
"--nhg-mode",
help="static-nhg : List of nexthops needs to be statically configured in FG_NHG_MEMBER table. \
dynamic-nhg : List of nexthops will be dynamically derived from the route updates.",
help="The filtering method used to identify when to use Fine Grained vs regular route handling.
-- nexthop-based filters on nexthop IPs only.
-- route-based filters on both prefix and nexthop IPs.
-- prefix-based filters on prefix only.[mandatory]",
)
@click.option(
"--max-next-hops",
help="Applicable only when nhg_mode = dynamic-nhg. Maximum number of nexthops that will be received in \
route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.",
help="Applicable only for match_mode = prefix-based. Maximum number of nexthops that will be
received in route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.[mandatory]",
)
@clicommon.pass_db
def FG_NHG_update(db, name, bucket_size, match_mode, nhg_mode, max_next_hops):
def FG_NHG_update(db, name, bucket_size, match_mode, max_next_hops):
""" Add object in FG_NHG. """

table = "FG_NHG"
Expand All @@ -300,8 +288,6 @@ def FG_NHG_update(db, name, bucket_size, match_mode, nhg_mode, max_next_hops):
data["bucket_size"] = bucket_size
if match_mode is not None:
data["match_mode"] = match_mode
if nhg_mode is not None:
data["nhg_mode"] = nhg_mode
if max_next_hops is not None:
data["max_next_hops"] = max_next_hops

Expand Down
15 changes: 13 additions & 2 deletions show/plugins/sonic-fine-grained-ecmp_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def FG_NHG(db):

"BUCKET SIZE",
"MATCH MODE",
"NHG MODE",
"MAX NEXT HOPS",

]

body = []
Expand Down Expand Up @@ -97,6 +95,19 @@ def FG_NHG(db):
that match FG_NHG_PREFIX for this FG_NHG.', 'is-leaf-list': False, 'is-mandatory': False, 'group': ''}
),
]
format_attr_value(
entry,
{'name': 'bucket_size', 'description': 'total hash bucket size desired, recommended value of Lowest Common\nMultiple of 1..{max # of next-hops}', 'is-leaf-list': False, 'is-mandatory': True, 'group': ''}
),
format_attr_value(
entry,
{'name': 'match_mode', 'description': 'The filtering method used to identify when to use Fine Grained vs regular route handling.\n -- nexthop-based filters on nexthop IPs only.\n -- route-based filters on both prefix and nexthop IPs.\n -- prefix-based filters on prefix only.', 'is-leaf-list': False, 'is-mandatory': True, 'group': ''}
),
format_attr_value(
entry,
{'name': 'max_next_hops', 'description': 'Applicable only for match_mode = prefix-based. Maximum number of nexthops that will be\nreceived in route updates for any of the prefixes that match FG_NHG_PREFIX for this FG_NHG.', 'is-leaf-list': False, 'is-mandatory': True, 'group': ''}
),
]

body.append(row)

Expand Down

0 comments on commit df91a3f

Please sign in to comment.