Esempio n. 1
0
 def test_power_spectral_density_below_range(self) -> None:
     config = EnodebConfiguration(BaicellsQRTBTrDataModel())
     channel = LteChannel(
         low_frequency_hz=3550_000_000,
         high_frequency_hz=3560_000_000,
         max_eirp_dbm_mhz=-138,
     )
     state = CBSDStateResult(
         radio_enabled=True,
         channel=channel,
     )
     with self.assertRaises(ConfigurationError):
         qrtb_update_desired_config_from_cbsd_state(state, config)
Esempio n. 2
0
 def test_too_low_bandwidth(self) -> None:
     config = EnodebConfiguration(BaicellsQRTBTrDataModel())
     channel = LteChannel(
         low_frequency_hz=3550_000_000,
         high_frequency_hz=3551_000_000,
         max_eirp_dbm_mhz=10,
     )
     state = CBSDStateResult(
         radio_enabled=True,
         channel=channel,
     )
     with self.assertRaises(ConfigurationError):
         qrtb_update_desired_config_from_cbsd_state(state, config)
Esempio n. 3
0
 def test_bandwidth_non_default_MHz(self) -> None:
     config = EnodebConfiguration(BaicellsQRTBTrDataModel())
     channel = LteChannel(
         low_frequency_hz=3690_000_000,
         high_frequency_hz=3698_000_000,
         max_eirp_dbm_mhz=1,
     )
     state = CBSDStateResult(
         radio_enabled=True,
         channel=channel,
     )
     qrtb_update_desired_config_from_cbsd_state(state, config)
     self.assert_config_updated(config, '25', 56680, 1)
Esempio n. 4
0
def get_cbsd_state(request: CBSDRequest) -> CBSDStateResult:
    """
    Make RPC call to 'GetCBSDState' method of dp service
    """
    try:
        chan = ServiceRegistry.get_rpc_channel(
            DP_SERVICE_NAME,
            ServiceRegistry.CLOUD,
        )
    except ValueError:
        logger.error('Cant get RPC channel to %s', DP_SERVICE_NAME)
        return CBSDStateResult(radio_enabled=False)
    client = DPServiceStub(chan)
    try:
        res = client.GetCBSDState(request, DEFAULT_GRPC_TIMEOUT)
    except grpc.RpcError as err:
        logger.warning(
            "GetCBSDState error: [%s] %s",
            err.code(),
            err.details(),
        )
        return CBSDStateResult(radio_enabled=False)
    return res
Esempio n. 5
0
 def test_tx_params_with_unsupported_bandwidths(self, low_frequency_hz,
                                                high_frequency_hz) -> None:
     """Test that tx parameters calculations raise an exception for unsupported bandwidth ranges"""
     desired_config = EnodebConfiguration(FreedomFiOneTrDataModel())
     channel = LteChannel(
         low_frequency_hz=low_frequency_hz,
         high_frequency_hz=high_frequency_hz,
         max_eirp_dbm_mhz=5,
     )
     state = CBSDStateResult(
         radio_enabled=True,
         channel=channel,
     )
     with self.assertRaises(ConfigurationError):
         ff_one_update_desired_config_from_cbsd_state(state, desired_config)
Esempio n. 6
0
 def test_tx_parameters_with_eirp_out_of_range(self,
                                               max_eirp_dbm_mhz) -> None:
     """Test that tx parameters calculations raise an exception when eirp received from SAS
     is outside of acceptable range for the given bandwidth"""
     desired_config = EnodebConfiguration(FreedomFiOneTrDataModel())
     channel = LteChannel(
         low_frequency_hz=3550_000_000,
         high_frequency_hz=3570_000_000,
         max_eirp_dbm_mhz=max_eirp_dbm_mhz,
     )
     state = CBSDStateResult(
         radio_enabled=True,
         channel=channel,
     )
     with self.assertRaises(ConfigurationError):
         ff_one_update_desired_config_from_cbsd_state(state, desired_config)
