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
Exemple #3
0
    def _get_packages(self, bundle):
        """ Return 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:
            packages (List[.api_model.Package]): List of api packages.
        """

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

        # build api model packages
        packages = ApiModelBuilder(self.iskeyword, self.language, bundle.name).generate(modules)
        packages.extend(
            SubModuleBuilder().generate(pyang_builder.get_submodules(), self.iskeyword, self.language, bundle.name))

        return packages
Exemple #4
0
    def _get_packages(self, bundle):
        """ Return packages for resolved YANG modules. Each module will be
            represented as an api package.

        Args:
            bundle (Bundle): Bundle package.

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

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

        # build api model packages
        packages = ApiModelBuilder(self.iskeyword, self.language,
                                   bundle.name).generate(modules)
        packages.extend(SubModuleBuilder().generate(
            pyang_builder.get_submodules(), self.iskeyword, self.language,
            bundle.name))

        return packages
Exemple #5
0
    def _get_api_pkgs(self, bundle):
        """ 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(bundle)
        modules = pyang_builder.parse_and_return_modules()

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

        return api_pkgs