예제 #1
0
파일: Router.py 프로젝트: ramanraja/Home5
def bulk_onboard_devices(jdevice_tree):
    success = True
    for devid in jdevice_tree.keys():
        jnew_device = {'device_id': devid, 'relsen_list': jdevice_tree[devid]}
        if not onboard_device(jnew_device):
            success = False  # even if one of them fails, return false eventually
    build_device_inventory()  # update in-mem structures
    return success
예제 #2
0
파일: Router.py 프로젝트: ramanraja/Home5
def onboard_device(jnew_device):
    dprint('\nOnboarding: ', jnew_device)
    if not insert_device(jnew_device['device_id']):
        return False
    for rsid in jnew_device['relsen_list']:
        if not insert_relsen(jnew_device['device_id'], rsid):
            return False
    build_device_inventory()  # update in-mem structures
    return True