예제 #1
0
    def wtp(self, wtp):
        """Assigns LVAP to new wtp."""

        # Initialize the Resource Pool
        pool = ResourcePool()

        # Update the pool with all the available ResourseBlocks
        for block in wtp.blocks.values():
            pool.append(block)

        # Filter blocks so we are sure to go to the same interface and band
        blocks = pool.filter_by_channel(self.blocks[0].channel) \
                     .filter_by_band(self.blocks[0].band) \
                     .first()

        self.blocks = blocks