def unpack_facts(obj): result = dict(obj) if 'hardware-address' in result: result['hardware-address'] = unpack_mac(result['hardware-address']) if 'ip-address' in result: result['ip-address'] = unpack_ip(result['ip-address']) if 'hardware-type' in result: result['hardware-type'] = struct.unpack("!I", result['hardware-type']) return result
def unpack_facts(obj): result = dict(obj) if 'hardware-address' in result: result['hardware-address'] = unpack_mac(result['hardware-address']) if 'ip-address' in result: result['ip-address'] = unpack_ip(result['ip-address']) if 'hardware-type' in result: result['hardware-type'] = struct.unpack("!I", result['hardware-type']) return result
def unpack_facts(obj): result = dict(obj) if 'hardware-address' in result: result['hardware-address'] = to_native(unpack_mac(result[to_bytes('hardware-address')])) if 'ip-address' in result: result['ip-address'] = to_native(unpack_ip(result[to_bytes('ip-address')])) if 'hardware-type' in result: result['hardware-type'] = struct.unpack("!I", result[to_bytes('hardware-type')]) return result
def __init__(self, obj): self.mac = None for (k, val) in obj: if k == "ip-address": self.ip_addr = pypureomapi.unpack_ip(val) elif k == "state": self.state = STATES[struct.unpack("!I", val)[0]] elif k == "hardware-address": self.mac = pypureomapi.unpack_mac(val) elif k == "client-hostname": self.client_hostname = val elif k == "starts": self.starts = unpack_time(val) elif k == "ends": self.ends = unpack_time(val) elif k == "tstp": self.tstp = unpack_time(val) elif k == "tsfp": self.tsfp = unpack_time(val) elif k == "atsfp": self.atsfp = unpack_time(val) elif k == "cltt": self.cltt = unpack_time(val)