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
Merge branch 'thgeneric' of ssh://git.onelab.eu/git/sfa into thgeneric
[sfa.git]
/
sfa
/
plc
/
network.py
diff --git
a/sfa/plc/network.py
b/sfa/plc/network.py
index
c84ffa5
..
e97565c
100644
(file)
--- a/
sfa/plc/network.py
+++ b/
sfa/plc/network.py
@@
-6,8
+6,7
@@
from StringIO import StringIO
from lxml import etree
from xmlbuilder import XMLBuilder
from lxml import etree
from xmlbuilder import XMLBuilder
-from sfa.util.faults import *
-#from sfa.util.sfalogging import sfa_logger
+from sfa.util.faults import InvalidRSpec
from sfa.util.xrn import get_authority
from sfa.util.plxrn import hrn_to_pl_slicename, hostname_to_urn
from sfa.util.xrn import get_authority
from sfa.util.plxrn import hrn_to_pl_slicename, hostname_to_urn
@@
-283,12
+282,11
@@
class Slicetag:
def write(self, api):
if self.was_added():
def write(self, api):
if self.was_added():
- api.plshell.AddSliceTag(api.plauth, self.slice_id,
- self.tagname, self.value, self.node_id)
+ api.driver.AddSliceTag(self.slice_id, self.tagname, self.value, self.node_id)
elif self.was_changed():
elif self.was_changed():
- api.
plshell.UpdateSliceTag(api.plauth,
self.id, self.value)
+ api.
driver.UpdateSliceTag(
self.id, self.value)
elif self.was_deleted():
elif self.was_deleted():
- api.
plshell.DeleteSliceTag(api.plauth,
self.id)
+ api.
driver.DeleteSliceTag(
self.id)
class TagType:
class TagType:
@@
-474,6
+472,10
@@
class Network:
if not relaxng(tree):
error = relaxng.error_log.last_error
message = "%s (line %s)" % (error.message, error.line)
if not relaxng(tree):
error = relaxng.error_log.last_error
message = "%s (line %s)" % (error.message, error.line)
+ self.api.logger.error("failed to validate rspec %r"%message)
+ self.api.logger.debug("---------- XML input BEG")
+ self.api.logger.debug(xml)
+ self.api.logger.debug("---------- XML input END")
raise InvalidRSpec(message)
self.rspec = rspec
raise InvalidRSpec(message)
self.rspec = rspec
@@
-557,7
+559,7
@@
class Network:
Create a dictionary of site objects keyed by site ID
"""
tmp = []
Create a dictionary of site objects keyed by site ID
"""
tmp = []
- for site in api.
plshell.GetSites(api.plauth,
{'peer_id': None}):
+ for site in api.
driver.GetSites(
{'peer_id': None}):
t = site['site_id'], Site(self, site)
tmp.append(t)
return dict(tmp)
t = site['site_id'], Site(self, site)
tmp.append(t)
return dict(tmp)
@@
-568,7
+570,7
@@
class Network:
Create a dictionary of node objects keyed by node ID
"""
tmp = []
Create a dictionary of node objects keyed by node ID
"""
tmp = []
- for node in api.
plshell.GetNodes(api.plauth,
{'peer_id': None}):
+ for node in api.
driver.GetNodes(
{'peer_id': None}):
try:
t = node['node_id'], Node(self, node)
tmp.append(t)
try:
t = node['node_id'], Node(self, node)
tmp.append(t)
@@
-582,7
+584,7
@@
class Network:
Create a dictionary of node objects keyed by node ID
"""
tmp = []
Create a dictionary of node objects keyed by node ID
"""
tmp = []
- for iface in api.
plshell.GetInterfaces(api.plauth
):
+ for iface in api.
driver.GetInterfaces(
):
t = iface['interface_id'], Iface(self, iface)
tmp.append(t)
return dict(tmp)
t = iface['interface_id'], Iface(self, iface)
tmp.append(t)
return dict(tmp)
@@
-592,7
+594,7
@@
class Network:
Create a dictionary of slicetag objects keyed by slice tag ID
"""
tmp = []
Create a dictionary of slicetag objects keyed by slice tag ID
"""
tmp = []
- for tag in api.
plshell.GetSliceTags(api.plauth,
{'~tagname':Slicetag.ignore_tags}, Slicetag.filter_fields):
+ for tag in api.
driver.GetSliceTags(
{'~tagname':Slicetag.ignore_tags}, Slicetag.filter_fields):
t = tag['slice_tag_id'], Slicetag(tag)
tmp.append(t)
return dict(tmp)
t = tag['slice_tag_id'], Slicetag(tag)
tmp.append(t)
return dict(tmp)
@@
-602,7
+604,7
@@
class Network:
Create a list of tagtype obects keyed by tag name
"""
tmp = []
Create a list of tagtype obects keyed by tag name
"""
tmp = []
- for tag in api.
plshell.GetTagTypes(api.plauth,
{'~tagname':TagType.ignore_tags}):
+ for tag in api.
driver.GetTagTypes(
{'~tagname':TagType.ignore_tags}):
t = tag['tagname'], TagType(tag)
tmp.append(t)
return dict(tmp)
t = tag['tagname'], TagType(tag)
tmp.append(t)
return dict(tmp)
@@
-612,7
+614,7
@@
class Network:
Return a Slice object for a single slice
"""
slicename = hrn_to_pl_slicename(hrn)
Return a Slice object for a single slice
"""
slicename = hrn_to_pl_slicename(hrn)
- slice = api.
plshell.GetSlices(api.plauth,
[slicename])
+ slice = api.
driver.GetSlices(
[slicename])
if len(slice):
self.slice = Slice(self, slicename, slice[0])
return self.slice
if len(slice):
self.slice = Slice(self, slicename, slice[0])
return self.slice