Repository¶
-
class
ydk::path::
Repository
¶ The Repository is responsible for loading module locally or downloading module remotely if certain model providers are provided; It holds a variable pointing to the location for model downloads and could be used as a factory class to create
RootSchemaNode
based on a list ofCapability
passed in or list of capability lookup tables and a list ofCapability
passed in.-
std::string
path
¶ Location where YANG models are present and/or downloaded to
-
Repository
(ModelCachingOption caching_option = ModelCachingOption::PER_DEVICE)¶ Create an instance of
Repository
, the model downloading path is set to~/.ydk
.If the caching option is set to
PER_DEVICE
, directories with format of~/.ydk/hostname:port
(~/.ydk/127.0.0.1:1220
for example) are used for model downloading. Otherwise, a common directory(~/.ydk/common_cache
) is used for all devices.Parameters: caching_option – Model caching option. Raises: YIllegalStateError
If the model downloads directory could not be created.
-
Repository
(const std::string &search_dir, ModelCachingOption caching_option = ModelCachingOption::PER_DEVICE)¶ Create an instance of
Repository
, the model downloading path is set tosearch_dir
.Parameters: - search_dir – The path in the filesystem where yang files can be found.
- caching_option – Model caching option.
Raises: YIllegalStateError
If the model downloads directory could not be created.
-
std::shared_ptr<RootSchemaNode>
create_root_schema
(const std::vector<Capability> &capabilities)¶ Creates a pointer of
RootSchemaNode
based on the list of capabilities passed in.Parameters: capabilities – List of capabilities available. Returns: Pointer to the RootSchemaNode
.
-
std::shared_ptr<RootSchemaNode>
create_root_schema
(const std::vector<std::unordered_map<std::string, path::Capability>> &lookup_tables, const std::vector<path::Capability> &caps_to_load)¶ Creates a pointer of
RootSchemaNode
based on the list of capabilities passed in and the list of lookup tables passed in.Parameters: - lookup_tables – List of capabilities lookup table available.
- caps_to_load – List of capabilities available.
Returns: Pointer to the
RootSchemaNode
.
-
void
add_model_provider
(ModelProvider *model_provider)¶ The model provider is responsible for downloading the model from a remote device. It is meant to be invoked if the repository cannot load the model from the local directory.
Parameters: model_provider – The model provider to add
-
void
remove_model_provider
(ModelProvider *model_provider)¶ Removes the given model provider from this repository
Parameters: model_provider – The model provider to remove
-
std::vector<ModelProvider *>
get_model_providers
() const¶ Gets all model providers registered with this repository.
Returns: List of model providers associated with this repository
-
std::string