Ejemplo n.º 1
0
def test_factory():
    switch = factory(SwitchDescriptor(hostname='hostname', model='juniper', username='******', password='******', port=22))

    assert_that(switch, instance_of(RemoteSwitch))
    assert_that(switch.switch_descriptor.hostname, equal_to("hostname"))
    assert_that(switch.switch_descriptor.model, equal_to("juniper"))
    assert_that(switch.switch_descriptor.username, equal_to("username"))
    assert_that(switch.switch_descriptor.password, equal_to("password"))
    assert_that(switch.switch_descriptor.port, equal_to(22))
Ejemplo n.º 2
0
 def get_switch_by_descriptor(self, switch_descriptor):
     if switch_descriptor.netman_server is not None:
         return remote.factory(switch_descriptor)
     return self.factories[switch_descriptor.model](
         switch_descriptor,
         lock=self.get_lock(switch_descriptor))