Table Of Contents

This Page

nepi.resources.omf package

Submodules

nepi.resources.omf.application module

class nepi.resources.omf.application.OMFApplication(ec, guid)[source]

Bases: nepi.resources.omf.omf_resource.OMFResource

Class Args :
Parameters:
  • ec (ExperimentController) – The Experiment controller
  • guid (int) – guid of the RM
add_set_hook()[source]

Initialize the hooks for OMF 5.4 only

check_deploy(cid)[source]

Check, through the mail box in the parser, if the confirmation of the creation has been received

Parameters:cid – the id of the original message
check_release(cid)[source]

Check, through the mail box in the parser, if the confirmation of the release has been received

Parameters:cid – the id of the original message
check_start(uid)[source]

Check, through the mail box in the parser, if the confirmation of the start has been received

Parameters:uid – the id of the original message
do_deploy()[source]

Deploy the RM. It means nothing special for an application for now (later it will be upload sources, ...) It becomes DEPLOYED after the topic for the application has been created

do_release()[source]

Clean the RM at the end of the experiment and release the API.

do_start()[source]

Start the RM. It means : Send Xmpp Message Using OMF protocol to execute the application.

do_stop()[source]

Stop the RM. It means : Send Xmpp Message Using OMF protocol to kill the application. State is set to STOPPED after the message is sent.

exp_id[source]
node[source]
stdin_hook(old_value, new_value)[source]

Set a hook to the stdin attribute in order to send a message at each time the value of this parameter is changed. Used ofr OMF 5.4 only

trace(name, attr='all', block=512, offset=0)[source]
valid_connection(guid)[source]

Check if the connection with the guid in parameter is possible. Only meaningful connections are allowed.

Parameters:guid (int) – Guid of RM it will be connected
Return type:Boolean

nepi.resources.omf.channel module

class nepi.resources.omf.channel.OMFChannel(ec, guid)[source]

Bases: nepi.resources.omf.omf_resource.OMFResource

Class Args :
Parameters:
  • ec (ExperimentController) – The Experiment controller
  • guid (int) – guid of the RM
  • creds (dict) – Credentials to communicate with the rm (XmppClient for OMF)
ChannelToFreq = {'11': '2462', '10': '2457', '13': '2472', '12': '2467', '1': '2412', '3': '2422', '2': '2417', '5': '2432', '4': '2427', '7': '2442', '6': '2437', '9': '2452', '8': '2447'}
do_deploy()[source]

Deploy the RM. It means : Get the xmpp client and send messages using OMF 5.4 or 6 protocol to configure the channel.

do_release()[source]

Clean the RM at the end of the experiment and release the API

exp_id[source]
get_frequency(channel)[source]

Returns the frequency of a specific channel number

valid_connection(guid)[source]

Check if the connection with the guid in parameter is possible. Only meaningful connections are allowed.

Parameters:guid (int) – Guid of the current RM
Return type:Boolean

nepi.resources.omf.interface module

class nepi.resources.omf.interface.OMFWifiInterface(ec, guid)[source]

Bases: nepi.resources.omf.omf_resource.OMFResource

Class Args :
Parameters:
  • ec (ExperimentController) – The Experiment controller
  • guid (int) – guid of the RM
channel[source]
check_deploy(cid)[source]

Check, through the mail box in the parser, if the confirmation of the creation has been received

Parameters:cid – the id of the original message
check_release(cid)[source]

Check, through the mail box in the parser, if the confirmation of the release has been received

Parameters:cid – the id of the original message
configure_iface()[source]

Configure the interface without the ip

configure_ip()[source]

Configure the ip of the interface

CELL ID shraing problem. By putting th ip at the end of the configuration, each node use the same channel and can then share the same CELL ID. In the second case, the channel is defined at the end and the node don’t share a common CELL ID and can not communicate.

configure_on_omf5()[source]

Method to configure the wifi interface when OMF 5.4 is used.

configure_on_omf6()[source]

Method to configure the wifi interface when OMF 6 is used.

do_deploy()[source]

Deploy the RM. It means : Get the xmpp client and send messages using OMF 5.4 or 6 protocol to configure the interface.

do_release()[source]

Clean the RM at the end of the experiment and release the API

exp_id[source]
node[source]
valid_connection(guid)[source]

Check if the connection with the guid in parameter is possible. Only meaningful connections are allowed.

Parameters:guid (int) – Guid of the current RM
Return type:Boolean

nepi.resources.omf.messages_5_4 module

class nepi.resources.omf.messages_5_4.MessageHandler(sliceid, expid)[source]
Class Args :
Parameters:
  • sliceid – Slice Name (= Xmpp Slice)
  • expid (str) – Experiment ID (= Xmpp User)

Note

This class is used only for OMF 5.4 Protocol and is going to become unused

