-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
An ability to get a parent prefix from an ip address using API #1737
Comments
If you have the ip with mask on CIDR form, just do the following request:
In my test it returns the parent prefix of 10.0.0.0/24. Edit: Just noticed that you said you didn't have the prefix length. But you do, if you have ARP then you have a layer 3 interface and that interface has a mask set, right? |
Yep, If I have the ip with mask, i can calculate the prefix and get it using API
This code gives a big load to the Netbox database that's why the function is executing slowly. |
Example from an IOS XR router:
Your code takes that and:
|
It appears that this is incorrect. |
Issue type
[X] Feature request
[ ] Bug report
[ ] Documentation
Environment
Description
It is a continuation of NetBox-discussion https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/netbox-discuss/t7J_LL2jMcM/dOvZVqEYAQAJ
Would like to get the closest parent prefix for an IP address using API.
It would be useful for those that use a netbox with external tools. For example, I want to add a list of ip addresses to netbox from a core switch's arp table using API. For each ip address I must set a prefix length. If I could get a parent prefix using API than I could get a prefix length for this IP address.
The text was updated successfully, but these errors were encountered: