check(register_host("ng-laptop-wifi", dladdr=0x001EC2C2565D)) check(register_host("ss-laptop-wifi", dladdr=0x001B63C68C4F)) check(register_host("ss-laptop-wired", dladdr=0x001B63938B95)) check(register_host("ka-laptop-wifi", dladdr=0x001CBFC95543)) check(register_host("ka-laptop-wired", dladdr=0x001D09C85B51)) check(register_host("tk-laptop-wifi", dladdr=0x001E5271B4DB)) check(register_host("mc-laptop-wifi", dladdr=0x001EC2BAAF55)) check(register_host("mc-laptop-wired", dladdr=0x001EC21C3865)) check(register_host("jp-laptop-wifi", dladdr=0x001B63C15FD2)) check(register_host("jp-laptop-wired", dladdr=0x001B6391F375)) check(register_host("pb-laptop-wifi", dladdr=0x001F3B0132B1)) check(register_host("pb-laptop-wired", dladdr=0x001EC902C0A1)) check(register_host("mm-laptop-wifi", dladdr=0x0013CE0F7B25)) check(register_host("mm-laptop-wired", dladdr=0x00123FE3D331)) check(register_user("natasha")) check(register_user("ben")) check(register_user("martin")) check(register_user("dan")) check(register_user("keith")) check(register_user("reid")) check(register_user("pete")) # GROUP DEFINITIONS check( register_host_group( "testing", "test machines", [ "straits",
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
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']))
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 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
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'])) check(register_host_group('all', 'my all host group', [], ['h1group', 'h2group'])) check(register_user_group('all', 'my all user group', [], ['u1group', 'u2group']))