Commit b0fde63d authored by David Johnson's avatar David Johnson
Browse files

Change some slice attributes stuff.

parent 3ad1910a
...@@ -370,12 +370,17 @@ class PLCagent: ...@@ -370,12 +370,17 @@ class PLCagent:
def AuthCheck(self): def AuthCheck(self):
return self.__server.AuthCheck(self.auth) return self.__server.AuthCheck(self.auth)
def SliceAddAttribute(self,attrname,attrvalue): def SliceAddAttribute(self,attrname,attrvalue,node=None):
if attrname == None or attrvalue == None \ if attrname == None or attrvalue == None \
or attrname == '' or attrvalue == '': or attrname == '' or attrvalue == '':
return 0 return 0
return self.__server.AddSliceAttribute(self.auth,self.slicename, if node:
attrname,attrvalue) return self.__server.AddSliceAttribute(self.auth,self.slicename,
attrname,attrvalue,node)
else:
return self.__server.AddSliceAttribute(self.auth,self.slicename,
attrname,attrvalue)
pass
def SiteAdd(self,name,url,longitude,latitude): def SiteAdd(self,name,url,longitude,latitude):
return self.__server.AddSite(self.auth, return self.__server.AddSite(self.auth,
...@@ -733,6 +738,7 @@ class mod_PLC4: ...@@ -733,6 +738,7 @@ class mod_PLC4:
pass pass
# Allow slice attributes to be set "generically" via the db # Allow slice attributes to be set "generically" via the db
# Also see below where we add slice attributes on a per-node basis
sas = self.plc.getAttrVal("slice_attributes",required=False) sas = self.plc.getAttrVal("slice_attributes",required=False)
if sas: if sas:
try: try:
...@@ -802,6 +808,12 @@ class mod_PLC4: ...@@ -802,6 +808,12 @@ class mod_PLC4:
print "Failed to add nodes to slice %s" % slice.slicename print "Failed to add nodes to slice %s" % slice.slicename
raise raise
# add any per-node or per-nodegroup attributes:
#
# XXX: will not work as above -- need to fix above and add this
# code in a way that works with the plab_attributes table.
#
# XXX: this is currently locked out to pi/user roles, although the docs # XXX: this is currently locked out to pi/user roles, although the docs
# say otherwise, so we can't use it automatically yet. # say otherwise, so we can't use it automatically yet.
# #
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment