download_all

        High-level api: Convert cxml tree to an internal schema tree. This
        method is recursive.

        Parameters
        ----------

        check_before_download : `bool`
            True if checking capabilities.txt file is required.

        Returns
        -------

        None
            Nothing returns.

def download_all(self, check_before_download=True):
        '''download_all

        High-level api: Convert cxml tree to an internal schema tree. This
        method is recursive.

        Parameters
        ----------

        check_before_download : `bool`
            True if checking capabilities.txt file is required.

        Returns
        -------

        None
            Nothing returns.
        '''

        # check the content of self.yang_capabilities
        if check_before_download:
            if not self.need_download:
                logger.info('Skip downloading as the content of {} matches ' \
                            'device hello message' \
                            .format(self.yang_capabilities))
                return

        # clean up folder self.dir_yang
        for root, dirs, files in os.walk(self.dir_yang):
            for f in files:
                os.remove(os.path.join(root, f))

        # download all
        self.to_be_downloaded = set(self.device.models_loadable)
        self.downloaded = set()
        while self.to_be_downloaded:
            self.download(self.to_be_downloaded.pop())

        # write self.yang_capabilities
        with open(self.yang_capabilities, 'w') as f:
            f.write('\n'.join(sorted(list(self.device.server_capabilities))))