Esempio n. 1
0
    def __init__(self, name: str, ue_config: UserEquipmentConfiguration,
                 network_config: NetworkPacketConfiguration, core_id: str, t_initial: float = 0):
        super().__init__(name)

        ue_id = ue_config.ue_id
        service_config_list = ue_config.service_config_list
        service_ids = [service_config.service_id for service_config in service_config_list]

        self.ue_id = ue_id

        # Define and add components
        services = [Service(name + service.service_id, ue_id, service, network_config, t_initial, lite_id=core_id)
                    for service in service_config_list]
        [self.add_component(service) for service in services]

        self.input_network = Port(NetworkPacket, 'input_network')
        self.output_network = Port(NetworkPacket, 'output_network')
        self.output_service_delay_report = Port(ServiceDelayReport, 'output_service_delay_report')
        self.add_in_port(self.input_network)
        self.add_out_port(self.output_network)
        self.add_out_port(self.output_service_delay_report)

        if len(services) > 1:  # More than one service -> we add a multiplexer
            service_mux = UEServiceMux(name + '_service_mux', service_ids)
            self.add_component(service_mux)
            self.add_coupling(self.input_network, service_mux.input_network)
            for service in services:
                self.add_coupling(service_mux.outputs_network[service.service_id], service.input_network)
        else:  # Otherwise, multiplexer is not required
            self.add_coupling(self.input_network, services[0].input_network)
        for service in services:
            self.add_coupling(service.output_network, self.output_network)
            self.add_coupling(service.output_service_delay_report, self.output_service_delay_report)
Esempio n. 2
0
    def __init__(self, name: str, rack_id: str,
                 rack_node_config: RackNodeConfiguration, env_temp: float):
        self.rack_id = rack_id
        temp_model_name = rack_node_config.temp_model_name
        power_model_name = rack_node_config.pwr_model_name
        temp_model_config = rack_node_config.temp_model_config
        power_model_config = rack_node_config.pwr_model_config

        self.temp_model = self.rack_temp_factory.create_model(
            temp_model_name, **temp_model_config)
        self.power_model = self.rack_power_factory.create_model(
            power_model_name, **power_model_config)

        self.utilization = 0
        self.max_u = 0
        self.pu_reports = dict()
        self.power = 0
        self.temp = env_temp
        self.env_temp = env_temp

        self.input_pu_report = Port(ProcessingUnitReport,
                                    name + '_input_pu_report')
        self.output_rack_report = Port(RackReport,
                                       name + '_output_rack_report')
        super().__init__(name=name)
        self.add_in_port(self.input_pu_report)
        self.add_out_port(self.output_rack_report)
Esempio n. 3
0
    def __init__(self, name: str, nodes: Dict[str, NodeConfiguration], default_link: LinkConfiguration,
                 topology: Dict[str, Dict[str, Dict[str, Union[LinkConfiguration, None]]]]):
        """
        Network model for Mercury. It is defined as a directed graph
        :param name: name of the xDEVS atomic model
        :param nodes: dictionary containing the ID of every node in the network and their configuration.
        :param default_link: Default link configuration in case a given link in the topology is None
        :param topology: directed graph representing the network {node_from: {node_to: link_configuration}}
        """
        super().__init__(name=name)

        self.input_node_location = Port(NodeLocation, 'input_new_location')
        self.input_data = Port(PhysicalPacket, 'input_data')
        self.output_link_report = Port(NetworkLinkReport, 'output_link_report')
        self.add_in_port(self.input_node_location)
        self.add_in_port(self.input_data)
        self.add_out_port(self.output_link_report)

        self.links = dict()  # It contains the links of the network
        self.tx_overheads = dict()  # It contains the transmission overhead of each link
        self.buffers = dict()  # it contains the buffers of each transmitter
        self.outputs_node_to = dict()  # it contains all the output ports
        for node_from, links in topology.items():
            self.links[node_from] = dict()
            self.tx_overheads[node_from] = dict()
            self.buffers[node_from] = dict()
            for node_to, link_config in links.items():
                if node_to not in self.outputs_node_to:
                    self.outputs_node_to[node_to] = Port(PhysicalPacket, 'output_' + node_to)
                    self.add_out_port(self.outputs_node_to[node_to])
                conf = link_config if link_config is not None else default_link
                self.links[node_from][node_to] = Link(nodes[node_from], nodes[node_to], conf)
                self.tx_overheads[node_from][node_to] = 0
                self.buffers[node_from][node_to] = deque()
Esempio n. 4
0
    def __init__(self, name: str, core_config,
                 fed_mgmt_config: FederationManagementConfiguration,
                 network_config: NetworkPacketConfiguration,
                 ues: Dict[str, Tuple[float, ...]], aps: Dict[str, Tuple[float,
                                                                         ...]],
                 edcs: Dict[str, Tuple[float, ...]], services_id: List[str]):
        super().__init__(name=name)

        self.sdn_controller_id = core_config.sdnc_id
        self.fed_mgmt_config = fed_mgmt_config
        self.network_config = network_config
        self.ues = ues
        self.aps = aps
        self.edcs = edcs

        sdn_strategy_name = core_config.sdn_strategy_name
        sdn_strategy_config = core_config.sdn_strategy_config
        self.sdn_strategy = SoftwareDefinedNetworkController.sdn_strategy_factory.create_strategy(
            sdn_strategy_name, aps, edcs, services_id, **sdn_strategy_config)

        self.designated_edcs = {
            ap_id: {service_id: None
                    for service_id in services_id}
            for ap_id in aps
        }
        self.designated_aps = self._select_ue_bindings()

        self.input_node_location = Port(NodeLocation, 'input_node_location')
        self.input_network = Port(NetworkPacket, 'input_network')
        self.output_network = Port(NetworkPacket, 'output_network')
        self.add_in_port(self.input_node_location)
        self.add_in_port(self.input_network)
        self.add_out_port(self.output_network)
