mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
python3: ipnetwork: create new ipnetwork object from existing ones
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -34,6 +34,9 @@ class IPNetwork:
|
|||||||
if isinstance(ip, int):
|
if isinstance(ip, int):
|
||||||
self._ip = ipaddress.ip_address(ip)
|
self._ip = ipaddress.ip_address(ip)
|
||||||
ip = str(self._ip)
|
ip = str(self._ip)
|
||||||
|
elif isinstance(ip, IPNetwork):
|
||||||
|
self._ip = ip._ip
|
||||||
|
self.__prefixlen = ip.prefixlen
|
||||||
else:
|
else:
|
||||||
if not prefixlen:
|
if not prefixlen:
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user