def _parseMixedIPFromIndex(rawIndexValue): rawIndexValue = rawIndexValue.split('.') #split it to array rawIndexValue = ".".join(rawIndexValue[2:]) #the first two elements are irrelevant, ignore them rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue() ipAddr = None try: ipAddr = InetAddress.getByAddress(rawIndexValue).getHostAddress() except: pass return ipAddr
def parseIPFromIpNetToPhysicalTableIndex(rawIndexValue): realValue = None try: rawIndexValue = rawIndexValue.split('.') #split it to array rawIndexValue = ".".join(rawIndexValue[3:]) #the first three elements are irrelevant, ignore them rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue() inetAddress = InetAddress.getByAddress(rawIndexValue) realValue = inetAddress.getHostAddress() except: pass return realValue
def parseIPv6FromIPv6NetToMediaTableIndex(rawIndexValue): realValue = None try: rawIndexValue = rawIndexValue.split('.') #split it to array rawIndexValue = ".".join(rawIndexValue[2:]) #the first two elements are irrelevant, ignore them rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue() ipv6Address = InetAddress.getByAddress(rawIndexValue) realValue = ipv6Address.getHostAddress() except: pass return realValue