### Install Scrapli from source Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Clone the Scrapli repository and install it locally from the source code. ```bash git clone https://github.com/carlmontanari/scrapli cd scrapli pip install . ``` -------------------------------- ### Install Scrapli with all extras Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install Scrapli with both TextFSM and Genie extras included for full functionality. ```bash pip install scrapli[full] ``` -------------------------------- ### Install Scrapli with TextFSM extra Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install Scrapli with the TextFSM parsing capabilities enabled. ```bash pip install scrapli[textfsm] ``` -------------------------------- ### Install Scrapli with Genie extra Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install Scrapli with the Genie integration enabled. ```bash pip install scrapli[genie] ``` -------------------------------- ### IOSXE establish-subscription Example Source: https://github.com/carlmontanari/scrapli/blob/main/examples/netconf/subscriptions/README.md Example of setting up a Netconf subscription with an IOSXE device using the `establish-subscription` RPC. This method associates a subscription ID, and you should use `get_next_subscription` to fetch messages. ```python iosxe_subscription_payload = """ NETCONF """ # ... (assuming 'conn' is a scrapli connection object) response = conn.raw_rpc(iosxe_subscription_payload) # To get notifications, use get_next_subscription # notification = conn.get_next_subscription(subscription_id=response.data_xml.find(".//subscription-id").text) ``` -------------------------------- ### Netopeer create-subscription Example Source: https://github.com/carlmontanari/scrapli/blob/main/examples/netconf/subscriptions/README.md Example of setting up a Netconf subscription with a Netopeer server using the `create-subscription` RPC. Use `get_next_notification` to retrieve messages. ```python netopeer_subscription_payload = """ * """ # ... (assuming 'conn' is a scrapli connection object) response = conn.raw_rpc(netopeer_subscription_payload) # To get notifications, use get_next_notification # notification = conn.get_next_notification() ``` -------------------------------- ### Install Scrapli from GitHub main Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install the latest version of Scrapli directly from its GitHub repository's main branch using pip. ```bash pip install git+https://github.com/carlmontanari/scrapli ``` -------------------------------- ### Install scrapli-ssh2 Source: https://github.com/carlmontanari/scrapli/wiki/SSH2-Transport After installing the necessary build tools, you can install the scrapli-ssh2 package. This enables SSH2 support for scrapli. ```bash pip install scrapli-ssh2 ``` -------------------------------- ### Install Scrapli using pip Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md The most straightforward way to install the Scrapli Python package is using pip. ```bash pip install scrapli ``` -------------------------------- ### SSH2-Python Installation Error in Alpine Source: https://github.com/carlmontanari/scrapli/wiki/SSH2-Transport This is an example of the error encountered when trying to install ssh2-python in an Alpine container without the necessary build tools. It indicates a failure during the setup process. ```text ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-df5rt80m/ssh2-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-df5rt80m/ssh2-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-9rtatp1t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.7m/ssh2-python Check the logs for full command output. bash-5.0# ``` -------------------------------- ### Install Scrapli from a specific GitHub commit Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install a specific version of Scrapli from GitHub by referencing a commit hash. ```bash pip install git+https://github.com/carlmontanari/scrapli.git@0d1e871 ``` -------------------------------- ### Install Scrapli2 using pip Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md To use semantic versioning, install the scrapli2 package via pip. ```bash pip install scrapli2 ``` -------------------------------- ### Initialize Scrapli CLI Driver in Zig Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Example of initializing a CLI driver using the scrapli library in Zig. ```zig const d = try cli.Driver.init(allocator, host, .{}) ``` -------------------------------- ### CLI Driver Methods Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md Details the methods available on the CLI driver, including examples for fetching the current device prompt across Zig, Python, and Go. ```APIDOC ## Methods ### Cli #### Get Prompt Fetches the current "prompt" from the device. This is determined by a regular expression pattern specific to the device's platform. - **zig**: `getPrompt` - **python**: `get_prompt` / `get_prompt_async` - **go**: `GetPrompt` ``` -------------------------------- ### Install OpenSSH Client on Debian Source: https://github.com/carlmontanari/scrapli/wiki/SystemSSH-Transport Use this command to install the OpenSSH client on Debian-based systems. This is required for Scrapli's SystemSSH transport. ```bash apt install openssh-client ``` -------------------------------- ### Nokia SRLinux Platform Definition Example Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md An annotated example of a Nokia SRLinux platform definition in YAML format. It illustrates prompt patterns, default modes, mode definitions, failure indicators, and on-open/on-close instructions. ```yaml --- prompt_pattern: '(^.*[>#$]\s?+$)|(--.*--\s*\n[abcd]:\S+#\s*$)' # (1) default_mode: 'exec' # (2) modes: # (3) - name: 'bash' prompt_pattern: '^.*[>#$]\s?+$' prompt_excludes: # (4) # ensure bash doesnt match on exec/config. technically this could be in a bash prompt # but seems pretty unlikely - '--{' accessible_modes: - name: 'exec' instructions: # (5) - send_input: input: 'exit' - name: 'exec' prompt_pattern: '^--{(\s[\w\s]+]){0,5}[+\*\s]{1,}running\s}--[.+?]+--\s*\n[abcd]:\S+#\s*$' accessible_modes: - name: 'bash' instructions: - send_input: input: 'bash' - name: 'configuration' instructions: - send_input: input: 'enter candidate private' - name: 'configuration' prompt_pattern: '^--{(\s[\w\s]+]){0,5}[+\!\s]{1,}candidate[\-\w\s]+}--[.+?]+--\s*\n[abcd]:\S+#\s*$' accessible_modes: - name: 'exec' instructions: - send_input: input: 'discard now' failure_indicators: # (6) - 'Error:' on_open_instructions: # (7) - enter_mode: requested_mode: 'exec' - send_input: input: 'environment cli-engine type basic' - send_input: input: 'environment complete-on-space false' on_close_instructions: # (8) - enter_mode: requested_mode: 'exec' - write: input: 'quit' ``` -------------------------------- ### Scrapli Misc Options Example Source: https://github.com/carlmontanari/scrapli/blob/main/examples/cli/misc_options/README.md Illustrates including/excluding inputs and trailing prompts, and demonstrates input handling and operation timeouts. ```python import scrapli.driver with scrapli.driver.NetworkDriver(host="some.host.com", transport="ssh", auth_type="password", username="user", password="password") as driver: # example of including inputs and trailing prompts response = driver.get_configuration( "show running-config", with_prompt=True, with_input=True, timeout_ms=5000, ) print(response.textf("running-config")) # example of not including inputs and trailing prompts response = driver.get_configuration( "show running-config", with_prompt=False, with_input=False, timeout_ms=5000, ) print(response.textf("running-config")) # example of input handling response = driver.get_configuration( "configure terminal", input_handling="allow_empty", timeout_ms=5000, ) print(response.textf("running-config")) # example of operation timeout response = driver.get_configuration( "show running-config", timeout_ms=1000, ) print(response.textf("running-config")) ``` -------------------------------- ### Install CMake for Alpine Source: https://github.com/carlmontanari/scrapli/wiki/SSH2-Transport Before installing scrapli-ssh2, ensure CMake is installed in your Alpine container. This is a prerequisite for building the ssh2-python package. ```bash apk add --no-cache cmake ``` -------------------------------- ### Install Scrapli from a specific GitHub branch Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Install Scrapli from a specific feature branch on GitHub. Note the use of '#egg=scrapli2' for semver naming. ```bash pip install git+https://github.com/carlmontanari/scrapli.git@some-feature#egg=scrapli2 ``` -------------------------------- ### Get Scrapligo Go module Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Add the Scrapligo Go module to your project using the go get command. ```bash go get github.com/scrapli/scrapligo/v2 ``` -------------------------------- ### Install OpenSSH Server on Debian Source: https://github.com/carlmontanari/scrapli/wiki/SystemSSH-Transport Use this command to install the OpenSSH server on Debian-based systems. While not always strictly necessary for client-only operations, some users have reported it resolves issues with Scrapli's SystemSSH transport. ```bash apt install openssh-server ``` -------------------------------- ### Dynamically Get Configuration Prompt for Interact Events Source: https://github.com/carlmontanari/scrapli/wiki/IOSXEDriver Acquire configuration privilege and dynamically retrieve the device's prompt to use in interact_events, ensuring compatibility. ```python conn.acquire_priv("configuration") config_prompt = conn.get_prompt() ``` -------------------------------- ### Import Scrapli in Zig Program Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Import the scrapli module into your Zig program to start using its functionalities. ```zig const scrapli = @import("scrapli"); const cli = scrapli.cli; ``` -------------------------------- ### Get Scrapligo Go module at a specific tag Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Fetch a specific version of the Scrapligo Go module using a tag. ```bash go get github.com/scrapli/scrapligo/v2@v2.0.0 ``` -------------------------------- ### IOSXE User Removal Confirmation Prompt Source: https://github.com/carlmontanari/scrapli/wiki/IOSXEDriver This is an example of the confirmation prompt encountered when removing a user on an IOSXE device. ```text csr1000v#conf t Enter configuration commands, one per line. End with CNTL/Z. c রূপান্তরিত1000v(config)#no username deleteme This operation will remove all username related configurations with same name.Do you want to continue? [confirm] ``` -------------------------------- ### Connect to NETCONF Server with Scrapli Go Source: https://github.com/carlmontanari/scrapli/blob/main/docs/examples/go.md This snippet demonstrates connecting to a NETCONF server using scrapli-go. It sets up connection options, opens the connection with context cancellation, and retrieves configuration using `GetConfig`. ```go package main import ( "context" "fmt" "time" scrapligonetconf "github.com/scrapli/scrapligo/v2/netconf" scrapligooptions "github.com/scrapli/scrapligo/v2/options" ) func main() { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() opts := []scrapligooptions.Option{ scrapligooptions.WithUsername("scrapli"), scrapligooptions.WithPassword("verysecurepassword"), } n, err := scrapligonetconf.NewNetconf( "myrouter", opts... ) if err != nil { panic(fmt.Sprintf("failed creating netconf object, error: %v", err)) } _, err = n.Open(ctx) if err != nil { panic(err) } defer n.Close(ctx) r, err := n.GetConfig(ctx) if err != nil { panic(err) } fmt.Println(r.Result()) } ``` -------------------------------- ### Connect to NETCONF Device with Scrapli Source: https://github.com/carlmontanari/scrapli/blob/main/docs/examples/python.md Use the `Netconf` class to establish a NETCONF connection. Provide the host and authentication options. The connection can be managed using a `with` statement, and configuration data can be retrieved using methods like `get_config()`. ```python from scrapli import AuthOptions, Netconf def main(name): netconf = Netconf( host="myrouter", auth_options=AuthOptions( username="scrapli", password="verysecurepassword", ), ) with cli as c: result = c.get_config() print(result.result) if __name__ == "__main__": main() ``` -------------------------------- ### Connect to CLI Device with Scrapli Go Source: https://github.com/carlmontanari/scrapli/blob/main/docs/examples/go.md Use this snippet to establish a connection to a CLI device using SSH or Telnet. Ensure you have the correct device definition and credentials. The connection is opened and closed using context for cancellation. ```go package main import ( "context" "fmt" "time" scrapligocli "github.com/scrapli/scrapligo/v2/cli" scrapligooptions "github.com/scrapli/scrapligo/v2/options" ) func main() { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() opts := []scrapligooptions.Option{ scrapligooptions.WithDefinitionFileOrName(scrapligocli.NokiaSrlinux), scrapligooptions.WithUsername("scrapli"), scrapligooptions.WithPassword("verysecurepassword"), } c, err := scrapligocli.NewCli( "myrouter", opts... ) if err != nil { panic(fmt.Sprintf("failed creating cli object, error: %v", err)) } _, err = c.Open(ctx) if err != nil { panic(err) } defer c.Close(ctx) r, err := c.SendInput(ctx, "info") if err != nil { panic(err) } fmt.Println(r.Result()) } ``` -------------------------------- ### Connect to CLI Device with Scrapli Source: https://github.com/carlmontanari/scrapli/blob/main/docs/examples/python.md Use the `Cli` class to connect to a CLI device via SSH or Telnet. Ensure you provide the correct host and authentication details. The `definition_file_or_name` argument specifies the platform, and the connection can be managed using a `with` statement. ```python from scrapli import AuthOptions, Cli def main(name): cli = Cli( definition_file_or_name="cisco_iosxe", host="myrouter", auth_options=AuthOptions( username="scrapli", password="verysecurepassword", ), ) with cli as c: result = c.send_input(input_="show version") print(result.result) if __name__ == "__main__": main() ``` -------------------------------- ### Fetch libscrapli for Scrapligo Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Use the provided Go script to fetch and cache the libscrapli dependency for Scrapligo. ```bash go run build/write_libscrapli_to_cache/main.go ``` -------------------------------- ### Fetch libscrapli Zig Dependency Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Use `zig fetch` to download and save the libscrapli library to your build.zig.zon file. ```bash zig fetch --save=libscrapli https://github.com/scrapli/libscrapli/archive/refs/tags/v0.0.1-rc.1.tar.gz ``` -------------------------------- ### Send Interactive Command in Configuration Mode Source: https://github.com/carlmontanari/scrapli/wiki/IOSXEDriver Use the send_interactive method to execute a command that requires confirmation, specifying the privilege level. ```python interactive_output = conn.send_interactive(interact_events=interact_events, privilege_level="configuration") ``` -------------------------------- ### Async IO in Scrapli Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md Explains Scrapli's asynchronous I/O model, highlighting its use of pthreads, non-blocking transports, and epoll/kqueue waiters for efficient and cancellable read operations. It also details how operations are managed and polled in different language contexts (async Python, sync Python, Go). ```APIDOC ## Async IO in Scrapli Scrapli leverages a pthread for its read loop, ensuring efficient consumption of data from transports. Transports operate in a non-blocking fashion, utilizing epoll/kqueue waiters for asynchronous data availability. This design allows for cancellable reads without tight polling loops. Operations initiated by scrapli/scrapligo are queued and pollable via an operation ID. In async Python and Go, operations are awaited by selecting on a file descriptor. In synchronous Python, operations are polled at intervals with backoff. This approach ensures efficient performance across synchronous Python, asynchronous Python, and native Go implementations. ``` -------------------------------- ### Add libscrapli to Zig Build Configuration Source: https://github.com/carlmontanari/scrapli/blob/main/docs/installation.md Configure your `build.zig` file to include libscrapli as a dependency for your project. ```zig const std = @import("std"); pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const main = b.step("main", "Build main.zig executable"); const libscrapli = b.dependency( "libscrapli", .{ .target = target, .optimize = optimize, }, ); const exe_mod = b.createModule( .{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }, ); const main_exe = b.addExecutable( .{ .name = "libscrapli_usage_example", .root_module = exe_mod, }, ); main_exe.root_module.addImport("scrapli", libscrapli.module("scrapli")); const exe_target_output = b.addInstallArtifact(main_exe, .{}); main.dependOn(&exe_target_output.step); } ``` -------------------------------- ### Session Interaction Methods Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md Methods for interacting with the device session, such as changing modes, sending commands, and handling prompts. ```APIDOC ## Enter Mode ### Description Enter the given "mode" on the server. This can be things like "configuration" or "privileged-exec" type modes. The modes themselves are defined in the platform definition, so consult the definition for available modes. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **mode** (string) - Required - The name of the mode to enter. ### Request Example ```python session.enter_mode("configuration") ``` ### Response Details on response are not provided, but it's assumed to indicate success or failure of mode entry. ``` ```APIDOC ## Send Input ### Description Send a given input to the device. This input will be sent at the "default" mode for the given platform unless otherwise specified. For example, if you want to send "configuration" you will need to use this method and specify the configuration mode. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **input_string** (string) - Required - The input to send to the device. - **mode** (string) - Optional - The mode in which to send the input. Defaults to "default". ### Request Example ```python session.send_input("show version", "privileged-exec") ``` ### Response Details on response are not provided, but it's assumed to return the output from the device. ``` ```APIDOC ## Send Inputs ### Description Sends multiple inputs to the device sequentially. This is a convenience method for sending several commands or configurations without explicit calls for each. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **inputs** (list of strings) - Required - A list of inputs to send to the device. - **mode** (string) - Optional - The mode in which to send the inputs. Defaults to "default". ### Request Example ```python session.send_inputs(["configure terminal", "hostname test-router"]) ``` ### Response Details on response are not provided, but it's assumed to return the aggregated output from the device for all inputs. ``` ```APIDOC ## Send Prompted Input ### Description Used to deal with "prompts" from the device, such as confirmation requests. This method accepts an input to send, then a prompt pattern (exact string or regular expression) to expect, and finally, an input to respond to the prompt with. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **input_string** (string) - Required - The initial input to send to the device. - **prompt_pattern** (string) - Required - The exact string or regular expression to match for the prompt. - **response_input** (string) - Required - The input to send in response to the prompt. - **mode** (string) - Optional - The mode in which to send the input. Defaults to "default". ### Request Example ```python session.send_prompted_input("write memory", r"(yes|no)", "yes") ``` ### Response Details on response are not provided, but it's assumed to return the output from the device after handling the prompt. ``` ```APIDOC ## Read With Callbacks ### Description An advanced method that accepts an optional input to "start" the operation, then a list of callbacks with information about how those callbacks should be triggered. Originally intended for console server interactions and initial configuration dialogs, but can be used in other ways. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **input_string** (string) - Optional - An initial input to send to start the operation. - **callbacks** (list of callback objects) - Required - A list defining how and when callbacks should be triggered. ### Request Example ```python def my_callback(data): print(f"Received: {data}") session.read_with_callbacks(input_string="show running-config", callbacks=[{"trigger": "#", "action": my_callback}]) ``` ### Response Details on response are not provided, but it's assumed to return data processed by the callbacks. ``` -------------------------------- ### Handle User Removal with Dynamic Prompt Source: https://github.com/carlmontanari/scrapli/wiki/IOSXEDriver Construct interact_events using a dynamically obtained configuration prompt to handle user removal confirmation. ```python interact_events = [ ('no username horseinthesky', '[confirm]'), ('', config_prompt), ] interactive_output = conn.send_interactive(interact_events=interact_events, privilege_level="configuration") ``` -------------------------------- ### Define Interact Events for User Removal Source: https://github.com/carlmontanari/scrapli/wiki/IOSXEDriver Define the sequence of inputs and expected responses for handling the user removal confirmation prompt. ```python interact_events = [ ('no username deleteme', 'This operation will remove all username related configurations with same name.Do you want to continue? [confirm]'), ('', csr1000v(config)#, ] ``` -------------------------------- ### Scrapli Platform Definition JSON Schema Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md A JSON schema for validating Scrapli platform definition files. This schema defines the structure and types for properties like prompt patterns, modes, and instructions. ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "PlatformDefinition", "type": "object", "properties": { "prompt_pattern": { "type": "string" }, "default_mode": { "type": "string" }, "modes": { "type": "array", "items": { "$ref": "#/$defs/ModeOptions" } }, "failure_indicators": { "type": ["array", "null"], "items": { "type": "array", "items": { "type": "string" } } }, "on_open_instructions": { "type": ["array", "null"], "items": { "$ref": "#/$defs/BoundOnXCallbackInstruction" } }, "on_close_instructions": { "type": ["array", "null"], "items": { "$ref": "#/$defs/BoundOnXCallbackInstruction" } }, "force_in_session_auth": { "type": ["boolean", "null"] }, "bypass_in_session_auth": { "type": ["boolean", "null"] }, "ntc_templates_platform": { "type": ["string", "null"] }, "genie_platform": { "type": ["string", "null"] } }, "required": ["prompt_pattern", "default_mode", "modes"], "$defs": { "ModeOptions": { ``` -------------------------------- ### Netconf Operations Source: https://github.com/carlmontanari/scrapli/blob/main/docs/details.md Methods for performing Netconf operations, including configuration management and data retrieval. ```APIDOC ## Raw RPC ### Description A method to send a "raw" RPC of your own creation. This allows you to use scrapli for RPCs that scrapli does not natively support, which is especially useful for subscriptions etc. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **rpc_data** (string) - Required - The XML payload of the raw RPC. ### Request Example ```python xml_payload = "" session.raw_rpc(xml_payload) ``` ### Response Details on response are not provided, but it's assumed to return the XML response from the Netconf server. ``` ```APIDOC ## Get Config ### Description Executes the get-config RPC to retrieve configuration data from a specified datastore. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **source_datastore** (string) - Optional - The datastore to retrieve configuration from (e.g., 'running', 'startup'). Defaults to 'running'. - **filter_xml** (string) - Optional - XML filter to apply to the configuration retrieval. ### Request Example ```python session.get_config(source_datastore='startup') ``` ### Response Details on response are not provided, but it's assumed to return the configuration data in XML format. ``` ```APIDOC ## Edit Config ### Description Executes the edit-config RPC to modify configuration data in a specified datastore. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **config_data** (string) - Required - The configuration data to apply, typically in XML format. - **target_datastore** (string) - Optional - The datastore to modify (e.g., 'running', 'startup'). Defaults to 'running'. - **options** (dict) - Optional - Additional options for the edit-config operation. ### Request Example ```python config_payload = "new-host" session.edit_config(config_data=config_payload, target_datastore='running') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the configuration edit. ``` ```APIDOC ## Copy Config ### Description Copies configuration from one datastore to another. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **source_datastore** (string) - Required - The datastore to copy from. - **destination_datastore** (string) - Required - The datastore to copy to. - **options** (dict) - Optional - Additional options for the copy-config operation. ### Request Example ```python session.copy_config(source_datastore='running', destination_datastore='startup') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the configuration copy. ``` ```APIDOC ## Delete Config ### Description Deletes configuration data from a specified datastore. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **target_datastore** (string) - Required - The datastore from which to delete configuration. - **options** (dict) - Optional - Additional options for the delete-config operation. ### Request Example ```python session.delete_config(target_datastore='running') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the configuration deletion. ``` ```APIDOC ## Lock ### Description Locks a given datastore to prevent concurrent modifications. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **datastore** (string) - Required - The datastore to lock. - **options** (dict) - Optional - Additional options for the lock operation. ### Request Example ```python session.lock(datastore='running') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the datastore lock. ``` ```APIDOC ## Unlock ### Description Unlocks a previously locked datastore. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **datastore** (string) - Required - The datastore to unlock. - **options** (dict) - Optional - Additional options for the unlock operation. ### Request Example ```python session.unlock(datastore='running') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the datastore unlock. ``` ```APIDOC ## Get ### Description Performs a generic get RPC against the target server. This is a versatile method for retrieving various types of data. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **filter_xml** (string) - Optional - XML filter to apply to the data retrieval. - **source_datastore** (string) - Optional - The datastore to retrieve data from. - **options** (dict) - Optional - Additional options for the get operation. ### Request Example ```python session.get(filter_xml='') ``` ### Response Details on response are not provided, but it's assumed to return the requested data in XML format. ``` ```APIDOC ## Close Session ### Description Nicely closes the NETCONF session. Typically, you don't need to call this directly as the `close` method on the session object will handle it. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters None. ### Request Example ```python session.close_session() ``` ### Response Details on response are not provided, but it's assumed to indicate the successful closure of the session. ``` ```APIDOC ## Kill Session ### Description Kills another NETCONF session. You must provide the session ID of the session to be terminated. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **session_id** (string or int) - Required - The ID of the session to kill. - **options** (dict) - Optional - Additional options for the kill-session operation. ### Request Example ```python session.kill_session("12345") ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of terminating the session. ``` ```APIDOC ## Commit ### Description Commits pending changes in a datastore. This is typically used after making modifications via `edit_config`. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **options** (dict) - Optional - Additional options for the commit operation. ### Request Example ```python session.commit() ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the commit operation. ``` ```APIDOC ## Discard ### Description Discards pending changes in a datastore. This is used to revert any uncommitted modifications. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **options** (dict) - Optional - Additional options for the discard operation. ### Request Example ```python session.discard() ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of discarding changes. ``` ```APIDOC ## Cancel Commit ### Description Cancels a pending commit operation. This is used if a commit has been initiated but not yet finalized. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **options** (dict) - Optional - Additional options for the cancel-commit operation. ### Request Example ```python session.cancel_commit() ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of canceling the commit. ``` ```APIDOC ## Validate ### Description Validates the contents of a datastore. This checks for syntactical and semantic correctness without applying the changes. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **datastore** (string) - Optional - The datastore to validate. Defaults to 'running'. - **options** (dict) - Optional - Additional options for the validate operation. ### Request Example ```python session.validate(datastore='startup') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the validation. ``` ```APIDOC ## Get Schema ### Description Fetches a schema from the server. This is useful for understanding the data model supported by the device. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **schema_format** (string) - Optional - The desired format of the schema (e.g., 'yang'). - **options** (dict) - Optional - Additional options for the get-schema operation. ### Request Example ```python session.get_schema(schema_format='yang') ``` ### Response Details on response are not provided, but it's assumed to return the requested schema in the specified format. ``` ```APIDOC ## Get Data ### Description Executes the get-data RPC to retrieve specific data from the device based on a filter. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **filter_xml** (string) - Required - XML filter specifying the data to retrieve. - **options** (dict) - Optional - Additional options for the get-data operation. ### Request Example ```python session.get_data(filter_xml='') ``` ### Response Details on response are not provided, but it's assumed to return the requested data in XML format. ``` ```APIDOC ## Edit Data ### Description Executes the edit-data RPC to modify specific data within the device's configuration. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **data_xml** (string) - Required - XML data to be applied. - **target_datastore** (string) - Optional - The datastore to modify. Defaults to 'running'. - **options** (dict) - Optional - Additional options for the edit-data operation. ### Request Example ```python session.edit_data(data_xml='test') ``` ### Response Details on response are not provided, but it's assumed to indicate the success or failure of the data edit. ``` ```APIDOC ## Action ### Description Executes an action RPC on the server. Actions are operations that do not modify configuration but perform specific tasks. ### Method Not specified, but implied to be a method call on a session object. ### Endpoint Not applicable (library method). ### Parameters - **action_xml** (string) - Required - XML payload defining the action to execute. - **options** (dict) - Optional - Additional options for the action operation. ### Request Example ```python session.action(action_xml='GigabitEthernet0/1') ``` ### Response Details on response are not provided, but it's assumed to return the result of the action. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.