예제 #1
0
파일: ipv4.py 프로젝트: souperrod/exscript
def remote_ip(scope, local_ips):
    """
    Given an IP address, this function calculates the remaining available
    IP address under the assumption that it is a /30 network.
    In other words, given one link net address, this function returns the
    other link net address.

    :type  local_ips: string
    :param local_ips: An IP address, or a list of IP addresses.
    :rtype:  string
    :return: The other IP address of the link address pair.
    """
    return [ipv4.remote_ip(ip) for ip in local_ips]
예제 #2
0
파일: ipv4.py 프로젝트: 0x24bin/exscript
def remote_ip(scope, local_ips):
    """
    Given an IP address, this function calculates the remaining available
    IP address under the assumption that it is a /30 network.
    In other words, given one link net address, this function returns the
    other link net address.

    @type  local_ips: string
    @param local_ips: An IP address, or a list of IP addresses.
    @rtype:  string
    @return: The other IP address of the link address pair.
    """
    return [ipv4.remote_ip(ip) for ip in local_ips]
예제 #3
0
 def testRemoteIp(self):
     from Exscript.util.ipv4 import remote_ip
     self.assertEqual(remote_ip('10.0.0.0'), '10.0.0.3')
     self.assertEqual(remote_ip('10.0.0.1'), '10.0.0.2')
     self.assertEqual(remote_ip('10.0.0.2'), '10.0.0.1')
     self.assertEqual(remote_ip('10.0.0.3'), '10.0.0.0')
예제 #4
0
 def testRemoteIp(self):
     from Exscript.util.ipv4 import remote_ip
     self.assertEqual(remote_ip('10.0.0.0'), '10.0.0.3')
     self.assertEqual(remote_ip('10.0.0.1'), '10.0.0.2')
     self.assertEqual(remote_ip('10.0.0.2'), '10.0.0.1')
     self.assertEqual(remote_ip('10.0.0.3'), '10.0.0.0')