from sfa.rspecs.elements.versions.pgv2Services import PGv2Services
from sfa.rspecs.elements.versions.pgv2SliverType import PGv2SliverType
from sfa.rspecs.elements.versions.pgv2Interface import PGv2Interface
+from sfa.rspecs.elements.granularity import Granularity
from sfa.planetlab.plxrn import xrn_to_hostname
# set location
if node.get('location'):
node_elem.add_instance('location', node['location'], Location.fields)
+
+ # set granularity
+ if node['exclusive'] == "true":
+ granularity = node.get('granularity')
+ node_elem.add_instance('granularity', granularity, granularity.fields)
# set interfaces
PGv2Interface.add_interfaces(node_elem, node.get('interfaces'))
#if node.get('interfaces'):
if len(locations) > 0:
node['location'] = locations[0]
+ # get granularity
+ granularity_elems = node_elem.xpath('./default:granularity | ./granularity')
+ if len(granularity_elems) > 0:
+ node['granularity'] = granularity_elems[0].get_instance(Granularity)
+
# get interfaces
iface_elems = node_elem.xpath('./default:interface | ./interface')
node['interfaces'] = [iface_elem.get_instance(Interface) for iface_elem in iface_elems]