Esempio n. 5
0
    def __init__(self, name: str, edc_config: EdgeDataCenterConfiguration,
                 services_config: Dict[str, ServiceConfiguration], fed_mgmt_config: FederationManagementConfiguration,
                 network_config: NetworkPacketConfiguration, sdn_controller_id: str, lite=False):
        """
        Edge Data Center xDEVS module
        :param str name: xDEVS module name
        :param EdgeDataCenterConfiguration edc_config: Edge Data Center Configuration
        :param dict services_config: dictionary with all the services_config configurations
        :param FederationManagementConfiguration fed_mgmt_config: Federation Management Application configuration
        :param NetworkPacketConfiguration network_config: network layer packets configuration
        :param str sdn_controller_id: Federation Controller ID
        """
        super().__init__(name)
        # Unwrap EDC configuration values
        self.edc_id = edc_config.edc_id
        edc_location = edc_config.edc_location
        racks_config_list = edc_config.racks_configuration_list
        r_manager_config = edc_config.r_manager_config
        env_temp = edc_config.env_temp

        # Create and add submodules
        racks = [Rack(name + '_' + rack_id, racks_config_list[rack_id], services_config, env_temp)
                 for rack_id in racks_config_list]
        rack_mux = RackMultiplexer(name + '_rack_mux', list(racks_config_list.keys()))
        r_manager = ResourceManager(name + '_r_manager', self.edc_id, edc_location, r_manager_config, services_config,
                                    env_temp)
        edc_interface = EdgeDataCenterInterface(name + '_edc_interface', self.edc_id, fed_mgmt_config, network_config,
                                                sdn_controller_id, lite)
        [self.add_component(rack) for rack in racks]
        self.add_component(rack_mux)
        self.add_component(r_manager)
        self.add_component(edc_interface)

        # Define input/output_ports
        port_type = NetworkPacket if lite else PhysicalPacket
        self.input_crosshaul = Port(port_type, name + '_input_crosshaul')
        self.output_crosshaul = Port(port_type, name + '_output_crosshaul')
        self.output_edc_report = Port(EdgeDataCenterReport, name + '_output_edc_report')
        self.add_in_port(self.input_crosshaul)
        self.add_out_port(self.output_crosshaul)
        self.add_out_port(self.output_edc_report)

        self._interface_r_manager_internal_couplings_spec(edc_interface, r_manager)
        # External couplings for resource manager
        self._r_manager_external_couplings(r_manager)

        # External couplings for EDC interface
        self._interface_external_couplings(edc_interface)
        # Internal couplings for interface and resource manager
        self._interface_r_manager_internal_couplings_std(edc_interface, r_manager)
        # Internal couplings for resource manager and processing units multiplexer
        self._r_manager_rack_mux_internal_couplings(r_manager, rack_mux)
        for rack in racks:
            # Internal couplings for processing units multiplexer and processing units
            self._p_units_mux_i_rack_internal_couplings(rack_mux, rack)
            # Internal couplings for resource manager and processing units
            self._resource_manager_rack_internal_couplings(r_manager, rack)
Esempio n. 6
0
 def __init__(self, node_id_list, name="network_mux"):
     self.input = Port(NetworkPacket, 'input')
     self.outputs = {
         node_id: Port(NetworkPacket, 'output_' + node_id)
         for node_id in node_id_list
     }
     super().__init__(name, node_id_list)
     self.add_in_port(self.input)
     [self.add_out_port(port) for port in self.outputs.values()]
Esempio n. 7
0
    def __init__(self, name: str, node_id: str, max_hops: int = 0):
        super().__init__(name=name)
        self.node_id = node_id
        self.max_hops = max_hops

        self.input = Port(PhysicalPacket, "input")
        self.output_node = Port(PhysicalPacket, "output_node")
        self.output_transmitter = Port(PhysicalPacket, "output_transmitter")
        self.add_in_port(self.input)
        self.add_out_port(self.output_node)
        self.add_out_port(self.output_transmitter)
Esempio n. 8
0
    def __init__(self, name, proc_time):
        super().__init__(name)

        self.i_in = Port(Job, "i_in")
        self.o_out = Port(Job, "o_out")

        self.add_in_port(self.i_in)
        self.add_out_port(self.o_out)

        self.current_job = None
        self.proc_time = proc_time
Esempio n. 9
0
    def __init__(self, name, proc_time):
        super().__init__(name)

        self.i_input = Port(Ball, 'i_input')
        self.o_output = Port(Ball, 'o_output')

        self.add_in_port(self.i_input)
        self.add_out_port(self.o_output)

        self.current_job = None
        self.proc_time = proc_time
        self.clock = 0
