waft.warp_client.cli.warp_cli_base module

class waft.warp_client.cli.warp_cli_base.WarpCliBase(node: BaseNode)

Bases: ABC

Base class for warp cli functionality

connect() dict

Run connect command

debug_pcap_start(interface: Iterable[str] | None = None, time_limit: int | None = None, size_limit: int | None = None, packet_size: int | None = None, **kwargs)

Submit warp-cli debug pcap start command

Parameters:
  • interface – Network interfaces to capture packets from. Specify this option multiple times to capture from multiple interfaces. Use “_tun” as a shortcut for the tunnel interface and “_default” for the default network interface.

  • time_limit – Time limit for pcap capture in min (default 5min)

  • size_limit – Size limit for pcap capture in mb (default 5mb)

  • packet_size – Packet size for pcap capture in bytes (default 160b)

  • **kwargs – Additional keyword arguments for the run_command method

debug_pcap_stop(**kwargs) Result

Submit warp-cli debug pcap stop command

debug_posture() list[DevicePostureRuleResult]

Submit warp-cli debug posture command

disconnect(**kwargs) dict

Run disconnect command

mdm_get_configs() dict

Run mdm get-configs to see what mdm config is applied

mdm_set_config(config_name: str) dict

Run mdm set-config to select config from MDM :param config_name: name of config from MDM to select

mode(mode: WarpModes, **kwargs) str

Set the warp mode in the cli

override_local_network_show() dict

Submit admin override code

override_show() dict

Show current override information

override_unlock(override_code: str) dict

Submit admin override code

registration_delete(**kwargs) dict

Run registration delete cli command

Parameters:

**kwargs – Additional keyword arguments for the run_command method

registration_devices() dict

Run registration devices cli command

registration_new(org_name: str | None = None) str

Run registration new cli command

registration_organization() dict

Run registration organization cli command

registration_show(**kwargs) dict

Run registration show cli command

registration_token(token: str, **kwargs) dict

Run registration token cli command

Parameters:
  • token – Token string to register

  • **kwargs – Additional keyword arguments for the run_command method

Returns:

String output (or error if auto_raise set to False) from token registration

run_command(command_parts: list, accept_tos: bool = True, json_fmt: bool = True, sudo: bool = False, auto_raise: bool = True, timeout: int | None = 15) Result

Executes a WARP CLI command with an option to automatically accept the terms of service.

This method constructs and executes a WARP CLI command on a remote node. If the accept_tos flag is set to True, the –accept-tos flag is prepended to the command, ensuring that the terms of service are accepted automatically when the command is executed.

Parameters:
  • command_parts (list) – A list of command components to be passed to the WARP CLI.

  • accept_tos (bool) – A flag to indicate whether to automatically accept the terms of service

  • json_fmt (bool) – A flag to indicate whether to request json output from the command

  • True). ((default is)

  • sudo – If set to True warp-cli command will be run using sudo

  • auto_raise – If set to True, error will be raised on non-zero return status for warp-cli command

  • timeout – Command timeout in seconds. Defaults to 5 seconds.

Returns:

The result object from fabric

Return type:

Result

settings_list() dict

Run settings list cli command

settings_mode_switch_allowed() bool

Run settings mode-switch-allowed cli command

settings_reset() dict

Run settings reset cli command

settings_support_url() dict

Run settings support-url cli command

status() WarpCliStatus

Run status command

tunnel_ip_add(ip: str | IPv4Address | IPv6Address) dict

Add an ip address to tunnel via warp cli :param ip: Valid ipv4 or ipv6 address

Returns: Response from cli

tunnel_ip_list() dict

Run tunnel ip list to get a list of ips in the tunnel

tunnel_ip_remove(ip: str | IPv4Address | IPv6Address) dict

Remove an ip address from tunnel :param ip: Valid ipv4 or ipv6 address

Returns: Response from cli

tunnel_protocol_set(protocol: WarpProtocols)

Run tunnel protocol set <protocol> with the given protocol type input :param protocol: Protocol to set tunnel to use

version() str

Run version command

vnet(vnet_name: str | None = None) dict

Run vnet cli command