return switch_info d = check(register_switch("marbles", 622687516026)) d.addCallback(register_switch_ports, 4) d = check(register_switch("of3k", 94259811924)) d.addCallback(register_switch_ports, 4) d = check(register_switch("of6k", 110887703091)) d.addCallback(register_switch_ports, 5) d.addCallback(register_switch_ports, 2, 6) d.addCallback(register_switch_ports, 1, 5, "wireless") # REGISTER HOSTS/USERS check(register_host("grasshopper", dladdr=0x0090FB1858AC)) check(register_host("ladybug", dladdr=0x0090FB18590C)) check(register_host("miwok", dladdr=0x001AA08F9A95)) check(register_host("hardrock", dladdr=0x0002E30F80A4)) check(register_host("badwater", dladdr=0x00A0CC28A994)) check(register_host("leadville", dladdr=0x001A9240AC05)) check(register_host("javelina", dladdr=0x0014C1325FD6)) check(register_host("gobi", dladdr=0x001E906A7DFE)) check(register_host("emerson", dladdr=0x001D09708D2E)) check(register_host("salsa", dladdr=0x0015F26B68C6)) check(register_host("wahoos", dladdr=0x001BB9A57FBC)) check(register_host("nox-ucb", dladdr=0x001FC610C596)) check(register_host("nicira-bw", dladdr=0x001A4B122FF8)) check(register_host("nicira-color", dladdr=0x001635571374))
num_register = num_register - 1 if num_register == 0 and addedAll: print 'Registration test complete' def unwrap_reg_loc(switch_info, name, switch, port, port_name): check_dir_pass(register_location(name, switch, port, port_name)) d = check_dir_pass(register_switch('switch1', 0x505400000004)) d.addCallback(unwrap_reg_loc, 'loc1', 'switch1', 1, 'eth0') check_dir_pass(register_location('loc2', 0x505400000003, 0, 'eth0')) check_dir_pass(register_location('loc3', 0x505400000003, 1, 'eth1')) check_dir_pass(register_host('host1', dladdr=0x505400000001, is_gateway=True)) check_dir_pass(register_host('host2', dladdr=0x505400000002)) check_dir_pass(register_user('user1')) check_dir_pass(register_user('user2')) check_dir_fail(register_switch('switch1', 0x505400000004)) # dup entry check_dir_fail(register_switch('switch2', 0x505400000004)) # dup entry check_dir_fail(register_location('loc5', 0x505400000003, 0, 'eth0')) # dup entry check_dir_fail(register_location('loc6', 0x505400000003, 1, 'eth1')) # dup entry check_dir_fail(register_location('loc1', 0x505400000004, 1, 'eth1')) # dup entry check_dir_fail(register_location('loc1', 0x505400000004, 2,
global num_register num_register = num_register - 1 if num_register == 0 and addedAll: print 'Registration complete' def register_failed(res): print 'Registration failed' 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(
if should_pass == True: log.err('Register should have passed') num_register = num_register - 1 if num_register == 0 and addedAll: print 'Registration test complete' def unwrap_reg_loc(switch_info, name, switch, port, port_name): check_dir_pass(register_location(name, switch, port, port_name)) d = check_dir_pass(register_switch('switch1', 0x505400000004)) d.addCallback(unwrap_reg_loc, 'loc1', 'switch1', 1, 'eth0') check_dir_pass(register_location('loc2', 0x505400000003, 0, 'eth0')) check_dir_pass(register_location('loc3', 0x505400000003, 1, 'eth1')) check_dir_pass(register_host('host1', dladdr=0x505400000001, is_gateway=True)) check_dir_pass(register_host('host2', dladdr=0x505400000002)) check_dir_pass(register_user('user1')) check_dir_pass(register_user('user2')) check_dir_fail(register_switch('switch1', 0x505400000004)) # dup entry check_dir_fail(register_switch('switch2', 0x505400000004)) # dup entry check_dir_fail(register_location('loc5', 0x505400000003, 0, 'eth0')) # dup entry check_dir_fail(register_location('loc6', 0x505400000003, 1, 'eth1')) # dup entry 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
def register_success(res): global num_register num_register = num_register - 1 if num_register == 0 and addedAll: print 'Registration complete' def register_failed(res): print 'Registration failed' 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']))