Esempio n. 10
0
    def __init__(self, name, period):
        super().__init__(name)
        self.i_start = Port(Job, "i_start")
        self.i_stop = Port(Job, "i_stop")
        self.o_out = Port(Job, "o_out")

        self.add_in_port(self.i_start)
        self.add_in_port(self.i_stop)
        self.add_out_port(self.o_out)

        self.period = period
        self.job_counter = 1
Esempio n. 11
0
    def __init__(self, name, service_ids):
        self.service_ids = service_ids

        self.input_network = Port(NetworkPacket, name + '_input_network')
        self.outputs_network = {
            service: Port(NetworkPacket, name + '_output_network_' + service)
            for service in service_ids
        }

        super().__init__(name, service_ids)

        self.add_in_port(self.input_network)
        [self.add_out_port(port) for port in self.outputs_network.values()]
Esempio n. 12
0
    def __init__(self, name, ap_id):
        super().__init__(name=name)
        self.ap_id = ap_id
        self.service_routing = dict()
        self.ue_connected = list()

        self.input_new_sdn_path = Port(NewSDNPath,
                                       name + '_input_new_sdn_path')
        self.input_connected_ue_list = Port(EnableChannels,
                                            name + '_input_connected_ue_list')
        self.input_service_routing_request = Port(
            GetDataCenterRequest, name + '_input_service_routing_request')
        self.input_radio = Port(NetworkPacket, name + '_input_radio')
        self.input_crosshaul = Port(NetworkPacket, name + '_input_crosshaul')
        self.output_service_routing_response = Port(
            GetDataCenterResponse, name + '_output_service_routing_response')
        self.output_crosshaul = Port(NetworkPacket, name + '_output_crosshaul')
        self.output_radio = Port(NetworkPacket, name + '_output_radio')
        self.add_in_port(self.input_new_sdn_path)
        self.add_in_port(self.input_connected_ue_list)
        self.add_in_port(self.input_service_routing_request)
        self.add_in_port(self.input_radio)
        self.add_in_port(self.input_crosshaul)
        self.add_out_port(self.output_service_routing_response)
        self.add_out_port(self.output_crosshaul)
        self.add_out_port(self.output_radio)
Esempio n. 13
0
    def __init__(self,
                 name: str,
                 edc_id: str,
                 fed_mgmt_config: FederationManagementConfiguration,
                 network_config: NetworkPacketConfiguration,
                 sdn_controller_id: str,
                 lite=False):
        """
        Data Center Interface implementation for xDEVS
        :param name: Name of the stateless state machine xDEVS atomic module
        :param edc_id: ID of the corresponding Edge Data Center
        :param fed_mgmt_config: Federation Management application configuration
        :param network_config: network packets configuration
        :param sdn_controller_id: ID of the edge fed_controller_config controller
        """

        self.edc_id = edc_id
        self.fed_mgmt_config = fed_mgmt_config
        self.network_config = network_config
        self.sdn_controller_id = sdn_controller_id

        self.lite = lite

        self.routing_table = dict()

        super().__init__(name=name)

        out_type = NetworkPacket if lite else PhysicalPacket

        self.input_crosshaul = Port(out_type, 'input_crosshaul')
        self.input_create_session_response = Port(CreateSessionResponsePacket,
                                                  'input_create_session_resp')
        self.input_ongoing_session_response = Port(
            OngoingSessionResponsePacket, 'input_ongoing_session_resp')
        self.input_remove_session_response = Port(RemoveSessionResponsePacket,
                                                  'input_remove_session_resp')
        self.input_edc_report = Port(EdgeDataCenterReport, 'input_edc_report')
        self.output_create_session_request = Port(CreateSessionRequestPacket,
                                                  'output_create_session')
        self.output_ongoing_session_request = Port(OngoingSessionRequestPacket,
                                                   'output_ongoing_session')
        self.output_remove_session_request = Port(RemoveSessionRequestPacket,
                                                  'output_remove_session')
        self.output_crosshaul = Port(out_type, 'output_crosshaul')

        self.add_in_port(self.input_crosshaul)
        self.add_in_port(self.input_create_session_response)
        self.add_in_port(self.input_ongoing_session_response)
        self.add_in_port(self.input_remove_session_response)
        self.add_in_port(self.input_edc_report)
        self.add_out_port(self.output_create_session_request)
        self.add_out_port(self.output_ongoing_session_request)
        self.add_out_port(self.output_remove_session_request)
        self.add_out_port(self.output_crosshaul)
Esempio n. 14
0
    def __init__(self, name, obs_time):
        super().__init__(name)

        self.i_arrived = Port(Job, "i_arrived")
        self.i_solved = Port(Job, "i_solved")
        self.o_out = Port(Job, "o_out")

        self.add_in_port(self.i_arrived)
        self.add_in_port(self.i_solved)
        self.add_out_port(self.o_out)

        self.jobs_arrived = []
        self.jobs_solved = []

        self.total_ta = 0
        self.clock = 0
        self.obs_time = obs_time
