Beispiel #1
0
 def push_constellation(self, ecu_groups, busses, bus_connections):
     ''' this method receives the initial constellation of the 
         environment and publishes it to the handlers 
     
         Input:  ecu_groups        list        list of lists: [[ecu_list, ecu_spec],[ecu_list, ecu_spec],...]
                 busses            list        list of lists: [[bus_list, ecu_spec],[bus_list, ecu_spec],...]
                 bus_connections   list        list of lists [[bus_id, ecu_id], [bus_id, ecu_id],...]
         Output: -
     '''        
     # set eventline handlers
     for ecu in ecu_groups: 
         try:
             General().register_eventline_tags(ecu[0][0].ecuSW.comm_mod._tags)
         except:
             pass
     
     # push the constellation
     push_list = [MonitorInput([ecu_groups, busses, bus_connections], MonitorTags.CONSELLATION_INFORMATION, \
                         None, 0, None, None, None, None, None, None)]
     self._input_handler.publish(push_list, RefList())        
         
     # push initial ecu ids
     
     push_list = MonitorInput(APICore()._ecu_list_from_groups(ecu_groups), MonitorTags.ECU_ID_LIST, \
                         None, 0, None, None, None, None, None, None)
     self._input_handler.publish(push_list, RefList())   
Beispiel #2
0
 def __init__(self, sim_env, bus_id, data_rate, avg_ecu_dist=2):
     ''' Constructor
         
         Input:    sim_env        simpy.Environment         environment in which this Bus acts
                   bus_id         string                    id of this Bus object
                   data_rate      float                     datarate of this bus
                   avg_ecu_dist   float                     average distance between two connected ECUs
             
         Output:   -                  
     '''
     AbstractCANBus.__init__(self, sim_env, bus_id, data_rate, avg_ecu_dist)
     
     # bus objects
     self.current_message = None  # current message on the bus [sender_ecu, message]
     self.set_settings()
     self.monitor_list = RefList()
     self._used_prop_times = {}
     self.gateways = []
     self.first = True
     
     # synchronization objects
     self.pot_messages = []  # gathers all potential messages that want to be sent at a certain point in time
     self.sync_1 = simpy.Store(self.sim_env, capacity=1)  # if the decision, who is allowed to sent is done this synchronizer starts the transmission
     self.sync_2 = simpy.Store(self.sim_env, capacity=1)  # if store is empty then the channel is busy
     self.sync_send = simpy.Store(self.sim_env, capacity=1)  # store that is full if sending and free else
     self.subscribers = 0  # number of ECUs waiting for the channel to be freed
         
     # project parameters
     self.SCB_GATHER_MSGS = time.SCB_GATHER_MSGS
     self.SCB_GRAB_PRIO_MSG = time.SCB_GRAB_PRIO_MSG
     self.SCB_PROPAGATION_DELAY = time.SCB_PROPAGATION_DELAY
     self.SCB_SENDING_TIME = time.SCB_SENDING_TIME
     self.SCB_WRITE_TO_TRANSCEIVER_BUFFER = time.SCB_WRITE_TO_TRANSCEIVER_BUFFER
Beispiel #3
0
    def __init__(self, export_options=False, file_path=False, ignore=False):
        AbstractInterpreter.__init__(self, export_options, file_path)
        if ignore: return

        # CSV Output
        self.ecu_ids = RefList()
        self.first = True
    def __init__(self, sim_env, ecu_id):
        ''' Constructor
            
            Input:  ecu_id         string                   id of the corresponding AbstractECU
                    sim_env        simpy.Environment        environment of this component
            Output:  -
        '''
        AbstractCommModule.__init__(self, sim_env)

        # local parameters
        self._ecu_id = ecu_id
        self._jitter_in = 1
        self.monitor_list = RefList()
        
        # initialize
        self._init_layers(self.sim_env, self.MessageClass)
        
        # add tags
        self._tags = ["AUTH_SEND_TIME_BEFORE_ENCRYPTION", "AUTH_SEND_TIME_AFTER_ENCRYPTION", "AUTH_RECEIVE_TIME_BEFORE_DECRYPTION", "AUTH_RECEIVE_TIME_AFTER_DECRYPTION"]        
    
        # NEW: Add key pair - public and private
        assymetric_encryption_algorithm = AsymAuthMechEnum.RSA
        assymetric_encryption_key_length = AuKeyLengthEnum.bit_512
        assymetric_encryption_option = 65537
        self.priv_key, self.pub_key = encryption_tools.asy_get_key_pair(assymetric_encryption_algorithm, assymetric_encryption_key_length, assymetric_encryption_option)
        PublicKeyManager().add_key(self._ecu_id, self.pub_key) # make public key available to everybody

        # Create a certificate from root L3 along L3 L31 L311
        [certificate, root_certificates_to_verify_this_certificate, priv_key] = GeneralSpecPreset().certificate_manager.generate_valid_ecu_cert(self._ecu_id, CAEnum.CA_L311, 0, float('inf'))
        self.my_certificate = certificate
        self.my_root_certificates = root_certificates_to_verify_this_certificate
