diff --git a/DeviceAPI/API_rtu.py b/DeviceAPI/API_rtu.py index afcdbb07..1acedf89 100644 --- a/DeviceAPI/API_rtu.py +++ b/DeviceAPI/API_rtu.py @@ -93,7 +93,7 @@ def getDataFromDevice(self): devicedata = dict() client = connection(self.address, port=502) client.connect() - result = client.read_input_registers(0, 26, unit=self.slave_id) + result = client.read_input_registers(0, 26, unit=self.subordinate_id) if int(result.registers[18]) == 32767: devicedata['temperature'] = None else: @@ -123,12 +123,12 @@ def getDataFromDevice(self): devicedata['fan_state'] = 'ON' else: devicedata['fan_state'] = 'OFF' - result = client.read_holding_registers(129, 1, unit=self.slave_id) + result = client.read_holding_registers(129, 1, unit=self.subordinate_id) if int(result.registers[0]) > 100: devicedata['heating'] = 0 else: devicedata['heating'] = int(result.registers[0]) - result = client.read_holding_registers(10, 1, unit=self.slave_id) + result = client.read_holding_registers(10, 1, unit=self.subordinate_id) if int(result.registers[0]) == 0: devicedata['cooling_mode'] = 'None' devicedata['cooling_status'] = 'OFF' @@ -170,39 +170,39 @@ def setDeviceData(self, postmsg): client.connect() if BEMOSS_ONTOLOGY.HEAT_SETPOINT.NAME in postmsg.keys(): client.write_register(187, int(self.far2cel(float(postmsg.get('heat_setpoint'))) * 100.0), - unit=self.slave_id) + unit=self.subordinate_id) if BEMOSS_ONTOLOGY.COOL_SETPOINT.NAME in postmsg.keys(): client.write_register(188, int(self.far2cel(float(postmsg.get('cool_setpoint'))) * 100.0), - unit=self.slave_id) + unit=self.subordinate_id) if BEMOSS_ONTOLOGY.OUTSIDE_DAMPER.NAME in postmsg.keys(): client.write_register(274, int(postmsg.get('outside_damper_position')), - unit=self.slave_id) + unit=self.subordinate_id) if BEMOSS_ONTOLOGY.DAMPER.NAME in postmsg.keys(): client.write_register(275, int(postmsg.get('bypass_damper_position')), - unit=self.slave_id) + unit=self.subordinate_id) if BEMOSS_ONTOLOGY.FAN_STATE.NAME in postmsg.keys(): if postmsg.get('fan_state') == 'ON' or postmsg.get('fan_state') == True: - client.write_register(130, 2, unit=self.slave_id) + client.write_register(130, 2, unit=self.subordinate_id) elif postmsg.get('fan_state') == 'OFF' or postmsg.get('fan_state') == False: - client.write_register(130, 1, unit=self.slave_id) + client.write_register(130, 1, unit=self.subordinate_id) if BEMOSS_ONTOLOGY.COOLING_STATUS.NAME in postmsg.keys(): if postmsg.get('cooling_status') == 'ON': - client.write_registers(124, [1, 2, 2, 2], unit=self.slave_id) + client.write_registers(124, [1, 2, 2, 2], unit=self.subordinate_id) elif postmsg.get('cooling_status') == 'OFF': - client.write_registers(124, [0, 1, 1, 1], unit=self.slave_id) + client.write_registers(124, [0, 1, 1, 1], unit=self.subordinate_id) if BEMOSS_ONTOLOGY.COOLING.NAME in postmsg.keys(): if postmsg.get('cooling_mode') == 'None': - client.write_register(10, 0, unit=self.slave_id) + client.write_register(10, 0, unit=self.subordinate_id) elif postmsg.get('cooling_mode') == 'STG1': - client.write_register(10, 1, unit=self.slave_id) + client.write_register(10, 1, unit=self.subordinate_id) elif postmsg.get('cooling_mode') == 'STG2': - client.write_register(10, 2, unit=self.slave_id) + client.write_register(10, 2, unit=self.subordinate_id) elif postmsg.get('cooling_mode') == 'STG3': - client.write_register(10, 3, unit=self.slave_id) + client.write_register(10, 3, unit=self.subordinate_id) elif postmsg.get('cooling_mode') == 'STG4': - client.write_register(10, 4, unit=self.slave_id) + client.write_register(10, 4, unit=self.subordinate_id) if BEMOSS_ONTOLOGY.HEATING.NAME in postmsg.keys(): - client.write_register(129, int(postmsg.get('heating')), unit=self.slave_id) + client.write_register(129, int(postmsg.get('heating')), unit=self.subordinate_id) client.close() return True except: diff --git a/DeviceAPI/API_vav.py b/DeviceAPI/API_vav.py index fad7c843..adcd1923 100644 --- a/DeviceAPI/API_vav.py +++ b/DeviceAPI/API_vav.py @@ -89,7 +89,7 @@ def getDataFromDevice(self): devicedata=dict() client = connection(self.address, port=502) client.connect() - result = client.read_input_registers(0,8,unit=self.slave_id) + result = client.read_input_registers(0,8,unit=self.subordinate_id) if int(result.registers[0])==32767: devicedata["temperature"] = None else: @@ -100,7 +100,7 @@ def getDataFromDevice(self): devicedata['supply_temperature'] =None else: devicedata['supply_temperature']=round(float(self.cel2far(float(int(result.registers[7]))/100.0)),1) - result = client.read_holding_registers(159,2,unit=self.slave_id) + result = client.read_holding_registers(159,2,unit=self.subordinate_id) if (int(result.registers[0])==1): devicedata['override']='ON' else: @@ -118,16 +118,16 @@ def setDeviceData(self, postmsg): client = connection(self.address,port=502) client.connect() if BEMOSS_ONTOLOGY.HEAT_SETPOINT.NAME in postmsg.keys(): - result=client.write_register(6,int(self.far2cel(float(postmsg.get('heat_setpoint'))* 100.0)),unit=self.slave_id) + result=client.write_register(6,int(self.far2cel(float(postmsg.get('heat_setpoint'))* 100.0)),unit=self.subordinate_id) if BEMOSS_ONTOLOGY.COOL_SETPOINT.NAME in postmsg.keys(): - result2=client.write_register(6,int(self.far2cel(float(postmsg.get('cool_setpoint'))* 100.0)),unit=self.slave_id) + result2=client.write_register(6,int(self.far2cel(float(postmsg.get('cool_setpoint'))* 100.0)),unit=self.subordinate_id) if BEMOSS_ONTOLOGY.OVERRIDE.NAME in postmsg.keys(): if postmsg.get('override') == 'ON' or postmsg.get('override') == True: - client.write_register(159,1,unit=self.slave_id) + client.write_register(159,1,unit=self.subordinate_id) elif postmsg.get('override') == 'OFF' or postmsg.get('override') == False: - client.write_register(159,0,unit=self.slave_id) + client.write_register(159,0,unit=self.subordinate_id) if BEMOSS_ONTOLOGY.FLAP.NAME in postmsg.keys(): - client.write_register(160,int(postmsg.get('flap_position')),unit=self.slave_id) + client.write_register(160,int(postmsg.get('flap_position')),unit=self.subordinate_id) client.close() return True except: diff --git a/DeviceAPI/BACnetAPI.py b/DeviceAPI/BACnetAPI.py index ee495959..7a9a7a13 100644 --- a/DeviceAPI/BACnetAPI.py +++ b/DeviceAPI/BACnetAPI.py @@ -48,7 +48,7 @@ import os import gevent from DeviceAPI.BaseAPI import baseAPI -from services.core.MasterDriverAgent.master_driver.driver import DriverAgent +from services.core.MainDriverAgent.main_driver.driver import DriverAgent from csv import DictWriter from bacpypes.object import get_datatype from bacpypes.primitivedata import Enumerated, Unsigned, Boolean, Integer, Real, Double diff --git a/DeviceAPI/ModbusAPI.py b/DeviceAPI/ModbusAPI.py index ea0d4a92..4680cdcb 100644 --- a/DeviceAPI/ModbusAPI.py +++ b/DeviceAPI/ModbusAPI.py @@ -59,7 +59,7 @@ def __init__(self,**kwargs): if 'address' in self.variables.keys(): address_parts = self.get_variable("address").split(':') self.address = address_parts[0] - self.slave_id =int(address_parts[1]) + self.subordinate_id =int(address_parts[1]) self._debug = True def discover(self): @@ -77,15 +77,15 @@ def discover(self): data[header].append(value) except KeyError: data[header] = [value] - client.slavelist=data["Slave_id"] + client.subordinatelist=data["Subordinate_id"] device_list=client.discovery() for address in device_list: if isinstance(address, dict): break else: - slave_id=address.split(':')[1] - for idx, val in enumerate(data["Slave_id"]): - if slave_id==val: + subordinate_id=address.split(':')[1] + for idx, val in enumerate(data["Subordinate_id"]): + if subordinate_id==val: macaddress = data["MacAddress"][idx] model = data["ModelName"][idx] vendor = data["VendorName"][idx] diff --git a/bemoss_lib/protocols/Modbus.py b/bemoss_lib/protocols/Modbus.py index a44b7f5b..37521523 100644 --- a/bemoss_lib/protocols/Modbus.py +++ b/bemoss_lib/protocols/Modbus.py @@ -58,18 +58,18 @@ def discovery(self): client = connection(ip, port=502) client.connect() result2=None - possible_slave_ids = self.slavelist - for slave_id in possible_slave_ids: - slave_id=int(slave_id) - result = client.read_device_info(slave_id, object_id=0x00) + possible_subordinate_ids = self.subordinatelist + for subordinate_id in possible_subordinate_ids: + subordinate_id=int(subordinate_id) + result = client.read_device_info(subordinate_id, object_id=0x00) if result is None: - result2 = client.read_input_registers(0, 10, unit=slave_id) + result2 = client.read_input_registers(0, 10, unit=subordinate_id) if result2 is None: - result2 = client.read_holding_registers(999, 1, unit=slave_id) + result2 = client.read_holding_registers(999, 1, unit=subordinate_id) if result2 is None: - result2=client.read_discrete_inputs(0,10, unit=slave_id) + result2=client.read_discrete_inputs(0,10, unit=subordinate_id) if result2 is None: - result2 = client.read_coils(0, 10, unit=slave_id) + result2 = client.read_coils(0, 10, unit=subordinate_id) if result or result2 is not None: str_Result = str(result) str_Result2=str(result2) @@ -77,27 +77,27 @@ def discovery(self): match=re.search('Response', str_Result2) match2 = re.search('IllegalFunction', str_Result) if match2 or match: - device_list.append(ip + ':' + str(slave_id)) + device_list.append(ip + ':' + str(subordinate_id)) continue else:##reading registers of Result try: Vendor=result.information[0] except: Vendor="unknown device" - mac=client.read_device_info(slave_id, object_id=0x01) + mac=client.read_device_info(subordinate_id, object_id=0x01) if mac is not None: mac=mac.information[0] else: - mac=slave_id - ModelName= client.read_device_info(slave_id, object_id=0x05) + mac=subordinate_id + ModelName= client.read_device_info(subordinate_id, object_id=0x05) if ModelName is not None: ModelName=ModelName.information[0] else: ModelName="unknown device" - device_list.append({'address': ip + ':' + str(slave_id), 'mac': mac, + device_list.append({'address': ip + ':' + str(subordinate_id), 'mac': mac, 'model': ModelName, 'vendor': Vendor}) except Exception as er: - print ("problem with slave id " + str(slave_id)) + print ("problem with subordinate id " + str(subordinate_id)) print er else: pass @@ -111,26 +111,26 @@ def discovery(self): print "Modbus discovery failed: Couldn't find IP subnet of network!" return device_list - def getDevicedetails(self, slave_id): + def getDevicedetails(self, subordinate_id): deviceinfo = list() - if slave_id == 7: + if subordinate_id == 7: macaddress = '30168D000129' model='VC1000' vendor='Prolon' - elif slave_id == 1: + elif subordinate_id == 1: macaddress = '30168D000262' model = 'VC1000' vendor = 'Prolon' - elif slave_id == 2: + elif subordinate_id == 2: macaddress = '30168D000263' model = 'VC1000' vendor = 'Prolon' - elif slave_id == 15: + elif subordinate_id == 15: macaddress = '30168D000130' model='M1000' vendor='Prolon' - elif slave_id == 20: + elif subordinate_id == 20: macaddress = '30168D000264' model = 'M1000' vendor = 'Prolon' @@ -143,8 +143,8 @@ def getDevicedetails(self, slave_id): class connection(ModbusTcpClient): - def read_device_info(self,slave,object_id): + def read_device_info(self,subordinate,object_id): request = ReadDeviceInformationRequest(object_id) - request.unit_id = slave + request.unit_id = subordinate return self.execute(request) \ No newline at end of file diff --git a/scripts/scalability-testing/config_builder.py b/scripts/scalability-testing/config_builder.py index 50c2badf..b1a60a11 100644 --- a/scripts/scalability-testing/config_builder.py +++ b/scripts/scalability-testing/config_builder.py @@ -61,7 +61,7 @@ import argparse import itertools from test_settings import (virtual_device_host, device_types, config_dir, - volttron_install, master_driver_file, + volttron_install, main_driver_file, host_config_location) class DeviceConfig(object): @@ -195,15 +195,15 @@ def build_all_configs(agent_config, device_type, host_address, count, reg_config config_list, command_lines = build_device_configs(device_type, host_address, count, reg_config, config_dir, interval, publish_only_depth_all, campus, building) - build_master_config(agent_config, config_dir, config_list, + build_main_config(agent_config, config_dir, config_list, scalability_test, scalability_test_iterations, stagger_driver_startup) -def build_master_config(agent_config, config_dir, config_list, +def build_main_config(agent_config, config_dir, config_list, scalability_test, scalability_test_iterations, stagger_driver_startup): - """Takes the input from multiple called to build_device_configs and create the master config.""" + """Takes the input from multiple called to build_device_configs and create the main config.""" configuration = {"driver_config_list": config_list} configuration['scalability_test'] = scalability_test configuration['scalability_test_iterations'] = scalability_test_iterations @@ -219,20 +219,20 @@ def build_master_config(agent_config, config_dir, config_list, if __name__ == "__main__": parser = argparse.ArgumentParser(description="Create driver configuration files for scalability test.") parser.add_argument('--agent-config', metavar='CONFIG_NAME', - help='name of the master driver config file', - default=master_driver_file) + help='name of the main driver config file', + default=main_driver_file) parser.add_argument('--count', type=int, default=1, help='number of devices to configure') parser.add_argument('--scalability-test', action='store_true', - help='Configure master driver for a scalability test') + help='Configure main driver for a scalability test') parser.add_argument('--publish-only-depth-all', action='store_true', help='Configure drivers to only publish depth first all.') parser.add_argument('--stagger-driver-startup', type=float, - help='Configure master driver to stagger driver startup over N seconds.') + help='Configure main driver to stagger driver startup over N seconds.') parser.add_argument('--scalability-test-iterations', type=int, default=5, help='Scalability test iterations') diff --git a/scripts/scalability-testing/fabfile.py b/scripts/scalability-testing/fabfile.py index bfe3e2a7..5f672074 100644 --- a/scripts/scalability-testing/fabfile.py +++ b/scripts/scalability-testing/fabfile.py @@ -89,8 +89,8 @@ def build_configs(): config_paths.extend(configs) command_lines.extend(commands) - #config_builder.build_master_config(test_settings.master_driver_file, config_dir, config_paths) - config_builder.build_master_config(test_settings.master_driver_file, + #config_builder.build_main_config(test_settings.main_driver_file, config_dir, config_paths) + config_builder.build_main_config(test_settings.main_driver_file, config_full_path, config_paths, True, diff --git a/scripts/scalability-testing/test_settings.py b/scripts/scalability-testing/test_settings.py index 178092b3..2c1bd010 100644 --- a/scripts/scalability-testing/test_settings.py +++ b/scripts/scalability-testing/test_settings.py @@ -59,7 +59,7 @@ device_types = {'bacnet': (1, 'device-configs/bacnet_lab.csv'), 'modbus': (1, 'device-configs/catalyst371.csv')} -#Output directory for configurations for the master driver agent +#Output directory for configurations for the main driver agent # and individual drivers on the local host. #Directory will be created if it does not exist. config_dir = "configs" @@ -67,8 +67,8 @@ #Volttron installation directory on virtua_device_host. volttron_install = "~/volttron" -#Master driver config file name -master_driver_file = "master-driver.agent" +#Main driver config file name +main_driver_file = "main-driver.agent" #Location of virtual device config files on virtual device host. #Directory will be created if it does not exist and will diff --git a/scripts/scalability-testing/virtual-drivers/modbus.py b/scripts/scalability-testing/virtual-drivers/modbus.py index 27770047..64e71ffb 100644 --- a/scripts/scalability-testing/virtual-drivers/modbus.py +++ b/scripts/scalability-testing/virtual-drivers/modbus.py @@ -64,7 +64,7 @@ from pymodbus.device import ModbusDeviceIdentification from pymodbus.datastore import ModbusSequentialDataBlock -from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext +from pymodbus.datastore import ModbusSubordinateContext, ModbusServerContext from pymodbus.pdu import ModbusPDU from csv import DictReader @@ -198,12 +198,12 @@ def get_server_context(self): print "byte", False, start, count hr = ModbusSequentialDataBlock(start, [0]*count) - store = ModbusSlaveContext( + store = ModbusSubordinateContext( di = di, co = co, hr = hr, ir = ir) - context = ModbusServerContext(slaves=store, single=True) + context = ModbusServerContext(subordinates=store, single=True) return context diff --git a/services/core/ActuatorAgent/tests/test_actuator_pubsub.py b/services/core/ActuatorAgent/tests/test_actuator_pubsub.py index 881a2b6a..2fb77991 100644 --- a/services/core/ActuatorAgent/tests/test_actuator_pubsub.py +++ b/services/core/ActuatorAgent/tests/test_actuator_pubsub.py @@ -158,7 +158,7 @@ def publish_agent(request, volttron_instance1): """ Fixture used for setting up the environment. 1. Creates fake driver configs - 2. Starts the master driver agent with the created fake driver agents + 2. Starts the main driver agent with the created fake driver agents 3. Starts the actuator agent 4. Creates an instance Agent class for publishing and returns it @@ -168,7 +168,7 @@ def publish_agent(request, volttron_instance1): :return: an instance of fake agent used for publishing """ global actuator_uuid, publish_agent_v2 - # Create master driver config and 4 fake devices each with 6 points + # Create main driver config and 4 fake devices each with 6 points process = Popen(['python', 'config_builder.py', '--count=4', '--publish-only-depth-all', 'fake', 'fake_unit_testing.csv', 'null'], @@ -179,17 +179,17 @@ def publish_agent(request, volttron_instance1): print result assert result == 0 - # Start the master driver agent which would intern start the fake driver + # Start the main driver agent which would intern start the fake driver # using the configs created above - master_uuid = volttron_instance1.install_agent( - agent_dir="services/core/MasterDriverAgent", - config_file="scripts/scalability-testing/configs/master-driver.agent", + main_uuid = volttron_instance1.install_agent( + agent_dir="services/core/MainDriverAgent", + config_file="scripts/scalability-testing/configs/main-driver.agent", start=True) - print("agent id: ", master_uuid) + print("agent id: ", main_uuid) gevent.sleep(2) # wait for the agent to start and start the devices # Start the actuator agent through which publish agent should communicate - # to fake device. Start the master driver agent which would intern start + # to fake device. Start the main driver agent which would intern start # the fake driver using the configs created above actuator_uuid = volttron_instance1.install_agent( agent_dir="services/core/ActuatorAgent", @@ -227,7 +227,7 @@ def publish_agent(request, volttron_instance1): def stop_agent(): print("In teardown method of module") volttron_instance1.stop_agent(actuator_uuid) - volttron_instance1.stop_agent(master_uuid) + volttron_instance1.stop_agent(main_uuid) fake_publish_agent.core.stop() request.addfinalizer(stop_agent) @@ -1621,7 +1621,7 @@ def test_get_error_invalid_point(publish_agent): result_header = publish_agent.callback.call_args[0][4] result_message = publish_agent.callback.call_args[0][5] assert result_message['type'] == \ - 'master_driver.interfaces.DriverInterfaceError' + 'main_driver.interfaces.DriverInterfaceError' assert result_message['value'] == \ "['Point not configured on device: SampleWritableFloat12']" assert result_header['requesterID'] == TEST_AGENT diff --git a/services/core/ActuatorAgent/tests/test_actuator_rpc.py b/services/core/ActuatorAgent/tests/test_actuator_rpc.py index 79f6daa1..a74aca95 100644 --- a/services/core/ActuatorAgent/tests/test_actuator_rpc.py +++ b/services/core/ActuatorAgent/tests/test_actuator_rpc.py @@ -82,7 +82,7 @@ def publish_agent(request, volttron_instance1): """ Fixture used for setting up the environment. 1. Creates fake driver configs - 2. Starts the master driver agent with the created fake driver agents + 2. Starts the main driver agent with the created fake driver agents 3. Starts the actuator agent 4. Creates an instance Agent class for publishing and returns it @@ -90,7 +90,7 @@ def publish_agent(request, volttron_instance1): :param volttron_instance1: instance of volttron in which test cases are run :return: an instance of fake agent used for publishing """ - # Create master driver config and 2 fake devices each with 6 points + # Create main driver config and 2 fake devices each with 6 points process = Popen(['python', 'config_builder.py', '--count=4', '--publish-only-depth-all', 'fake', 'fake_unit_testing.csv', 'null'], @@ -102,17 +102,17 @@ def publish_agent(request, volttron_instance1): print result assert result == 0 - # Start the master driver agent which would intern start the fake driver + # Start the main driver agent which would intern start the fake driver # using the configs created above - master_uuid = volttron_instance1.install_agent( - agent_dir="services/core/MasterDriverAgent", - config_file="scripts/scalability-testing/configs/master-driver.agent", + main_uuid = volttron_instance1.install_agent( + agent_dir="services/core/MainDriverAgent", + config_file="scripts/scalability-testing/configs/main-driver.agent", start=True) - print("agent id: ", master_uuid) + print("agent id: ", main_uuid) gevent.sleep(2) # wait for the agent to start and start the devices # Start the actuator agent through which publish agent should communicate - # to fake device. Start the master driver agent which would intern start + # to fake device. Start the main driver agent which would intern start # the fake driver using the configs created above actuator_uuid = volttron_instance1.install_agent( agent_dir="services/core/ActuatorAgent", @@ -128,7 +128,7 @@ def publish_agent(request, volttron_instance1): def stop_agent(): print("In teardown method of module") volttron_instance1.stop_agent(actuator_uuid) - volttron_instance1.stop_agent(master_uuid) + volttron_instance1.stop_agent(main_uuid) publish_agent.core.stop() request.addfinalizer(stop_agent) diff --git a/services/core/ForwardHistorian/tests/test_forwardhistorian.py b/services/core/ForwardHistorian/tests/test_forwardhistorian.py index 9fedffc7..1f5ba068 100644 --- a/services/core/ForwardHistorian/tests/test_forwardhistorian.py +++ b/services/core/ForwardHistorian/tests/test_forwardhistorian.py @@ -508,7 +508,7 @@ def test_actuator_topic(publish_agent, query_agent, volttron_instance1, volttron_instance2): print("\n** test_actuator_topic **") - # Create master driver config and 4 fake devices each with 6 points + # Create main driver config and 4 fake devices each with 6 points process = Popen(['python', 'config_builder.py', '--count=1', '--publish-only-depth-all', 'fake', 'fake_unit_testing.csv', 'null'], @@ -519,17 +519,17 @@ def test_actuator_topic(publish_agent, query_agent, volttron_instance1, print result assert result == 0 - # Start the master driver agent which would intern start the fake driver + # Start the main driver agent which would intern start the fake driver # using the configs created above - master_uuid = volttron_instance1.install_agent( - agent_dir="services/core/MasterDriverAgent", - config_file="scripts/scalability-testing/configs/master-driver.agent", + main_uuid = volttron_instance1.install_agent( + agent_dir="services/core/MainDriverAgent", + config_file="scripts/scalability-testing/configs/main-driver.agent", start=True) - print("agent id: ", master_uuid) + print("agent id: ", main_uuid) gevent.sleep(2) # wait for the agent to start and start the devices # Start the actuator agent through which publish agent should communicate - # to fake device. Start the master driver agent which would intern start + # to fake device. Start the main driver agent which would intern start # the fake driver using the configs created above actuator_uuid = volttron_instance1.install_agent( agent_dir="services/core/ActuatorAgent", diff --git a/services/core/MasterDriverAgent/master_driver/agent.py b/services/core/MasterDriverAgent/master_driver/agent.py index d4fed395..7d0d406c 100644 --- a/services/core/MasterDriverAgent/master_driver/agent.py +++ b/services/core/MasterDriverAgent/master_driver/agent.py @@ -70,7 +70,7 @@ _log = logging.getLogger(__name__) __version__ = '0.1' -def master_driver_agent(config_path, **kwargs): +def main_driver_agent(config_path, **kwargs): config = utils.load_config(config_path) @@ -134,14 +134,14 @@ def get_config(name, default=None): staggered_start = get_config('staggered_start', None) - return MasterDriverAgent(driver_config_list, scalability_test, scalability_test_iterations, staggered_start, + return MainDriverAgent(driver_config_list, scalability_test, scalability_test_iterations, staggered_start, identity=vip_identity, heartbeat_autostart=True, **kwargs) -class MasterDriverAgent(Agent): +class MainDriverAgent(Agent): def __init__(self, driver_config_list, scalability_test = False, scalability_test_iterations = 3, staggered_start = None, **kwargs): - super(MasterDriverAgent, self).__init__(**kwargs) + super(MainDriverAgent, self).__init__(**kwargs) self.instances = {} self.scalability_test = scalability_test self.scalability_test_iterations = scalability_test_iterations @@ -244,7 +244,7 @@ def revert_device(self, path, **kwargs): def main(argv=sys.argv): '''Main method called to start the agent.''' #try: - utils.vip_main(master_driver_agent) + utils.vip_main(main_driver_agent) #except Exception: # _log.exception('unhandled exception') diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/__init__.py b/services/core/MasterDriverAgent/master_driver/interfaces/__init__.py index b8282e58..3519ccc6 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/__init__.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/__init__.py @@ -56,7 +56,7 @@ While it is possible to create an Agent which handles communication with a new device it will miss out on the benefits of creating a proper interface for the -Master Driver Agent. +Main Driver Agent. Creating an Interface for a device allows users of the device to automatically benefit from the following platform features: @@ -76,7 +76,7 @@ ------------------------ To create a new device driver create a new module in the -:py:mod:`MasterDriverAgent.master_driver.interfaces` package. The name of +:py:mod:`MainDriverAgent.main_driver.interfaces` package. The name of this module will be the name to use in the "driver_type" setting in a :ref:`driver configuration file ` in order to load the new driver. @@ -105,10 +105,10 @@ ----------------------------------- When processing a :ref:`driver configuration file ` -the Master Driver Agent will use the "driver_type" setting to automatically find and load the +the Main Driver Agent will use the "driver_type" setting to automatically find and load the appropriate ``Interface`` class for the desired driver. -After loading the class the Master Driver Agent will call :py:meth:`BaseInterface.configure` +After loading the class the Main Driver Agent will call :py:meth:`BaseInterface.configure` with the contents of the "driver_config" section of the :ref:`driver configuration file ` parsed into a python dictionary and the contents of the file referenced in @@ -118,14 +118,14 @@ on a device by creating instances of :py:class:`BaseRegister` (or a subclass) and adding them to the Interface with :py:meth:`BaseInterface.insert_register`. -After calling :py:meth:`BaseInterface.configure` the Master Driver Agent +After calling :py:meth:`BaseInterface.configure` the Main Driver Agent will use the created registers to create meta data for each point on the device. Device Scraping --------------- The work scheduling and publish periodic device scrapes is handled by -the Master Driver Agent. When a scrape starts the Master Driver Agent calls the +the Main Driver Agent. When a scrape starts the Main Driver Agent calls the :py:meth:`BaseInterface.scrape_all`. It will take the results of the call and attach meta data and and publish as needed. @@ -133,11 +133,11 @@ ------------------ Requests to interact with the device via any method supported by the platform -are routed to the correct Interface instance by the Master Driver Agent. +are routed to the correct Interface instance by the Main Driver Agent. Most commands originate from RPC calls to the :py:class:`Actuator Agent` and are forwarded -to the Master Driver Agent. +to the Main Driver Agent. - A command to set the value of a point on a device results in a call to :py:meth:`BaseInterface.set_point`. @@ -155,7 +155,7 @@ Registers --------- -The Master Driver Agent uses the :py:meth:`BaseInterface.get_register_names` and +The Main Driver Agent uses the :py:meth:`BaseInterface.get_register_names` and :py:meth:`BaseInterface.get_register_by_name` methods to get registers to setup meta data. This means that its a requirement to use the BaseRegister class to store @@ -208,7 +208,7 @@ class BaseRegister(object): :type units: str :type description: str - The Master Driver Agent will use :py:meth:`BaseRegister.get_units` to populate metadata for + The Main Driver Agent will use :py:meth:`BaseRegister.get_units` to populate metadata for publishing. When instantiating register instances be sure to provide a useful string for the units argument. """ @@ -254,7 +254,7 @@ class BaseInterface(object): All interfaces *must* subclass this. - :param vip: A reference to the MasterDriverAgent vip subsystem. + :param vip: A reference to the MainDriverAgent vip subsystem. :param core: A reference to the parent driver agent's core subsystem. """ @@ -373,7 +373,7 @@ def set_point(self, point_name, value, **kwargs): @abc.abstractmethod def scrape_all(self): """ - Method the Master Driver Agent calls to get the current state + Method the Main Driver Agent calls to get the current state of a device for publication. :return: Point names to values for device. @@ -586,7 +586,7 @@ def _set_point(self, point_name, value): @abc.abstractmethod def _scrape_all(self): """ - Method the Master Driver Agent calls to get the current state + Method the Main Driver Agent calls to get the current state of a device for publication. If using this mixin you must override this method diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/bacnet.py b/services/core/MasterDriverAgent/master_driver/interfaces/bacnet.py index 9bb410a9..bc051795 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/bacnet.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/bacnet.py @@ -50,12 +50,12 @@ # operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY # under Contract DE-AC05-76RL01830 -from services.core.MasterDriverAgent.master_driver.interfaces import BaseInterface, BaseRegister +from services.core.MainDriverAgent.main_driver.interfaces import BaseInterface, BaseRegister from csv import DictReader from StringIO import StringIO import logging from datetime import datetime, timedelta -from services.core.MasterDriverAgent.master_driver.driver_exceptions import DriverConfigError +from services.core.MainDriverAgent.main_driver.driver_exceptions import DriverConfigError from volttron.platform.vip.agent import errors #Logging is completely configured by now. _log = logging.getLogger(__name__) diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/fakedriver.py b/services/core/MasterDriverAgent/master_driver/interfaces/fakedriver.py index 30309d0c..4976d5bc 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/fakedriver.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/fakedriver.py @@ -53,7 +53,7 @@ import datetime from math import sin, pi -from master_driver.interfaces import BaseInterface, BaseRegister, BasicRevert +from main_driver.interfaces import BaseInterface, BaseRegister, BasicRevert from csv import DictReader from StringIO import StringIO import logging diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/modbus.py b/services/core/MasterDriverAgent/master_driver/interfaces/modbus.py index 6b81778c..83f2a0c1 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/modbus.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/modbus.py @@ -57,7 +57,7 @@ from pymodbus.constants import Defaults from volttron.platform.agent import utils -from master_driver.interfaces import BaseInterface, BaseRegister, BasicRevert, DriverInterfaceError +from main_driver.interfaces import BaseInterface, BaseRegister, BasicRevert, DriverInterfaceError import struct import logging @@ -66,7 +66,7 @@ import os.path from contextlib import contextmanager, closing -from master_driver.driver_locks import socket_lock +from main_driver.driver_locks import socket_lock @contextmanager def modbus_client(address, port): @@ -92,15 +92,15 @@ class ModbusInterfaceException(ModbusException): pass class ModbusRegisterBase(BaseRegister): - def __init__(self, address, register_type, read_only, pointName, units, description = '', slave_id=0): + def __init__(self, address, register_type, read_only, pointName, units, description = '', subordinate_id=0): super(ModbusRegisterBase, self).__init__(register_type, read_only, pointName, units, description = '') self.address = address - self.slave_id = slave_id + self.subordinate_id = subordinate_id class ModbusBitRegister(ModbusRegisterBase): - def __init__(self, address, type_string, pointName, units, read_only, description = '', slave_id=0): + def __init__(self, address, type_string, pointName, units, read_only, description = '', subordinate_id=0): super(ModbusBitRegister, self).__init__(address, "bit", read_only, pointName, units, - description = description, slave_id=slave_id) + description = description, subordinate_id=subordinate_id) self.python_type = bool @@ -113,14 +113,14 @@ def get_register_count(self): return 1 def get_state(self, client): - response_bits = client.read_discrete_inputs(self.address, unit=self.slave_id) if self.read_only else client.read_coils(self.address, unit=self.slave_id) + response_bits = client.read_discrete_inputs(self.address, unit=self.subordinate_id) if self.read_only else client.read_coils(self.address, unit=self.subordinate_id) if response_bits is None: raise ModbusInterfaceException("pymodbus returned None") return response_bits.bits[0] def set_state(self, client, value): if not self.read_only: - response = client.write_coil(self.address, value, unit=self.slave_id) + response = client.write_coil(self.address, value, unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") if isinstance(response, ExceptionResponse): @@ -129,9 +129,9 @@ def set_state(self, client, value): return None class ModbusByteRegister(ModbusRegisterBase): - def __init__(self, address, type_string, pointName, units, read_only, description = '', slave_id=0): + def __init__(self, address, type_string, pointName, units, read_only, description = '', subordinate_id=0): super(ModbusByteRegister, self).__init__(address, "byte", read_only, - pointName, units, description = description, slave_id=slave_id) + pointName, units, description = description, subordinate_id=subordinate_id) try: self.parse_struct = struct.Struct(type_string) @@ -162,9 +162,9 @@ def parse_value(self, starting_address, byte_stream): def get_state(self, client): if self.read_only: - response = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + response = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) else: - response = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + response = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") @@ -177,7 +177,7 @@ def set_state(self, client, value): if not self.read_only: value_bytes = self.parse_struct.pack(value) register_values = PYMODBUS_REGISTER_STRUCT.unpack_from(value_bytes) - client.write_registers(self.address, register_values, unit=self.slave_id) + client.write_registers(self.address, register_values, unit=self.subordinate_id) return self.get_state(client) return None @@ -188,7 +188,7 @@ def __init__(self, **kwargs): self.build_ranges_map() def configure(self, config_dict, registry_config_str): - self.slave_id=config_dict.get("slave_id", 0) + self.subordinate_id=config_dict.get("subordinate_id", 0) self.ip_address = config_dict["device_address"] self.port = config_dict.get("port", Defaults.Port) self.parse_config(registry_config_str) @@ -247,7 +247,7 @@ def scrape_byte_registers(self, client, read_only): for group in xrange(start, end + 1, MODBUS_READ_MAX): count = min(end - group + 1, MODBUS_READ_MAX) - response = client.read_input_registers(group, count, unit=self.slave_id) if read_only else client.read_holding_registers(group, count, unit=self.slave_id) + response = client.read_input_registers(group, count, unit=self.subordinate_id) if read_only else client.read_holding_registers(group, count, unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") response_bytes = response.encode() @@ -272,7 +272,7 @@ def scrape_bit_registers(self, client, read_only): for group in xrange(start, end + 1, MODBUS_READ_MAX): count = min(end - group + 1, MODBUS_READ_MAX) - response = client.read_discrete_inputs(group, count, unit=self.slave_id) if read_only else client.read_coils(group, count, unit=self.slave_id) + response = client.read_discrete_inputs(group, count, unit=self.subordinate_id) if read_only else client.read_coils(group, count, unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") result += response.bits @@ -297,7 +297,7 @@ def _scrape_all(self): except (ConnectionException, ModbusIOException, ModbusInterfaceException) as e: raise DriverInterfaceError ("Failed to scrape device at " + self.ip_address + ":" + str(self.port) + " " + - "ID: " + str(self.slave_id) + str(e)) + "ID: " + str(self.subordinate_id) + str(e)) return result_dict @@ -323,7 +323,7 @@ def parse_config(self, config_string): default_value = None klass = ModbusBitRegister if bit_register else ModbusByteRegister - register = klass(address, io_type, point_path, units, read_only, description = description, slave_id=self.slave_id) + register = klass(address, io_type, point_path, units, read_only, description = description, subordinate_id=self.subordinate_id) self.insert_register(register) diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/radiothermostat.py b/services/core/MasterDriverAgent/master_driver/interfaces/radiothermostat.py index c04ba8d5..d71d6ee2 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/radiothermostat.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/radiothermostat.py @@ -42,7 +42,7 @@ import time import ast import csv -from master_driver.interfaces import BaseInterface, BaseRegister, DriverInterfaceError +from main_driver.interfaces import BaseInterface, BaseRegister, DriverInterfaceError from csv import DictReader from StringIO import StringIO from datetime import datetime diff --git a/services/core/MasterDriverAgent/master_driver/interfaces/universal.py b/services/core/MasterDriverAgent/master_driver/interfaces/universal.py index 36807b6e..a17ecfa2 100644 --- a/services/core/MasterDriverAgent/master_driver/interfaces/universal.py +++ b/services/core/MasterDriverAgent/master_driver/interfaces/universal.py @@ -52,7 +52,7 @@ import random from volttron.platform.agent import utils -from master_driver.interfaces import BaseInterface, BaseRegister, BasicRevert +from main_driver.interfaces import BaseInterface, BaseRegister, BasicRevert from csv import DictReader from StringIO import StringIO import gevent @@ -117,7 +117,7 @@ def _set_point(self, point_name, value): return register._value # this gets called periodically via DriverAgent::periodic_read() - # ( on behalf of MasterDriverAgent ) + # ( on behalf of MainDriverAgent ) def _scrape_all(self): result = {} read_registers = self.get_registers_by_type("byte", True) diff --git a/services/core/MasterDriverAgent/master_driver/tests/test_revert_mixin.py b/services/core/MasterDriverAgent/master_driver/tests/test_revert_mixin.py index a4f2d4dd..5112bd69 100644 --- a/services/core/MasterDriverAgent/master_driver/tests/test_revert_mixin.py +++ b/services/core/MasterDriverAgent/master_driver/tests/test_revert_mixin.py @@ -53,7 +53,7 @@ #}}} -from master_driver.interfaces.fakedriver import Interface +from main_driver.interfaces.fakedriver import Interface import pytest registry_config_string = """Point Name,Volttron Point Name,Units,Units Details,Writable,Starting Value,Type,Notes diff --git a/volttron/drivers/file_driver.py b/volttron/drivers/file_driver.py index a50f57ad..8011e76b 100755 --- a/volttron/drivers/file_driver.py +++ b/volttron/drivers/file_driver.py @@ -160,7 +160,7 @@ def scrape_all(self): except (IOError): print ("ERROR: Failed to scrape device at " + self.ip_address + ":" + str(self.port) + " " + - "ID: " + str(self.slave_id)) + "ID: " + str(self.subordinate_id)) return None return result_dict diff --git a/volttron/drivers/modbus.py b/volttron/drivers/modbus.py index 21dd3613..cbaa3637 100755 --- a/volttron/drivers/modbus.py +++ b/volttron/drivers/modbus.py @@ -93,15 +93,15 @@ class ModbusInterfaceException(ModbusException): pass class ModbusRegisterBase(BaseRegister): - def __init__(self, address, register_type, read_only, pointName, units, description = '', slave_id=0): + def __init__(self, address, register_type, read_only, pointName, units, description = '', subordinate_id=0): super(ModbusRegisterBase, self).__init__(register_type, read_only, pointName, units, description = '') self.address = address - self.slave_id = slave_id + self.subordinate_id = subordinate_id class ModbusBitRegister(ModbusRegisterBase): - def __init__(self, address, type_string, pointName, units, read_only, description = '', slave_id=0): + def __init__(self, address, type_string, pointName, units, read_only, description = '', subordinate_id=0): super(ModbusBitRegister, self).__init__(address, "bit", read_only, pointName, units, - description = description, slave_id=slave_id) + description = description, subordinate_id=subordinate_id) self.python_type = bool @@ -119,12 +119,12 @@ def get_state_callback(self, response_bits): return response_bits.bits[0] def get_state_async(self, client): - d = client.read_discrete_inputs(self.address, unit=self.slave_id) if self.read_only else client.read_coils(self.address, unit=self.slave_id) + d = client.read_discrete_inputs(self.address, unit=self.subordinate_id) if self.read_only else client.read_coils(self.address, unit=self.subordinate_id) d.addCallback(self.get_state_callback) return d def get_state_sync(self, client): - response_bits = client.read_discrete_inputs(self.address, unit=self.slave_id) if self.read_only else client.read_coils(self.address, unit=self.slave_id) + response_bits = client.read_discrete_inputs(self.address, unit=self.subordinate_id) if self.read_only else client.read_coils(self.address, unit=self.subordinate_id) return self.get_state_callback(response_bits) def set_state_callback(self, response): @@ -136,21 +136,21 @@ def set_state_callback(self, response): def set_state_sync(self, client, value): if not self.read_only: - r = client.write_coil(self.address, value, unit=self.slave_id) + r = client.write_coil(self.address, value, unit=self.subordinate_id) return self.set_state_callback(r) return None def set_state_async(self, client, value): if not self.read_only: - r = client.write_coil(self.address, value, unit=self.slave_id) + r = client.write_coil(self.address, value, unit=self.subordinate_id) r.addCallback(self.set_state_callback) return r return None class ModbusByteRegister(ModbusRegisterBase): - def __init__(self, address, type_string, pointName, units, read_only, description = '', slave_id=0): + def __init__(self, address, type_string, pointName, units, read_only, description = '', subordinate_id=0): super(ModbusByteRegister, self).__init__(address, "byte", read_only, - pointName, units, description = description, slave_id=slave_id) + pointName, units, description = description, subordinate_id=subordinate_id) try: self.parse_struct = struct.Struct(type_string) @@ -187,17 +187,17 @@ def get_state_callback(self, response): def get_state_async(self, client): if self.read_only: - d = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + d = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) else: - d = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + d = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) d.addCallback(self.get_state_callback) return d def get_state_sync(self, client): if self.read_only: - response = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + response = client.read_input_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) else: - response = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.slave_id) + response = client.read_holding_registers(self.address, count=self.get_register_count(), unit=self.subordinate_id) return self.get_state_callback(response) @@ -205,7 +205,7 @@ def set_state_sync(self, client, value): if not self.read_only: value_bytes = self.parse_struct.pack(value) register_values = PYMODBUS_REGISTER_STRUCT.unpack_from(value_bytes) - client.write_registers(self.address, register_values, unit=self.slave_id) + client.write_registers(self.address, register_values, unit=self.subordinate_id) return self.get_state_sync(client) return None @@ -216,16 +216,16 @@ def set_state_async(self, client, value): if not self.read_only: value_bytes = self.parse_struct.pack(value) register_values = PYMODBUS_REGISTER_STRUCT.unpack_from(value_bytes) - r = client.write_registers(self.address, register_values, unit=self.slave_id) + r = client.write_registers(self.address, register_values, unit=self.subordinate_id) r.addCallback(self.set_state_callback, client) return r return None class ModbusInterface(BaseInterface): - def __init__(self, ip_address, port=Defaults.Port, slave_id=0, config_file=configFile, **kwargs): + def __init__(self, ip_address, port=Defaults.Port, subordinate_id=0, config_file=configFile, **kwargs): super(ModbusInterface, self).__init__(**kwargs) - self.slave_id=slave_id + self.subordinate_id=subordinate_id self.ip_address = ip_address self.port = port self.build_ranges_map() @@ -312,7 +312,7 @@ def scrape_byte_registers(self, client, read_only): for group in xrange(start, end + 1, MODBUS_READ_MAX): count = min(end - group + 1, MODBUS_READ_MAX) - response = client.read_input_registers(group, count, unit=self.slave_id) if read_only else client.read_holding_registers(group, count, unit=self.slave_id) + response = client.read_input_registers(group, count, unit=self.subordinate_id) if read_only else client.read_holding_registers(group, count, unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") response_bytes = response.encode() @@ -337,7 +337,7 @@ def scrape_bit_registers(self, client, read_only): for group in xrange(start, end + 1, MODBUS_READ_MAX): count = min(end - group + 1, MODBUS_READ_MAX) - response = client.read_discrete_inputs(group, count, unit=self.slave_id) if read_only else client.read_coils(group, count, unit=self.slave_id) + response = client.read_discrete_inputs(group, count, unit=self.subordinate_id) if read_only else client.read_coils(group, count, unit=self.subordinate_id) if response is None: raise ModbusInterfaceException("pymodbus returned None") result += response.bits @@ -362,7 +362,7 @@ def scrape_all(self): except (ConnectionException, ModbusIOException, ModbusInterfaceException) as e: print ("ERROR: Failed to scrape device at " + self.ip_address + ":" + str(self.port) + " " + - "ID: " + str(self.slave_id) + str(e)) + "ID: " + str(self.subordinate_id) + str(e)) return None finally: client.close() @@ -390,7 +390,7 @@ def parse_config(self, config_file): units = regDef['Units'] klass = ModbusBitRegister if bit_register else ModbusByteRegister - register = klass(address, io_type, point_path, units, read_only, description = description, slave_id=self.slave_id) + register = klass(address, io_type, point_path, units, read_only, description = description, subordinate_id=self.subordinate_id) self.insert_register(register) @@ -403,11 +403,11 @@ def setup(self, opts): def get_interface(self, opts): ip_address = opts['ip_address'] - slave_id = int(opts.get('slave_id',0)) + subordinate_id = int(opts.get('subordinate_id',0)) port = int(opts.get('port',502)) catalyst_config = opts.get('register_config', configFile) - return ModbusInterface(ip_address, slave_id=slave_id, port=port, config_file=catalyst_config) + return ModbusInterface(ip_address, subordinate_id=subordinate_id, port=port, config_file=catalyst_config) if __name__ == "__main__": from pprint import pprint diff --git a/volttron/platform/agent/base_historian.py b/volttron/platform/agent/base_historian.py index 081ec87d..d05ee2a4 100644 --- a/volttron/platform/agent/base_historian.py +++ b/volttron/platform/agent/base_historian.py @@ -884,7 +884,7 @@ def _setupdb(self): max_storage_bytes = self._backup_storage_limit_gb * 1024 ** 3 self.max_pages = max_storage_bytes / page_size - c.execute("SELECT name FROM sqlite_master WHERE type='table' " + c.execute("SELECT name FROM sqlite_main WHERE type='table' " "AND name='outstanding';") if c.fetchone() is None: @@ -898,7 +898,7 @@ def _setupdb(self): value_string TEXT NOT NULL, UNIQUE(ts, topic_id, source))''') - c.execute("SELECT name FROM sqlite_master WHERE type='table' " + c.execute("SELECT name FROM sqlite_main WHERE type='table' " "AND name='metadata';") if c.fetchone() is None: @@ -913,7 +913,7 @@ def _setupdb(self): for row in c: self._meta_data[(row[0], row[1])][row[2]] = row[3] - c.execute("SELECT name FROM sqlite_master WHERE type='table' " + c.execute("SELECT name FROM sqlite_main WHERE type='table' " "AND name='topics';") if c.fetchone() is None: diff --git a/volttron/platform/agent/known_identities.py b/volttron/platform/agent/known_identities.py index 36cba958..47c430b5 100644 --- a/volttron/platform/agent/known_identities.py +++ b/volttron/platform/agent/known_identities.py @@ -4,7 +4,7 @@ PLATFORM_HISTORIAN = 'platform.historian' CONTROL = 'control' CONTROL_CONNECTION = 'control.connection' -MASTER_WEB = 'master.web' +MASTER_WEB = 'main.web' all_known = (VOLTTRON_CENTRAL, VOLTTRON_CENTRAL_PLATFORM, PLATFORM_HISTORIAN, CONTROL, CONTROL_CONNECTION, MASTER_WEB) diff --git a/volttron/platform/agent/tests/test_base_historian.py b/volttron/platform/agent/tests/test_base_historian.py index 7b38fd54..64482d70 100644 --- a/volttron/platform/agent/tests/test_base_historian.py +++ b/volttron/platform/agent/tests/test_base_historian.py @@ -21,23 +21,23 @@ def query_historian(self): def prep_config(volttron_home): - src_driver = os.getcwd() + '/services/core/MasterDriverAgent/master_driver/test_fakedriver.config' + src_driver = os.getcwd() + '/services/core/MainDriverAgent/main_driver/test_fakedriver.config' new_driver = volttron_home + '/test_fakedriver.config' shutil.copy(src_driver, new_driver) with open(new_driver, 'r+') as f: config = json.load(f) - config['registry_config'] = os.getcwd() + '/services/core/MasterDriverAgent/master_driver/fake.csv' + config['registry_config'] = os.getcwd() + '/services/core/MainDriverAgent/main_driver/fake.csv' f.seek(0) f.truncate() json.dump(config, f) - master_config = { - "agentid": "master_driver", + main_config = { + "agentid": "main_driver", "driver_config_list": [new_driver] } - return master_config + return main_config foundtopic = False @@ -52,9 +52,9 @@ def test_base_historian(volttron_instance1): v1 = volttron_instance1 assert v1.is_running() - master_config = prep_config(v1.volttron_home) - master_uuid = v1.install_agent(agent_dir="services/core/MasterDriverAgent", - config_file=master_config) + main_config = prep_config(v1.volttron_home) + main_uuid = v1.install_agent(agent_dir="services/core/MainDriverAgent", + config_file=main_config) gevent.sleep(2) db = Historian(address=v1.vip_address[0], diff --git a/volttrontesting/platform/python_2_7_3_sqlite3/dump.py b/volttrontesting/platform/python_2_7_3_sqlite3/dump.py index da6be686..d95282af 100644 --- a/volttrontesting/platform/python_2_7_3_sqlite3/dump.py +++ b/volttrontesting/platform/python_2_7_3_sqlite3/dump.py @@ -19,10 +19,10 @@ def _iterdump(connection): cu = connection.cursor() yield('BEGIN TRANSACTION;') - # sqlite_master table contains the SQL CREATE statements for the database. + # sqlite_main table contains the SQL CREATE statements for the database. q = """ SELECT "name", "type", "sql" - FROM "sqlite_master" + FROM "sqlite_main" WHERE "sql" NOT NULL AND "type" == 'table' """ @@ -31,13 +31,13 @@ def _iterdump(connection): if table_name == 'sqlite_sequence': yield('DELETE FROM "sqlite_sequence";') elif table_name == 'sqlite_stat1': - yield('ANALYZE "sqlite_master";') + yield('ANALYZE "sqlite_main";') elif table_name.startswith('sqlite_'): continue # NOTE: Virtual table support not implemented #elif sql.startswith('CREATE VIRTUAL TABLE'): # qtable = table_name.replace("'", "''") - # yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"\ + # yield("INSERT INTO sqlite_main(type,name,tbl_name,rootpage,sql)"\ # "VALUES('table','{0}','{0}',0,'{1}');".format( # qtable, # sql.replace("''"))) @@ -58,7 +58,7 @@ def _iterdump(connection): # Now when the type is 'index', 'trigger', or 'view' q = """ SELECT "name", "type", "sql" - FROM "sqlite_master" + FROM "sqlite_main" WHERE "sql" NOT NULL AND "type" IN ('index', 'trigger', 'view') """ diff --git a/volttrontesting/platform/test_platform_web.py b/volttrontesting/platform/test_platform_web.py index bc54551e..e5185607 100644 --- a/volttrontesting/platform/test_platform_web.py +++ b/volttrontesting/platform/test_platform_web.py @@ -66,7 +66,7 @@ def test_register_route(volttron_instance1_web): webdir, index_html = _build_web_dir(vi.volttron_home) agent = vi.build_agent(use_ipc=True) - agent.vip.rpc.call('master.web', + agent.vip.rpc.call('main.web', 'register_path_route', 'volttron.central', '', webdir).get(timeout=5) response = requests.get(vi.bind_web_address+"/index.html")