Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Converts an IP address into an OSI Network Entity Title
suitable for use in IS-IS on Junos.

>>> ip_to_net_ent_title(IPAddress("192.168.19.1"))
'49.0001.1921.6801.9001.00'

        def ip_to_net_ent_title(ip):
    """ Converts an IP address into an OSI Network Entity Title
    suitable for use in IS-IS on Junos.

    >>> ip_to_net_ent_title(IPAddress("192.168.19.1"))
    '49.0001.1921.6801.9001.00'
    """
    LOG.debug("Converting IP to OSI ENT format")
    area_id = "49.0001"
# Pad with leading zeros, eg 1->001, 12->012, 123->123
    ip_octets = ["%03d" % int(octet) for octet in ip.words]
# Condense to single string
    ip_octets = "".join(ip_octets)
# and split into bytes
    ip_octets = ip_octets[0:4] + "." + ip_octets[4:8] + "." + ip_octets[8:12]
    return area_id + "." + ip_octets + "." + "00"
        


src/a/n/ank_le-HEAD/AutoNetkit/compiler/junoscompiler.py   ank_le(Download)
            'netmask':      str(lo_ip.netmask),
            'prefixlen':    str(lo_ip.prefixlen),
            'net_ent_title': ank.ip_to_net_ent_title(lo_ip.ip),
            'description': 'Loopback',
        })