from PLC.PCUs import PCU, PCUs
from PLC.Nodes import Node, Nodes
from PLC.NodeNetworks import NodeNetwork, NodeNetworks, valid_ip
from PLC.PCUs import PCU, PCUs
from PLC.Nodes import Node, Nodes
from PLC.NodeNetworks import NodeNetwork, NodeNetworks, valid_ip
roles = ['admin', 'pi', 'user', 'tech']
accepts = [
roles = ['admin', 'pi', 'user', 'tech']
accepts = [
{'pcu_hostname': PCU.fields['hostname'],
'pcu_ip': PCU.fields['ip'],
'node_hostname': Node.fields['hostname'],
{'pcu_hostname': PCU.fields['hostname'],
'pcu_ip': PCU.fields['ip'],
'node_hostname': Node.fields['hostname'],
def call(self, auth, search_vals):
# Get all PCUs. This is a stupid function. The API should not
# be used for DB mining.
def call(self, auth, search_vals):
# Get all PCUs. This is a stupid function. The API should not
# be used for DB mining.
if 'node_hostname' in search_vals:
pcus = filter(lambda pcu: \
search_vals['node_hostname'] in \
if 'node_hostname' in search_vals:
pcus = filter(lambda pcu: \
search_vals['node_hostname'] in \