- Added Node, Site, Slice, Person, and PLC classes useful for defining a default...
[tests.git] / qaapi / qa / PLCs.py
1 import os
2 import copy     
3 from Remote import Remote
4 from Table import Table
5
6 class PLC(dict, Remote):
7     fields = {
8         'name': 'TestPLC',                              # PLC Name                      
9         'host': 'localhost',                            # Node Hostname
10         'ip':   '127.0.0.1',                            # IP
11         'chroot': None,
12         'vserver': None,                                # Vserver where this PLC lives
13         'rootkey': '/home/tmack/.ssh/plc-root',         # Root Key
14         'api_path': '/PLCAPI/',                                 # PLCAPI path 
15         'port': '443'                                   # PLCAPI port
16         
17         }
18
19     def __init__(self, config, fields = {}):
20         # XX Filter out fields not specified in fields
21         dict.__init__(self, self.fields)
22         
23         # Merge defined fields with defaults
24         self.update(fields)
25         
26         # init config
27         self.config = config
28         self.config.update_api(self)
29
30 class PLCs(list, Table):
31
32     def __init__(self, config, plcs):
33         plclist = [PLC(config, plc) for plc in plcs]
34         list.__init__(self, plclist)