Esempio n. 15
0
    def __init__(self,
                 ue_ids_list,
                 ap_ids_list,
                 edc_ids_list,
                 core_ids_list,
                 name='shortcut'):

        node_id_list = [
            *ue_ids_list, *ap_ids_list, *edc_ids_list, *core_ids_list
        ]
        assert len(node_id_list) == len(set(node_id_list))

        self.ue_ids_list = ue_ids_list
        self.ap_ids_list = ap_ids_list
        self.edc_ids_list = edc_ids_list
        self.core_ids_list = core_ids_list

        self.input_xh = Port(PhysicalPacket, 'input_xh')
        self.input_radio_control = Port(PhysicalPacket, 'input_radio_control')
        self.input_radio_transport = Port(PhysicalPacket,
                                          'input_radio_transport')

        self.outputs_xh = dict()
        self.outputs_radio_control = dict()
        self.outputs_radio_transport = dict()
        for node_id in [*ap_ids_list, *edc_ids_list, *core_ids_list]:
            self.outputs_xh[node_id] = Port(PhysicalPacket,
                                            'output_xh_' + node_id)
        for out_ports in [(self.outputs_radio_control, 'control'),
                          (self.outputs_radio_transport, 'transport')]:
            for node_id in [*ue_ids_list, *ap_ids_list]:
                out_ports[0][node_id] = Port(
                    PhysicalPacket,
                    'output_{}_{}'.format(out_ports[1], node_id))

        super().__init__(name, node_id_list)

        self.add_in_port(self.input_xh)
        self.add_in_port(self.input_radio_control)
        self.add_in_port(self.input_radio_transport)
        for node_id in [*ap_ids_list, *edc_ids_list, *core_ids_list]:
            self.add_out_port(self.outputs_xh[node_id])
        for out_ports in [(self.outputs_radio_control, 'control'),
                          (self.outputs_radio_transport, 'transport')]:
            for node_id in [*ue_ids_list, *ap_ids_list]:
                self.add_out_port(out_ports[0][node_id])
Esempio n. 16
0
    def __init__(self, name: str, ap_id: str,
                 rac_config: RadioAccessNetworkConfiguration):
        """
        Create an instance of AP service broadcast module.
        :param name: Name of the module
        :param ap_id: ID of the AP
        :param rac_config: Radio Access Control configuration
        """
        super().__init__(name=name)
        self.ap_id = ap_id
        self.pss_period = rac_config.pss_period
        self.header = rac_config.header

        self.input_repeat = Port(str, 'input_repeat')
        self.output_pss = Port(PrimarySynchronizationSignal, 'output_pss')
        self.add_in_port(self.input_repeat)
        self.add_out_port(self.output_pss)
Esempio n. 17
0
    def __init__(self, name: str, core_config: CoreLayerConfiguration, rac_config: RadioAccessNetworkConfiguration,
                 fed_mgmt_config: FederationManagementConfiguration, network_config: NetworkPacketConfiguration,
                 aps: Dict[str, Tuple[float, ...]], edcs: Dict[str, Tuple[float, ...]], services_id: List[str]):
        """
        Core Layer Module for Mercury Simulator
        :param name: Name of the Core layer XDEVS module
        :param core_config: Core Layer Configuration
        :param rac_config:
        :param fed_mgmt_config:
        :param network_config:
        :param aps: list of APs in the scenario
        :param edcs: list of EDCs in the scenario
        :param services_id:
        """
        super().__init__(name)

        self.input_node_location = Port(NodeLocation, 'input_node_location')
        self.output_crosshaul = Port(PhysicalPacket, 'output_crosshaul')
        self.add_in_port(self.input_node_location)
        self.add_out_port(self.output_crosshaul)
        self.inputs_crosshaul = dict()

        self.sdnc_id = core_config.sdnc_id
        sdn_strategy_name = core_config.sdn_strategy_name
        sdn_strategy_config = core_config.sdn_strategy_config

        self.core_functions = {self.sdnc_id: SoftwareDefinedNetworkController(name + '_sdn', self.sdnc_id,
                                                                              fed_mgmt_config, network_config, aps,
                                                                              edcs, services_id, sdn_strategy_name,
                                                                              **sdn_strategy_config)}
        self.add_component(self.core_functions[self.sdnc_id])
        self.add_coupling(self.input_node_location, self.core_functions[self.sdnc_id].input_node_location)

        if not rac_config.bypass_amf:
            self.amf_id = core_config.amf_id
            self.core_functions[self.amf_id] = AccessAndMobilityManagementFunction(name + '_amf', self.amf_id,
                                                                                   rac_config, network_config)

        for core_function_id, core_function in self.core_functions.items():
            self.add_component(core_function)
            self.inputs_crosshaul[core_function_id] = Port(PhysicalPacket, 'input_' + core_function_id)
            self.add_in_port(self.inputs_crosshaul[core_function_id])
            self.add_coupling(self.inputs_crosshaul[core_function_id], core_function.input_crosshaul)
            self.add_coupling(core_function.output_crosshaul, self.output_crosshaul)
Esempio n. 18
0
    def __init__(self, name: str, radio_config: RadioConfiguration,
                 ues: Dict[str, NodeConfiguration],
                 aps: Dict[str, NodeConfiguration]):

        super().__init__(name)

        self.input_pbch = Port(PhysicalPacket, "input_pbch")
        self.input_repeat_location = Port(str, "input_repeat_location")
        self.output_node_location = Port(NodeLocation, "output_node_location")

        self.add_in_port(self.input_pbch)
        self.add_in_port(self.input_repeat_location)
        self.add_out_port(self.output_node_location)

        # Ports for PBCH channel
        self.outputs_pbch = dict()
        for ue_id in ues:
            self.outputs_pbch[ue_id] = Port(PhysicalPacket,
                                            "output_pbch_" + ue_id)
            self.add_out_port(self.outputs_pbch[ue_id])

        # Create and add sub-components
        radio_config.define_nodes(aps, ues)
        nodes = {**aps, **ues}

        pbch = Network(name + "_pbch", nodes, radio_config.base_dl_config,
                       radio_config.dl_template)
        nodes_mobility = Nodes(name + '_nodes', nodes)
        self.add_component(pbch)
        self.add_component(nodes_mobility)

        self.add_coupling(nodes_mobility.output_node_location,
                          pbch.input_node_location)

        self.add_coupling(self.input_repeat_location,
                          nodes_mobility.input_repeat_location)
        self.add_coupling(nodes_mobility.output_node_location,
                          self.output_node_location)

        self.add_coupling(self.input_pbch, pbch.input_data)
        for ue_id in ues:
            self.add_coupling(pbch.outputs_node_to[ue_id],
                              self.outputs_pbch[ue_id])
