def add_host(mac, name=None, ip=None, ddns=False, group=None,
        supersede_host=False):
    statements = ''
    o = _conn()
    msg = omapi.OmapiMessage.open(b'host')
    msg.message.append(('create', struct.pack('!I', 1)))
    msg.message.append(('exclusive', struct.pack('!I', 1)))
    msg.obj.append(('hardware-address', omapi.pack_mac(mac)))
    msg.obj.append(('hardware-type', struct.pack('!I', 1)))
    if ip:
        msg.obj.append(('ip-address', omapi.pack_ip(ip)))
    if name:
        msg.obj.append(('name', name))
    if group:
        msg.obj.append(('group', group))
    if supersede_host:
        statements += 'option host-name "{0}"; '.format(name)
    if ddns and name:
        statements += 'ddns-hostname "{0}"; '.format(name)
    if statements:
        msg.obj.append(('statements', statements))
    response = o.query_server(msg)
    if response.opcode != omapi.OMAPI_OP_UPDATE:
        return False
    return True
Add a host object for the given mac.
dataset/ETHPy150Open saltstack/salt/salt/modules/omapi.py/add_host