X-Git-Url: http://git.onelab.eu/?p=sfa-gui.git;a=blobdiff_plain;f=SfaData.py;h=b99c56ecf019f471fe4aa03fd4423e85d96bca6a;hp=049b0d3015a651445126205b19a7fe04114d4975;hb=4c3865f7bc1d92a5598dc1d62f13b293f2d0fe9f;hpb=dd75c282952182b904fbfd26b2f87f5d39552630 diff --git a/SfaData.py b/SfaData.py index 049b0d3..b99c56e 100644 --- a/SfaData.py +++ b/SfaData.py @@ -1,5 +1,6 @@ import os -from subprocess import call +import re +from subprocess import * from sfa.util.rspecHelper import RSpec class SfaData: @@ -30,8 +31,26 @@ class SfaData: def setSlice(self, slice): SfaData.slice = slice - def getRecord(self): - pass + def getRecord(self, hrn): + text = Popen(["sfi.py", "-u", self.getUser(), "-a", + self.getAuthority(), "-r", self.registry, + "-s", self.slicemgr, "show", hrn], + stdout=PIPE).communicate()[0] + return text + + def listChildren(self, hrn): + children = [] + text = Popen(["sfi.py", "-u", self.getUser(), "-a", + self.getAuthority(), "-r", self.registry, + "-s", self.slicemgr, "list", hrn], + stdout=PIPE).communicate()[0] + lines = text.split('\n') + for line in lines: + if line: + (hrn, kind) = line.split() + children.append((hrn, kind)) + + return children def getRSpec(self): slice = self.getSlice()