Skip to content
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

[show] vnet endpoint [ip/ipv6] command #2342

Merged
merged 11 commits into from
Oct 3, 2022
Merged

[show] vnet endpoint [ip/ipv6] command #2342

merged 11 commits into from
Oct 3, 2022

Conversation

siqbal1986
Copy link
Contributor

@siqbal1986 siqbal1986 commented Aug 30, 2022

What I did

Created a new CLI Command Show vnet endpoint with option to give IPv4 or IPv6 address parameter.

How I did it

This command goes over all vxlan tunnels and checks each endpoints monitor session to populate the endpoint state. while doing so it also tracks the prefixes pointing to an endpoint.

How to verify it

run show vnet endpoint or show vnet endpoint<ipv4 address/ipv6 address>.

>>show vnet endpoint  
Endpoint               Endpoint Monitor         prefix count  status
---------------------  ---------------------  --------------  --------
fddd:a100:a251::a10:1  fddd:a100:a251::a10:1               1  Unknown
fddd:a101:a251::a10:1  fddd:a101:a251::a10:1               1  Down
100.251.7.1            100.251.7.1                         3  Up


>>show vnet endpoint fddd:a101:a251::a10:1
Endpoint               Endpoint Monitor           prefix                        status
---------------------  -------------------------  ----------------------------  --------
fddd:a101:a251::a10:1  ['fddd:a101:a251::a10:1']  ['fddd:a156:a251::a6:1/128']  Down


>>show vnet endpoint 100.251.7.1
Endpoint     Endpoint Monitor    prefix                                                        status
-----------  ------------------  ------------------------------------------------------------  --------
100.251.7.1  ['100.251.7.1']     ['160.162.191.1/32', '160.163.191.1/32', '160.164.191.1/32']  Up

Previous command output (if the output of a command-line utility has changed)

None

New command output (if the output of a command-line utility has changed)

NA

The status may be active, inactive or not present at all.
The status field cna have 3 values.
Empty : Configured but not in ASIC
Active : Configured and active in ASIC.
Inacive : Configured but not in ASIC due to lack ofr BFD session.
show vnet endpoint [IPv4/IPv6]
This command shows the status of a vxlan tunnel endpoint nad the number of prefixes pointing to it.
Also this command can show the prefix details if endpoint ip is specified.
This command checks the endpoint state using BFD monitoring session of the endpoint.
Copy link
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add tests

- Usage:

```
show vnet endpoint <ipv4_address/ipv6_address>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also print the "endpoint_monitor" ip so we have a mapping? BFD session just have endpoint_monitor'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

show/vnet.py Outdated
for idx, endpoint in enumerate(endpoints):
monitor_dict[endpoint] = monitors[idx]
if endpoint not in prefix_count:
prefix_count[endpoint] =0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after = for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

show/vnet.py Outdated
for k in vnet_rt_keys:
val = appl_db.get_all(appl_db.APPL_DB, k)
endpoints = val.get('endpoint').split(',')
monitors = val.get('endpoint_monitor').split(',')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space after =. Please fix spacing in all places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@siqbal1986 siqbal1986 merged commit 57c509a into sonic-net:master Oct 3, 2022
prsunny pushed a commit that referenced this pull request Oct 5, 2022
* [show] vnet endpoint [ip/ipv6] command
@yxieca
Copy link
Contributor

yxieca commented Oct 6, 2022

@siqbal1986 this change cannot be cherry-picked to 202205 branch cleanly. Please create separate PR.

EdenGri pushed a commit to EdenGri/sonic-utilities that referenced this pull request Oct 12, 2022
mdanish-kh pushed a commit to hamnarauf/sonic-utilities that referenced this pull request Oct 22, 2022
siqbal1986 added a commit to siqbal1986/sonic-utilities that referenced this pull request Nov 2, 2022
siqbal1986 added a commit that referenced this pull request Nov 3, 2022
What I did
Created a new CLI Command Show vnet endpoint with option to give IPv4 or IPv6 address parameter.

How I did it
This command goes over all vxlan tunnels and checks each endpoints monitor session to populate the endpoint state. while doing so it also tracks the prefixes pointing to an endpoint.

How to verify it
run show vnet endpoint or show vnet endpoint<ipv4 address/ipv6 address>.

>>show vnet endpoint  
Endpoint               Endpoint Monitor         prefix count  status
---------------------  ---------------------  --------------  --------
fddd:a100:a251::a10:1  fddd:a100:a251::a10:1               1  Unknown
fddd:a101:a251::a10:1  fddd:a101:a251::a10:1               1  Down
100.251.7.1            100.251.7.1                         3  Up


>>show vnet endpoint fddd:a101:a251::a10:1
Endpoint               Endpoint Monitor           prefix                        status
---------------------  -------------------------  ----------------------------  --------
fddd:a101:a251::a10:1  ['fddd:a101:a251::a10:1']  ['fddd:a156:a251::a6:1/128']  Down


>>show vnet endpoint 100.251.7.1
Endpoint     Endpoint Monitor    prefix                                                        status
-----------  ------------------  ------------------------------------------------------------  --------
100.251.7.1  ['100.251.7.1']     ['160.162.191.1/32', '160.163.191.1/32', '160.164.191.1/32']  Up
Previous command output (if the output of a command-line utility has changed)
None

New command output (if the output of a command-line utility has changed)
NA
preetham-singh pushed a commit to preetham-singh/sonic-utilities that referenced this pull request Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants