Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testIPv6Obj_recursive():
"""IPv6Obj() should be able to parse itself"""
obj = IPv6Obj(IPv6Obj('fe80:a:b:c:d:e::1/64'))
assert str(obj.ip_object)=='fe80:a:b:c:d:e:0:1'
assert obj.prefixlen==64
def network_object(self):
try:
if self._address_family == 'ip':
return IPv4Obj(
'%s/%s' % (self.network, self.masklen), strict=False)
elif self._address_family == 'ipv6':
return IPv6Obj('%s/%s' % (self.network, self.masklen))
except:
return None
def network_object(self):
try:
if self._address_family == 'ip':
return IPv4Obj(
'%s/%s' % (self.network, self.netmask), strict=False)
elif self._address_family == 'ipv6':
return IPv6Obj('%s/%s' % (self.network, self.masklen))
except:
return None