Esempio n. 19
0
    def __init__(self, name: str, ue_config: UserEquipmentConfiguration, rac_config: RadioAccessNetworkConfiguration,
                 network_config: NetworkPacketConfiguration, t_initial: float = 0):
        """
        User Equipment xDEVS model
        :param name: xDEVS model name
        :param ue_config: User Equipment Configuration
        :param rac_config: Radio Access Network service packets configuration
        :param network_config: Network packets configuration
        :param t_initial: Initial guard time in order to avoid identical simultaneous behavior between UEs
        """
        super().__init__(name)

        # Unpack configuration parameters
        ue_id = ue_config.ue_id
        service_config_list = ue_config.service_config_list
        service_ids = [service_config.service_id for service_config in service_config_list]

        self.ue_id = ue_id

        # Define and add components
        antenna = UserEquipmentAntenna(name + '_antenna', ue_id, network_config)
        access_manager = AccessManager(name + '_access_manager', ue_id, rac_config)
        service_mux = UEServiceMux(name + '_service_mux', service_ids)
        services = [Service(name + service.service_id, ue_id, service, network_config, t_initial)
                    for service in service_config_list]
        self.add_component(antenna)
        self.add_component(access_manager)
        self.add_component(service_mux)
        [self.add_component(service) for service in services]

        # I/O ports
        self.input_radio_bc = Port(PhysicalPacket, name + '_input_radio_bc')
        self.input_radio_control_dl = Port(PhysicalPacket, name + '_input_radio_control_dl')
        self.input_radio_transport_dl = Port(PhysicalPacket, name + '_input_radio_transport_dl')
        self.output_radio_control_ul = Port(PhysicalPacket, name + '_output_radio_control_ul')
        self.output_radio_transport_ul = Port(PhysicalPacket, name + '_output_radio_transport_ul')
        self.add_in_port(self.input_radio_bc)
        self.add_in_port(self.input_radio_control_dl)
        self.add_in_port(self.input_radio_transport_dl)
        self.add_out_port(self.output_radio_control_ul)
        self.add_out_port(self.output_radio_transport_ul)

        self.output_repeat_location = Port(str, 'output_repeat_location')
        self.output_service_delay_report = Port(ServiceDelayReport, 'output_service_delay_report')
        self.add_out_port(self.output_repeat_location)
        self.add_out_port(self.output_service_delay_report)

        self.external_couplings_antenna(antenna)
        self.external_couplings_access(access_manager)
        for service in services:
            self.external_couplings_service(service)

        self.internal_couplings_antenna_access(antenna, access_manager)
        self.internal_couplings_antenna_mux(antenna, service_mux)
        for service in services:
            self.internal_couplings_antenna_service(antenna, service)
            self.internal_couplings_access_service(access_manager, service)
            self.internal_couplings_mux_service(service_mux, service)
Esempio n. 20
0
    def __init__(self, name: str, sdn_controller_id: str,
                 fed_mgmt_config: FederationManagementConfiguration,
                 network_config: NetworkPacketConfiguration,
                 aps: Dict[str, Tuple[float, ...]], edcs: Dict[str,
                                                               Tuple[float,
                                                                     ...]],
                 services_id: List[str], sdn_strategy_name: str, **kwargs):
        """
        xDEVS model of a Software-Defined Network Controller for interconnecting Acess Points and Edge Data Centers
        :param name: Name of the XDEVS SDN Controller module
        :param sdn_controller_id: ID of the SDN controller
        :param fed_mgmt_config: fed_controller_config management application configuration
        :param network_config: network packets configuration
        :param aps: list of APs in the scenario
        :param edcs: list of EDCs in the scenario
        :param services_id: ID of all the services defined in the scenario
        :param sdn_strategy_name: Software-Defined Network linking strategy name
        :param kwargs: SDN linking strategy configuration parameters
        """
        super().__init__(name=name)

        self.sdn_controller_id = sdn_controller_id
        self.fed_mgmt_config = fed_mgmt_config
        self.network_config = network_config
        self.aps = aps
        self.edcs = edcs

        self.sdn_strategy = self.sdn_strategy_factory.create_strategy(
            sdn_strategy_name, aps, edcs, services_id, **kwargs)

        self.designated_edcs = {
            ap_id: {service_id: None
                    for service_id in services_id}
            for ap_id in aps
        }

        self.input_node_location = Port(NodeLocation, 'input_node_location')
        self.input_crosshaul = Port(PhysicalPacket, 'input_crosshaul')
        self.output_crosshaul = Port(PhysicalPacket, 'output_crosshaul')
        self.add_in_port(self.input_node_location)
        self.add_in_port(self.input_crosshaul)
        self.add_out_port(self.output_crosshaul)
