Example #1
0
def t4(factory):
    pretty = '%s t4' % __file__
    print(pretty)

    # add testdrive and stack configurations to a broker
    factory.write_config('spirent.json', json.dumps(cfg, indent=4))
    b = factory.make_master('master')
    handsets = b.list_equipment({'type': 'handset'})
    testdrives = b.list_equipment({'type': 'testdrive'})
    s = RemoteBroker(b.address, 3, 'share_key')
    s.set_stacks('local', [[handsets[0], testdrives[0]]])

    # allocate a stack
    try:
        h, t = b.get_resource({'type': 'handset'}, {'type': 'testdrive'})
    except Exception, e:
        print('FAIL %s: could not allocate: %s' % (pretty, str(e)))
        return False
Example #2
0
def t3(factory):
    pretty = '%s t3' % __file__
    print(pretty)

    # add testdrive and stack configurations to a broker
    factory.write_config('spirent.json', json.dumps(cfg, indent=4))
    b = factory.make_master('master')
    h = b.list_equipment({'type': 'handset'})[0]
    t = b.list_equipment({'type': 'testdrive'})[0]
    s = RemoteBroker(b.address, 3, 'share_key')
    s.set_stacks('local', [[h, t]])

    # check that the stack exists
    stacks = b.list_stacks()
    if [h, t] not in stacks:
        print('FAIL %s: wrong stacks: %s' % (pretty, stacks))
        return False

    return True