Routed Network module

rapyuta.io implements various features for automatically linking different deployments, and hence, aid software composition. It implements a dedicated communication plane for ROS.

Routed network is a rapyuta.io resource to enable ROS communication between different ROS package deployments. Binding a routed network resource to your deployment will enable other deployments on the same routed network to consume ROS topics/services/actions as defined in the package. Data flow occurs only when another package chooses to subscribe to a topic, call a service or call an action.

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_cloud_routed_network(name, ros_distro, shared, parameters=None)

Create a routed network

Parameters
  • name (str) – Name of the routed network.

  • ros_distro (enum ROSDistro) – ros ditro of the runtime.

  • shared (bool) – Whether the network should be shared.

  • parameters (Parameters) – parameters of the routed network

Returns

Instance of RoutedNetwork class.

Following example demonstrates how to create a routed network.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.package import ROSDistro
>>> from rapyuta_io.clients.routed_network import Parameters, RoutedNetworkLimits
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> parameters = Parameters(RoutedNetworkLimits.SMALL)
>>> routed_network = client.create_cloud_routed_network('network_name', ROSDistro.KINETIC, True,
...                                                        parameters=parameters)
create_device_routed_network(name, ros_distro, shared, device, network_interface, restart_policy=RestartPolicy.Always)

Create a routed network

Parameters
  • name (str) – Name of the routed network.

  • ros_distro (enum ROSDistro) – ros ditro of the runtime.

  • shared (bool) – Whether the network should be shared.

  • device (Instance of Device class.) – device on which the routed network is deployed.

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

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

Returns

Instance of RoutedNetwork class.

Following example demonstrates how to create a routed network.

>>> from rapyuta_io import Client
>>> from rapyuta_io.clients.package import ROSDistro
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.create_device_routed_network('network_name',
>>>                                                      ROSDistro.KINETIC, True)
delete_routed_network(network_guid)

Delete a routed network using its network_guid

Parameters

network_guid (str) – Routed Network GUID

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

List routed network

Returns

List instance of RoutedNetwork class.

get_routed_network(network_guid)

Get routed network for the guid

Parameters

network_guid (str) – guid of routed network

Returns

Instance of RoutedNetwork class.

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.get_routed_network(network_guid)

Routed Network Module

class Parameters(limits=None)

Parameters represents Routed Network Parameters

Variables

limits (RoutedNetworkLimits) – Values corresponding to limits of the parameters

Parameters

limits (RoutedNetworkLimits) – Values corresponding to limits of the parameters

class RoutedNetwork(*args, **kwargs)

RoutedNetwork represents Routed 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 RoutedNetwork.

  • guid (str) – GUID

  • runtime (Runtime) – Runtime of RoutedNetwork

  • rosDistro (ROSDistro) – ROSDistro of RoutedNetwork

  • shared (bool) – Whether the network can be shared.

  • parameters (Parameters) – parameters of the routed network

  • phase (DeploymentPhaseConstants) – Deployment phase

  • status (DeploymentStatusConstants) – (full-only) Deployment status

  • error_code – Deployment errors

  • internalDeploymentGUID (str) – guid of the internal deployment

  • internalDeploymentStatus (InternalDeploymentStatus) – Internal deployment status of the routed network. Has attributes: phase, status (full-only), and errors.

  • ownerProject (str) – Owner project guid.

  • creator (str) – Creator user guid.

  • CreatedAt (str) – Date of creation.

  • UpdatedAt (str) – Date of updation.

  • DeletedAt (str) – Date of deletion.

delete()

Delete the routed network using the routed network object.

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

>>> from rapyuta_io import Client
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> routed_network = client.get_routed_network(network_guid='network_guid')
>>> routed_network.delete()
poll_routed_network_till_ready(retry_count=120, sleep_interval=5)

Wait for the routed 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_routed_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")
>>> routed_network = client.get_routed_network('network-guid')
>>> try:
...     network_status = routed_network.poll_routed_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 InternalDeploymentStatus(phase, status=None, error_code=None)

InternalDeploymentStatus represents Internal Deployment Status.

Variables
Parameters