Esempio n. 21
0
    def __init__(self, name: str, master_nodes: Dict[str, NodeConfiguration], slave_nodes: Dict[str, NodeConfiguration],
                 default_link: LinkConfiguration, topology: Dict[str, Dict[str, Dict[str, None]]]):

        for node_from, links in topology.items():
            assert node_from in slave_nodes
            for node_to in links:
                assert node_to in master_nodes

        super().__init__(name, master_nodes, slave_nodes, default_link, topology)

        self.input_channel_share = Port(ChannelShare, 'input_channel_share')
        self.add_in_port(self.input_channel_share)
Esempio n. 22
0
    def __init__(self, name: str, edcs_config: Dict[str, EdgeDataCenterConfiguration],
                 services_config: Dict[str, ServiceConfiguration], fed_mgmt_config: FederationManagementConfiguration,
                 network_config: NetworkPacketConfiguration, sdn_controller_id: str, lite=False):
        """
        Edge Federation xDEVS model
        :param name: xDEVS module name
        :param edcs_config: Edge Data Centers configuration dict {EDC ID: EDC configuration}
        :param services_config: dictionary with all the services_config configurations
        :param fed_mgmt_config: Federation Management Application configuration
        :param network_config: network layer packets configuration
        :param sdn_controller_id: ID of the SDN controller
        """

        super().__init__(name)
        # Unwrap configuration parameters
        self.n_edc = len(edcs_config)

        # Define sub-modules and add them to coupled module
        self.edcs = {edc_id: EdgeDataCenter(name + '_' + edc_id, edc_config, services_config, fed_mgmt_config,
                                            network_config, sdn_controller_id, lite)
                     for edc_id, edc_config in edcs_config.items()}
        [self.add_component(edc) for edc in self.edcs.values()]

        port_type = NetworkPacket if lite else PhysicalPacket

        # Define input/output ports
        self.output_edc_report = Port(EdgeDataCenterReport, 'output_edc_report')
        self.output_crosshaul = Port(port_type, 'output_crosshaul')
        self.add_out_port(self.output_edc_report)
        self.add_out_port(self.output_crosshaul)

        self.inputs_crosshaul = dict()
        for edc_id, edc in self.edcs.items():
            self.add_coupling(edc.output_edc_report, self.output_edc_report)
            self.add_coupling(edc.output_crosshaul, self.output_crosshaul)

            self.inputs_crosshaul[edc_id] = Port(port_type, 'input_crosshaul_' + edc_id)
            self.add_in_port(self.inputs_crosshaul[edc_id])
            self.add_coupling(self.inputs_crosshaul[edc_id], edc.input_crosshaul)
Esempio n. 23
0
    def __init__(self, name: str, amf_id: str, ran_config: RadioAccessNetworkConfiguration,
                 network_config: NetworkPacketConfiguration):
        """
        Access and Mobility Management Function xDEVS model
        :param name: name of the xDEVS module
        :param amf_id: ID of the Access and Mobility Management Function
        :param ran_config: RAN application Configuration
        :param network_config: network packets configuration
        """

        super().__init__(name=name)

        self.amf_id = amf_id
        self.ran_ac_config = ran_config
        self.network_config = network_config

        self.path_table = dict()  # {node_id: connected_ap}

        self.input_crosshaul = Port(PhysicalPacket, 'input_crosshaul')
        self.output_crosshaul = Port(PhysicalPacket, 'output_crosshaul')
        self.add_in_port(self.input_crosshaul)
        self.add_out_port(self.output_crosshaul)
Esempio n. 24
0
    def __init__(self, name, nodes_config: Dict[str, NodeConfiguration]):
        """

        :param name:
        :param nodes_config:
        """
        self.nodes_mobility = dict()
        for node_id, node_config in nodes_config.items():
            self.nodes_mobility[node_id] = node_config.node_mobility

        self.nodes_location = dict()
        self.nodes_next_change = dict()
        for node_id, mobility in self.nodes_mobility.items():
            self.nodes_location[node_id] = mobility.position
            self.nodes_next_change[node_id] = mobility.get_next_sigma(0)

        super().__init__(self.get_next_event(0), name)

        self.input_repeat_location = Port(str, 'input_repeat_location')
        self.output_node_location = Port(NodeLocation, 'output_node_location')
        self.add_in_port(self.input_repeat_location)
        self.add_out_port(self.output_node_location)
Esempio n. 25
0
    def __init__(self, name: str,
                 iot_layer_config: IoTDevicesLayerConfiguration,
                 network_config: NetworkPacketConfiguration, core_id: str):
        super().__init__(name)
        # Unpack configuration parameters
        ue_config_list = iot_layer_config.ues_config
        guard_generator = iot_layer_config.guard_time_generator

        # Check that UE IDs are unique
        self.ue_ids = [ue_id for ue_id in ue_config_list]
        if len(self.ue_ids) != len(set(self.ue_ids)):
            raise ValueError('UE IDs must be unique')

        # Start and add components
        ues = {
            ue_id: UserEquipmentLite(name + '_ue_' + ue_id, ue_config,
                                     network_config, core_id,
                                     guard_generator.guard_time())
            for ue_id, ue_config in ue_config_list.items()
        }
        [self.add_component(ue) for ue in ues.values()]

        self.output_network = Port(NetworkPacket, 'output_network')
        self.output_service_delay_report = Port(ServiceDelayReport,
                                                'output_service_delay_report')
        self.add_out_port(self.output_network)
        self.add_out_port(self.output_service_delay_report)

        self.inputs_network = dict()
        for ue_id in ues:
            self.inputs_network[ue_id] = Port(NetworkPacket,
                                              'input_network_' + ue_id)
            self.add_in_port(self.inputs_network[ue_id])
            self.add_coupling(self.inputs_network[ue_id],
                              ues[ue_id].input_network)
            self.add_coupling(ues[ue_id].output_network, self.output_network)
            self.add_coupling(ues[ue_id].output_service_delay_report,
                              self.output_service_delay_report)