Beispiel #5
0
 def __init__(self, input_handler_chain=False):   
     QObject.__init__(self)                
     
     self.sim_env = None
     self.monitored = []
     self.t_period = 1
     self.sample_time = 0.5  # Sample time in which the information is read from the objects
     self._show_time = True
     self._last_run_elements = RefList()
     self._init_input_handlers(input_handler_chain)
Beispiel #6
0
    def __init__(self, sim_env, ecu_id):
        ''' Constructor
            
            Input:  ecu_id         string                   id of the corresponding AbstractECU
                    sim_env        simpy.Environment        environment of this component
            Output:  -
        '''
        AbstractCommModule.__init__(self, sim_env)

        # local parameters
        self._ecu_id = ecu_id
        self._jitter_in = 1
        self.monitor_list = RefList()

        # initialize
        self._init_layers(self.sim_env, self.MessageClass)
Beispiel #7
0
    def __init__(self, sim_env, ecu_id):
        ''' Constructor
            
            Input:  ecu_id         string                   id of the corresponding AbstractECU
                    sim_env        simpy.Environment        environment of this component
            Output:  -
        '''
        AbstractCommModule.__init__(self, sim_env)

        # local parameters
        self._ecu_id = ecu_id
        self._jitter_in = 1
        self.monitor_list = RefList()

        # initialize
        self._init_layers(self.sim_env, self.MessageClass)

        # add tags
        self._tags = [
            "AUTH_SEND_TIME_BEFORE_ENCRYPTION",
            "AUTH_SEND_TIME_AFTER_ENCRYPTION",
            "AUTH_RECEIVE_TIME_BEFORE_DECRYPTION",
            "AUTH_RECEIVE_TIME_AFTER_DECRYPTION"
        ]

        # NEW: Add key pair - public and private
        assymetric_encryption_algorithm = AsymAuthMechEnum.RSA
        assymetric_encryption_key_length = AuKeyLengthEnum.bit_512
        assymetric_encryption_option = 65537
        self.priv_key, self.pub_key = encryption_tools.asy_get_key_pair(
            assymetric_encryption_algorithm, assymetric_encryption_key_length,
            assymetric_encryption_option)
        PublicKeyManager().add_key(
            self._ecu_id,
            self.pub_key)  # make public key available to everybody

        self.first_message = False
Beispiel #8
0
    def __init__(self, sim_env, ecu_id):
        ''' Constructor
            
            Input:  ecu_id         string                   id of the corresponding AbstractECU
                    sim_env        simpy.Environment        environment of this component
            Output:  -
        '''
        AbstractCommModule.__init__(self, sim_env)

        # local parameters
        self._ecu_id = ecu_id
        self._jitter_in = 1
        self.monitor_list = RefList()

        # initialize
        self._init_layers(self.sim_env, self.MessageClass)

        # add tags
        self._tags = [
            "AUTH_SEND_TIME_BEFORE_ENCRYPTION",
            "AUTH_SEND_TIME_AFTER_ENCRYPTION",
            "AUTH_RECEIVE_TIME_BEFORE_DECRYPTION",
            "AUTH_RECEIVE_TIME_AFTER_DECRYPTION"
        ]