Esempio n. 7
0
 def test_omit_other_params_when_radio_disabled(self) -> None:
     config = EnodebConfiguration(BaicellsQRTBTrDataModel())
     channel = LteChannel(
         low_frequency_hz=3550_000_000,
         high_frequency_hz=3560_000_000,
         max_eirp_dbm_mhz=-100,
     )
     state = CBSDStateResult(
         radio_enabled=False,
         channel=channel,
     )
     qrtb_update_desired_config_from_cbsd_state(state, config)
     self.assertEqual(
         config.get_parameter(ParameterName.SAS_RADIO_ENABLE, ),
         False,
     )
Esempio n. 8
0
    def test_tx_params_not_set_when_radio_disabled(self):
        """Test that tx parameters of the enodeb are not set when ADMIN_STATE is disabled on the radio"""
        desired_config = EnodebConfiguration(FreedomFiOneTrDataModel())
        channel = LteChannel(
            low_frequency_hz=3550000000,
            high_frequency_hz=3570000000,
            max_eirp_dbm_mhz=20,
        )
        state = CBSDStateResult(
            radio_enabled=False,
            channel=channel,
        )

        ff_one_update_desired_config_from_cbsd_state(state, desired_config)
        self.assertEqual(1, len(desired_config.get_parameter_names()))
        self.assertFalse(
            desired_config.get_parameter(ParameterName.ADMIN_STATE))
 def _build_get_state_result() -> CBSDStateResult:
     return CBSDStateResult(
         radio_enabled=True,
         carrier_aggregation_enabled=False,
         channel=LteChannel(
             low_frequency_hz=3620_000_000,
             high_frequency_hz=3630_000_000,
             max_eirp_dbm_mhz=28.0,
         ),
         channels=[
             LteChannel(
                 low_frequency_hz=3620_000_000,
                 high_frequency_hz=3630_000_000,
                 max_eirp_dbm_mhz=28.0,
             ),
         ],
     )
Esempio n. 10
0
 def _build_expected_result(grant: DBGrant) -> CBSDStateResult:
     return CBSDStateResult(
         radio_enabled=True,
         carrier_aggregation_enabled=False,
         channel=LteChannel(
             low_frequency_hz=grant.low_frequency,
             high_frequency_hz=grant.high_frequency,
             max_eirp_dbm_mhz=grant.max_eirp,
         ),
         channels=[
             LteChannel(
                 low_frequency_hz=grant.low_frequency,
                 high_frequency_hz=grant.high_frequency,
                 max_eirp_dbm_mhz=grant.max_eirp,
             ),
         ],
     )
Esempio n. 11
0
    def test_dp_log_created_from_grpc_response(self, with_cbsd, fcc_id,
                                               network_id):
        # Given
        cbsd = None
        if with_cbsd:
            cbsd = self.session.query(DBCbsd).first()
        channels = [
            LteChannel(
                low_frequency_hz=1,
                high_frequency_hz=2,
                max_eirp_dbm_mhz=3,
            ),
            LteChannel(
                low_frequency_hz=4,
                high_frequency_hz=5,
                max_eirp_dbm_mhz=6,
            ),
        ]
        message = CBSDStateResult(
            channels=channels,
            radio_enabled=True,
            carrier_aggregation_enabled=True,
        )

        # When
        actual_log = make_dp_log(
            method_name=CBSD_REGISTER,
            message=message,
            cbsd=cbsd,
            serial_number=SOME_SERIAL_NUMBER,
        )

        # Then
        expected_log = DPLog(
            event_timestamp=SOME_DATE,
            cbsd_serial_number=SOME_SERIAL_NUMBER,
            fcc_id=fcc_id,
            log_from=DP,
            log_message=str(message),
            log_name='CBSDRegisterResponse',
            log_to=CBSD,
            network_id=network_id,
            response_code=None,
        )
        self.assertEqual(expected_log, actual_log)
