--- /dev/null
+# $Id$
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.NodeTypes import NodeType, NodeTypes
+from PLC.Auth import Auth
+
+class AddNodeType(Method):
+    """
+    Adds a new node node type.
+
+    Returns 1 if successful, faults otherwise.
+    """
+
+    roles = ['admin']
+
+    accepts = [
+        Auth(),
+        NodeType.fields['node_type']
+        ]
+
+    returns = Parameter(int, '1 if successful')
+
+    
+    def call(self, auth, name):
+        node_type = NodeType(self.api)
+        node_type['node_type'] = name
+        node_type.sync(insert = True)
+
+        return 1
 
--- /dev/null
+# $Id$
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.NodeTypes import NodeType, NodeTypes
+from PLC.Auth import Auth
+
+class DeleteNodeType(Method):
+    """
+    Deletes a node node type.
+
+    WARNING: This will cause the deletion of all nodes in this boot
+    state.
+
+    Returns 1 if successful, faults otherwise.
+    """
+
+    roles = ['admin']
+
+    accepts = [
+        Auth(),
+        NodeType.fields['node_type']
+        ]
+
+    returns = Parameter(int, '1 if successful')
+
+
+    def call(self, auth, name):
+        node_types = NodeTypes(self.api, [name])
+        if not node_types:
+            raise PLCInvalidArgument, "No such node type"
+        node_type = node_types[0]
+
+        node_type.delete()
+       
+        return 1
 
--- /dev/null
+# $Id$
+from PLC.Faults import *
+from PLC.Method import Method
+from PLC.Parameter import Parameter, Mixed
+from PLC.NodeTypes import NodeType, NodeTypes
+from PLC.Auth import Auth
+
+class GetNodeTypes(Method):
+    """
+    Returns an array of all valid node node types.
+    """
+
+    roles = ['admin', 'pi', 'user', 'tech', 'node']
+
+    accepts = [
+        Auth()
+        ]
+
+    returns = [NodeType.fields['node_type']]
+    
+
+    def call(self, auth):
+        return [node_type['node_type'] for node_type in NodeTypes(self.api)]
 
 AddNodeGroup
 AddNodeTag
 AddNodeToPCU
+AddNodeType
 AddPCU
 AddPCUProtocolType
 AddPCUType
 DeleteNodeFromPCU
 DeleteNodeGroup
 DeleteNodeTag
+DeleteNodeType
 DeletePCU
 DeletePCUProtocolType
 DeletePCUType
 GetNetworkTypes
 GetNodeGroups
 GetNodeTags
+GetNodeTypes
 GetNodes
 GetPCUProtocolTypes
 GetPCUTypes
 
--- /dev/null
+#
+# Functions for interacting with the node_types table in the database
+#
+# $Id$
+#
+
+from PLC.Faults import *
+from PLC.Parameter import Parameter
+from PLC.Table import Row, Table
+
+class NodeType(Row):
+    """
+    Representation of a row in the node_types table. To use,
+    instantiate with a dict of values.
+    """
+
+    table_name = 'node_types'
+    primary_key = 'node_type'
+    join_tables = ['nodes']
+    fields = {
+        'node_type': Parameter(str, "Node type", max = 20),
+        }
+
+    def validate_node_type(self, name):
+       # Make sure name is not blank
+        if not len(name):
+            raise PLCInvalidArgument, "Node type must be specified"
+       
+       # Make sure node type does not alredy exist
+       conflicts = NodeTypes(self.api, [name])
+        if conflicts:
+            raise PLCInvalidArgument, "Node type name already in use"
+
+       return name
+
+class NodeTypes(Table):
+    """
+    Representation of the node_types table in the database.
+    """
+
+    def __init__(self, api, node_types = None):
+        Table.__init__(self, api, NodeType)
+
+        sql = "SELECT %s FROM node_types" % \
+              ", ".join(NodeType.fields)
+        
+        if node_types:
+            sql += " WHERE node_type IN (%s)" % ", ".join(map(api.db.quote, node_types))
+
+        self.selectall(sql)
 
 NetworkTypes
 NodeGroups
 NodeTags
+NodeTypes
 Nodes
 PCUProtocolTypes
 PCUTypes