Ejemplo n.º 1
0
def build_enodebd_update_cbsd_request(
    serial_number: str,
    latitude_deg: str,
    longitude_deg: str,
    indoor_deployment: str,
    antenna_height: str,
    antenna_height_type: str,
    cbsd_category: str,
) -> EnodebdUpdateCbsdRequest:
    # cbsd category and antenna height type should be converted to lowercase
    # for the gRPC call
    antenna_height_type = antenna_height_type.lower()
    cbsd_category = cbsd_category.lower()
    # lat and long values are part of tr181 specification, but they are kept in device config
    # transformed and eventually kept within the device config as strings representing degrees
    latitude_deg_float = float(latitude_deg)
    longitude_deg_float = float(longitude_deg)

    indoor_deployment_bool = _indoortobool(indoor_deployment)
    antenna_height_float = float(antenna_height)

    installation_param = InstallationParam(
        latitude_deg=DoubleValue(value=latitude_deg_float),
        longitude_deg=DoubleValue(value=longitude_deg_float),
        indoor_deployment=BoolValue(value=indoor_deployment_bool),
        height_m=DoubleValue(value=antenna_height_float),
        height_type=StringValue(value=antenna_height_type),
    )

    return EnodebdUpdateCbsdRequest(
        serial_number=serial_number,
        installation_param=installation_param,
        cbsd_category=cbsd_category,
    )
Ejemplo n.º 2
0
    def given_single_step_cbsd_provisioned(self,
                                           builder: CbsdAPIDataBuilder) -> int:
        self.when_cbsd_is_created(builder.payload)
        update_request = EnodebdUpdateCbsdRequest(
            serial_number=self.serial_number,
            installation_param=InstallationParam(
                antenna_gain=DoubleValue(value=15),
                latitude_deg=DoubleValue(value=10.5),
                longitude_deg=DoubleValue(value=11.5),
                indoor_deployment=BoolValue(value=True),
                height_type=StringValue(value="agl"),
                height_m=DoubleValue(value=12.5),
            ),
            cbsd_category="a",
        )
        self.when_cbsd_is_updated_by_enodebd(update_request)
        cbsd = self.when_cbsd_is_fetched(builder.payload["serial_number"])
        self.then_cbsd_is(
            cbsd,
            builder.with_state(UNREGISTERED).with_is_active(False).
            with_full_installation_param().with_cbsd_category("a").payload,
        )

        state = self.when_cbsd_asks_for_state()
        self.then_state_is(state, get_empty_state())

        cbsd = self._check_cbsd_successfully_provisioned(builder)

        return cbsd['id']
Ejemplo n.º 3
0
    def test_cbsd_not_unregistered_when_coordinates_change_less_than_10_m(
            self):
        builder = CbsdAPIDataBuilder()\
            .with_single_step_enabled(True) \
            .with_capabilities() \
            .with_frequency_preferences() \
            .with_desired_state() \
            .with_serial_number(self.serial_number) \
            .with_full_installation_param() \
            .with_cbsd_category("a")

        self.given_single_step_cbsd_provisioned(builder)
        with self.while_cbsd_is_active():
            filters = get_filters_for_request_type('deregistration',
                                                   self.serial_number)

            update_request = EnodebdUpdateCbsdRequest(
                serial_number=self.serial_number,
                installation_param=InstallationParam(
                    antenna_gain=DoubleValue(value=15),
                    latitude_deg=DoubleValue(value=10.500001),
                    longitude_deg=DoubleValue(value=11.5000001),
                    indoor_deployment=BoolValue(value=True),
                    height_type=StringValue(value="agl"),
                    height_m=DoubleValue(value=12.5),
                ),
                cbsd_category="a",
            )

            self.when_cbsd_is_updated_by_enodebd(update_request)
            cbsd = self.when_cbsd_is_fetched(self.serial_number)
            self.then_cbsd_is(cbsd, builder.payload)
            self.then_message_is_never_sent(filters)
Ejemplo n.º 4
0
    def delete_cbsd(self, cbsd_id: int):
        filters = self._get_filters_for_request_type('deregistration',
                                                     self.serial_number)

        self.when_cbsd_is_deleted(cbsd_id)
        self.then_cbsd_is_deleted(self.serial_number)

        try:
            self.when_cbsd_is_updated_by_enodebd(
                EnodebdUpdateCbsdRequest(serial_number=self.serial_number))
        except grpc.RpcError as e:
            self.assertEqual(grpc.StatusCode.NOT_FOUND, e.code())

        self.then_message_is_eventually_sent(filters)
Ejemplo n.º 5
0
 def build_enodebd_update_request(
         self,
         indoor_deployment=False,
         cbsd_category="a") -> EnodebdUpdateCbsdRequest:
     return EnodebdUpdateCbsdRequest(
         serial_number=self.payload["serial_number"],
         installation_param=InstallationParam(
             latitude_deg=DoubleValue(value=10.5),
             longitude_deg=DoubleValue(value=11.5),
             indoor_deployment=BoolValue(value=indoor_deployment),
             height_type=StringValue(value="agl"),
             height_m=DoubleValue(value=12.5),
         ),
         cbsd_category=cbsd_category,
     )
Ejemplo n.º 6
0
    def test_enodebd_update_cbsd(self) -> None:
        builder = CbsdAPIDataBuilder() \
            .with_capabilities() \
            .with_frequency_preferences() \
            .with_desired_state() \
            .with_antenna_gain(15) \
            .with_serial_number(self.serial_number) \
            .with_cbsd_category("b")
        self.when_cbsd_is_created(builder.payload)
        cbsd = self.when_cbsd_is_fetched(self.serial_number)
        self.then_cbsd_is(
            cbsd,
            builder.with_indoor_deployment(False).with_is_active(
                False).with_state(UNREGISTERED).payload,
        )

        req = EnodebdUpdateCbsdRequest(
            serial_number=self.serial_number,
            cbsd_category="a",
            installation_param=InstallationParam(
                latitude_deg=DoubleValue(value=10.5),
                longitude_deg=DoubleValue(value=11.5),
                height_m=DoubleValue(value=12.5),
                height_type=StringValue(value="agl"),
                indoor_deployment=BoolValue(value=True),
                antenna_gain=DoubleValue(value=15),
            ),
        )
        self.when_cbsd_is_updated_by_enodebd(req)
        self.then_logs_are({"serial_number": self.serial_number},
                           ["EnodebdUpdateCbsd"])
        cbsd = self.when_cbsd_is_fetched(self.serial_number)
        self.then_cbsd_is(
            cbsd,
            builder.with_cbsd_category(
                "a").with_full_installation_param().payload)