Example #1
0
def _test2():
	# test with AlertAgent, ReadAttackAgent
	import cyberAttack
	cosimProps = {'port':'6267', 'hostname':'localhost', 'glmPath':omf.omfDir + '/scratch/CIGAR/test_smsSingle.glm', 'startTime':'2000-01-01 00:00:00','endTime':'2000-01-05 12:00:00', 'stepSizeSeconds':3600} #error with having 
	agents = [cyberAttack.AlertAgent('AlertAgent', '2000-01-03 12:00:00')] 
	print 'Starting co-sim with 1 agent.'
	coord = Coordinator(agents, cosimProps)
Example #2
0
def _test3():
	# test with AlertAgent, ReadAttackAgent
	import cyberAttack
	cosimProps = {'port':'6267', 'hostname':'localhost', 'glmPath':omf.omfDir + '/scratch/CIGAR/test_smsSingle.glm', 'startTime':'2000-01-01 00:00:00','endTime':'2000-01-05 00:00:00', 'stepSizeSeconds':3600}
	agents = [
		cyberAttack.AlertAgent('AlertAgent', '2000-01-03 12:00:00'),
		cyberAttack.ReadAttackAgent('ReadAttackAgent', '2000-01-02 10:00:00', 'tm_1', 'measured_power')
	]
	print 'Starting co-sim with 2 agents.'
	coord = Coordinator(agents, cosimProps)
	print coord.drawResults()
Example #3
0
def _test5():
	# test with AlertAgent, ReadAttackAgent, ReadIntervalAttackAgent, and WriteAttackAgent
	# shows how WriteAttackAgent and WriteIntervalAttackAgent interact with ReadAttackAgent and ReadIntervalAttackAgent
	import cyberAttack
	cosimProps = {'port':'6267', 'hostname':'localhost', 'glmPath':omf.omfDir + '/scratch/CIGAR/test_smsSingle.glm', 'startTime':'2000-01-01 00:00:00','endTime':'2000-01-05 00:00:00', 'stepSizeSeconds':3600}
	agents = []
	agents.append(cyberAttack.AlertAgent('Joe', '2000-01-03 04:00:00'))
	agents.append(cyberAttack.ReadAttackAgent('Sue', '2000-01-02 10:00:00', 'tm_1', 'measured_power'))
	agents.append(cyberAttack.ReadIntervalAttackAgent('David', '2000-01-02 08:00:00', '2000-01-03 08:00:00', 'tm_1', 'measured_real_energy'))
	agents.append(cyberAttack.WriteAttackAgent('Shammya', '2000-01-02 16:00:00', 'tm_1', 'measured_real_energy', '0.0'))
	agents.append(cyberAttack.WriteIntervalAttackAgent('Dan', '2000-01-03 20:00:00', '2000-01-04 08:00:00', 'inverter_1', 'power_factor', '0.4'))
	agents.append(cyberAttack.ReadIntervalAttackAgent('Dan2.0', '2000-01-03 12:00:00', '2000-01-04 12:00:00', 'tm_2', 'measured_reactive_power'))
	agents.append(cyberAttack.DefendByValueAgent('Dan.biz', 'battery_1', 'generator_status', 'ONLINE'))
	agents.append(cyberAttack.WriteAttackAgent('Alice', '2000-01-01 04:00:00', 'battery_1', 'generator_status', 'OFFLINE'))
	print 'Starting co-sim with 8 agents.'
	coord = Coordinator(agents, cosimProps)
	# print coord.drawResults()
	print coord.drawPrettyResults()
Example #4
0
def _test4():
    # test with AlertAgent, ReadAttackAgent, and ReadAttackIntervalAgent
    import cyberAttack
    cosimProps = {
        'port': '6267',
        'hostname': 'localhost',
        'glmPath': './smsSingle.glm',
        'startTime': '2000-01-01 00:00:00',
        'endTime': '2000-01-05 00:00:00',
        'stepSizeSeconds': 3600
    }
    agents = [
        cyberAttack.AlertAgent('2000-01-03 04:00:00'),
        cyberAttack.ReadAttackAgent('2000-01-02 10:00:00', 'tm_1',
                                    'measured_power'),
        cyberAttack.ReadIntervalAttackAgent('2000-01-02 08:00:00',
                                            '2000-01-03 08:00:00', 'tm_1',
                                            'measured_real_energy')
    ]
    print 'Starting co-sim with 3 agents.'
    coord = Coordinator(agents, cosimProps)
    print coord.drawResults()