alias_function(name, target)[source]

Build an Alias Message

Parameters:
  • name (str) – Name of the new alias
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
configure_function(target, value, path)[source]

Build a Configure Message

Parameters:
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
  • value (int) – guid of the RM
  • path (dict) – Path of the element to configure (ex : net/w0/channel)
enroll_function(enrollkey, image, index, target)[source]

Build an Enroll Message

Parameters:
  • enrollkey (str) – Type of enrollment (= 1)
  • image (str) – Image (= * when all the nodes are concerned)
  • index (str) – Index (= 1 in general)
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
execute_function(target, appid, cmdlineargs, path, env)[source]

Build an Execute Message

Parameters:
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
  • appid (str) – Application id
  • cmdlineargs (str) – Arguments of the application
  • path (str) – Path of the application
  • env (str) – Environment variables
exit_function(target, appid)[source]

Build an Exit Message

Parameters:
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
  • appid (str) – Application id (ex : vlc#1)
log_function(level, logger, level_name, data)[source]

Build a Log Message

Parameters:
  • level (str) – Level of logging
  • logger (str) – Element publishing the log
  • level_name (str) – Name of the level (ex : INFO)
  • data (str) – Content to publish
newexp_function(experimentid, address)[source]

Build a NewExp Message

Parameters:
  • experimentid (str) – Id of the new experiment
  • address (str) – Adress of the destination set of nodes
noop_function(target)[source]

Build a Noop Message

Parameters:target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
stdin_function(target, value, appid)[source]

Build an Execute Message

Parameters:
  • value (str) – parameter that go in the stdin
  • target (str) – Hrn of the target node (ex : omf.plexus.wlab17)
  • appid (str) – Application id

nepi.resources.omf.messages_6 module

class nepi.resources.omf.messages_6.MessageHandler[source]
Class Args :
Parameters:
  • sliceid – Slice Name (= Xmpp Slice)
  • expid (str) – Experiment ID (= Xmpp User)

Note

This class is used only for OMF 5.4 Protocol and is going to become unused

configure_function(msg_id, src, timestamp, props=None, guards=None)[source]

Build a configure message

Parameters:
  • msg_id (str) – Id of the message
  • src (str) – Src node that send the message (jabber source)
  • timestamp (str) – Unix Timestamp
  • props (list) – List of properties
  • guards (list) – list of guards (assertions for properties)
create_function(msg_id, src, rtype, timestamp, props=None, guards=None)[source]

Build a create message

Parameters:
  • msg_id (str) – Id of the message
  • src (str) – Src node that send the message (jabber source)
  • rtype (str) – Type of the object
  • timestamp (str) – Unix Timestamp
  • props (list) – List of properties
  • guards (list) – list of guards (assertions for properties)
release_function(msg_id, src, timestamp, res_id=None, props=None, guards=None)[source]

Build a release message

Parameters:
  • msg_id (str) – Id of the message
  • src (str) – Src node that send the message (jabber source)
  • timestamp (str) – Unix Timestamp
  • res_id (str) – Id of the release resource
  • props (list) – List of properties
  • guards (list) – list of guards (assertions for properties)
request_function(msg_id, src, timestamp, props=None, guards=None)[source]

Build a request message

Parameters:
  • msg_id (str) – Id of the message
  • src (str) – Src node that send the message (jabber source)
  • timestamp (str) – Unix Timestamp
  • props (list) – List of properties
  • guards (list) – list of guards (assertions for properties)

nepi.resources.omf.node module

class nepi.resources.omf.node.OMFNode(ec, guid)[source]

Bases: nepi.resources.omf.omf_resource.OMFResource

Class Args :
Parameters:
  • ec (ExperimentController) – The Experiment controller
  • guid (int) – guid of the RM
  • creds (dict) – Credentials to communicate with the rm (XmppClient for OMF)
do_deploy()[source]

Deploy the RM. It means : Send Xmpp Message Using OMF protocol to enroll the node into the experiment.

do_release()[source]

Clean the RM at the end of the experiment by unenrolling the node from the topic

exp_id[source]
valid_connection(guid)[source]

Check if the connection with the guid in parameter is possible. Only meaningful connections are allowed.

Parameters:guid (int) – Guid of the current RM
Return type:Boolean

nepi.resources.omf.omf5_api module

class nepi.resources.omf.omf5_api.OMF5API(host, slice, port, password, xmpp_root=None, exp_id=None)[source]

Bases: nepi.util.logger.Logger

Class Args :
Parameters:
  • host (str) – Xmpp Server
  • slice (str) – Xmpp Slice
  • port (str) – Xmpp Port
  • password (str) – Xmpp password
  • xmpp_root (str) – Root of the Xmpp Topic Architecture

Note

This class is the implementation of an OMF 5.4 API. Since the version 5.4.1, the Topic Architecture start with OMF_5.4 instead of OMF used for OMF5.3

configure(hostname, attribute, value)[source]

Configure attribute on the node

Parameters:
  • hostname (str) – Full hrn of the node
  • attribute (str) – Attribute that need to be configured ( often written as /net/wX/attribute, with X the interface number)
  • value (str) – Value of the attribute
delete(hostname)[source]

Delete the topic corresponding to the hostname for this session

Parameters:hostname (str) – Full hrn of the node
disconnect()[source]

Delete the session and logger topics. Then disconnect

enroll_host(hostname)[source]
Create and Subscribe to the session topic and the resources
corresponding to the hostname
Parameters:hostname (str) – Full hrn of the node
execute(hostname, app_id, arguments, path, env)[source]

Execute command on the node

Parameters:
  • hostname (str) – Full hrn of the node
  • app_id (str) – Application Id (Any id that represents in a unique way the application)
  • arguments (str) – Arguments of the application
  • path (str) – Path of the application
  • env (str) – Environnement values for the application
exit(hostname, app_id)[source]

Kill an application started with OMF

Parameters:
  • hostname (str) – Full hrn of the node
  • app_id (str) – Application Id of the application you want to stop
release(hostname)[source]

Delete the session and logger topics. Then disconnect

send_stdin(hostname, value, app_id)[source]

Send to the stdin of the application the value

Parameters:
  • hostname (str) – Full hrn of the node
  • appid (str) – Application Id (Any id that represents in a unique way the application)
  • value (str) – parameter to execute in the stdin of the application

nepi.resources.omf.omf6_api module

class nepi.resources.omf.omf6_api.OMF6API(server, user='nepi', port='5222', password='1234', exp_id=None)[source]

Bases: nepi.util.logger.Logger

Class Args :
Parameters:
  • server (str) – Xmpp Server
  • user (str) – Xmpp User
  • port (str) – Xmpp Port
  • password (str) – Xmpp password
  • xmpp_root (str) – Root of the Xmpp Topic Architecture

Note

This class is the implementation of an OMF 5.4 API. Since the version 5.4.1, the Topic Architecture start with OMF_5.4 instead of OMF used for OMF5.3

check_mailbox(itype, attr)[source]

Check the mail box

Parameters:
  • itype (str) – type of mail
  • attr (str) – value wanted
check_ready(xmpp)[source]
create_and_enroll_topic(topic)[source]
Create and Subscribe to the session topic and the resources
corresponding to the hostname
Parameters:hostname (str) – Full hrn of the node
disconnect()[source]

Delete the session and logger topics. Then disconnect

enroll_topic(topic)[source]

Create and Subscribe to the session topic and the resources corresponding to the hostname

frcp_configure(topic, props=None, guards=None)[source]

Publish a configure message

frcp_create(msg_id, topic, rtype, props=None, guards=None)[source]

Publish a create message

frcp_inform(topic, cid, itype)[source]

Publish an inform message

frcp_release(msg_id, parent, child, res_id=None, props=None, guards=None)[source]

Publish a release message

frcp_request(topic, props=None, guards=None)[source]

Execute command on the node

unenroll_topic(topic)[source]

Create and Subscribe to the session topic and the resources corresponding to the hostname

nepi.resources.omf.omf6_parser module

class nepi.resources.omf.omf6_parser.OMF6Parser[source]

Bases: nepi.util.logger.Logger

Class Args :
Parameters:
  • jid (str) – Jabber Id (= Xmpp Slice + Date)
  • password (str) – Jabber Password (= Xmpp Password)

Note

This class is an XMPP Client with customized method

check_mailbox(itype, attr)[source]

Check the mail box

Parameters:
  • itype (str) – type of mail
  • attr (str) – value wanted
handle(iq)[source]

Check the mail box

Parameters:iq – message received
init_mailbox()[source]

nepi.resources.omf.omf_api_factory module

class nepi.resources.omf.omf_api_factory.OMFAPIFactory[source]

Bases: object

Note

It allows the different RM to use the same xmpp client if they use the same credentials. For the moment, it is focused on XMPP.

classmethod create_api(version, server, user, port, password, exp_id)[source]

Create an OMF API if this one doesn’t exist yet with this credentials

Parameters:
  • version (str) – OMF Version. Either 5 or 6
  • server (str) – Xmpp Server Adress
  • user (str) – Xmpp User
  • port (str) – Xmpp Port (Default : 5222)
  • password (str) – Xmpp Password
  • exp_id (str) – Id of the experiment
classmethod get_api(version, server, user, port, password, exp_id=None)[source]

Get an OMF Api

Parameters:
  • version (str) – OMF Version. Either 5 or 6
  • server (str) – Xmpp Server Adress
  • user (str) – Xmpp User
  • port (str) – Xmpp Port (Default : 5222)
  • password (str) – Xmpp Password
  • exp_id (str) – Id of the experiment
lock = <thread.lock object at 0x7f028fc193b0>
classmethod release_api(version, server, user, port, password, exp_id=None)[source]

Release an OMF API with this credentials

Parameters:
  • version (str) – OMF Version. Either 5 or 6
  • server (str) – Xmpp Server Adress
  • user (str) – Xmpp User
  • port (str) – Xmpp Port (Default : 5222)
  • password (str) – Xmpp Password
  • exp_id (str) – Id of the experiment

nepi.resources.omf.omf_client module

class nepi.resources.omf.omf_client.BaseOMFClient(jid, password, ssl=False, plugin_config={}, plugin_whitelist=[], escape_quotes=True, sasl_mech=None)[source]

Bases: sleekxmpp.clientxmpp.ClientXMPP

class nepi.resources.omf.omf_client.OMFClient(jid, password)[source]

Bases: nepi.resources.omf.omf_client.BaseOMFClient, nepi.util.logger.Logger

Class Args :
Parameters:
  • jid (str) – Jabber Id (= Xmpp Slice + Date)
  • password (str) – Jabber Password (= Xmpp Password)

Note

This class is an XMPP Client with customized method

check_mailbox(itype, attr)[source]

Check the mail box

Parameters:
  • itype (str) – type of mail
  • attr (str) – value wanted
create(node)[source]

Create the topic corresponding to the node

Parameters:node (str) – Name of the topic, corresponding to the node (ex : omf.plexus.wlab17)
delete(node)[source]

Delete the topic corresponding to the node

Parameters:node (str) – Name of the topic, corresponding to the node (ex : omf.plexus.wlab17)
get(data)[source]

Get the item

Parameters:data (str) – data from which the items will be get back
handle_omf_message(iq)[source]

Handle published/received message

Parameters:iq (Iq Stanza) – Stanzas that is currently published/received
nodes()[source]

Get all the nodes of the Xmppp Server.

publish(data, node)[source]

Publish the data to the corresponding topic

Parameters:
  • data (str) – Data that will be published
  • node (str) – Name of the topic
purge()[source]

Purge the information in the server

ready[source]

Check if the client is ready

register(iq)[source]

Register to the Xmppp Server. This function is called directly by the sleekXmpp library

retract(data)[source]

Retract the item

Parameters:data (str) – data from which the item will be retracted
start(event)[source]

Send presence to the Xmppp Server. This function is called directly by the sleekXmpp library

subscribe(node)[source]

Subscribe to a topic

Parameters:node (str) – Name of the topic
subscriptions()[source]

Get all the subscriptions of the Xmppp Server.

unregister()[source]

Unregister from the Xmppp Server.

unsubscribe(node)[source]

Unsubscribe to a topic

Parameters:node (str) – Name of the topic

nepi.resources.omf.omf_resource module

class nepi.resources.omf.omf_resource.OMFResource(ec, guid)[source]

Bases: nepi.execution.resource.ResourceManager

Generic resource gathering XMPP credential information and common methods for OMF nodes, channels, applications, etc.

class nepi.resources.omf.omf_resource.ResourceGateway[source]

Dictionary used to set OMF gateway depending on Testbed information.

AMtoGateway = {'nitlab.inf.uth.gr': 'nitlab.inf.uth.gr', 'nicta': '??.??.??', 'am.wilab2.ilabt.iminds.be': 'ops.wilab2.ilabt.iminds.be'}
TestbedtoGateway = {'wilabt': 'ops.wilab2.ilabt.iminds.be', 'nicta': '??.??.??', 'nitos': 'nitlab.inf.uth.gr'}

nepi.resources.omf.wilabt_node module

class nepi.resources.omf.wilabt_node.WilabtSfaNode(ec, guid)[source]

Bases: nepi.resources.omf.node.OMFNode

do_deploy()[source]
do_discover()[source]

Based on the attributes defined by the user, discover the suitable node for provision.

do_provision()[source]

Add node to user’s slice and verifing that the node is functioning correctly. Check ssh, omf rc running, hostname, file system.

do_release()[source]
execute(command, sudo=False, env=None, tty=False, forward_x11=False, retry=3, connect_timeout=30, strict_host_checking=False, persistent=True, blocking=True)[source]

Notice that this invocation will block until the execution finishes. If this is not the desired behavior, use ‘run’ instead.

fail_discovery()[source]
fail_node_not_alive(host=None)[source]
fail_node_not_available(host)[source]
fail_not_enough_nodes()[source]
fail_sfaapi()[source]
sfaapi[source]

Property to instanciate the SFA API based in sfi client. For each SFA method called this instance is used.

valid_connection(guid)[source]

Module contents