Native Network module

rapyuta.io provides a way to establish robot to robot communication without using brokered solution in a local network. The main purpose of native network is to give the same communication mechanism as present in a single shared ROS master.

Client Module

class Client(auth_token, project=None)

Client class provides access to device, package, volume and deployment classes.

__init__(auth_token, project=None)

Get new client object

Parameters
  • auth_token (string) – Authentication token

  • project (string) – project_guid of the user

create_native_network(native_network)

Creates a new native network

Parameters

native_network (NativeNetwork) – Native Network object

Return type

NativeNetwork

Following example demonstrates how to create a native network under a project
>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.native_network import NativeNetwork,Parameters,NativeNetworkLimits
>>> from rapyuta_io.clients.package import Runtime, ROSDistro
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> parameters = Parameters(NativeNetworkLimits.SMALL)
>>> native_network = NativeNetwork('native_network_name', Runtime.CLOUD, ROSDistro.KINETIC,
...                                  parameters=parameters)
>>> native_network = client.create_native_network(native_network)
delete_native_network(network_guid)

Delete a native network using its network_guid

Parameters

network_guid (str) – Native Network GUID

Following example demonstrates how to delete a native network under a project
>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.delete_native_network('network_guid')
get_native_network(network_guid)

Get a native network using its network_guid

Parameters

network_guid (str) – native network GUID

Return type

NativeNetwork

Following example demonstrates how a native network can be fetched using this method

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> native_network = client.get_native_network('network_guid')
list_native_networks()

Lists all the native networks under a project

Returns

A list of all available native networks under the Project.

Return type

List(NativeNetwork)

Following example demonstartes how to list all the native networks under a project

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> native_networks = client.list_native_networks()

Native Network Module

class NativeNetwork(name, runtime, ros_distro, parameters=None)

NativeNetwork represents native network.

Variables marked as (full-only) are only available on a full object. Use refresh() to convert a partial object into a full one.

Variables
  • name (str) – name of the native network

  • runtime (Runtime) – runtime of the native network

  • ros_distro (ROSDistro) – ROS distribution

  • parameters (Parameters) – parameters of the native network

  • created_at (str) – creation time of the native network

  • updated_at (str) – updating time of the native network

  • guid (str) – native network guid

  • owner_project (str) – project id

  • creator (str) – user id

  • internal_deployment_guid (str) – guid of the internal deployment

  • internal_deployment_status (InternalDeploymentStatus) – internal deployment status of the native network

Parameters
  • name (str) – name of the native network

  • runtime (Runtime) – runtime of the native network

  • ros_distro (ROSDistro) – ROS distribution

  • parameters (Parameters) – parameters of the native network

delete()

Delete the native network using the native network object.

Following example demonstrates how to delete a native network using native network object:

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> native_network = client.get_native_network(network_guid='network_guid')
>>> native_network.delete()
poll_native_network_till_ready(retry_count=120, sleep_interval=5)

Wait for the native network to be ready

Parameters
  • retry_count – Optional parameter to specify the retries. Default value is 120

  • sleep_interval – Optional parameter to specify the interval between retries. Default value is 5 Sec.

Returns

instance of class InternalDeploymentStatus:

Raises

APIError: If service binding api return an error, the status code is anything other than 200/201

Raises

DeploymentNotRunningException: If the deployment’s state might not progress due to errors.

Raises

RetriesExhausted: If number of polling retries exhausted before the deployment could succeed or fail.

Following example demonstrates use of poll_native_network_till_ready:

>>> from rapyuta_io import Client
>>> from rapyuta_io.utils.error import (DeploymentNotRunningException,
...     RetriesExhausted)
>>> client = Client(auth_token='auth_token', project="project_guid")
>>> native_network = client.get_native_network('network-guid')
>>> try:
...     network_status = native_network.poll_native_network_till_ready()
...     print network_status
... except RetriesExhausted as e:
...     print e, 'Retry again?'
... except DeploymentNotRunningException as e:
...     print e, e.deployment_status
refresh()

Fetches the updated resource from the server, and adds/updates object attributes based on it.

Raises

APIError: If the api returns an error, the status code is anything other than 200/201

class NativeNetworkLimits

NativeNetworkLimits may be one of:

NativeNetworkLimits.X_SMALL (cpu: 0.5core, memory: 2GB)

NativeNetworkLimits.SMALL (cpu: 1core, memory: 4GB)

NativeNetworkLimits.MEDIUM (cpu: 2cores, memory: 8GB)

NativeNetworkLimits.LARGE (cpu: 4cores, memory: 16GB)

class Parameters(limits=None, device=None, network_interface=None, restart_policy=None)

Parameters represents Native Network Parameters

Variables
  • limits (NativeNetworkLimits) – Values corresponding to limits of the parameters

  • device_id (str) – device_id of device on which the native network is deployed.

  • network_interface (str) – network interface to which native network is binded.

  • restart_policy (enum RestartPolicy) – restart policy of native network.

Parameters
  • limits (NativeNetworkLimits) – Values corresponding to limits of the parameters

  • device (Device) – device on which the native network is deployed.

  • network_interface (str) – network interface to which native network is binded.

  • restart_policy (enum RestartPolicy) – restart policy of native network.

class InternalDeploymentStatus(phase, status=None, error_code=None)

InternalDeploymentStatus represents Internal Deployment Status.

Variables
Parameters