Exemple #1
0
    def _get_api_pkgs(self, resolved_model_dir):
        """ Return api packages for resolved YANG modules. Each module will be
            represented as an api package.

        Args:
            resolved_model_dir (str): Path to resolved YANG modules.

        Returns:
            api_pkgs (List[.api_model.Package]): List of api packages.
        """

        pyang_builder = PyangModelBuilder(resolved_model_dir)
        modules = pyang_builder.parse_and_return_modules()

        # build api model packages
        if not self.groupings_as_class:
            api_pkgs = ApiModelBuilder(self.iskeyword,
                                       self.language).generate(modules)
        else:
            api_pkgs = GroupingClassApiModelBuilder(
                self.iskeyword, self.language).generate(modules)
        api_pkgs.extend(SubModuleBuilder().generate(
            pyang_builder.get_submodules(), self.iskeyword))

        return api_pkgs
Exemple #2
0
    def _build_api_model_packages(self, modules, groupings_as_class):
        packages = []

        if not groupings_as_class:
            packages = ApiModelBuilder().generate(modules)
        else:
            packages = GroupingClassApiModelBuilder().generate(modules)
        return packages