aggregate = Aggregate(api)
- rspec = aggregate.get_rspec(slice_xrn=xrn, version=rspec_version)
+ rspec = aggregate.get_rspec(slice_xrn=xrn, version=rspec_version, type='advertisement')
# cache the result
if caching and api.cache and not xrn:
self.prepared = True
- def get_rspec(self, slice_xrn=None, version = None):
+ def get_rspec(self, slice_xrn=None, version = None, type=None):
self.prepare()
rspec = None
rspec_version = RSpecVersion(version)
if rspec_version['type'].lower() == 'protogeni':
- rspec = PGRSpec()
+ rspec = PGRSpec(type=type)
elif rspec_version['type'].lower() == 'sfa':
rspec = SfaRSpec()
else:
version = None
namespaces = None
- def __init__(self, rspec="", namespaces={}):
+ def __init__(self, rspec="", namespaces={}, type=None):
+ self.type = type
if rspec:
self.parse_rspec(rspec, namespaces)
else:
self.create()
- def create(self, type="advertisement"):
+ def create(self):
"""
Create root element
"""
self.parse_rspec(self.template, self.namespaces)
self.xml.set('valid_until', expires_ts)
self.xml.set('generated', generated_ts)
+ if self.type:
+ self.xml.set('type', self.type)
def parse_rspec(self, rspec, namespaces={}):
"""