Esempio n. 26
0
    def __init__(self, name: str, master_nodes: Dict[str, NodeConfiguration], slave_nodes: Dict[str, NodeConfiguration],
                 default_link: LinkConfiguration, topology: Dict[str, Dict[str, Dict[str, None]]],
                 channel_div_name: str = None, channel_div_config: Dict = None):

        for node_from, links in topology.items():
            assert node_from in master_nodes
            for node_to in links:
                assert node_to in slave_nodes

        super().__init__(name, master_nodes, slave_nodes, default_link, topology)

        # the one in charge of divinding the spectrum (APs)
        self.channel_div = None
        if channel_div_name is None:
            channel_div_name = 'equal'
        if channel_div_config is None:
            channel_div_config = dict()
        self.channel_div = self.channel_div_factory.create_division(channel_div_name, **channel_div_config)

        self.input_enable_channels = Port(EnableChannels, 'input_enable_channels')
        self.output_channel_share = Port(ChannelShare, 'output_channel_share')
        self.add_in_port(self.input_enable_channels)
        self.add_out_port(self.output_channel_share)
Esempio n. 27
0
    def __init__(self, name: str, ue_id: str, service_config: ServiceConfiguration,
                 network_config: NetworkPacketConfiguration, t_initial: float, lite_id: str = None):
        """
        Service xDEVS module

        :param name: name of the xDEVS module
        :param ue_id: User Equipment ID
        :param service_config: service configuration
        :param network_config: network configuration
        :param t_initial: initial back off time before starting to operate
        """
        self.service_id = service_config.service_id
        super().__init__(name + "_" + self.service_id)

        data_generator = ServiceDataGenerator(name + '_data_generator', ue_id, service_config, t_initial)
        session_manager = ServiceSessionManager(name + '_session_manager', ue_id, service_config, network_config,
                                                t_initial, lite_id)
        self.add_component(data_generator)
        self.add_component(session_manager)

        self.input_network = Port(NetworkPacket, 'input_network')
        self.output_network = Port(NetworkPacket, 'output_network')
        self.output_service_delay_report = Port(ServiceDelayReport, 'output_service_delay_report')
        self.add_in_port(self.input_network)
        self.add_out_port(self.output_network)
        self.add_out_port(self.output_service_delay_report)

        lite = lite_id is not None
        if not lite:
            self.input_connected_ap = Port(ConnectedAccessPoint, 'input_connected_ap')
            self.output_service_required = Port(ServiceRequired, 'output_service_required')
            self.add_in_port(self.input_connected_ap)
            self.add_out_port(self.output_service_required)

        self.external_couplings_session_manager(session_manager, lite)
        self.internal_couplings(data_generator, session_manager)
Esempio n. 28
0
    def __init__(self, name: str, ue_id: str, service_config: ServiceConfiguration, t_initial: float):
        """
        Service Data Generator xDEVS module

        :param name: name of the xDEVS module
        :param ue_id: User Equipment ID
        :param service_config: service configuration
        :param t_initial: initial back off time before creating the first package
        """
        self.ue_id = ue_id
        # Unwrap configuration parameters
        self.service_id = service_config.service_id
        self.service_u = service_config.service_u
        self.header = service_config.header
        self.data = service_config.data
        self.packaging_time = service_config.packaging_time

        super().__init__(t_initial + self.packaging_time, name)

        # I/O ports
        self.output_session_request = Port(OngoingSessionRequestPacket, 'output_session_request')
        self.add_out_port(self.output_session_request)
