>>>from pyroute2 import IPDB
>>>ipdb = IPDB()
>>>ipdb.interfaces.eth0.add_ip('2.1.1.1/24')
>>>ipdb.interfaces.eth0.add_ip('1.1.1/24') # wrong ip address to raise error
>>>ipdb.interfaces.eth0.add_ip('1.1.1.1/24')
>>> ipdb.interfaces.eth0.review()
{'map': None, '-vlans': set([]), 'stats': None, '-ports': set([]), 'protinfo': None, '-ipaddr': set([]), '+ports': set([]), 'stats64': None, 'af_spec': None, '+vlans': set([]), '+ipaddr': (('2.1.1.1', 24), ('1.1.1', 24), ('1.1.1.1', 24)), 'linkinfo': None}
>>> ipdb.interfaces.eth0.commit()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/pyroute2/ipdb/interfaces.py", line 1040, in commit
raise error
socket.error: illegal IP address string passed to inet_pton
[root@localhost ~]# ip a s eth02: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:cb:d7:ff brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0 valid_lft 80635sec preferred_lft 80635sec valid_lft forever preferred_lft forever inet6 fe80::ce02:a084:585f:b8/64 scope link valid_lft forever preferred_lft forever
--
You received this message because you are subscribed to the Google Groups "pyroute2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[root@localhost ~]# pip show pyroute2---Metadata-Version: 1.1Name: pyroute2Version: 0.4.17Summary: Python Netlink libraryHome-page: https://github.com/svinota/pyroute2Author: Peter V. SavelievAuthor-email: pe...@svinota.euLicense: dual license GPLv2+ and Apache v2Location: /usr/lib/python2.7/site-packagesRequires:Classifiers: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) License :: OSI Approved :: Apache Software License Programming Language :: Python Topic :: Software Development :: Libraries :: Python Modules Topic :: System :: Networking Topic :: System :: Systems Administration Operating System :: POSIX :: Linux Intended Audience :: Developers Intended Audience :: System Administrators Intended Audience :: Telecommunications Industry Programming Language :: Python :: 2.6 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Development Status :: 4 - Beta
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev+unsubscribe@googlegroups.com.