Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Addition of get_eigrp_neighbors() #197

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Addition of get_eigrp_neighbors() #197

wants to merge 2 commits into from

Conversation

WilliamMarti
Copy link

Discussion at #183.

Starting with just the get_eigrp_neighbors() method for now to get my feet wet with the code base before I get too deep.

Addition of eigrp_config_neighbors dict to models.py
Addition of test_get_eigrp_neighbors() to test/base.py
Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

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

Looks good to me!

But please write the same test also for the new testing framework: https://github.com/napalm-automation/napalm-base/blob/develop/napalm_base/test/getters.py

I would incline to write only for the new one, but as you already did it also for the old one, we can leave it there.

Thanks!

raise SkipTest()

assert isinstance(get_eigrp_neighbors, dict)
assert self._test_model(models.eigrp_config_neighbors, get_eigrp_neighbors)
Copy link
Member

Choose a reason for hiding this comment

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

newline please

@mirceaulinic mirceaulinic added this to the 0.23.0 milestone Feb 1, 2017
@WilliamMarti
Copy link
Author

All doable, based on the comments from @dbarrosop in #183 I will wait until I have an actual implementation before my next PR.

Thanks guys

@mirceaulinic mirceaulinic modified the milestones: BLOCKED, 0.23.0 Feb 7, 2017
@mirceaulinic
Copy link
Member

Hi @WilliamMarti - how is this going? Just checking if you need any help with the implementation.

@icmp-echo
Copy link

it would be helpful if we also can get something like get_vlan and get_interfaces_descriptions because that would help us lot in Network automation project, i am not a developer i am new to this but i am trying to wrap my head around how to write those modules so I can also contribute towards that. Any help is appreciated. I wanna work on this if somebody can point me right direction.

@dbarrosop
Copy link
Member

@icmp-echo you have some info here: https://napalm.readthedocs.io/en/latest/contributing/index.html#proposing-a-new-method

Btw, get_interfaces_descriptions shouldn't be necessary as get_interfaces already gives you the interface description.

@icmp-echo
Copy link

@dbarrosop Thank you for responding, I really appreciate it.
About get_interface You are right sir,
it does pull interfaces description now question becomes can we use grain or pass an argument to just return interface description for specific port like this:

salt -G 'os:junos and interface:fe-0/0/5' grains.get description

we dont have a grain for description yet, but i envision to pull that off same with the vlans as well, once we have get_vlan it would be easy to write the grains on top of that.

but this a good start. Thank you.

@dbarrosop
Copy link
Member

dbarrosop commented Jun 6, 2017

salt -G 'os:junos and interface:fe-0/0/5' grains.get description

That looks like a salt thing, I don't think we need a method for that. @mirceaulinic can you comment on this? You are the resident salt expert here ;)

@icmp-echo we should also move this topic to a dedicate issue now that I realized. Would you mind creating a new issue to track that?

@mirceaulinic
Copy link
Member

mirceaulinic commented Jun 6, 2017

salt -G 'os:junos and interface:fe-0/0/5' selects those devices running Junos and having the interface fe-0/0/5. The grains are used to select minions, not a particular feature / subset / subsystem.

I see what you are trying to achieve @icmp-echo. Searching for a particular detail indeed is very useful in production networks especially when it grows that much that you can't keep in mind all the details.
For this, you may find this Salt runner useful: https://docs.saltstack.com/en/develop/ref/runners/all/salt.runners.net.html -- will be added in the next release, Nitrogen (later this month). To see how this runner works, see this video: https://www.youtube.com/watch?v=AqBk5fM7qZ0. In the first example it returns all interfaces having the pattern "cogent" in their description. Similarly you can search for mac addresses, ip addresses, interfaces, etc. In your case would probably be salt-run net.find fe-0/0/5. And it returns an output like:

Details for interface xe-0/0/0
_________________________________________________________________________________________________________________
|    Device    | Interface | Interface Description |  UP  | Enabled | Speed [Mbps] | MAC Address | IP Addresses |
_________________________________________________________________________________________________________________
| edge01.bjm01 | vt-0/0/10 |                       | True |   True  |     1000     |             |              |
_________________________________________________________________________________________________________________
| edge01.flw01 | vt-0/0/10 |                       | True |   True  |     1000     |             |              |
_________________________________________________________________________________________________________________
| edge01.pos01 | vt-0/0/10 |                       | True |   True  |     1000     |             |              |
_________________________________________________________________________________________________________________
| edge01.oua01 | vt-0/0/10 |                       | True |   True  |     1000     |             |              |
_________________________________________________________________________________________________________________

As an aside, check this out too: https://docs.saltstack.com/en/develop/ref/runners/all/salt.runners.bgp.html.

You can also use the grains to achieve this, but I would not recommend. Salt impresses with its speed and caching the interfaces under grains would slow down a bit the matching if you have a device with many interfaces. Grains should have a very simple structure.

But if you really want, you can, by writing a custom grains modules in your envirnment: https://docs.saltstack.com/en/develop/topics/grains/index.html#writing-grains
See below an example:

def interfaces_grain(proxy):
    if proxy['napalm.initialized']:
        intrf = proxy['napalm.call']('get_interfaces')
        if intrf:
            return {'interfaces_details': intrf.get('out', {})}

And then you can select your devices like: salt -G 'os:junos and interfaces_details:fe-0/0/5:description:*pattern*

@icmp-echo
Copy link

@mirceaulinic this is awesome feature, and more I learn about salt more I fall in love with its capacity and power it posses, thank you for your awesome response, It a lot for me to process and think in your one response, but again thanks alot.
@dbarrosop I am gonna open a new issue but i dont know how to move existing replies & comments to a new issue, but its a good idea. Thank you.

@icmp-echo
Copy link

new issue #260 was opened for follow up @dbarrosop . Thanks.

@mirceaulinic
Copy link
Member

Hi @WilliamMarti - continuing from #197 (comment): are you still working on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants