def test_get_state_with_multiple_cbsds(self):
        some_cbsd = DBCbsdBuilder(). \
            with_state(self.unregistered). \
            with_registration('some'). \
            with_eirp_capabilities(0, 10, 20, 1). \
            with_active_mode_config(self.registered). \
            build()
        other_cbsd = DBCbsdBuilder(). \
            with_state(self.registered). \
            with_registration('other'). \
            with_eirp_capabilities(5, 15, 25, 3). \
            with_active_mode_config(self.registered). \
            build()
        self.session.add_all([some_cbsd, other_cbsd])
        self.session.commit()

        some_config = ActiveModeConfigBuilder(). \
            with_state(Unregistered). \
            with_registration('some'). \
            with_eirp_capabilities(0, 10, 20, 1). \
            with_desired_state(Registered). \
            build()
        other_config = ActiveModeConfigBuilder(). \
            with_state(Registered). \
            with_registration('other'). \
            with_eirp_capabilities(5, 15, 25, 3). \
            with_desired_state(Registered). \
            build()
        expected = State(active_mode_configs=[some_config, other_config])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_should_send_data_if_cbsd_needs_deletion(self):
        cbsd = DBCbsdBuilder(). \
            with_id(SOME_ID). \
            with_state(self.registered). \
            with_desired_state(self.registered). \
            with_registration('some'). \
            with_max_ibw(1000). \
            with_carrier_aggregation(True). \
            with_available_frequencies(FREQUENCIES). \
            deleted(). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = ActiveModeCbsdBuilder(). \
            with_id(SOME_ID). \
            with_state(Registered). \
            with_desired_state(Registered). \
            with_registration('some'). \
            deleted(). \
            with_category('b'). \
            with_grant_settings(
            GrantSettings(
                grant_redundancy_enabled=True,
                carrier_aggregation_enabled=True,
                max_ibw_mhz=1000,
                available_frequencies=FREQUENCIES,
            ),
            ).build()  # noqa: E123
        expected = State(cbsds=[am_cbsd])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_basic_state(self):
        cbsd = self._prepare_base_cbsd().build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = self._prepare_base_active_mode_cbsd().build()
        expected = State(cbsds=[am_cbsd])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_with_pending_requests(self):
        cbsd = self._prepare_base_cbsd(). \
            with_request(self.grant, '{"key2":"value2"}'). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        expected = State()

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
示例#5
0
    def test_not_get_state_with_single_step_enabled_and_without_installation_params(self):
        cbsd = self._prepare_base_cbsd(). \
            with_single_step_enabled(). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        expected = State()

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_with_processed_requests(self):
        cbsd = self._prepare_base_cbsd(). \
            with_request(self.processed, self.grant, '{"key1":"value1"}'). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        config = self._prepare_base_active_mode_config().build()
        expected = State(cbsds=[config])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_not_get_state_without_eirp_capabilities(self):
        cbsd = DBCbsdBuilder(). \
            with_state(self.unregistered). \
            with_registration('some'). \
            with_desired_state(self.registered). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        expected = State()

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
示例#8
0
    def test_not_get_state_without_registration_params(self):
        cbsd = DBCbsdBuilder(). \
            with_state(self.unregistered). \
            with_eirp_capabilities(0, 10, 20, 1). \
            with_active_mode_config(self.registered). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        expected = State()

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
示例#9
0
    def test_not_get_state_with_single_step_enabled_category_a_and_outdoor(self):
        cbsd = self._prepare_base_cbsd(). \
            with_category('a'). \
            with_installation_params(1, 2, 3, 'AGL', False). \
            with_single_step_enabled(). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        expected = State()

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_with_frequency_preferences(self):
        cbsd = self._prepare_base_cbsd(). \
            with_preferences(15, [3600, 3580, 3620]). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_preferences(15, [3600, 3580, 3620]). \
            build()

        expected = State(cbsds=[am_cbsd])
        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(actual, expected)
示例#11
0
    def test_get_state_with_last_seen(self):
        cbsd = self._prepare_base_cbsd(). \
            with_last_seen(1). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        config = self._prepare_base_active_mode_config(). \
            with_last_seen(1). \
            build()
        expected = State(cbsds=[config])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_for_cbsd_marked_for_deletion(self):
        cbsd = self._prepare_base_cbsd(). \
            deleted(). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        config = self._prepare_base_active_mode_config(). \
            deleted(). \
            build()
        expected = State(active_mode_configs=[config])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_for_single_step(self):
        cbsd = self._prepare_base_cbsd(). \
            with_single_step_enabled(). \
            with_installation_params(1, 2, 3, 'AGL', True). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_single_step_enabled(). \
            with_installation_params(1, 2, 3, 'AGL', True). \
            build()
        expected = State(cbsds=[am_cbsd])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)
    def test_get_state_with_channels(self):
        cbsd = self._prepare_base_cbsd(). \
            with_channel(1, 2, 3). \
            with_channel(5, 6). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_channel(1, 2, 3). \
            with_channel(5, 6). \
            build()
        expected = State(cbsds=[am_cbsd])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(actual, expected)
    def test_get_state_with_grants(self):
        cbsd = self._prepare_base_cbsd(). \
            with_grant("granted_grant", self.granted, 3). \
            with_grant("authorized_grant", self.authorized, 5, 6). \
            build()
        self.session.add(cbsd)
        self.session.commit()

        am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_grant("granted_grant", Granted, 3, 0). \
            with_grant("authorized_grant", Authorized, 5, 6). \
            build()

        expected = State(cbsds=[am_cbsd])
        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(actual, expected)
    def test_get_state_with_multiple_cbsds(self):
        some_cbsd = self._prepare_base_cbsd(). \
            with_id(SOME_ID). \
            with_registration('some'). \
            build()
        other_cbsd = self._prepare_base_cbsd(). \
            with_id(OTHER_ID). \
            with_registration('other'). \
            build()
        self.session.add_all([some_cbsd, other_cbsd])
        self.session.commit()

        some_am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_id(SOME_ID). \
            with_registration('some'). \
            build()
        other_am_cbsd = self._prepare_base_active_mode_cbsd(). \
            with_id(OTHER_ID). \
            with_registration('other'). \
            build()
        expected = State(cbsds=[some_am_cbsd, other_am_cbsd])

        actual = self.amc_service.GetState(GetStateRequest(), None)
        self.assertEqual(expected, actual)