Exemplo n.º 1
0
 def list_resources(self, version=None, options=None):
     logger.warning("iotlabdriver list_resources")
     if not options:
         options = {}
     aggregate = IotLABAggregate(self)
     rspec = aggregate.list_resources(version=version, options=options)
     return rspec
Exemplo n.º 2
0
 def status(self, urns, options=None):
     logger.warning("iotlabdriver status")
     aggregate = IotLABAggregate(self)
     desc = aggregate.describe(urns, version='GENI 3')
     status = {'geni_urn': desc['geni_urn'],
               'geni_slivers': desc['geni_slivers']}
     return status
Exemplo n.º 3
0
    def allocate(self, urn, rspec_string, expiration, options=None):
        """
        Allocate method submit an experiment on Iot-LAB testbed with :
            * user : get the slice user which launch request (caller_hrn)
            * reservation : get the start time and duration in RSpec leases
            * nodes : get the nodes list in RSpec leases
        If we have a request success on Iot-LAB testbed we store in SFA
        database the assocation OAR scheduler job id and slice hrn

        :param urn : slice urn
        :param rspec_string : RSpec received
        :param options : options with slice users (geni_users)
        """
        # pylint:disable=R0914

        logger.warning("iotlabdriver allocate")
        xrn = Xrn(urn)
        aggregate = IotLABAggregate(self)
        # parse rspec
        rspec = RSpec(rspec_string)

        caller_hrn = options.get('actual_caller_hrn', [])
        geni_users = options.get('geni_users', [])
        caller_user = [user for user in geni_users if
                       urn_to_hrn(user['urn'])[0] == caller_hrn][0]
        logger.warning("iotlabdriver allocate caller : %s" %
                       caller_user['email'])

        login = self._get_user_login(caller_user)
        # only if we have a user
        if login:
            nodes_list, start_time, duration = \
                self._get_experiment(rspec)
            logger.warning("iotlabdriver allocate submit OAR job :"
                           " %s %s %s %s" %
                           (xrn.hrn, start_time, duration, nodes_list))
            # [0-9A-Za-z_] with onelab.inria.test_iotlab
            exp_name = '_'.join((xrn.hrn).split('.'))
            # submit OAR job
            ret = self.shell.reserve_nodes(login,
                                           exp_name,
                                           nodes_list,
                                           start_time,
                                           duration)

            # in case of job submission success save slice and lease job
            # id association in database
            if 'id' in ret:
                self._save_db_lease(int(ret['id']),
                                    xrn.hrn)

        return aggregate.describe([xrn.get_urn()], version=rspec.version)
Exemplo n.º 4
0
 def describe(self, urns, version, options=None):
     logger.warning("iotlabdriver describe")
     if not options:
         options = {}
     aggregate = IotLABAggregate(self)
     return aggregate.describe(urns, version=version, options=options)