Example #1
0
    def set_recipe(self, recipe_name):
        """ Reserves the machine for the specified recipe

        Also sends Device classes from the controller and initializes the
        InterfaceManager on the Slave and builds the device database.
        """
        self.rpc_call("set_recipe", recipe_name)
        self._send_device_classes()
        self.rpc_call("init_if_manager")

        devices = self.rpc_call("get_devices")
        for if_index, dev in devices.items():
            remote_dev = RemoteDevice(Device)
            remote_dev.host = self
            remote_dev.if_index = if_index

            self._device_database[if_index] = remote_dev
Example #2
0
    def device_created(self, dev_data):
        if_index = dev_data["if_index"]
        if if_index not in self._device_database:
            new_dev = None
            if len(self._tmp_device_database) > 0:
                for dev in self._tmp_device_database:
                    if dev._match_update_data(dev_data):
                        new_dev = dev
                        break

            if new_dev is None:
                new_dev = RemoteDevice(Device)
                new_dev.host = self
                new_dev.if_index = if_index
            else:
                self._tmp_device_database.remove(new_dev)

                new_dev.if_index = dev_data["if_index"]

            self._device_database[if_index] = new_dev