Esempio n. 29
0
    def __init__(self, name: str, aps_config: Dict[str,
                                                   AccessPointConfiguration],
                 amf_id: str, rac_config: RadioAccessNetworkConfiguration,
                 network_config: NetworkPacketConfiguration):
        super().__init__(name)
        # Unwrap configuration parameters
        self.ap_ids = [a for a in aps_config]
        if len(self.ap_ids) != len(set(self.ap_ids)):
            raise ValueError('AP IDs must be unique')

        # Create submodules and add them to the coupled model
        aps = {
            ap_id: AccessPoint(name + '_ap_' + ap_id, ap_config, amf_id,
                               rac_config, network_config)
            for ap_id, ap_config in aps_config.items()
        }

        [self.add_component(ap) for ap in aps.values()]

        # Handy ports
        self.input_repeat_pss = Port(str, 'input_new_ue_location')
        self.output_connected_ues = Port(EnableChannels,
                                         'output_connected_ues')
        self.output_crosshaul = Port(PhysicalPacket, 'output_crosshaul')
        self.output_radio_bc = Port(PhysicalPacket, 'output_radio_bc')
        self.output_radio_control_dl = Port(PhysicalPacket,
                                            'output_radio_control')
        self.output_radio_transport_dl = Port(PhysicalPacket,
                                              'output_radio_transport')

        self.add_in_port(self.input_repeat_pss)
        self.add_out_port(self.output_connected_ues)
        self.add_out_port(self.output_crosshaul)
        self.add_out_port(self.output_radio_bc)
        self.add_out_port(self.output_radio_control_dl)
        self.add_out_port(self.output_radio_transport_dl)

        # Crosshaul-related input/output ports
        self.inputs_crosshaul = dict()
        # Radio-related input/output ports
        self.inputs_radio_control_ul = dict()
        self.inputs_radio_transport_ul = dict()

        for ap_id, ap in aps.items():
            assert isinstance(ap, AccessPoint)
            self.add_coupling(self.input_repeat_pss, ap.input_resend_pss)
            self.add_coupling(ap.output_connected_ues,
                              self.output_connected_ues)

            self.inputs_crosshaul[ap_id] = Port(PhysicalPacket,
                                                'input_crosshaul_' + ap_id)
            self.inputs_radio_control_ul[ap_id] = Port(
                PhysicalPacket, 'input_radio_control_ul_' + ap_id)
            self.inputs_radio_transport_ul[ap_id] = Port(
                PhysicalPacket, 'input_radio_transport_ul_' + ap_id)

            self.add_in_port(self.inputs_crosshaul[ap_id])
            self.add_in_port(self.inputs_radio_control_ul[ap_id])
            self.add_in_port(self.inputs_radio_transport_ul[ap_id])

            self.add_coupling(self.inputs_crosshaul[ap_id], ap.input_crosshaul)
            self.add_coupling(ap.output_crosshaul, self.output_crosshaul)
            self.add_coupling(self.inputs_radio_control_ul[ap_id],
                              ap.input_radio_control_ul)
            self.add_coupling(self.inputs_radio_transport_ul[ap_id],
                              ap.input_radio_transport_ul)
            self.add_coupling(ap.output_radio_bc, self.output_radio_bc)
            self.add_coupling(ap.output_radio_control_dl,
                              self.output_radio_control_dl)
            self.add_coupling(ap.output_radio_transport_dl,
                              self.output_radio_transport_dl)
Esempio n. 30
0
    def __init__(self, name, rack_config, services_config, env_temp):
        super().__init__(name)

        self.input_change_status = Port(ChangeStatus, name + '_input_change_status')
        self.input_set_dvfs_mode = Port(SetDVFSMode, name + '_input_set_dvfs_mode')
        self.input_open_session = Port(OpenSessionRequest, name + '_input_open_session')
        self.input_ongoing_session = Port(OngoingSessionRequest, name + '_input_ongoing_session')
        self.input_close_session = Port(CloseSessionRequest, name + '_input_close_session')
        self.output_change_status_response = Port(ChangeStatusResponse, name + '_output_change_status_response')
        self.output_set_dvfs_mode_response = Port(SetDVFSModeResponse, name + '_output_set_dvfs_mode_response')
        self.output_open_session_response = Port(OpenSessionResponse, name + '_output_open_session_response')
        self.output_ongoing_session_response = Port(OngoingSessionResponse, name + '_output_ongoing_session_response')
        self.output_close_session_response = Port(CloseSessionResponse, name + '_output_close_session_response')
        self.output_rack_report = Port(RackReport, name + '_output_rack_report')

        self.add_in_port(self.input_change_status)               # port for incoming change status messages
        self.add_in_port(self.input_set_dvfs_mode)               # port for incoming new DVFS mode messages
        self.add_in_port(self.input_open_session)                # port for incoming open session messages
        self.add_in_port(self.input_ongoing_session)             # port for incoming ongoing session messages
        self.add_in_port(self.input_close_session)               # port for incoming close session messages
        self.add_out_port(self.output_change_status_response)    # port for leaving change status response messages
        self.add_out_port(self.output_set_dvfs_mode_response)    # port for leaving new DVFS mode response messages
        self.add_out_port(self.output_open_session_response)     # port for leaving open session response messages
        self.add_out_port(self.output_ongoing_session_response)  # port for leafing ongoing session response messages
        self.add_out_port(self.output_close_session_response)    # port for leaving close session response messages
        self.add_out_port(self.output_rack_report)               # Port for leaving rack report messages

        self.rack_id = rack_config.rack_id
        rack_node_config = rack_config.rack_node_config
        rack_node = RackNode(name, self.rack_id, rack_node_config, env_temp)
        n_pu = len(rack_config.pu_config_list)
        p_units = [ProcessingUnit(name+'_pu_'+str(i), rack_config.pu_config_list[i], rack_config.rack_id, i,
                                  services_config, env_temp)
                   for i in range(n_pu)]
        p_unit_mux = ProcessingUnitMultiplexer(name + '_pu_mux', n_pu)

        self.add_component(rack_node)
        [self.add_component(p_unit) for p_unit in p_units]
        self.add_component(p_unit_mux)

        self.external_couplings_rack_node(rack_node)
        self.external_couplings_mux(p_unit_mux)
        for p_unit in p_units:
            self.external_couplings_pu(p_unit)
            self.internal_couplings_pu_mux(p_unit, p_unit_mux)
            self.internal_couplings_pu_rack_node(p_unit, rack_node)