Esempio n. 1
0
    def expand_netmask(self, netmask):
        """Expand netmask based on the terms in the database.
           Doesn't bother using the database for tiny networks"""
        network = IPy.IP(netmask)
        if network.len() < 32:
            return [serialize_ip(str(ip)) for ip in network]
        ips = self.ips_from_network(network)

        if network.prefixlen() % 8 !=0:
            ips = [ip for ip in ips if IPy.IP(deserialize_ip(ip)) in network]
        return ips
Esempio n. 2
0
    def expand_netmask(self, netmask):
        """Expand netmask based on the terms in the database.
           Doesn't bother using the database for tiny networks"""
        network = IPy.IP(netmask)
        if network.len() < 32:
            return [serialize_ip(str(ip)) for ip in network]
        ips = self.ips_from_network(network)

        if network.prefixlen() % 8 != 0:
            ips = [ip for ip in ips if IPy.IP(deserialize_ip(ip)) in network]
        return ips
Esempio n. 3
0
def serde_case(ip):
    other = deserialize_ip(serialize_ip(ip))
    eq_(ip, other)
Esempio n. 4
0
def serde_case(ip):
    other = deserialize_ip(serialize_ip(ip))
    eq_(ip, other)