Exemplo n.º 1
0
    def send_ran_mac_slice_request(self,
                                   cell_id,
                                   plmn_id=PLMNID(),
                                   dscp=DSCP()):
        """Send a STATUS_SLICE_REQUEST message.
        Args:
            None
        Returns:
            None
        """

        msg = Container(length=RAN_MAC_SLICE_REQUEST.sizeof(),
                        plmn_id=plmn_id.to_raw(),
                        dscp=dscp.to_raw(),
                        padding=b'\x00\x00\x00')

        self.send_message(msg,
                          E_TYPE_SINGLE,
                          EP_ACT_RAN_MAC_SLICE,
                          RAN_MAC_SLICE_REQUEST,
                          cellid=cell_id)
Exemplo n.º 2
0
    def send_add_set_ran_mac_slice_request(self, cell, slc, opcode, rntis=[]):
        """Send an SET_RAN_MAC_SLICE_REQUEST message.
        Args:
            None
        Returns:
            None
        Raises:
            None
        """

        sched_id = slc.lte['static-properties']['sched_id']
        rbgs = slc.lte['static-properties']['rbgs']

        if self.vbs.addr in slc.lte['vbses']:

            if 'static-properties' in slc.lte['vbses'][self.vbs.addr]:

                static = slc.lte['vbses'][self.vbs.addr]['static-properties']

                if 'sched_id' in static:
                    sched_id = static['sched_id']

                if 'rbgs' in static:
                    rbgs = static['rbgs']

        msg = Container(plmn_id=slc.tenant.plmn_id.to_raw(),
                        dscp=slc.dscp.to_raw(),
                        padding=b'\x00\x00\x00',
                        options=[])

        # RBGs
        slice_rbgs = Container(rbgs=rbgs)
        s_rbgs = RAN_MAC_SLICE_RBGS.build(slice_rbgs)
        opt_rbgs = Container(type=EP_RAN_MAC_SLICE_RBGS,
                             length=RAN_MAC_SLICE_RBGS.sizeof(),
                             data=s_rbgs)

        # Scheduler id
        slice_sched_id = Container(sched_id=sched_id)
        s_sched_id = RAN_MAC_SLICE_SCHED_ID.build(slice_sched_id)
        opt_sched_id = Container(type=EP_RAN_MAC_SLICE_SCHED_ID,
                                 length=RAN_MAC_SLICE_SCHED_ID.sizeof(),
                                 data=s_sched_id)

        # RNTIs
        slice_rntis = Container(rntis=rntis)
        s_rntis = RAN_MAC_SLICE_RNTI_LIST.build(slice_rntis)
        opt_rntis = Container(type=EP_RAN_MAC_SLICE_RNTI_LIST,
                              length=2*len(rntis),
                              data=s_rntis)

        msg.options = [opt_rbgs, opt_sched_id, opt_rntis]

        msg.length = RAN_MAC_SLICE_REQUEST.sizeof() + \
            opt_rbgs.length + 4 + \
            opt_sched_id.length + 4 + \
            opt_rntis.length + 4

        self.send_message(msg,
                          E_TYPE_SINGLE,
                          EP_ACT_RAN_MAC_SLICE,
                          SET_RAN_MAC_SLICE_REQUEST,
                          opcode=opcode,
                          cellid=cell.pci)