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

Add support for multiple/secondary Ip-addresses in ipinterfaces() function #161

Open
King-Joakim opened this issue Feb 19, 2018 · 0 comments
Assignees

Comments

@King-Joakim
Copy link

Hello, Im trying to get my secondary ip's configured from the api('ipinterfaces').get(interface) function, however it only returns the first it finds as per the def _parse_address function.

Or is there another way to get all actual ip's configured via api and not parse the configuration with the client enable('show running-config') function?

Can it perhaps be changed to also return a key with a list of secondary ip-addresses if one exists?

Actual config:

interface Loopback0
mtu 1554
ip address 10.128.6.1/32
ip address 10.255.255.1/24 secondary

the api call:

arista_device.api('ipinterfaces').get(name='Loopback0')
{'name': 'Loopback0', 'address': '10.128.6.1/32', 'mtu': 1554}

@mharista mharista self-assigned this Feb 19, 2018
dlyssenko added a commit that referenced this issue Feb 19, 2023
…dary_ip

fix issue #161 - add parsing of secondary ip from interfaces
dlyssenko added a commit that referenced this issue Jun 6, 2023
* Try importing ujson and rapidjson before json

ujson and rapidjson are libraries that are
faster to encode and decode JSON objects

* Implement configure_session() to send "configure session", diff() for "show session-config diff", commit() for "commit", and abort() for "abort"

* Bump version

* Fix issue #186, fix typo in client.py

* Amend tests for #186

* Amend remove vlan to vni mapping CLI

* Add config session documentation

* Add config session documentation

* Remove config session doc from wrong dir

* adding streaming option for commands

* Correct typo "mutlicast"

* Adding Power support(ppc64le)with continuous integration/testing to the project for architecture independent

* Inorrect import from 'collections' will stop working in Python 3.9

Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
Solving

* Fix python2 dependancy on collections

* Bump Python version to 3.9 for CI

* Fix #189 #190 #195

* Bump version to rc

* fixed issue #198

* #197 - updated vlans.getall() to handle vlan grouppings

* updated vlans.get() to return range/list of vlan ids (instead of input regex), plus updated relevant unit tests

* fixed import warning in abstract module

* updated documentation to avoid using localhost for off-box connections

* Refactor deprecated unittest aliases for Python 3.11 compatibility.

* Update configfile.rst

* fix for the issue #213

* Ignore subinterfaces on switchports.getall()

Signed-off-by: DavidVentura <[email protected]>

* Stop on whitespace

* extended config for unit testing issue #213

* Add a test

* Add new value from #213

* merge tests

* address perf issues on section splitting

* fix bad test

* Add option to not include defaults with node.running_config

Currently, the Node(conn).running_config always includes config defaults, this is not always wanted.
For example if you want to compare the running_config to the startup_config, it is easier to not have defaults included in the running_config.

With this option you can do something like this;
```
In [3]: conn = client.connect(**params)

In [4]: node = client.Node(conn, config_defaults=False)

In [5]: node.running_config.splitlines()[3:] == node.startup_config.splitlines()[4:]
Out[5]: True
```

* updated client descritpion to reflect issue #222

* mitor fix in the description for reST markdown

* another minor update for client.connect description

* Add support for passwords that cannot be used to login

* added sphinx_rtd_theme to dev-requrements.txt

* docs: fixing #231

* fixing collection.Iterables in test_utils.py for py3.10

* fixing collection.Iterables in test_utils.py for py3.10 - minor improvement

* fix for issue #234 - allow passing ssl context to pyeapi

* minor markdown fix in client module description

* fix passwd exposure in traceback issue

* fixed issue where sphinx failed to generate API modules doc, plus made it python3 ready

* readying pyeapi for github actions + minor style fixes

* Migrate from Travis CI to GitHub workflows

* extended python-version list for CI with 2.7 and 3.10

* removed password from showing in debugs

* added pep8 E128 to ignore list - to adopt to Arista coding style

* fixed my update to accomodate to unit tests and possibly invalid jsons

* minor typo fixes in comments

* one more minor typo fix in comments

* Update ci.yml

self approving - trivial change

* Update test_client.py

self-approved - this is non-functional, only syntactic change to keep flake8 happy

* Update eapilib.py

self-approving: non-functional, only syntactic changes to keep flake8 happier.

* Update ci.yml

adding flake8 upgrade, as it crashes in some python versions

* fix for issue #210 - getall() fails in ipinterfaces module

* fix for issue #193 - flood list for vxlan in interfaces returns wrong data

* enhanced `section` to match subsections and removed py2.7 from CI

* minor syntax change to keep flake8 happy

* added a doc string and dressed up the function, no functional change

* few more space adjustments to please flake8

* Store and pass credentials as header tuple

* Support session-based authorization

Create a Session API mixin for Http and Https connection methods that
uses the /login endpoint to store a Cookie for all future connections.
This is useful when using centralized AAA to reduce the load of repeated
command calls.

Note that the cookie does have a lifetime, and that the connection will
stop working once the cookie lifetime expires, unless the authentication
method is manually called again

