Пример #1
0
check(register_user("keith"))
check(register_user("reid"))
check(register_user("pete"))

# GROUP DEFINITIONS

check(
    register_host_group(
        "testing",
        "test machines",
        [
            "straits",
            "little-pete",
            "leanhorse",
            "kirks",
            "tandoori",
            "ramonas",
            "salsa",
            "nox-ucb",
            "gunmetal",
            "nf2_name",
        ],
        [],
    )
)
check(
    register_host_group(
        "laptops",
        "laptops",
        [
            "dk-laptop-wifi",
Пример #2
0
check_dir_fail(register_host('host1', dladdr=0x505400000001))  # dup entry
check_dir_fail(register_host('host2', dladdr=0x505400000002))  # dup entry
check_dir_fail(register_host('host1', dladdr=0x505400000003))  # diff val
check_dir_fail(register_host('host2', dladdr=0x505400000004))  # diff val
check_dir_fail(register_host('ost1', dladdr=0x505400000001))  # diff id
check_dir_fail(register_host('ost2', dladdr=0x505400000002))  # diff id
check_dir_fail(register_host('host1', dladdr=0x50540000000))  # diff new id
check_dir_fail(register_host('hst1',
                             dladdr=0x505400000001))  # new name, existing id
check_dir_fail(register_host('hst2',
                             dladdr=0x505400000002))  # new name, existing id

check_dir_fail(register_user('user1'))  # dup entry

check_dir_pass(register_host_group('my_group', 'a host group', ['host1'], []))


def fn(flow, tmp=2, tmp1=3):
    return True


def fn2(flow=2):
    return True


def fn3(flow):
    return True


if not register_py_func(fn):
Пример #3
0
check(register_switch('switch1', 0x505400000003))
check(register_switch('switch2', 0x505400000006))
check(register_location('loc1', 0x505400000003, 0, 'eth0'))
check(register_location('loc2', 0x505400000006, 0, 'eth0'))
check(register_host('host1', dladdr=0x505400000001))
check(register_host('host2', dladdr=0x505400000002))
check(register_user('user1'))
check(register_user('user2'))

check(register_switch_group('s1group', 'my switch group', ['switch1'], []))
check(register_switch_group('s2group', 'my 2nd switch group', ['switch2'], []))
check(register_location_group('l1group', 'my loc group', ['loc1'], []))
check(register_location_group('l2group', 'my 2nd loc group', ['loc2'], []))
check(register_location_group('l3group', 'roup', [], []))
check(register_host_group('h1group', 'my host group', ['host1'], []))
check(register_host_group('h2group', 'my 2nd host group', ['host2'], []))
check(register_user_group('u1group', 'my user group', ['user1'], []))
check(register_user_group('u2group', 'my 2nd user group', ['user2'], []))

check(
    register_location_group('all', 'my all loc group', [],
                            ['l1group', 'l2group']))
check(
    register_host_group('all', 'my all host group', [],
                        ['h1group', 'h2group']))
check(
    register_user_group('all', 'my all user group', [],
                        ['u1group', 'u2group']))

check(
Пример #4
0
check_dir_fail(register_location('loc1', 0x505400000004, 1, 'eth1')) # dup entry
check_dir_fail(register_location('loc1', 0x505400000004, 2, 'eth2')) # diff addr

check_dir_fail(register_host('host1', dladdr=0x505400000001))  # dup entry
check_dir_fail(register_host('host2', dladdr=0x505400000002)) # dup entry
check_dir_fail(register_host('host1', dladdr=0x505400000003)) # diff val
check_dir_fail(register_host('host2', dladdr=0x505400000004))  # diff val
check_dir_fail(register_host('ost1', dladdr=0x505400000001)) # diff id
check_dir_fail(register_host('ost2', dladdr=0x505400000002))  # diff id
check_dir_fail(register_host('host1', dladdr=0x50540000000))   # diff new id
check_dir_fail(register_host('hst1', dladdr=0x505400000001))  # new name, existing id
check_dir_fail(register_host('hst2', dladdr=0x505400000002)) # new name, existing id

check_dir_fail(register_user('user1'))  # dup entry

check_dir_pass(register_host_group('my_group', 'a host group', ['host1'], []))

def fn(flow, tmp=2, tmp1=3):
    return True
def fn2(flow=2):
    return True
def fn3(flow):
    return True

if not register_py_func(fn):
    log.err("Could not register pyfunc %s" % fn.func_name)
if not register_py_func(fn2):
    log.err("Could not register pyfunc %s" % fn.func_name)
if not register_py_func(fn3):
    log.err("Could not register pyfunc %s" % fn.func_name)
Пример #5
0
check(register_switch('switch1', 0x505400000003))
check(register_switch('switch2', 0x505400000006))
check(register_location('loc1', 0x505400000003, 0, 'eth0'))
check(register_location('loc2', 0x505400000006, 0, 'eth0'))
check(register_host('host1', dladdr=0x505400000001))
check(register_host('host2', dladdr=0x505400000002))
check(register_user('user1'))
check(register_user('user2'))

check(register_switch_group('s1group', 'my switch group', ['switch1'], []))
check(register_switch_group('s2group', 'my 2nd switch group', ['switch2'], []))
check(register_location_group('l1group', 'my loc group', ['loc1'], []))
check(register_location_group('l2group', 'my 2nd loc group', ['loc2'], []))
check(register_location_group('l3group', 'roup', [], []))
check(register_host_group('h1group', 'my host group', ['host1'], []))
check(register_host_group('h2group', 'my 2nd host group', ['host2'], []))
check(register_user_group('u1group', 'my user group', ['user1'], []))
check(register_user_group('u2group', 'my 2nd user group', ['user2'], []))

check(register_location_group('all', 'my all loc group', [], ['l1group', 'l2group']))
check(register_host_group('all', 'my all host group', [], ['h1group', 'h2group']))
check(register_user_group('all', 'my all user group', [], ['u1group', 'u2group']))

check(register_dladdr_group('registered-macs', 'mac group',
                            [ 0x505400000001, 0x505400000002], []))
check(register_nwaddr_group('registered-ips', 'ip group',
                            [ '192.168.1.1', '192.168.1.2'], []))

addedAll = True
if num_register == 0: