From a1f2be15e901981efbaeaacc9a331342c1d3911e Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 5 Jun 2018 15:54:18 +0200 Subject: storyboard: Bind and register server name for Ouroboros In case the experiment is done with the Ouroboros prototype, the name needs to be bound and registered on the node. --- rumba/prototypes/ouroboros.py | 28 ++++++++++++++++++++++++++++ rumba/storyboard.py | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 653f564..51f3629 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -248,6 +248,34 @@ class Experiment(mod.Experiment): logger.info("Killing IRMd...") subprocess.check_call('sudo killall -15 irmd'.split()) + def bind_program(self, node, program, name): + """ + Bind a program to a certain name on a certain node. + + :param node: The node + :param program: The binary name + :param name: Name to bind to + """ + node.execute_command('irm b prog %s name %s' % (program, name)) + + def register_name(self, node, name, layers): + """ + Bind a program to a certain name on a certain node. + + :param node: The node + :param name: Name to register + :param layers: Layers to register in. If it is None, + then it registers in all layers. + """ + cmd = 'irm r n %s ' % name + if layers is None: + cmd += 'layer \'*\'' + else: + for layer in layers: + cmd += 'layer %s ' % layer + + node.execute_command(cmd) + def destroy_dif(self, dif): for ipcp in dif.ipcps: ipcp.node.execute_command('irm i d n ' + ipcp.name) diff --git a/rumba/storyboard.py b/rumba/storyboard.py index 2f88f16..2f1c6de 100644 --- a/rumba/storyboard.py +++ b/rumba/storyboard.py @@ -41,6 +41,7 @@ import uuid import rumba.model as model import rumba.ssh_support as ssh_support import rumba.log as log +import rumba.prototypes.ouroboros as our try: from io import StringIO @@ -478,6 +479,10 @@ class Server(_SBEntity): def run(self): """Starts this server""" for node in self.nodes: + if isinstance(self.experiment, our.Experiment): + self.experiment.bind_program(node, self.ap, self.id) + self.experiment.register_name(node, self.id, None) + run_cmd = self.ap + ( (" " + self.options) if self.options is not None else "" ) @@ -591,6 +596,7 @@ class StoryBoard(_SBEntity): 'not in experiment.' % (node.name,)) self.server_apps[s.id] = s self._build_nodes_lists() + s.experiment = self.experiment def set_experiment(self, experiment): """ -- cgit v1.2.3