* provisioning for providing CLI variants to handle deprecated cli transitions

* moved cli varinats functionality to clint.py module so that users could use it too

* fixed issue raising the exception properly for the last failed command

* fixed again raising the exception properly for the last failed command

* updated documentation

* space adjustment in the docstring

* provided comments on enforce_verification param deprecation

* removed python 3.5 and 3.6 from the workflows - unsupported

* fix issue #161 - add parsing of secondary ip from interfaces

* making flake8 happy

* Include error message in CommandError for commands that cause internal exceptions

* _parse_bgp_as regex to match as and asdot

* Checking if asn is asdot or not, and return string if asdot and int if not

* typo

* testing dumb shit

* dumby dumb dumb

* dafuq am i doing

* maybe just maybe

* i hate this shit i just wanna do neworking again :(

* lemme be a network engineer again please i wanna die

* play stupid games win stupid prices

* var typo

* testing

* testing suggested changes

* intendation error

* Update ipinterfaces.py

Replace IP MTU magic numbers with constants and provide references to RFCs

* Update ipinterfaces.py

* fixing doc build issues, errors, and providing docstring interpolation decorator

* fixing indents

* moved decorator's descriptin into the doc string

* removed deprecated spanningtree module

* removed all outdated python version checks

* minor improvement for docstr decorator

* Removed reference to python2 (#262)

* Removed reference to python2

* Removed support for lower versions of python

* Updated EOS version to the minimum supported

* Addressed formatting and error handling comments

* Refactored extra python2 check

* removed couple deprecations

* removed one more deprecation

* Created release-notes-1.0.0.rst

* Updated release-notes.rst

* Update VERSION

* Update __init__.py

* Update release-notes-1.0.0.rst

fixed a capital letter.

---------

Signed-off-by: DavidVentura <[email protected]>
Co-authored-by: Xavier Hardy <[email protected]>
Co-authored-by: Shintaro Kojima <[email protected]>
Co-authored-by: andriirr <[email protected]>
Co-authored-by: Andrii Rykhlivskyi <[email protected]>
Co-authored-by: mharista <[email protected]>
Co-authored-by: Bharath Ravindranath <[email protected]>
Co-authored-by: Will Hargrave <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Petr Klíma <[email protected]>
Co-authored-by: Dmitry Lyssenko <[email protected]>
Co-authored-by: Dmitry Lyssenko <[email protected]>
Co-authored-by: Karthikeyan Singaravelan <[email protected]>
Co-authored-by: DavidVentura <[email protected]>
Co-authored-by: erikl <[email protected]>
Co-authored-by: Jeremiah Millay <[email protected]>
Co-authored-by: steve ulrich <[email protected]>
Co-authored-by: Alarig Le Lay <[email protected]>
Co-authored-by: Stefano Rivera <[email protected]>
Co-authored-by: Brandon Ewing <[email protected]>
Co-authored-by: Dylan Kaplan <[email protected]>
Co-authored-by: bh-rr <[email protected]>
Co-authored-by: Greg Skinner <[email protected]>
Co-authored-by: chieto-arista <[email protected]>
dlyssenko added a commit that referenced this issue Jun 6, 2023
* Try importing ujson and rapidjson before json

ujson and rapidjson are libraries that are
faster to encode and decode JSON objects

* Implement configure_session() to send "configure session", diff() for "show session-config diff", commit() for "commit", and abort() for "abort"

* Bump version

* Fix issue #186, fix typo in client.py

* Amend tests for #186

* Amend remove vlan to vni mapping CLI

* Add config session documentation

* Add config session documentation

* Remove config session doc from wrong dir

* adding streaming option for commands

* Correct typo "mutlicast"

* Adding Power support(ppc64le)with continuous integration/testing to the project for architecture independent

* Inorrect import from 'collections' will stop working in Python 3.9

Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
Solving

* Fix python2 dependancy on collections

* Bump Python version to 3.9 for CI

* Fix #189 #190 #195

* Bump version to rc

* fixed issue #198

* #197 - updated vlans.getall() to handle vlan grouppings

* updated vlans.get() to return range/list of vlan ids (instead of input regex), plus updated relevant unit tests

* fixed import warning in abstract module

* updated documentation to avoid using localhost for off-box connections

* Refactor deprecated unittest aliases for Python 3.11 compatibility.

* Update configfile.rst

* fix for the issue #213

* Ignore subinterfaces on switchports.getall()



* Stop on whitespace

* extended config for unit testing issue #213

* Add a test

* Add new value from #213

* merge tests

* address perf issues on section splitting

* fix bad test

* Add option to not include defaults with node.running_config

Currently, the Node(conn).running_config always includes config defaults, this is not always wanted.
For example if you want to compare the running_config to the startup_config, it is easier to not have defaults included in the running_config.

With this option you can do something like this;
```
In [3]: conn = client.connect(**params)

In [4]: node = client.Node(conn, config_defaults=False)

In [5]: node.running_config.splitlines()[3:] == node.startup_config.splitlines()[4:]
Out[5]: True
```

* updated client descritpion to reflect issue #222

* mitor fix in the description for reST markdown

* another minor update for client.connect description

* Add support for passwords that cannot be used to login

* added sphinx_rtd_theme to dev-requrements.txt

* docs: fixing #231

* fixing collection.Iterables in test_utils.py for py3.10

* fixing collection.Iterables in test_utils.py for py3.10 - minor improvement

* fix for issue #234 - allow passing ssl context to pyeapi

* minor markdown fix in client module description

* fix passwd exposure in traceback issue

* fixed issue where sphinx failed to generate API modules doc, plus made it python3 ready

* readying pyeapi for github actions + minor style fixes

* Migrate from Travis CI to GitHub workflows

* extended python-version list for CI with 2.7 and 3.10

* removed password from showing in debugs

* added pep8 E128 to ignore list - to adopt to Arista coding style

* fixed my update to accomodate to unit tests and possibly invalid jsons

* minor typo fixes in comments

* one more minor typo fix in comments

* Update ci.yml

self approving - trivial change

* Update test_client.py

self-approved - this is non-functional, only syntactic change to keep flake8 happy

* Update eapilib.py

self-approving: non-functional, only syntactic changes to keep flake8 happier.

* Update ci.yml

adding flake8 upgrade, as it crashes in some python versions

* fix for issue #210 - getall() fails in ipinterfaces module

* fix for issue #193 - flood list for vxlan in interfaces returns wrong data

* enhanced `section` to match subsections and removed py2.7 from CI

* minor syntax change to keep flake8 happy

* added a doc string and dressed up the function, no functional change

* few more space adjustments to please flake8

* Store and pass credentials as header tuple

* Support session-based authorization

Create a Session API mixin for Http and Https connection methods that
uses the /login endpoint to store a Cookie for all future connections.
This is useful when using centralized AAA to reduce the load of repeated
command calls.

Note that the cookie does have a lifetime, and that the connection will
stop working once the cookie lifetime expires, unless the authentication
method is manually called again

* provisioning for providing CLI variants to handle deprecated cli transitions

* moved cli varinats functionality to clint.py module so that users could use it too

* fixed issue raising the exception properly for the last failed command

* fixed again raising the exception properly for the last failed command

* updated documentation

* space adjustment in the docstring

* provided comments on enforce_verification param deprecation

* removed python 3.5 and 3.6 from the workflows - unsupported

* fix issue #161 - add parsing of secondary ip from interfaces

* making flake8 happy

* Include error message in CommandError for commands that cause internal exceptions

* _parse_bgp_as regex to match as and asdot

* Checking if asn is asdot or not, and return string if asdot and int if not

* typo

* testing dumb shit

* dumby dumb dumb

* dafuq am i doing

* maybe just maybe

* i hate this shit i just wanna do neworking again :(

* lemme be a network engineer again please i wanna die

* play stupid games win stupid prices

* var typo

* testing

* testing suggested changes

* intendation error

* Update ipinterfaces.py

Replace IP MTU magic numbers with constants and provide references to RFCs

* Update ipinterfaces.py

* fixing doc build issues, errors, and providing docstring interpolation decorator

* fixing indents

* moved decorator's descriptin into the doc string

* removed deprecated spanningtree module

* removed all outdated python version checks

* minor improvement for docstr decorator

* Removed reference to python2 (#262)

* Removed reference to python2

* Removed support for lower versions of python

* Updated EOS version to the minimum supported

* Addressed formatting and error handling comments

* Refactored extra python2 check

* removed couple deprecations

* removed one more deprecation

* Created release-notes-1.0.0.rst

* Updated release-notes.rst

* Update VERSION

* Update __init__.py

* Update release-notes-1.0.0.rst

fixed a capital letter.

---------

Signed-off-by: DavidVentura <[email protected]>
Co-authored-by: Xavier Hardy <[email protected]>
Co-authored-by: Shintaro Kojima <[email protected]>
Co-authored-by: andriirr <[email protected]>
Co-authored-by: Andrii Rykhlivskyi <[email protected]>
Co-authored-by: mharista <[email protected]>
Co-authored-by: Bharath Ravindranath <[email protected]>
Co-authored-by: Will Hargrave <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Petr Klíma <[email protected]>
Co-authored-by: Dmitry Lyssenko <[email protected]>
Co-authored-by: Dmitry Lyssenko <[email protected]>
Co-authored-by: Karthikeyan Singaravelan <[email protected]>
Co-authored-by: DavidVentura <[email protected]>
Co-authored-by: erikl <[email protected]>
Co-authored-by: Jeremiah Millay <[email protected]>
Co-authored-by: steve ulrich <[email protected]>
Co-authored-by: Alarig Le Lay <[email protected]>
Co-authored-by: Stefano Rivera <[email protected]>
Co-authored-by: Brandon Ewing <[email protected]>
Co-authored-by: Dylan Kaplan <[email protected]>
Co-authored-by: bh-rr <[email protected]>
Co-authored-by: Greg Skinner <[email protected]>
Co-authored-by: chieto-arista <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants