git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
first rough implementation of PLC_VSYS_DEFAULTS at slice-creation time
[plcapi.git]
/
PLC
/
Methods
/
SliceGetTicket.py
diff --git
a/PLC/Methods/SliceGetTicket.py
b/PLC/Methods/SliceGetTicket.py
index
33043ca
..
27c0832
100644
(file)
--- a/
PLC/Methods/SliceGetTicket.py
+++ b/
PLC/Methods/SliceGetTicket.py
@@
-8,7
+8,7
@@
from PLC.Faults import *
from PLC.Slices import Slice, Slices
from PLC.Nodes import Node, Nodes
from PLC.Persons import Person, Persons
from PLC.Slices import Slice, Slices
from PLC.Nodes import Node, Nodes
from PLC.Persons import Person, Persons
-from PLC.Slice
Attributes import SliceAttribute, SliceAttribute
s
+from PLC.Slice
Tags import SliceTag, SliceTag
s
from PLC.Methods.GetSliceTicket import GetSliceTicket
from PLC.Methods.GetSliceTicket import GetSliceTicket
@@
-96,7
+96,7
@@
class SliceGetTicket(GetSliceTicket):
nodes = Nodes(self.api, slice['node_ids']).dict()
persons = Persons(self.api, slice['person_ids']).dict()
nodes = Nodes(self.api, slice['node_ids']).dict()
persons = Persons(self.api, slice['person_ids']).dict()
- slice_
attributes = SliceAttributes(self.api, slice['slice_attribute
_ids']).dict()
+ slice_
tags = SliceTags(self.api, slice['slice_tag
_ids']).dict()
ticket = NamedTemporaryFile()
ticket = NamedTemporaryFile()
@@
-111,7
+111,7
@@
class SliceGetTicket(GetSliceTicket):
{'id': str(slice['slice_id']),
'name': unicode(slice['name']),
'expiry': unicode(int(slice['expires']))})
{'id': str(slice['slice_id']),
'name': unicode(slice['name']),
'expiry': unicode(int(slice['expires']))})
-
+
# <nodes>
xml.startElement('nodes', {})
for node_id in slice['node_ids']:
# <nodes>
xml.startElement('nodes', {})
for node_id in slice['node_ids']:
@@
-140,13
+140,13
@@
class SliceGetTicket(GetSliceTicket):
# <rspec>
xml.startElement('rspec', {})
# <rspec>
xml.startElement('rspec', {})
- for slice_
attribute_id in slice['slice_attribute
_ids']:
- if not slice_
attributes.has_key(slice_attribute
_id):
+ for slice_
tag_id in slice['slice_tag
_ids']:
+ if not slice_
tags.has_key(slice_tag
_id):
continue
continue
- slice_
attribute = slice_attributes[slice_attribute
_id]
+ slice_
tag = slice_tags[slice_tag
_id]
- name = slice_
attribute
['name']
- value = slice_
attribute
['value']
+ name = slice_
tag
['name']
+ value = slice_
tag
['value']
def kbps_to_bps(kbps):
bps = int(kbps) * 1000
def kbps_to_bps(kbps):
bps = int(kbps) * 1000
@@
-178,7
+178,7
@@
class SliceGetTicket(GetSliceTicket):
if name == 'initscript':
(attribute_name, value_name, type) = ('initscript', 'initscript_id', 'integer')
if name == 'initscript':
(attribute_name, value_name, type) = ('initscript', 'initscript_id', 'integer')
- value = slice_
attribute['slice_attribute
_id']
+ value = slice_
tag['slice_tag
_id']
elif name in name_type_cast:
(attribute_name, value_name, type, cast) = name_type_cast[name]
value = cast(value)
elif name in name_type_cast:
(attribute_name, value_name, type, cast) = name_type_cast[name]
value = cast(value)
@@
-186,7
+186,7
@@
class SliceGetTicket(GetSliceTicket):
attribute_name = value_name = name
type = "string"
attribute_name = value_name = name
type = "string"
- # <resource name="
slice_attribute
_type">
+ # <resource name="
tag
_type">
xml.startElement('resource', {'name': unicode(attribute_name)})
# <value name="element_name" type="element_type">
xml.startElement('resource', {'name': unicode(attribute_name)})
# <value name="element_name" type="element_type">
@@
-236,7
+236,7
@@
class SliceGetTicket(GetSliceTicket):
p = Popen(["xmlsec1", "--sign",
"--privkey-pem", self.api.config.PLC_API_TICKET_KEY,
ticket.name],
p = Popen(["xmlsec1", "--sign",
"--privkey-pem", self.api.config.PLC_API_TICKET_KEY,
ticket.name],
- stdin = PIPE, stdout = PIPE, stderr = PIPE)
+ stdin = PIPE, stdout = PIPE, stderr = PIPE
, close_fds = True
)
signed_ticket = p.stdout.read()
err = p.stderr.read()
rc = p.wait()
signed_ticket = p.stdout.read()
err = p.stderr.read()
rc = p.wait()