RestconfServiceProvider

class RestconfServiceProvider : public path::ServiceProvider

Implementation of ServiceProvider for the restconf protocol.

RestconfServiceProvider(path::Repository &repo, const std::string &address, const std::string &username, const std::string &password, int port = 80, EncodingFormat encoding = EncodingFormat::JSON, const std::string &config_url_root = "/data", const std::string &state_url_root = "/data")

Constructs an instance of the RestconfServiceProvider to connect to a restconf server

Parameters:
  • repository – Reference to an instance of path::Repository
  • address – IP address of the device supporting a restconf interface
  • username – Username to log in to the device
  • password – Password to log in to the device
  • port – Device port used to access the restconf interface. Default value is 80
  • encoding – Type of encoding to be used for the payload. Default is JSON
  • config_url_root – To provider backwards compatibility with older drafts of restconf RFC, this can be “/config” or “/data” (which is the default)
  • state_url_root – To provider backwards compatibility with older drafts of restconf RFC, this can be “/operational” or “/data” (which is the default)
path::RootSchemaNode *get_root_schema() const

Returns the RootSchemaNode tree supported by this instance of the ServiceProvider.

Returns:Pointer to the RootSchemaNode or nullptr if one could not be created.
path::DataNode *invoke(path::Rpc *rpc) const
Invokes or executes the given rpc and returns a DataNode pointer if the Rpc has an output modelled in YANG.
Parameters:rpc – Pointer to the Rpc node.
Returns:Pointer to the DataNode representing the output.
EncodingFormat get_encoding()

Returns the type of encoding supported by the service provider.

~RestconfServiceProvider()