Example #1
0
 def _build_channel(cbsd: DBCbsd) -> DBChannel:
     return DBChannel(
         cbsd=cbsd,
         channel_type="some_channel_type",
         rule_applied="some_rule",
         low_frequency=3550_000_000,
         high_frequency=3570_000_000,
         last_used_max_eirp=20,
     )
Example #2
0
 def with_channel(
     self,
     low: int, high: int,
     max_eirp: float = None,
 ) -> DBCbsdBuilder:
     channel = DBChannel(
         low_frequency=low,
         high_frequency=high,
         max_eirp=max_eirp,
         channel_type='channel_type',
         rule_applied='rule',
     )
     self.cbsd.channels.append(channel)
     return self
 def _create_channels_for_cbsd(self, cbsd: DBCbsd, number: int):
     channels = [
         DBChannel(
             cbsd=cbsd,
             low_frequency=number,
             high_frequency=number + 1,
             channel_type=f"test_type{number}",
             rule_applied=f"test_rule{number}",
             max_eirp=0.1 + number,
         ) for _ in range(0, number)
     ]
     self.session.add_all(channels)
     self.session.commit()
     return channels
 def _create_channel(
     self,
     cbsd: DBCbsd,
     low_frequency: int,
     high_frequency: int,
 ) -> DBChannel:
     channel = DBChannel(
         cbsd=cbsd,
         low_frequency=low_frequency,
         high_frequency=high_frequency,
         channel_type="some_type",
         rule_applied="some_rule",
     )
     self.session.add(channel)
     self.session.commit()
     return channel
Example #5
0
def _create_channels(response: DBResponse, session: Session):
    _terminate_all_grants_from_response(response, session)
    cbsd_id = response.request.payload["cbsdId"]
    cbsd = session.query(DBCbsd).filter(DBCbsd.cbsd_id == cbsd_id).scalar()
    available_channels = response.payload.get("availableChannel")
    if not available_channels:
        logger.warning(
            "Could not create channel from spectrumInquiryResponse. Response missing 'availableChannel' object",
        )
        return
    for ac in available_channels:
        frequency_range = ac["frequencyRange"]
        channel = DBChannel(
            cbsd=cbsd,
            low_frequency=frequency_range["lowFrequency"],
            high_frequency=frequency_range["highFrequency"],
            channel_type=ac["channelType"],
            rule_applied=ac["ruleApplied"],
            max_eirp=ac.get("maxEirp"),
        )
        logger.info(f"Creating channel for {cbsd=}")
        session.add(channel)