This replaces the existing Legacy/* support with a new approach that
authorMarc Fiuczynski <mef@cs.princeton.edu>
Thu, 21 May 2009 22:08:49 +0000 (22:08 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Thu, 21 May 2009 22:08:49 +0000 (22:08 +0000)
attempts to more cleanly integrate with the way the API functions in
terms of the way authentication, documentation/help, etc. operates.

27 files changed:
PLC/API.py
PLC/Legacy/Types.py [deleted file]
PLC/Legacy/__init__.py [deleted file]
PLC/Legacy/v42legacy.py [deleted file]
PLC/Methods/AddNodeNetwork.py [new file with mode: 0644]
PLC/Methods/AddNodeNetworkSetting.py [new file with mode: 0644]
PLC/Methods/AddNodeNetworkSettingType.py [new file with mode: 0644]
PLC/Methods/AddSliceAttributeType.py [new file with mode: 0644]
PLC/Methods/DeleteNodeNetwork.py [new file with mode: 0644]
PLC/Methods/DeleteNodeNetworkSetting.py [new file with mode: 0644]
PLC/Methods/DeleteNodeNetworkSettingType.py [new file with mode: 0644]
PLC/Methods/DeleteSliceAttributeType.py [new file with mode: 0644]
PLC/Methods/GetNodeNetworkSettingTypes.py [new file with mode: 0644]
PLC/Methods/GetNodeNetworkSettings.py [new file with mode: 0644]
PLC/Methods/GetNodeNetworks.py [new file with mode: 0644]
PLC/Methods/GetSliceAttributeTypes.py [new file with mode: 0644]
PLC/Methods/UpdateNodeNetwork.py [new file with mode: 0644]
PLC/Methods/UpdateNodeNetworkSetting.py [new file with mode: 0644]
PLC/Methods/UpdateNodeNetworkSettingType.py [new file with mode: 0644]
PLC/Methods/UpdateSliceAttributeType.py [new file with mode: 0644]
PLC/Methods/__init__.py
PLC/__init__.py
PLC/v42Legacy.py [new file with mode: 0644]
PLC/v42LegacyNodeNetworkSettings.py [new file with mode: 0644]
PLC/v42LegacyNodeNetworks.py [new file with mode: 0644]
PLC/v42LegacyNodes.py [moved from PLC/Legacy/NodeNetworks.py with 54% similarity]
PLC/v42LegacyTypes.py [new file with mode: 0644]

index 8b85bd0..6ea37bc 100644 (file)
@@ -84,7 +84,6 @@ from PLC.Config import Config
 from PLC.Faults import *
 import PLC.Methods
 import PLC.Accessors
-import PLC.Legacy
 
 def import_deep(name):
     mod = __import__(name)
@@ -101,7 +100,7 @@ class PLCAPI:
     # other_methods_map : dict {methodname: fullpath}
     # e.g. 'Accessors' -> 'PLC.Accessors.Accessors'
     other_methods_map={}
-    for subdir in [ 'Accessors', 'Legacy']:
+    for subdir in [ 'Accessors' ]:
         path="PLC."+subdir
         # scan e.g. PLC.Accessors.__all__
         pkg = __import__(path).__dict__[subdir]
diff --git a/PLC/Legacy/Types.py b/PLC/Legacy/Types.py
deleted file mode 100644 (file)
index c0dd316..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Thierry Parmentelat - INRIA
-# $Id$
-
-from PLC.Method import Method
-import v42legacy
-import sys
-current_module=sys.modules[__name__]
-
-def import_deep(name):
-    mod = __import__(name)
-    components = name.split('.')
-    for comp in components[1:]:
-        mod = getattr(mod, comp)
-    return mod
-
-v42_to_v43_methodmap = {
-    "AddSliceAttributeType"         : "AddTagType",
-    "DeleteSliceAttributeType"      : "DeleteTagType",
-    "GetSliceAttributeTypes"        : "GetTagTypes",
-    "UpdateSliceAttributeType"      : "UpdateTagType",
-    "AddNodeNetworkSettingType"     : "AddTagType",
-    "DeleteNodeNetworkSettingType"  : "DeleteTagType",
-    "GetNodeNetworkSettingTypes"    : "GetTagTypes",
-    "UpdateNodeNetworkSettingType"  : "UpdateTagType",
-}    
-
-methods = v42_to_v43_methodmap.keys()
-
-v42_to_v43_argmap = { "name":"tagname" }
-v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()])
-
-def v42rename (x): return v42_to_v43_argmap.get(x,x)
-def v43rename (x): return v43_to_v42_argmap.get(x,x)
-
-# attach methods here
-for legacyname in methods:
-    # new method name
-    newname=v42_to_v43_methodmap[legacyname]
-    path = "PLC.Methods."
-    setattr(current_module,legacyname,v42legacy.make_class(legacyname,newname,path,import_deep,v42rename,v43rename))
diff --git a/PLC/Legacy/__init__.py b/PLC/Legacy/__init__.py
deleted file mode 100644 (file)
index 25f8ded..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# each module to define in "methods" the set of methods that it defines
-__all__ = """
-NodeNetworks
-Types
-""".split()
diff --git a/PLC/Legacy/v42legacy.py b/PLC/Legacy/v42legacy.py
deleted file mode 100644 (file)
index 2e170fc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# $Id: $
-
-from PLC.Method import Method
-from PLC.Auth import Auth
-import PLC.Auth
-
-# apply rename on list (columns) or dict (filter) args
-def patch (arg,rename):
-    if isinstance(arg,list):
-        for i in range(0,len(arg)):
-            arg[i] = patch(arg[i],rename)
-        return arg
-    if isinstance(arg,dict):
-        return dict ( [ (rename(k),v) for (k,v) in arg.iteritems() ] )
-    return rename(arg)
-
-def make_class (legacyname,newname,path,import_deep,v42rename,v43rename):
-    # locate new class
-    newclass=getattr(import_deep(path+newname),newname)
-    setattr(newclass,"__origcall",getattr(newclass,"call"))
-    # create class for legacy name
-    legacyclass = type(legacyname,(newclass,), 
-                       {"__doc__":"Legacy method - please use %s instead"%newname})
-    for internal in ["roles","accepts","returns"]:
-        setattr(legacyclass,internal,getattr(newclass,internal))
-    # turn off type checking, as introspection code fails on wrapped_call
-    setattr(legacyclass,"skip_typecheck",True)
-    # rewrite call
-    def wrapped_call (self,auth,*args, **kwds):
-       #print "%s: self.caller = %s, auth=%s, self.api=%s, self=%s" % (legacyname,self.caller,auth,self.api,self)
-        if not hasattr(self,"auth"):
-            self.auth = None
-
-        if self.auth == None and auth <> None:
-            self.auth = auth
-
-        if self.auth <> None and self.caller == None:
-            a = PLC.Auth.map_auth(auth)
-            print "a = %s" % a
-            a.check(self,auth,*args)
-
-        newargs=[patch(x,v42rename) for x in args]
-        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
-        results = self.__origcall(auth,*newargs,**newkwds)
-        return patch(results,v43rename)
-    setattr(legacyclass,"call",wrapped_call)
-
-    return legacyclass
-
diff --git a/PLC/Methods/AddNodeNetwork.py b/PLC/Methods/AddNodeNetwork.py
new file mode 100644 (file)
index 0000000..1512638
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworks import v42rename, v43rename
+from PLC.Methods.AddInterface import AddInterface
+class AddNodeNetwork(AddInterface):
+    """ Legacy version of AddInterface. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = AddInterface.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/AddNodeNetworkSetting.py b/PLC/Methods/AddNodeNetworkSetting.py
new file mode 100644 (file)
index 0000000..8bb051a
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename
+from PLC.Methods.AddInterfaceTag import AddInterfaceTag
+class AddNodeNetworkSetting(AddInterfaceTag):
+    """ Legacy version of AddInterfaceTag. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = AddInterfaceTag.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/AddNodeNetworkSettingType.py b/PLC/Methods/AddNodeNetworkSettingType.py
new file mode 100644 (file)
index 0000000..8f28e93
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.AddTagType import AddTagType
+class AddNodeNetworkSettingType(AddTagType):
+    """ Legacy version of AddTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = AddTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/AddSliceAttributeType.py b/PLC/Methods/AddSliceAttributeType.py
new file mode 100644 (file)
index 0000000..375fbcf
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.AddTagType import AddTagType
+class AddSliceAttributeType(AddTagType):
+    """ Legacy version of AddTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = AddTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/DeleteNodeNetwork.py b/PLC/Methods/DeleteNodeNetwork.py
new file mode 100644 (file)
index 0000000..ce70354
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworks import v42rename, v43rename
+from PLC.Methods.DeleteInterface import DeleteInterface
+class DeleteNodeNetwork(DeleteInterface):
+    """ Legacy version of DeleteInterface. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = DeleteInterface.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/DeleteNodeNetworkSetting.py b/PLC/Methods/DeleteNodeNetworkSetting.py
new file mode 100644 (file)
index 0000000..b8cada1
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename
+from PLC.Methods.DeleteInterfaceTag import DeleteInterfaceTag
+class DeleteNodeNetworkSetting(DeleteInterfaceTag):
+    """ Legacy version of DeleteInterfaceTag. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = DeleteInterfaceTag.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/DeleteNodeNetworkSettingType.py b/PLC/Methods/DeleteNodeNetworkSettingType.py
new file mode 100644 (file)
index 0000000..d25be8c
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.DeleteTagType import DeleteTagType
+class DeleteNodeNetworkSettingType(DeleteTagType):
+    """ Legacy version of DeleteTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = DeleteTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/DeleteSliceAttributeType.py b/PLC/Methods/DeleteSliceAttributeType.py
new file mode 100644 (file)
index 0000000..fd0cea1
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.DeleteTagType import DeleteTagType
+class DeleteSliceAttributeType(DeleteTagType):
+    """ Legacy version of DeleteTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = DeleteTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/GetNodeNetworkSettingTypes.py b/PLC/Methods/GetNodeNetworkSettingTypes.py
new file mode 100644 (file)
index 0000000..5a013ce
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.GetTagTypes import GetTagTypes
+class GetNodeNetworkSettingTypes(GetTagTypes):
+    """ Legacy version of GetTagTypes. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = GetTagTypes.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/GetNodeNetworkSettings.py b/PLC/Methods/GetNodeNetworkSettings.py
new file mode 100644 (file)
index 0000000..3fa055f
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename
+from PLC.Methods.GetInterfaceTags import GetInterfaceTags
+class GetNodeNetworkSettings(GetInterfaceTags):
+    """ Legacy version of GetInterfaceTags. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = GetInterfaceTags.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/GetNodeNetworks.py b/PLC/Methods/GetNodeNetworks.py
new file mode 100644 (file)
index 0000000..1aebdb2
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworks import v42rename, v43rename
+from PLC.Methods.GetInterfaces import GetInterfaces
+class GetNodeNetworks(GetInterfaces):
+    """ Legacy version of GetInterfaces. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = GetInterfaces.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/GetSliceAttributeTypes.py b/PLC/Methods/GetSliceAttributeTypes.py
new file mode 100644 (file)
index 0000000..5e0f7f1
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.GetTagTypes import GetTagTypes
+class GetSliceAttributeTypes(GetTagTypes):
+    """ Legacy version of GetTagTypes. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = GetTagTypes.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/UpdateNodeNetwork.py b/PLC/Methods/UpdateNodeNetwork.py
new file mode 100644 (file)
index 0000000..5df442f
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworks import v42rename, v43rename
+from PLC.Methods.UpdateInterface import UpdateInterface
+class UpdateNodeNetwork(UpdateInterface):
+    """ Legacy version of UpdateInterface. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = UpdateInterface.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/UpdateNodeNetworkSetting.py b/PLC/Methods/UpdateNodeNetworkSetting.py
new file mode 100644 (file)
index 0000000..ca06130
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename
+from PLC.Methods.UpdateInterfaceTag import UpdateInterfaceTag
+class UpdateNodeNetworkSetting(UpdateInterfaceTag):
+    """ Legacy version of UpdateInterfaceTag. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = UpdateInterfaceTag.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/UpdateNodeNetworkSettingType.py b/PLC/Methods/UpdateNodeNetworkSettingType.py
new file mode 100644 (file)
index 0000000..425e5d8
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.UpdateTagType import UpdateTagType
+class UpdateNodeNetworkSettingType(UpdateTagType):
+    """ Legacy version of UpdateTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = UpdateTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
diff --git a/PLC/Methods/UpdateSliceAttributeType.py b/PLC/Methods/UpdateSliceAttributeType.py
new file mode 100644 (file)
index 0000000..21d6ac3
--- /dev/null
@@ -0,0 +1,12 @@
+
+from PLC.v42Legacy import patch
+from PLC.v42LegacyTypes import v42rename, v43rename
+from PLC.Methods.UpdateTagType import UpdateTagType
+class UpdateSliceAttributeType(UpdateTagType):
+    """ Legacy version of UpdateTagType. """
+    skip_typecheck = True
+    def call(self, auth, *args, **kwds):
+        newargs=[patch(x,v42rename) for x in args]
+        newkwds=dict ( [ (k,patch(v,v42rename)) for (k,v) in kwds.iteritems() ] )
+        results = UpdateTagType.call(self,auth,*newargs,**newkwds)
+        return patch(results,v43rename)
index 9f6743d..939c4ee 100644 (file)
@@ -4,8 +4,8 @@ AddAddressType
 AddAddressTypeToAddress
 AddBootState
 AddConfFile
-AddConfFileToNode
 AddConfFileToNodeGroup
+AddConfFileToNode
 AddDummynetBox
 AddIlink
 AddInitScript
@@ -15,26 +15,30 @@ AddKeyType
 AddMessage
 AddNetworkMethod
 AddNetworkType
-AddNode
 AddNodeGroup
+AddNodeNetwork
+AddNodeNetworkSetting
+AddNodeNetworkSettingType
+AddNode
 AddNodeTag
 AddNodeToPCU
 AddNodeType
-AddPCU
 AddPCUProtocolType
+AddPCU
 AddPCUType
 AddPeer
-AddPerson
 AddPersonKey
+AddPerson
 AddPersonToSite
 AddPersonToSlice
 AddRole
 AddRoleToPerson
 AddSession
-AddSite
 AddSiteAddress
-AddSlice
+AddSite
+AddSliceAttributeType
 AddSliceInstantiation
+AddSlice
 AddSliceTag
 AddSliceToNodes
 AddSliceToNodesWhitelist
@@ -46,12 +50,12 @@ BootGetNodeDetails
 BootNotifyOwners
 BootUpdateNode
 DeleteAddress
-DeleteAddressType
 DeleteAddressTypeFromAddress
+DeleteAddressType
 DeleteBootState
-DeleteConfFile
-DeleteConfFileFromNode
 DeleteConfFileFromNodeGroup
+DeleteConfFileFromNode
+DeleteConfFile
 DeleteDummynetBox
 DeleteEmulationLink
 DeleteIlink
@@ -63,31 +67,35 @@ DeleteKeyType
 DeleteMessage
 DeleteNetworkMethod
 DeleteNetworkType
-DeleteNode
 DeleteNodeFromPCU
 DeleteNodeGroup
+DeleteNodeNetwork
+DeleteNodeNetworkSetting
+DeleteNodeNetworkSettingType
+DeleteNode
 DeleteNodeTag
 DeleteNodeType
-DeletePCU
 DeletePCUProtocolType
+DeletePCU
 DeletePCUType
 DeletePeer
-DeletePerson
 DeletePersonFromSite
 DeletePersonFromSlice
-DeleteRole
+DeletePerson
 DeleteRoleFromPerson
+DeleteRole
 DeleteSession
 DeleteSite
-DeleteSlice
+DeleteSliceAttributeType
 DeleteSliceFromNodes
 DeleteSliceFromNodesWhitelist
 DeleteSliceInstantiation
+DeleteSlice
 DeleteSliceTag
 DeleteTagType
 GenerateNodeConfFile
-GetAddressTypes
 GetAddresses
+GetAddressTypes
 GetBootMedium
 GetBootStates
 GetConfFiles
@@ -97,20 +105,23 @@ GetEventObjects
 GetEvents
 GetIlinks
 GetInitScripts
-GetInterfaceTags
 GetInterfaces
-GetKeyTypes
+GetInterfaceTags
 GetKeys
+GetKeyTypes
 GetMessages
 GetNetworkMethods
 GetNetworkTypes
 GetNodeGroups
+GetNodeNetworkSettings
+GetNodeNetworkSettingTypes
+GetNodeNetworks
+GetNodes
 GetNodeTags
 GetNodeTypes
-GetNodes
 GetPCUProtocolTypes
-GetPCUTypes
 GetPCUs
+GetPCUTypes
 GetPeerData
 GetPeerName
 GetPeers
@@ -120,11 +131,12 @@ GetRoles
 GetSession
 GetSessions
 GetSites
+GetSliceAttributeTypes
 GetSliceInstantiations
 GetSliceKeys
+GetSlices
 GetSliceTags
 GetSliceTicket
-GetSlices
 GetSlivers
 GetTagTypes
 GetWhitelist
@@ -153,6 +165,10 @@ SliceUpdate
 SliceUserAdd
 SliceUserDel
 SliceUsersList
+system.listMethods
+system.methodHelp
+system.methodSignature
+system.multicall
 UpdateAddress
 UpdateAddressType
 UpdateConfFile
@@ -163,21 +179,21 @@ UpdateInterface
 UpdateInterfaceTag
 UpdateKey
 UpdateMessage
-UpdateNode
 UpdateNodeGroup
+UpdateNodeNetwork
+UpdateNodeNetworkSetting
+UpdateNodeNetworkSettingType
+UpdateNode
 UpdateNodeTag
-UpdatePCU
 UpdatePCUProtocolType
+UpdatePCU
 UpdatePCUType
 UpdatePeer
 UpdatePerson
 UpdateSite
+UpdateSliceAttributeType
 UpdateSlice
 UpdateSliceTag
 UpdateTagType
 VerifyPerson
-system.listMethods
-system.methodHelp
-system.methodSignature
-system.multicall
 """.split()
index 0f20697..3e35b76 100644 (file)
@@ -1,8 +1,8 @@
 ## Please use make index to update this file
 all = """
-API
-AddressTypes
 Addresses
+AddressTypes
+API
 Auth
 Boot
 BootStates
@@ -16,35 +16,40 @@ Filter
 GPG
 Ilinks
 InitScripts
-InterfaceTags
 Interfaces
-KeyTypes
+InterfaceTags
 Keys
+KeyTypes
 Messages
 Method
 NetworkMethods
 NetworkTypes
 NodeGroups
+Nodes
 NodeTags
 NodeTypes
-Nodes
+Parameter
 PCUProtocolTypes
-PCUTypes
 PCUs
-POD
-Parameter
+PCUTypes
 Peers
 Persons
+POD
 PostgreSQL
 PyCurl
 Roles
+sendmail
 Sessions
 Shell
 Sites
 SliceInstantiations
-SliceTags
 Slices
+SliceTags
 Table
 TagTypes
-sendmail
+v42LegacyNodeNetworkSettings
+v42LegacyNodeNetworks
+v42LegacyNodes
+v42Legacy
+v42LegacyTypes
 """.split()
diff --git a/PLC/v42Legacy.py b/PLC/v42Legacy.py
new file mode 100644 (file)
index 0000000..f64087c
--- /dev/null
@@ -0,0 +1,12 @@
+# $Id: $
+
+# apply rename on list (columns) or dict (filter) args
+def patch (arg,rename):
+    if isinstance(arg,list):
+        for i in range(0,len(arg)):
+            arg[i] = patch(arg[i],rename)
+        return arg
+    if isinstance(arg,dict):
+        return dict ( [ (rename(k),v) for (k,v) in arg.iteritems() ] )
+    return rename(arg)
+
diff --git a/PLC/v42LegacyNodeNetworkSettings.py b/PLC/v42LegacyNodeNetworkSettings.py
new file mode 100644 (file)
index 0000000..e1cfae8
--- /dev/null
@@ -0,0 +1,15 @@
+# $Id: $
+
+# mapping of argument/return names for *NodeNetworkSettings* and *InterfaceTags* calls
+v42_to_v43_argmap = {
+    "nodenetwork_id":"interface_id",
+    "nodenetwork_ids":"interface_ids",
+    "nodenetwork_setting_id":"interface_tag_id",
+    "nodenetwork_setting_ids":"interface_tag_ids",
+    "nodenetwork_setting_type_id":"tag_type_id",
+    "name":"tagname"
+    }
+v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()])
+
+def v42rename (x): return v42_to_v43_argmap.get(x,x)
+def v43rename (x): return v43_to_v42_argmap.get(x,x)
diff --git a/PLC/v42LegacyNodeNetworks.py b/PLC/v42LegacyNodeNetworks.py
new file mode 100644 (file)
index 0000000..5a59812
--- /dev/null
@@ -0,0 +1,12 @@
+# $Id: $
+
+# mapping of argument/return names for *NodeNetwork* and *Interface* calls
+v42_to_v43_argmap = {
+    "nodenetwork_id":"interface_id",
+    "nodenetwork_ids":"interface_ids",
+    "nodenetwork_setting_ids":"interface_tag_ids",
+}
+v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()])
+
+def v42rename (x): return v42_to_v43_argmap.get(x,x)
+def v43rename (x): return v43_to_v42_argmap.get(x,x)
similarity index 54%
rename from PLC/Legacy/NodeNetworks.py
rename to PLC/v42LegacyNodes.py
index f5a42e4..a36d750 100644 (file)
@@ -1,10 +1,8 @@
-# Thierry Parmentelat - INRIA
-# $Id$
+# $Id: $
 
-from PLC.Method import Method
-import v42legacy
-import sys
-current_module=sys.modules[__name__]
+from PLC.Parameter import Parameter, Mixed, python_type
+from PLC.Filter import Filter
+from PLC.Nodes import Node, Nodes
 
 def import_deep(name):
     mod = __import__(name)
@@ -13,57 +11,17 @@ def import_deep(name):
         mod = getattr(mod, comp)
     return mod
 
-methods = [
-    "AddNodeNetwork",
-    "AddNodeNetworkSetting",
-    "DeleteNodeNetwork",
-    "DeleteNodeNetworkSetting",
-    "GetNodeNetworkSettings",
-    "GetNodeNetworks",
-    "UpdateNodeNetwork",
-    "UpdateNodeNetworkSetting",
-]
-
-# argument mapping
-v42_to_v43_argmap = {
-    "nodenetwork_id":"interface_id",
-    "nodenetwork_ids":"interface_ids",
-    "nodenetworksetting_ids":"interface_tag_ids",
-    }
-v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()])
-def v42rename (x): return v42_to_v43_argmap.get(x,x)
-def v43rename (x): return v43_to_v42_argmap.get(x,x)
-
-# attach methods here
-for legacyname in methods:
-    # new method name
-    newname=legacyname.replace("NodeNetwork","Interface").replace("Setting","Tag")
-    path = "PLC.Methods."
-    setattr(current_module,legacyname,v42legacy.make_class(legacyname,newname,path,import_deep,v42rename,v43rename))
-
 # GetNodes update
-# first replace the call method so we can translate fields
 c = getattr(import_deep("PLC.Methods.GetNodes"),"GetNodes")
 # rename call to __origcall so we can still invoke
 original = getattr(c,"call")
 setattr(c,"__origcall",original)
 
-# 4.2 legacy support; update node_fields to include nodenetwork_ids
-from PLC.Parameter import Parameter, Mixed, python_type
-from PLC.Filter import Filter
-from PLC.Nodes import Node, Nodes
-
 node_fields = {}
 node_fields['nodenetwork_ids']=Parameter([int], "Legacy version of interface_ids")
 for k,v in Node.fields.iteritems():
     node_fields[k]=v
 
-if False:
-    expected = node_fields['nodenetwork_ids']
-    print "type of nodenetwork_ids = %s" % python_type(node_fields['nodenetwork_ids'])
-    print Filter(node_fields).fields.keys()
-    print Filter(Node.fields).fields.keys()
-
 accepts = getattr(c,"accepts")
 arg0=accepts[0]
 arg1=Mixed([Mixed(Node.fields['node_id'],
diff --git a/PLC/v42LegacyTypes.py b/PLC/v42LegacyTypes.py
new file mode 100644 (file)
index 0000000..e6fd697
--- /dev/null
@@ -0,0 +1,8 @@
+# $Id: $
+
+# mapping of argument/return names for *{SliceAttribute,NetworkSetting}Type* and *TagType* calls
+v42_to_v43_argmap = { "name":"tagname" }
+v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()])
+
+def v42rename (x): return v42_to_v43_argmap.get(x,x)
+def v43rename (x): return v43_to_v42_argmap.get(x,x)