hrn, type = urn_to_hrn(slice_xrn)
self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name))
- print >>sys.stderr, " \r\n \r\n Createsliver.py call %s\ttarget-hrn: %s\tmethod-name: %s "%(self.api.interface, hrn, self.name)
# Find the valid credentials
valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', hrn)
origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
job_id = job_id[0]
oar = OARrestapi()
- jobs = oar.parser.SendRequest("GET_reserved_nodes")
+ jobs = oar.parser.SendRequest("GET_reserved_nodes", username = 'avakian')
print "\r\n OAR GET_reserved_nodes ",jobs
raw_json = get_stuff(oar,uri)
print "\r\n OAR ",uri, raw_json, "\r\n KKK \t",raw_json.keys()
-
+ uri = '/oarapi/jobs.json?user=avakian'
+ raw_json = get_stuff(oar,uri)
+ print "\r\nOAR ", uri, raw_json, "\r\n KKK \t",raw_json.keys()
return
def TestSlabDriver(job_id):
if isinstance(job_id,list) and len(job_id) == 1:
job_id = job_id[0]
slabdriver = SlabDriver(Config())
- l = slabdriver.GetSlices(slice_filter = 'senslab2.avakian_slice', slice_filter_type = 'slice_hrn')
- print l
+ nodes = slabdriver.GetReservedNodes(username='avakian')
+ print "\r\n \r\n" ,nodes
+
l = slabdriver.GetSlices(slice_filter = '29', slice_filter_type = 'record_id_user')
- print l
+
+
+ print "\r\n \r\nGetSlices" ,l
+
+ persons = slabdriver.GetPersons()
+ print "\r\n \r\n GetPersons" ,persons
#slabdriver.DeleteJobs(job_id,'senslab2.avakian_slice')
def RunAll():
# and /etc/sfa/configs/site.xml
# into /etc/sfa/sfa_config.xml
# sudo sfa-config-tty
-sudo cp $git_local_repo/sfa/senslab/config/$vm/sfa_config /etc/sfa/sfa_config
+#
+#sudo cp $git_local_repo/sfa/senslab/config/$vm/sfa_config /etc/sfa/sfa_config
sudo cp $git_local_repo/sfa/senslab/config/$vm/sfa_config.xml /etc/sfa/sfa_config.xml
-sudo cp $git_local_repo/sfa/senslab/config/$vm/site.xml /etc/sfa/site.xml
+sudo cp $git_local_repo/sfa/senslab/config/$vm/default_config.xml /etc/sfa/default_config.xml
+# sudo cp $git_local_repo/sfa/senslab/config/$vm/site.xml /etc/sfa/site.xml
+sudo cp $git_local_repo/sfa/senslab/config/$vm/site_config /etc/sfa/configs/site_config
# sudo ln -s ldap_config.py /etc/sfa/ldap_config.py
sudo cp $git_local_repo/sfa/senslab/config/ldap_config.py /etc/sfa/ldap_config.py
sudo service sfa restart
<variablelist>
<variable id="generic_flavour" type="string">
<name>Generic Flavour</name>
- <value>pl</value>
+ <value>slab</value>
<description>This string refers to a class located in sfa.generic that describes
which specific implementation needs to be used for api, manager and driver objects.
PlanetLab users do not need to change this setting.
<variable id="interface_hrn" type="string">
<name>Human readable name</name>
- <value>plc</value>
+ <value>senslab2</value>
<description>The human readable name for this interface.</description>
</variable>
<variable id="api_loglevel" type="int">
<name>Debug</name>
- <value>0</value>
+ <value>2</value>
<description>Logging level; 0=minimum, 1=info, 2=debug</description>
</variable>
</description>
</variable>
+ <variable id="data_dir" type="string">
+ <name>Data Directory </name>
+ <value>/var/lib/sfa/</value>
+ <description>Directory where cached certficiates and other data is stored.
+ </description>
+ </variable>
+
</variablelist>
</category>
<variable id="port" type="int">
<name>Port number</name>
- <value>12345</value>
+ <value>52345</value>
<description>The port where the registry is to be found.</description>
</variable>
<variable id="root_auth" type="string">
<name>Root Authority</name>
- <value>plc</value>
+ <value>senslab2</value>
<description>The hrn of the registry's root auth.</description>
</variable>
<variable id="port" type="int">
<name>Port number</name>
- <value>12347</value>
+ <value>52347</value>
<description>The port where the slice manager is to be found.</description>
</variable>
<variable id="port" type="int">
<name>Port number</name>
- <value>12346</value>
+ <value>52346</value>
<description>The port where the aggregate is to be found.</description>
</variable>
<variable id="user" type="string">
<name>Database user</name>
- <value>sfadbuser</value>
+ <value>sfa</value>
<description>When SFA gets co-hosted with a myplc, this should match the PLC config.</description>
</variable>
<variable id="password" type="string">
<name>Database password</name>
- <value></value>
+ <value>sfa</value>
<description>When SFA gets co-hosted with a myplc, this should match the PLC config.</description>
</variable>
<value>8773</value>
<description>The Nova/EC2 API port.</description>
</variable>
+ <variable id="novarc" type="string">
+ <name>novarc</name>
+ <value>/root/novarc</value>
+ <description>Path to novarc client config file</description>
+ </variable>
</variablelist>
</category>
-#import httplib
-#import json
import time
-#from sfa.util.config import Config
from sfa.util.xrn import hrn_to_urn, urn_to_hrn, urn_to_sliver_id
from sfa.rspecs.rspec import RSpec
from sfa.rspecs.elements.granularity import Granularity
from sfa.rspecs.version_manager import VersionManager
-#from sfa.util.sfatime import datetime_to_epoch
from sfa.rspecs.elements.versions.slabv1Node import SlabNode
from sfa.util.sfalogging import logger
#and therfore, node allocated to this slice
for sfa_slice in slices:
try:
-
+
for node in sfa_slice['node_ids']:
#node_id = self.driver.root_auth + '.' + node_id
- sliver = Sliver({'sliver_id': urn_to_sliver_id(slice_urn, \
- sfa_slice['record_id_slice'], node['hostname']),
+ sliver = Sliver({'sliver_id': Xrn(slice_urn, type='slice', id=node['hostname'], authority=self.driver.hrn).urn,
'name': sfa_slice['slice_hrn'],
'type': 'slab-node',
'tags': []})
- logger.log_exc("SLABAGGREGATE \t \
- get_slice_and_slivers node_id %s "%(node))
+
slivers[node['hostname']] = sliver
except KeyError:
logger.log_exc("SLABAGGREGATE \t \
#tag_ids = []
nodes_dict = {}
for node in nodes:
- #site_ids.append(node['site_id'])
- #interface_ids.extend(node['interface_ids'])
- #tag_ids.extend(node['node_tag_ids'])
+
nodes_dict[node['node_id']] = node
# get sites
res['pl_boot_state'] = nodeall_byhostname[node['hostname']]['boot_state']
#res['pl_last_contact'] = strftime(self.time_format, \
#gmtime(float(timestamp)))
- sliver_id = urn_to_sliver_id(slice_urn, sl['record_id_slice'], \
- nodeall_byhostname[node['hostname']]['node_id'])
+ sliver_id = Xrn(slice_urn, type='slice', \
+ id=nodeall_byhostname[node['hostname']]['node_id'], \
+ authority=self.hrn).urn
+
res['geni_urn'] = sliver_id
if nodeall_byhostname[node['hostname']]['boot_state'] == 'Alive':
return slice_urns
- #No site or node register supported
+
def register (self, sfa_record, hrn, pub_key):
- record_type = sfa_record['type']
- slab_record = self.sfa_fields_to_slab_fields(record_type, hrn, \
- sfa_record)
-
-
- if record_type == 'slice':
- acceptable_fields = ['url', 'instantiation', 'name', 'description']
- for key in slab_record.keys():
- if key not in acceptable_fields:
- slab_record.pop(key)
- logger.debug("SLABDRIVER.PY register")
- slices = self.GetSlices(slice_filter=slab_record['hrn'], \
- slice_filter_type = 'slice_hrn')
- if not slices:
- pointer = self.AddSlice(slab_record)
- else:
- pointer = slices[0]['slice_id']
-
- elif record_type == 'user':
- persons = self.GetPersons([sfa_record])
- #persons = self.GetPersons([sfa_record['hrn']])
- if not persons:
- sfa_record['enabled'] = False
- #For Senslab LDAP, if the user is a new one, disable the
- #account so that admins have to acknowledge the user first.
- pointer = self.AddPerson(dict(sfa_record))
- #add in LDAP
- else:
- pointer = persons[0]['person_id']
-
- #Does this make sense to senslab ?
- #if 'enabled' in sfa_record and sfa_record['enabled']:
- #self.UpdatePerson(pointer, \
- #{'enabled': sfa_record['enabled']})
-
- #TODO register Change this AddPersonToSite stuff 05/07/2012 SA
- #No site in senslab 28/08/12 SA
-
-
- # What roles should this user have?
- #No user roles in Slab/SFA 28/08/12 SA: roles are handled in LDAP
- # Add the user's key
- if pub_key:
- self.AddPersonKey(pointer, {'key_type' : 'ssh', \
- 'key' : pub_key})
-
- #No node adding outside OAR
-
- return pointer
+ """
+ Adding new user, slice, node or site should not be handled
+ by SFA.
+
+ Adding nodes = OAR
+ Adding users = LDAP Senslab
+ Adding slice = Import from LDAP users
+ Adding site = OAR
+ """
+ return -1
#No site or node record update allowed
def update (self, old_sfa_record, new_sfa_record, hrn, new_key):