-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sonic-utilities updates for MPLS #1537
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,8 @@ def show_thresholds(self, resource): | |
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"]: | ||
"acl_counter", "fdb_entry", "ipmc_entry", "snat_entry", "dnat_entry", "mpls_inseg", | ||
"mpls_nexthop"]: | ||
try: | ||
data.append([res, crm_info[res + "_threshold_type"], crm_info[res + "_low_threshold"], crm_info[res + "_high_threshold"]]) | ||
except KeyError: | ||
|
@@ -97,7 +98,8 @@ def get_resources(self, resource): | |
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"]: | ||
"nexthop_group_member", "nexthop_group", "fdb_entry", "ipmc_entry", "snat_entry", "dnat_entry", | ||
"mpls_inseg", "mpls_nexthop"]: | ||
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: | ||
|
@@ -262,6 +264,18 @@ 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): | ||
|
@@ -284,7 +298,7 @@ def nexthop(ctx): | |
@click.argument('value', type=click.Choice(['percentage', 'used', 'free'])) | ||
@click.pass_context | ||
def type(ctx, value): | ||
"""CRM threshod type configuration""" | ||
"""CRM threshold type configuration""" | ||
attr = '' | ||
|
||
if ctx.obj["crm"].addr_family != None: | ||
|
@@ -298,7 +312,7 @@ def type(ctx, value): | |
@click.argument('value', type=click.INT) | ||
@click.pass_context | ||
def low(ctx, value): | ||
"""CRM low threshod configuration""" | ||
"""CRM low threshold configuration""" | ||
attr = '' | ||
|
||
if ctx.obj["crm"].addr_family != None: | ||
|
@@ -312,7 +326,7 @@ def low(ctx, value): | |
@click.argument('value', type=click.INT) | ||
@click.pass_context | ||
def high(ctx, value): | ||
"""CRM high threshod configuration""" | ||
"""CRM high threshold configuration""" | ||
attr = '' | ||
|
||
if ctx.obj["crm"].addr_family != None: | ||
|
@@ -328,9 +342,13 @@ def high(ctx, value): | |
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 | ||
|
@@ -493,6 +511,21 @@ 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): | ||
|
@@ -520,9 +553,19 @@ def nexthop(ctx): | |
elif ctx.obj["crm"].cli_mode == 'resources': | ||
ctx.obj["crm"].show_resources('{0}_nexthop'.format(ctx.obj["crm"].addr_family)) | ||
|
||
@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)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't understand why this is a repeat of line 520-528 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @smaheshm This cut-n-paste remnant has been removed. |
||
ipv6.add_command(route) | ||
ipv6.add_command(neighbor) | ||
ipv6.add_command(nexthop) | ||
mpls.add_command(nexthop) | ||
|
||
@resources.group() | ||
@click.pass_context | ||
|
@@ -619,6 +662,7 @@ def dnat(ctx): | |
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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not move mpls into a mpls.py instead of put them in the main.py file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lguohan You asked this same question 3 months ago. I will restate my answer from then: All subgroups, including mpls, of the interface.group are in main.py. The mpls subgroup is very small and a separate file is overkill.