libsolace.items.SolaceVPN module

class libsolace.items.SolaceVPN.SolaceVPN[source]

Manage a Solace VPN

If vpn_name is passed as a kwarg, this plugin enters provision/batch mode, if it is omitted, the plugin will go into single query mode.

In provision/batch mode, this plugin generates all the neccesary SEMP requests to create a VPN. You also need to pass a owner_name and a existing acl_profile name. If these are omitted, the vpn_name property is used.

In single query mode, this plugin creates single SEMP requests, you need only pass a SolaceAPI into api, or invoke via SolaceAPI(“dev”).manage(“SolaceVPN”)

Parameters:
  • api (SolaceAPI) – The instance of SolaceAPI if not called from SolaceAPI.manage
  • vpn_name (str) – name of the VPN to scope the ACL to
Return type:

SolaceVPN

Query/Single Mode Example Direct Access:

>>> import libsolace.settingsloader as settings
>>> import libsolace
>>> from libsolace.SolaceAPI import SolaceAPI
>>> clazz = libsolace.plugin_registry("SolaceVPN", settings=settings)
>>> api = SolaceAPI("dev")
>>> solaceVpnPlugin = clazz(settings=settings, api=api)
>>> solaceVpnPlugin.get(vpn_name="default")

Provision/Batch Mode Example via SolaceAPI

>>> api = SolaceAPI("dev")
>>> vpn = api.manage("SolaceVPN", vpn_name="my_vpn", owner_name="someuser", acl_profile="default", max_spool_usage=1024)
>>> for req in vpn.commands.commands:
>>>    api.rpc(str(req[0]), **req[1])
api = 'None'
clear_radius(*args, **kwargs)[source]

Clears radius authentication mechanism

param vpn_name:The name of the VPN
type vpn_name:str
return:tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> tuple_request = api.manage("SolaceVPN").clear_radius(vpn_name="my_vpn")
>>> api.rpc(tuple_request)

Example 2:

>>> api = SolaceAPI("dev")
>>> api.rpc(api.manage("SolaceVPN").clear_radius(vpn_name="my_vpn"))
create_vpn(*args, **kwargs)[source]

New VPN SEMP Request generator.

Parameters:vpn_name (str) – The name of the VPN
Returns:tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> tuple_request = api.manage("SolaceVPN").create_vpn(vpn_name="my_vpn")
>>> api.rpc(tuple_request)

Example2:

>>> api = SolaceAPI("dev")
>>> api.rpc(api.manage("SolaceVPN").create_vpn(vpn_name="my_vpn"))
default_settings = {'max_spool_usage': 4096, 'large_message_threshold': 4096}
enable_vpn(*args, **kwargs)[source]

Enable a VPN

Parameters:vpn_name (str) – The name of the VPN
Returns:tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> request_tuple = api.manage("SolaceVPN").enable_vpn(vpn_name="my_vpn")
>>> api.rpc(request_tuple)
get(**kwargs)[source]

Returns a VPN from the appliance immediately. This method calls the api instance so it MUST be referenced through the SolaceAPI instance, or passed a api kwarg.

Parameters:
  • vpn_name (str) – The name of the VPN
  • detail (bool) – return details
Returns:

dict

Example:

>>> api = SolaceAPI("dev")
>>> dict_vpn = api.manage("SolaceVPN").get(vpn_name="my_vpn", detail=True)
list_vpns(**kwargs)[source]

Returns a list of vpns from first / primary node only

Parameters:vpn_name (str) – the vpn_name or search pattern
Returns:

Example:

>>> api = SolaceAPI("dev")
>>> list_dict = api.manage("SolaceVPN").list_vpns(vpn_name="*")
plugin_name = 'SolaceVPN'
set_internal_auth(*args, **kwargs)[source]

Set authentication method to internal

Parameters:vpn_name (str) – The name of the VPN
Returns:tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> tuple_request = api.manage("SolaceVPN").set_internal_auth(vpn_name="my_vpn")
>>> api.rpc(tuple_request)
set_large_message_threshold(*args, **kwargs)[source]

Sets the large message threshold

Parameters:
  • vpn_name (str) – The name of the VPN
  • large_message_threshold (int) – size in bytes
Returns:

tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> request_tuple = api.manage("SolaceVPN").set_large_message_threshold(vpn_name="my_vpn", large_message_threshold=4096)
>>> api.rpc(request_tuple)
set_logging_tag(*args, **kwargs)[source]

Sets the VPN logging tag, default = vpn_name

Parameters:
  • vpn_name (str) – The name of the VPN
  • tag (str) – string to use in logging tag
Returns:

tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> request_tuple = api.manage("SolaceVPN").set_logging_tag(vpn_name="my_vpn", tag="my_vpn_string")
>>> api.rpc(request_tuple)
set_spool_size(*args, **kwargs)[source]

Set the maximun spool size for the VPN

Parameters:
  • vpn_name (str) – The name of the VPN
  • max_spool_usage (int) – size in mb
Returns:

tuple SEMP request and kwargs

Example:

>>> api = SolaceAPI("dev")
>>> request_tuple = api.manage("SolaceVPN").set_spool_size(vpn_name="my_vpn", max_spool_usage=4096)
>>> api.rpc(request_tuple)