git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
renamed create_slice into CreateSliver on the managers side
[sfa.git]
/
sfa
/
managers
/
aggregate_manager_max.py
diff --git
a/sfa/managers/aggregate_manager_max.py
b/sfa/managers/aggregate_manager_max.py
index
14168a0
..
f289e7d
100644
(file)
--- a/
sfa/managers/aggregate_manager_max.py
+++ b/
sfa/managers/aggregate_manager_max.py
@@
-1,9
+1,13
@@
#!/usr/bin/python
#!/usr/bin/python
-from sfa.util.rspec import RSpec
import sys
import pdb
import sys
import pdb
-from sfa.util.namespace import *
+import xml.dom.minidom
+
+from sfa.util.rspec import RSpec
+from sfa.util.xrn import urn_to_hrn, hrn_to_urn, get_authority
+from sfa.util.plxrn import hrn_to_pl_slicename
+from sfa.util.plxrn import hrn_to_pl_slicename
from sfa.util.rspec import *
from sfa.util.specdict import *
from sfa.util.faults import *
from sfa.util.rspec import *
from sfa.util.specdict import *
from sfa.util.faults import *
@@
-12,8
+16,8
@@
from sfa.util.policy import Policy
from sfa.server.aggregate import Aggregates
from sfa.server.registry import Registries
from sfa.util.faults import *
from sfa.server.aggregate import Aggregates
from sfa.server.registry import Registries
from sfa.util.faults import *
+from sfa.util.callids import Callids
-import xml.dom.minidom
SFA_MAX_CONF_FILE = '/etc/sfa/max_allocations'
SFA_MAX_DEFAULT_RSPEC = '/etc/sfa/max_physical.xml'
SFA_MAX_CONF_FILE = '/etc/sfa/max_allocations'
SFA_MAX_DEFAULT_RSPEC = '/etc/sfa/max_physical.xml'
@@
-146,7
+150,8
@@
def create_slice_max_aggregate(api, hrn, nodes):
registries = Registries(api)
registry = registries[api.hrn]
credential = api.getCredential()
registries = Registries(api)
registry = registries[api.hrn]
credential = api.getCredential()
- records = registry.resolve(credential, hrn)
+ urn = hrn_to_urn(hrn, 'slice')
+ records = registry.Resolve(urn, credential)
for record in records:
if record.get_type() in ['slice']:
slice = record.as_dict()
for record in records:
if record.get_type() in ['slice']:
slice = record.as_dict()
@@
-163,7
+168,8
@@
def create_slice_max_aggregate(api, hrn, nodes):
sites = api.plshell.GetSites(api.plauth, [login_base])
if not sites:
authority = get_authority(hrn)
sites = api.plshell.GetSites(api.plauth, [login_base])
if not sites:
authority = get_authority(hrn)
- site_records = registry.resolve(credential, authority)
+ authority_urn = hrn_to_urn(authority, 'authority')
+ site_records = registry.Resolve(authority_urn, credential)
site_record = {}
if not site_records:
raise RecordNotFound(authority)
site_record = {}
if not site_records:
raise RecordNotFound(authority)
@@
-192,7
+198,8
@@
def create_slice_max_aggregate(api, hrn, nodes):
researchers = record.get('researcher', [])
for researcher in researchers:
person_record = {}
researchers = record.get('researcher', [])
for researcher in researchers:
person_record = {}
- person_records = registry.resolve(credential, researcher)
+ researcher_urn = hrn_to_urn(researcher, 'user')
+ person_records = registry.Resolve(researcher_urn, credential)
for record in person_records:
if record.get_type() in ['user']:
person_record = record
for record in person_records:
if record.get_type() in ['user']:
person_record = record
@@
-247,9
+254,10
@@
def create_slice_max_aggregate(api, hrn, nodes):
return 1
return 1
-def get_rspec(api, creds, options):
+def ListResources(api, creds, options, call_id):
+ if Callids().already_handled(call_id): return ""
# get slice's hrn from options
# get slice's hrn from options
- xrn = options.get('geni_slice_urn',
None
)
+ xrn = options.get('geni_slice_urn',
''
)
hrn, type = urn_to_hrn(xrn)
# Eg. config line:
# plc.princeton.sapan vlan23,vlan45
hrn, type = urn_to_hrn(xrn)
# Eg. config line:
# plc.princeton.sapan vlan23,vlan45
@@
-263,7
+271,9
@@
def get_rspec(api, creds, options):
return (ret_rspec)
return (ret_rspec)
-def create_slice(api, xrn, creds, rspec_xml, users):
+def CreateSliver(api, xrn, creds, rspec_xml, users, call_id):
+ if Callids().already_handled(call_id): return False
+
global topology
hrn = urn_to_hrn(xrn)[0]
topology = get_interface_map()
global topology
hrn = urn_to_hrn(xrn)[0]
topology = get_interface_map()
@@
-327,8
+337,8
@@
def main():
t = get_interface_map()
r = RSpec()
rspec_xml = open(sys.argv[1]).read()
t = get_interface_map()
r = RSpec()
rspec_xml = open(sys.argv[1]).read()
- #
get_rspec
(None,'foo')
-
create_slice(None, "plc.princeton.sap0", rspec_xml
)
+ #
ListResources
(None,'foo')
+
CreateSliver(None, "plc.princeton.sap0", rspec_xml, 'call-id-sap0'
)
if __name__ == "__main__":
main()
if __name__ == "__main__":
main()