Esempio n. 12
0
    def test_tx_parameters_with_eirp_within_range(
        self,
        low_frequency_hz,
        high_frequency_hz,
        max_eirp_dbm_mhz,
        expected_bw_rbs,
        expected_earfcn,
        expected_tx_power,
    ) -> None:
        """Test that tx parameters of the enodeb are calculated correctly when eirp received from SAS
        is within acceptable range for the given bandwidth

        Args:
            low_frequency_hz (Any): low frequency in hz
            high_frequency_hz (Any): high frequency in hz
            max_eirp_dbm_mhz (Any): max eirp
            expected_bw_rbs (Any): expected bandwidth
            expected_earfcn (Any): expected earfcn
            expected_tx_power (Any): expected tx power
        """
        desired_config = EnodebConfiguration(FreedomFiOneTrDataModel())
        channel = LteChannel(
            low_frequency_hz=low_frequency_hz,
            high_frequency_hz=high_frequency_hz,
            max_eirp_dbm_mhz=max_eirp_dbm_mhz,
        )
        state = CBSDStateResult(
            radio_enabled=True,
            channel=channel,
        )

        ff_one_update_desired_config_from_cbsd_state(state, desired_config)
        self._assert_config_updated(
            config=desired_config,
            bandwidth=expected_bw_rbs,
            earfcn=expected_earfcn,
            tx_power=expected_tx_power,
            radio_enabled=True,
        )
Esempio n. 13
0
 def get_empty_state() -> CBSDStateResult:
     return CBSDStateResult(radio_enabled=False)
Esempio n. 14
0
from magma.enodebd.tests.test_utils.enb_acs_builder import (
    EnodebAcsStateMachineBuilder, )
from magma.enodebd.tests.test_utils.enodeb_handler import EnodebHandlerTestCase
from magma.enodebd.tests.test_utils.tr069_msg_builder import Tr069MessageBuilder
from magma.enodebd.tr069 import models
from parameterized import parameterized

SRC_CONFIG_DIR = os.path.join(
    os.environ.get('MAGMA_ROOT'),
    'lte/gateway/configs',
)

MOCK_CBSD_STATE = CBSDStateResult(
    radio_enabled=True,
    channel=LteChannel(
        low_frequency_hz=3550000000,
        high_frequency_hz=3570000000,
        max_eirp_dbm_mhz=15,
    ),
)

TEST_SAS_URL = 'test_sas_url'
TEST_SAS_CERT_SUBJECT = 'test_sas_cert_subject'


class FreedomFiOneTests(EnodebHandlerTestCase):
    """Testing FreedomfiOne state machine"""
    def _get_ff_one_read_only_param_values_resp(
        self, ) -> models.GetParameterValuesResponse:
        msg = models.GetParameterValuesResponse()
        param_val_list = []
        param_val_list.append(
 def _build_empty_state_result() -> CBSDStateResult:
     return CBSDStateResult(radio_enabled=False)
Esempio n. 16
0
from magma.enodebd.exceptions import ConfigurationError
from magma.enodebd.tests.test_utils.config_builder import EnodebConfigBuilder
from magma.enodebd.tests.test_utils.enb_acs_builder import (
    EnodebAcsStateMachineBuilder, )
from magma.enodebd.tests.test_utils.enodeb_handler import EnodebHandlerTestCase
from magma.enodebd.tests.test_utils.tr069_msg_builder import Tr069MessageBuilder
from magma.enodebd.tr069 import models
from parameterized import parameterized

SRC_CONFIG_DIR = os.path.join(
    os.environ.get('MAGMA_ROOT'),
    'lte/gateway/configs',
)

MOCK_CBSD_STATE = CBSDStateResult(
    radio_enabled=True,
    channel=LteChannel(
        low_frequency_hz=3550_000_000,
        high_frequency_hz=3570_000_000,
        max_eirp_dbm_mhz=15,
    ),
)


class FreedomFiOneTests(EnodebHandlerTestCase):
    def _get_freedomfi_one_read_only_param_values_response(
        self, ) -> models.GetParameterValuesResponse:
        msg = models.GetParameterValuesResponse()
        param_val_list = []
        param_val_list.append(
            Tr069MessageBuilder.get_parameter_value_struct(
                name='Device.X_000E8F_DeviceFeature.X_000E8F_NEStatus'