X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Frspecs%2Faggregates%2Fvini%2Futils.py;h=ea36aaddeac4f7589af9e8a69f6e2555c9ac91d0;hb=3d7237fa0b5f2b4a60cb97c7fb3b6aecfd94558a;hp=c5fa4dc19b26ddadf752bf4ae8484e78c2d0c447;hpb=055366b0ce962e8fe8f332cded03b777f6b81191;p=sfa.git
diff --git a/sfa/rspecs/aggregates/vini/utils.py b/sfa/rspecs/aggregates/vini/utils.py
index c5fa4dc1..ea36aadd 100644
--- a/sfa/rspecs/aggregates/vini/utils.py
+++ b/sfa/rspecs/aggregates/vini/utils.py
@@ -7,62 +7,62 @@ default_topo_xml = """
i2atla1
i2chic1
- 1Mbit
+ 1000
i2atla1
i2hous1
- 1Mbit
+ 1000
i2atla1
i2wash1
- 1Mbit
+ 1000
i2chic1
i2kans1
- 1Mbit
+ 1000
i2chic1
i2wash1
- 1Mbit
+ 1000
i2hous1
i2kans1
- 1Mbit
+ 1000
i2hous1
i2losa1
- 1Mbit
+ 1000
i2kans1
i2salt1
- 1Mbit
+ 1000
i2losa1
i2salt1
- 1Mbit
+ 1000
i2losa1
i2seat1
- 1Mbit
+ 1000
i2newy1
i2wash1
- 1Mbit
+ 1000
i2salt1
i2seat1
- 1Mbit
+ 1000
"""
# Taken from bwlimit.py
@@ -481,7 +481,7 @@ class Topology:
return link
return None
- def nodeTopoFromRspec(self, rspec):
+ def nodeTopoFromRSpec(self, rspec):
if self.nodelinks:
raise Error("virtual topology already present")
@@ -490,11 +490,11 @@ class Topology:
for node in self.getNodes():
nodedict[node.tag] = node
- linkspecs = rspecdict['Rspec']['Request'][0]['NetSpec'][0]['LinkSpec']
+ linkspecs = rspecdict['RSpec']['Request'][0]['NetSpec'][0]['LinkSpec']
for l in linkspecs:
n1 = nodedict[l['endpoint'][0]]
n2 = nodedict[l['endpoint'][1]]
- bps = get_tc_rate(l['bw'][0])
+ bps = int(l['kbps'][0]) * 1000
self.nodelinks.append(Link(n1, n2, bps))
def nodeTopoFromSliceTags(self, slice):
@@ -542,7 +542,7 @@ class Topology:
maxbps = get_tc_rate(maxbw)
for link in self.nodelinks:
if link.bps <= 0:
- raise GeniInvalidArgument(bw, "BW")
+ raise SfaInvalidArgument(bw, "BW")
if link.bps > maxbps:
raise PermissionError(" %s requested %s but max BW is %s" %
(hrn, format_tc_rate(link.bps), maxbw))
@@ -560,12 +560,12 @@ class Topology:
"""
def toxml(self, hrn = None):
xml = """
-
+
"""
for site in self.getSites():
- if not (site.public and site.enabled):
+ if not (site.public and site.enabled and site.node_ids):
continue
xml += """
@@ -578,8 +578,8 @@ class Topology:
xml += """
%s
- %s
- """ % (node.tag, node.hostname, format_tc_rate(node.bps))
+ %s
+ """ % (node.tag, node.hostname, int(node.bps/1000))
xml += """
"""
@@ -588,8 +588,8 @@ class Topology:
%s
%s
- %s
- """ % (link.end1.name, link.end2.name, format_tc_rate(link.bps))
+ %s
+ """ % (link.end1.name, link.end2.name, int(link.bps/1000))
if hrn:
@@ -608,15 +608,15 @@ class Topology:
%s
%s
- %s
- """ % (link.end1.tag, link.end2.tag, format_tc_rate(link.bps))
+ %s
+ """ % (link.end1.tag, link.end2.tag, int(link.bps/1000))
else:
xml += default_topo_xml
xml += """
-"""
+"""
# Remove all leading whitespace and newlines
lines = xml.split("\n")