Ejemplo n.º 1
0
    def setUp(self):

        self.__verbose_testing = False

        self.__sc_id = 'humsat-d'
        self.__ufo_id = 'object-111'

        self.__user_1 = db_tools.create_user_profile()
        self.__user_2 = db_tools.create_user_profile(username='******')

        self.__request_1 = db_tools.create_request(user_profile=self.__user_1)
        self.__request_2 = db_tools.create_request(user_profile=self.__user_2)

        self.__sc = db_tools.create_sc(
            user_profile=self.__user_1, identifier=self.__sc_id
        )

        self.__ufo = db_tools.create_sc(
            user_profile=self.__user_2, identifier=self.__ufo_id, is_ufo=True
        )

        self.__admin = db_tools.create_user_profile(
            username='******',
            email='*****@*****.**',
            is_staff=True
        )
        self.__request_3 = db_tools.create_request(user_profile=self.__admin)
        self.__cluster = db_tools.create_launch(admin=self.__admin)

        if not self.__verbose_testing:
            logging.getLogger('leop').setLevel(level=logging.CRITICAL)
Ejemplo n.º 2
0
    def test_get_user(self):
        """UNIT test: services.accounts.utils - user from HTTP request
        Should extract the user object and username from a HTTP request
        """
        username = '******'
        user_profile = db_tools.create_user_profile(
            username=username
        )
        http_request = db_tools.create_request(user_profile=user_profile)
        username_2 = 'another'
        user_profile_2 = db_tools.create_user_profile(
            username=username_2
        )

        self.assertEqual(
            account_models.get_user(
                http_request=http_request,
                permissions_flag=False,
                test_username=username,
                testing_flag=False
            ),
            (user_profile, username),
            'Error extracing the user data from HTTP request'
        )

        self.assertEqual(
            account_models.get_user(
                http_request=http_request,
                permissions_flag=False,
                test_username=username_2,
                testing_flag=False
            ),
            (user_profile_2, username_2),
            'Error extracting the user data when no HTTP request is given'
        )
Ejemplo n.º 3
0
    def setUp(self):

        self.__verbose_testing = False

        self.__sc_id = 'humsat-d'
        self.__ufo_id = 'object-111'

        self.__user_1 = db_tools.create_user_profile()
        self.__user_2 = db_tools.create_user_profile(username='******')

        self.__request_1 = db_tools.create_request(user_profile=self.__user_1)
        self.__request_2 = db_tools.create_request(user_profile=self.__user_2)

        self.__sc = db_tools.create_sc(user_profile=self.__user_1,
                                       identifier=self.__sc_id)

        self.__ufo = db_tools.create_sc(user_profile=self.__user_2,
                                        identifier=self.__ufo_id,
                                        is_ufo=True)

        self.__admin = db_tools.create_user_profile(username='******',
                                                    email='*****@*****.**',
                                                    is_staff=True)
        self.__request_3 = db_tools.create_request(user_profile=self.__admin)
        self.__cluster = db_tools.create_launch(admin=self.__admin)

        if not self.__verbose_testing:
            logging.getLogger('leop').setLevel(level=logging.CRITICAL)
Ejemplo n.º 4
0
    def setUp(self):
        """Database setup for the tests.
        """

        self.__verbose_testing = False
        satnet_settings.JRPC_PERMISSIONS = True

        self.__user = db_tools.create_user_profile()
        self.__request_1 = db_tools.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user,
            identifier=self.__gs_1_id
        )
        self.__gs_2_id = 'gs-calpoly'
        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__user,
            identifier=self.__gs_2_id
        )

        self.__admin = db_tools.create_user_profile(
            username='******',
            email='*****@*****.**',
            is_staff=True
        )
        self.__request_2 = db_tools.create_request(user_profile=self.__admin)

        self.__leop_tle_l1 = db_tools.ISS_TLE[0]
        self.__leop_tle_l2 = db_tools.ISS_TLE[1]
        self.__leop_id = 'leop_cluster_4testing'
        self.__leop_date = pytz.utc.localize(datetime.datetime.today())
        self.__leop = db_tools.create_launch(
            admin=self.__admin, identifier=self.__leop_id,
            date=self.__leop_date,
            tle_l1=self.__leop_tle_l1, tle_l2=self.__leop_tle_l2
        )
        self.__leop_serial_date = str(self.__leop.date.isoformat())
        self.__leop_cs = launch_utils.generate_cluster_callsign(self.__leop_id)
        self.__leop_sc_id = launch_utils.generate_cluster_sc_identifier(
            self.__leop_id, self.__leop_cs
        )

        self.__ufo_id = 1
        self.__ufo_sc_id = launch_utils.generate_object_sc_identifier(
            self.__leop_id, self.__ufo_id
        )
        self.__ufo_callsign = 'SCLLY'
        self.__ufo_tle_l1 = self.__leop_tle_l1
        self.__ufo_tle_l2 = self.__leop_tle_l2

        self.__leop_2_tle_l1 = db_tools.TIANGONG_TLE[0]
        self.__leop_2_tle_l2 = db_tools.TIANGONG_TLE[1]

        if not self.__verbose_testing:
            logging.getLogger('leop').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 5
0
    def setUp(self):
        """Database setup for the tests.
        """

        self.__verbose_testing = False
        satnet_settings.JRPC_PERMISSIONS = True

        self.__user = db_tools.create_user_profile()
        self.__request_1 = db_tools.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(user_profile=self.__user,
                                         identifier=self.__gs_1_id)
        self.__gs_2_id = 'gs-calpoly'
        self.__gs_2 = db_tools.create_gs(user_profile=self.__user,
                                         identifier=self.__gs_2_id)

        self.__admin = db_tools.create_user_profile(username='******',
                                                    email='*****@*****.**',
                                                    is_staff=True)
        self.__request_2 = db_tools.create_request(user_profile=self.__admin)

        self.__leop_tle_l1 = db_tools.ISS_TLE[0]
        self.__leop_tle_l2 = db_tools.ISS_TLE[1]
        self.__leop_id = 'leop_cluster_4testing'
        self.__leop_date = pytz.utc.localize(datetime.datetime.today())
        self.__leop = db_tools.create_launch(admin=self.__admin,
                                             identifier=self.__leop_id,
                                             date=self.__leop_date,
                                             tle_l1=self.__leop_tle_l1,
                                             tle_l2=self.__leop_tle_l2)
        self.__leop_serial_date = str(self.__leop.date.isoformat())
        self.__leop_cs = launch_utils.generate_cluster_callsign(self.__leop_id)
        self.__leop_sc_id = launch_utils.generate_cluster_sc_identifier(
            self.__leop_id, self.__leop_cs)

        self.__ufo_id = 1
        self.__ufo_sc_id = launch_utils.generate_object_sc_identifier(
            self.__leop_id, self.__ufo_id)
        self.__ufo_callsign = 'SCLLY'
        self.__ufo_tle_l1 = self.__leop_tle_l1
        self.__ufo_tle_l2 = self.__leop_tle_l2

        self.__leop_2_tle_l1 = db_tools.TIANGONG_TLE[0]
        self.__leop_2_tle_l2 = db_tools.TIANGONG_TLE[1]

        if not self.__verbose_testing:
            logging.getLogger('leop').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 6
0
    def setUp(self):
        """Test setup
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__user = db_tools.create_user_profile()
        self.__request_1 = db_tools.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user, identifier=self.__gs_1_id
        )

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'CANX-2'
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user,
            identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id,
        )
Ejemplo n.º 7
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__sc_1_id = 'sc-xatcobeo'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_1_f = 437000000

        from services.configuration.signals import tle
        from services.scheduling.signals import compatibility
        from services.scheduling.signals import availability

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id
        )
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile, identifier=self.__sc_1_id
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
Ejemplo n.º 8
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        self.__test_sc_id = 'sc-canx-2'
        self.__sc_id = 'humd-sc'
        self.__user_profile = db_tools.create_user_profile()
        self.__request = db_tools.create_request(
            user_profile=self.__user_profile
        )
        self.__sc_callsign = 'HUMXXX7'
        self.__sc_tle_1_id = 'HUMSAT-D'
        self.__sc_tle_2_id = 'CANX-2'

        self.__gs_id = 'my-gs'
        self.__gs_callsign = 'GSXXGX'
        self.__gs_elevation = 20.1
        self.__gs_latitude = 54.80
        self.__gs_longitude = -8.90

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 9
0
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'

        self.__sc_1_id = 'sc-xatcobeo'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_2_id = 'xatco-fm-2'
        self.__sc_1_ch_3_id = 'xatco-fm-3'
        self.__sc_1_ch_4_id = 'xatco-afsk-1'

        self.__band = sn_helpers.create_band()
        self.__test_user_profile = sn_helpers.create_user_profile()
        self.__gs = sn_helpers.create_gs(
            user_profile=self.__test_user_profile, identifier=self.__gs_1_id,
        )
        self.__sc = sn_helpers.create_sc(
            user_profile=self.__test_user_profile, identifier=self.__sc_1_id
        )
Ejemplo n.º 10
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        self.__test_sc_id = 'sc-canx-2'
        self.__sc_id = 'humd-sc'
        self.__user_profile = db_tools.create_user_profile()
        self.__request = db_tools.create_request(
            user_profile=self.__user_profile)
        self.__sc_callsign = 'HUMXXX7'
        self.__sc_tle_1_id = 'HUMSAT-D'
        self.__sc_tle_2_id = 'CANX-2'

        self.__gs_id = 'my-gs'
        self.__gs_callsign = 'GSXXGX'
        self.__gs_elevation = 20.1
        self.__gs_latitude = 54.80
        self.__gs_longitude = -8.90

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 11
0
    def setUp(self):
        """Test setup
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__user = db_tools.create_user_profile()
        self.__request_1 = db_tools.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(user_profile=self.__user,
                                         identifier=self.__gs_1_id)

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'CANX-2'
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import compatibility

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_1_ch_2_id = 'chan-cas-2'
        self.__gs_1_ch_3_id = 'chan-cas-3'

        self.__sc_1_id = 'sc-xatcobeo'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_2_id = 'xatco-fm-2'
        self.__sc_1_ch_3_id = 'xatco-fm-3'
        self.__sc_1_ch_4_id = 'xatco-afsk-1'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__sc = db_tools.create_sc(
            user_profile=self.__user_profile, identifier=self.__sc_1_id
        )
Ejemplo n.º 13
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'uvigo'
        self.__gs_1_ch_1_id = 'qpsk-gs-1'
        self.__sc_1_id = 'xatcobe-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'qpsk-sc-1'
        self.__sc_1_ch_1_f = 437000000

        self.__band = db_tools.create_band()
        self.__test_user_profile = db_tools.create_user_profile()
        self.__simulator = simulation.OrbitalSimulator()

        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__test_user_profile, identifier=self.__gs_1_id,
            contact_elevation=0,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id
        )

        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__test_user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
Ejemplo n.º 14
0
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'

        self.__sc_1_id = 'sc-xatcobeo'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_2_id = 'xatco-fm-2'
        self.__sc_1_ch_3_id = 'xatco-fm-3'
        self.__sc_1_ch_4_id = 'xatco-afsk-1'

        self.__band = sn_helpers.create_band()
        self.__test_user_profile = sn_helpers.create_user_profile()
        self.__gs = sn_helpers.create_gs(
            user_profile=self.__test_user_profile,
            identifier=self.__gs_1_id,
        )
        self.__sc = sn_helpers.create_sc(user_profile=self.__test_user_profile,
                                         identifier=self.__sc_1_id)
Ejemplo n.º 15
0
    def setup_databases(self, **kwargs):
        """
        Sets up the database together with some additional objects required for
        the automated tests.

        :param kwargs: Additional parameters dictionary
        """

        verbose_testing = False
        db = nose_runner.NoseTestSuiteRunner(SatnetTestRunner, self)\
            .setup_databases()
        sys.stdout.write('>>> Loading CELESTRAK tles: ')
        sys.stdout.flush()

        # 1) first we create the local server in case it does not exist
        db_tools.create_local_server()

        try:

            # 2) later, we try to load the CELESTRAK TLE database
            tle.TwoLineElementsManager.load_tles(testing=True)
            tle.TwoLineElementsManager.load_tles(
                source=Celestrak.CELESTRAK_GOES, testing=True
            )
            # tle.TwoLineElementsManager.load_celestrak()
            print(' done!')

            # 3) SC necessary for speeding-up some tests
            sys.stdout.write('>>> Adding <CANX-2> as testing Spacecraft...')
            sys.stdout.flush()
            db_tools.create_sc(
                user_profile=db_tools.create_user_profile(
                    username='******'
                ),
                identifier='sc-canx-2', tle_id='CANX-2'
            )
            print(' done!')

        except urllib.error.URLError:
            print(' No internet connection! Could not load TLEs.')

        sys.stdout.write('>>> Initializing available bands...')
        sys.stdout.flush()
        # 4) Initialization of the available communication channel bands.
        db_tools.init_available()
        print(' done!')

        if not verbose_testing:
            logging.getLogger('push').setLevel(level=logging.CRITICAL)
            logging.getLogger('accounts').setLevel(level=logging.CRITICAL)
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('communications').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('leop').setLevel(level=logging.CRITICAL)
            logging.getLogger('network').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        return db
Ejemplo n.º 16
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False
        self.__test_slot_id = -1

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1,
            self.__sc_1_ch_1_f,
            self.__sc_1_ch_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band,
                                                   self.__gs_1_ch_1_id)

        self.__rule_1 = jrpc_rules.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=sn_misc.get_today_utc(),
                date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=sn_misc.get_next_midnight() +
                datetime.timedelta(seconds=1),
                ending_time=sn_misc.get_next_midnight() +
                datetime.timedelta(hours=23, minutes=59, seconds=59)))
Ejemplo n.º 17
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import availability

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = str('xatcobeo-fm')
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = str('gs-la-fm')
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }
        self.__gs_1_ch_2_id = 'gs-la-fm-2'
        self.__gs_1_ch_2_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        operational_models.OperationalSlot.objects.set_debug()
Ejemplo n.º 18
0
    def setUp(self):
        """Database setup for the tests.
        """
        self.__verbose_testing = False

        self.__user = db_tools.create_user_profile()
        self.__request = db_tools.create_request(user_profile=self.__user)

        self.__user_no_gs = db_tools.create_user_profile(username='******')
        self.__request_ung = db_tools.create_request(
            user_profile=self.__user_no_gs
        )

        self.__user_gs_2 = db_tools.create_user_profile(username='******')
        self.__request_gs_2 = db_tools.create_request(
            user_profile=self.__user_gs_2
        )

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user,
            identifier=self.__gs_1_id
        )
        self.__gs_2_id = 'gs-calpoly'
        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__user_gs_2,
            identifier=self.__gs_2_id
        )

        self.__short_message = 'QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
        self.__long_message = 'ogAAAABErEarAAAAAESsRwoAAAAARKxHaAAAAABErEfGAA' \
                              'AAAESsSCVCE4y4RKxIg0NICpdErEjhQ4IvIkSsSUBDKx7d' \
                              'RKxJngAAAABErEn8AAAAAESsSloAAAAARKxKuQAAAABEtQ' \
                              'kRAAAAAES1CXkAAAAARLUJ4QAAAABEtQpKAAAAAES1CrJD' \
                              'JhD9RLULGkN2IZtEtQuCQ0j6M0S1C'
        self.__b64_message = base64.b64encode(
            b'Base64 is a group of similar binary-to-text encoding schemes '
            b'that represent binary data in an ASCII string format by '
            b'translating it into a radix-64 representation. The term Base64 '
            b'originates from a specific MIME content transfer encoding.'
        )

        if not self.__verbose_testing:
            logging.getLogger('communications').setLevel(level=logging.CRITICAL)
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import compatibility

        self.__gs_1_id = 'uvigo'
        self.__gs_1_ch_1_id = 'qpsk-gs-1'
        self.__gs_1_ch_2_id = 'qpsk-gs-2'

        self.__gs_2_id = 'calpoly'

        self.__sc_1_id = 'humd'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_2_id = 'gmsk-sc-2'

        self.__sc_2_id = 'beesat'

        self.__band = db_tools.create_band()
        self.__test_user_profile = db_tools.create_user_profile()

        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__test_user_profile, identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id
        )

        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__test_user_profile, identifier=self.__gs_2_id,
        )

        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__test_user_profile,
            identifier=self.__sc_1_id
        )
        self.__sc_2 = db_tools.create_sc(
            user_profile=self.__test_user_profile,
            identifier=self.__sc_2_id
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
Ejemplo n.º 20
0
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'uvigo'
        self.__gs_1_ch_1_id = 'qpsk-gs-1'
        self.__gs_1_ch_2_id = 'qpsk-gs-2'

        self.__gs_2_id = 'calpoly'

        self.__sc_1_id = 'humd'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_2_id = 'gmsk-sc-2'

        self.__sc_2_id = 'beesat'

        self.__band = db_tools.create_band()
        self.__test_user_profile = db_tools.create_user_profile()

        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__test_user_profile,
            identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band,
                                                   self.__gs_1_ch_1_id)

        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__test_user_profile,
            identifier=self.__gs_2_id,
        )

        self.__sc_1 = db_tools.create_sc(user_profile=self.__test_user_profile,
                                         identifier=self.__sc_1_id)
        self.__sc_2 = db_tools.create_sc(user_profile=self.__test_user_profile,
                                         identifier=self.__sc_2_id)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1,
            self.__sc_1_ch_1_f,
            self.__sc_1_ch_1_id,
        )

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 21
0
    def setUp(self):
        """Database setup for the tests.
        """
        self.__verbose_testing = False

        self.__user = db_tools.create_user_profile()
        self.__request = db_tools.create_request(user_profile=self.__user)

        self.__user_no_gs = db_tools.create_user_profile(username='******')
        self.__request_ung = db_tools.create_request(
            user_profile=self.__user_no_gs)

        self.__user_gs_2 = db_tools.create_user_profile(username='******')
        self.__request_gs_2 = db_tools.create_request(
            user_profile=self.__user_gs_2)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(user_profile=self.__user,
                                         identifier=self.__gs_1_id)
        self.__gs_2_id = 'gs-calpoly'
        self.__gs_2 = db_tools.create_gs(user_profile=self.__user_gs_2,
                                         identifier=self.__gs_2_id)

        self.__short_message = 'QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
        self.__long_message = 'ogAAAABErEarAAAAAESsRwoAAAAARKxHaAAAAABErEfGAA' \
                              'AAAESsSCVCE4y4RKxIg0NICpdErEjhQ4IvIkSsSUBDKx7d' \
                              'RKxJngAAAABErEn8AAAAAESsSloAAAAARKxKuQAAAABEtQ' \
                              'kRAAAAAES1CXkAAAAARLUJ4QAAAABEtQpKAAAAAES1CrJD' \
                              'JhD9RLULGkN2IZtEtQuCQ0j6M0S1C'
        self.__b64_message = base64.b64encode(
            b'Base64 is a group of similar binary-to-text encoding schemes '
            b'that represent binary data in an ASCII string format by '
            b'translating it into a radix-64 representation. The term Base64 '
            b'originates from a specific MIME content transfer encoding.')

        if not self.__verbose_testing:
            logging.getLogger('communications').setLevel(
                level=logging.CRITICAL)
Ejemplo n.º 22
0
    def setUp(self):

        super(TestTle, self).setUp()

        self.__verbose_testing = False
        self.__sc_1_id = 'sc-humsat'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__user_profile = None

        self.__sc_2_id = 'fake-sat'
        self.__sc_2_tle_id = 'XXX99X9X'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()

        if not self.__verbose_testing:
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
Ejemplo n.º 23
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_2_id = 'gs-cuvi'

        self.__band = sn_helpers.create_band()
        self.__user_profile = sn_helpers.create_user_profile()
        self.__gs = sn_helpers.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
Ejemplo n.º 24
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id
        )
Ejemplo n.º 25
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_2_id = 'gs-cuvi'

        self.__band = sn_helpers.create_band()
        self.__user_profile = sn_helpers.create_user_profile()
        self.__gs = sn_helpers.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )
Ejemplo n.º 26
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs, self.__band,
                                                   self.__gs_1_ch_1_id)
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_id = 'uvigo'
        self.__gs_ch_1_id = 'qpsk-gs-1'
        self.__gs_ch_2_id = 'qpsk-gs-2'

        self.__sc_id = 'humd'
        self.__sc_ch_1_id = 'gmsk-sc-1'
        self.__sc_ch_f = 437000000
        self.__sc_ch_2_id = 'gmsk-sc-2'

        self.__sc_id = 'beesat'

        self.__band = db_tools.create_band()
        self.__test_user_profile = db_tools.create_user_profile()

        self.__gs = db_tools.create_gs(
            user_profile=self.__test_user_profile, identifier=self.__gs_id,
        )
        self.__gs_ch_1 = db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_ch_1_id
        )
        self.__gs_ch_2 = db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_ch_2_id
        )

        self.__sc = db_tools.create_sc(
            user_profile=self.__test_user_profile,
            identifier=self.__sc_id
        )
        self.__sc_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_ch_f, self.__sc_ch_1_id,
        )
        self.__sc_ch_2 = db_tools.sc_add_channel(
            self.__sc, self.__sc_ch_f, self.__sc_ch_2_id,
        )
Ejemplo n.º 28
0
    def setUp(self):
        """Database setup for the tests.
        """
        self.__verbose_testing = False

        self.__user = sn_helpers.create_user_profile()
        self.__request_1 = sn_helpers.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = sn_helpers.create_gs(user_profile=self.__user,
                                           identifier=self.__gs_1_id)

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'CANX-2'
        self.__sc_1 = sn_helpers.create_sc(
            user_profile=self.__user,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
Ejemplo n.º 29
0
    def setUp(self):
        """Database setup for the tests.
        """
        self.__verbose_testing = False

        self.__user = db_tools.create_user_profile()
        self.__request_1 = db_tools.create_request(user_profile=self.__user)

        self.__gs_1_id = 'gs-uvigo'
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user, identifier=self.__gs_1_id
        )

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'CANX-2'
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user,
            identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id,
        )
Ejemplo n.º 30
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)

        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1_id = 'humd-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
Ejemplo n.º 31
0
    def test_gs_list_others(self):
        """JRPC test: configuration.gs.list.others
        This test validates the list of GroundStation objects
        returned through the JRPC method.
        """
        if self.__verbose_testing:
            print('>>> TEST (test_sc_list_others)')

        self.assertListEqual(
            jrpc_gs.list_groundstations_others(request=self.__http_request), []
        )

        user_profile_2 = db_tools.create_user_profile(
            username='******'
        )
        request_2 = db_tools.create_request(user_profile=user_profile_2)
        self.assertListEqual(
            jrpc_gs.list_groundstations_others(request=request_2), [
                self.__gs_1_id, self.__gs_2_id
            ]
        )
Ejemplo n.º 32
0
    def test_sc_list_mine(self):
        """JRPC test: configuration.sc.list.mine
        This test validates the list of SpacecraftConfiguration objects
        returned through the JRPC method.
        """
        if self.__verbose_testing:
            print('>>> TEST (test_sc_list_mine)')

        self.assertEquals(
            jrpc_sc.list_spacecraft_mine(request=self.__http_request), [
                self.__sc_1_id, self.__sc_2_id
            ]
        )

        user_profile_2 = db_tools.create_user_profile(
            username='******'
        )
        request_2 = db_tools.create_request(user_profile=user_profile_2)
        self.assertListEqual(
            jrpc_sc.list_spacecraft_mine(request=request_2), []
        )
Ejemplo n.º 33
0
    def setUp(self):
        """Test setup
        Initial database configuration for the tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_callsign = 'GS1GSGS'
        self.__gs_1_contact_elevation = 10.30
        self.__gs_1_longitude = -8.9330
        self.__gs_1_latitude = 42.6000
        self.__gs_1_configuration = (
            self.__gs_1_callsign,
            10.3,
            self.__gs_1_latitude,
            self.__gs_1_longitude
        )
        self.__gs_1_ch_1_id = 'fm-1'
        self.__gs_1_ch_2_id = 'afsk-2'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__http_request = db_tools.create_request(
            user_profile=self.__user_profile
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
            callsign=self.__gs_1_callsign,
            contact_elevation=self.__gs_1_contact_elevation,
            latitude=self.__gs_1_latitude,
            longitude=self.__gs_1_longitude,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id,
        )
Ejemplo n.º 34
0
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = True

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('django.db.backends.schema')\
                .setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_1_ch_2_id = 'chan-cas-2'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id
        )
        self.__gs_1_ch_2 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_2_id
        )

        self.__sc_1_id = 'humd'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_2_id = 'gmsk-sc-2'

        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
Ejemplo n.º 35
0
    def setUp(self):
        """
        Populates the initial database with a set of objects required to run
        the following tests.
        """
        self.__verbose_testing = True

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('django.db.backends.schema')\
                .setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_1_ch_2_id = 'chan-cas-2'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band,
                                                   self.__gs_1_ch_1_id)
        self.__gs_1_ch_2 = db_tools.gs_add_channel(self.__gs_1, self.__band,
                                                   self.__gs_1_ch_2_id)

        self.__sc_1_id = 'humd'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_2_id = 'gmsk-sc-2'

        self.__sc_1 = db_tools.create_sc(user_profile=self.__user_profile,
                                         identifier=self.__sc_1_id)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1,
            self.__sc_1_ch_1_f,
            self.__sc_1_ch_1_id,
        )
Ejemplo n.º 36
0
    def setUp(self):
        """Test setup
        Initial database configuration for the tests.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_callsign = 'GS1GSGS'
        self.__gs_1_contact_elevation = 10.30
        self.__gs_1_longitude = -8.9330
        self.__gs_1_latitude = 42.6000
        self.__gs_1_configuration = (self.__gs_1_callsign, 10.3,
                                     self.__gs_1_latitude,
                                     self.__gs_1_longitude)
        self.__gs_1_ch_1_id = 'fm-1'
        self.__gs_1_ch_2_id = 'afsk-2'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__http_request = db_tools.create_request(
            user_profile=self.__user_profile)
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
            callsign=self.__gs_1_callsign,
            contact_elevation=self.__gs_1_contact_elevation,
            latitude=self.__gs_1_latitude,
            longitude=self.__gs_1_longitude,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1,
            self.__band,
            self.__gs_1_ch_1_id,
        )
Ejemplo n.º 37
0
    def setUp(self):

        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        self.__rule_date = misc.get_today_utc()
        self.__rule_s_time = misc.get_today_utc().replace(
            hour=12, minute=0, second=0, microsecond=0
        )
        self.__rule_e_time = self.__rule_s_time + datetime.timedelta(hours=5)

        self.__utc_s_date = self.__rule_date - datetime.timedelta(days=1)
        self.__utc_e_date = self.__rule_date + datetime.timedelta(days=365)
        self.__utc_s_time = self.__rule_s_time
        self.__utc_e_time = self.__rule_e_time

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__gs_2_id = 'gs-cuvi'

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import availability, compatibility

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_2_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id
        )
Ejemplo n.º 38
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        self.__rule_1_cfg = db_tools.create_jrpc_daily_rule(
            starting_time=misc.localize_time_utc(
                datetime.time(hour=8, minute=0, second=0)),
            ending_time=misc.localize_time_utc(
                datetime.time(hour=23, minute=55, second=0)))

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'xatcobeo-fm'
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }
        self.__gs_1_ch_2_id = 'gs-la-fm-2'
        self.__gs_1_ch_2_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import availability
        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import compatibility
        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import operational

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )
Ejemplo n.º 39
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        self.__rule_1_cfg = db_tools.create_jrpc_daily_rule(
            starting_time=misc.localize_time_utc(datetime.time(
                hour=8, minute=0, second=0
            )),
            ending_time=misc.localize_time_utc(datetime.time(
                hour=23, minute=55, second=0
            ))
        )

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'xatcobeo-fm'
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }
        self.__gs_1_ch_2_id = 'gs-la-fm-2'
        self.__gs_1_ch_2_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import availability
        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import compatibility
        # noinspection PyUnresolvedReferences
        from services.scheduling.signals import operational

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
    def test_bug_1(self):
        """INTR test: services.scheduling - operational slot generation
        """

        self.__gs_1_id = 'gs-vigo'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__sc_1_id = 'sc-serpens'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_1_f = 437500000

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()

        # 1) create vigo gs
        self.__gs = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id
        )

        # CHECK A: NO ADDITIONAL pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_0 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id
        )

        self.assertEqual(len(p_slots_0), 0)
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0
        )
        self.assertEqual(len(o_slots_0), 0)

        # 2) serpens spacecraft
        self.__sc = db_tools.create_sc(
            user_profile=self.__user_profile, identifier=self.__sc_1_id
        )

        # CHECK B: MORE pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_1 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id
        )
        self.assertGreater(len(p_slots_1), len(p_slots_0))
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0
        )
        self.assertEqual(len(o_slots_0), 0)

        # 3) we add channels and, therefore, compatibility matches
        #       without availability rules, no operational slots
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id
        )

        # CHECK C: SAME pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_2 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id
        )
        self.assertEqual(len(p_slots_2), len(p_slots_1))
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0
        )
        self.assertEqual(len(o_slots_0), 0)

        # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC
        #       all pass slots should became operational slots.
        self.__rule_1 = rules_jrpc.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=sn_misc.get_today_utc(),
                date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=sn_misc.get_next_midnight() + datetime.timedelta(
                    seconds=1
                ),
                ending_time=sn_misc.get_next_midnight() + datetime.timedelta(
                    hours=23, minutes=59, seconds=59
                )
            )
        )

        # CHECK D: 3 availability slots (1 per day, almost 24 hours)
        #           should transform all pass slots into operational slots
        a_slots = availability_models.AvailabilitySlot.objects.values_list(
            'start', 'end'
        )
        x_slots = [
            (
                sn_misc.get_today_utc() + datetime.timedelta(
                    seconds=1
                ),
                sn_misc.get_today_utc() + datetime.timedelta(
                    hours=23, minutes=59, seconds=59
                )
            ),
            (
                sn_misc.get_today_utc() + datetime.timedelta(
                    days=1, seconds=1
                ),
                sn_misc.get_today_utc() + datetime.timedelta(
                    days=1, hours=23, minutes=59, seconds=59
                )
            ),
            (
                sn_misc.get_today_utc() + datetime.timedelta(
                    days=2, seconds=1
                ),
                sn_misc.get_today_utc() + datetime.timedelta(
                    days=2, hours=23, minutes=59, seconds=59
                )
            )
        ]

        self.assertCountEqual(a_slots, x_slots)

        p_slots_applicable_objs = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id,
            start__gte=sn_misc.get_now_utc()
        )
        p_slots_applicable = p_slots_applicable_objs.values_list(
            'start', 'end'
        )

        self.assertGreaterEqual(len(p_slots_2), len(p_slots_applicable))

        o_slots_1 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_applicable_objs,
            state=operational_models.STATE_FREE
        ).values_list('start', 'end')
        self.assertCountEqual(p_slots_applicable, o_slots_1)

        # CHECK E: RPC interface should return an equivalent set of slots:
        o_slots_gs = gs_ops_rpc.get_operational_slots(self.__gs_1_id)
        self.assertEqual(len(o_slots_gs[self.__sc_1_id]), len(o_slots_1))

        if self.__verbose_testing:
            sn_misc.print_list(o_slots_1, name='o_slots_1')
            sn_misc.print_list(
                o_slots_gs[self.__sc_1_id], name='o_slots-' + self.__gs_1_id
            )
Ejemplo n.º 41
0
    def setUp(self):
        """Database setup
        """
        self.__verbose_testing = False

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'xatcobeo-fm'
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }
        self.__gs_1_ch_2_id = 'gs-la-fm-2'
        self.__gs_1_ch_2_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )

        self.assertEqual(
            jrpc_gs_chs.gs_channel_create(
                groundstation_id=self.__gs_1_id,
                channel_id=self.__gs_1_ch_1_id,
                configuration=self.__gs_1_ch_1_cfg
            ), True, 'Channel should have been created!'
        )
        self.assertRaises(
            Exception,
            jrpc_gs_scheduling.get_operational_slots,
            self.__gs_1_ch_1_id
        )

        # 3) basic test, should generate 2 FREE slots
        self.assertEqual(
            jrpc_sc_chs.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_1_id,
                configuration=self.__sc_1_ch_1_cfg
            ), True, 'Channel should have been created!'
        )

        # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC
        #       all pass slots should became operational slots.
        self.__rule_1 = jrpc_rules.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=misc.get_today_utc(),
                date_f=misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=misc.get_next_midnight() + datetime.timedelta(
                    seconds=1
                ),
                ending_time=misc.get_next_midnight() + datetime.timedelta(
                    hours=23, minutes=59, seconds=59
                )
            )
        )
Ejemplo n.º 42
0
    def test_bug_1(self):
        """INTR test: services.scheduling - operational slot generation
        """

        self.__gs_1_id = 'gs-vigo'
        self.__gs_1_ch_1_id = 'chan-cas-1'
        self.__sc_1_id = 'sc-serpens'
        self.__sc_1_ch_1_id = 'xatco-fm-1'
        self.__sc_1_ch_1_f = 437500000

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()

        # 1) create vigo gs
        self.__gs = db_tools.create_gs(user_profile=self.__user_profile,
                                       identifier=self.__gs_1_id)

        # CHECK A: NO ADDITIONAL pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_0 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id)

        self.assertEqual(len(p_slots_0), 0)
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0)
        self.assertEqual(len(o_slots_0), 0)

        # 2) serpens spacecraft
        self.__sc = db_tools.create_sc(user_profile=self.__user_profile,
                                       identifier=self.__sc_1_id)

        # CHECK B: MORE pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_1 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id)
        self.assertGreater(len(p_slots_1), len(p_slots_0))
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0)
        self.assertEqual(len(o_slots_0), 0)

        # 3) we add channels and, therefore, compatibility matches
        #       without availability rules, no operational slots
        self.__sc_1_ch_1 = db_tools.sc_add_channel(self.__sc,
                                                   self.__sc_1_ch_1_f,
                                                   self.__sc_1_ch_1_id)
        self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs, self.__band,
                                                   self.__gs_1_ch_1_id)

        # CHECK C: SAME pass slots, no operational slots
        # ### There are pass slots for the already-propagated spacecraft
        p_slots_2 = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id)
        self.assertEqual(len(p_slots_2), len(p_slots_1))
        o_slots_0 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_0)
        self.assertEqual(len(o_slots_0), 0)

        # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC
        #       all pass slots should became operational slots.
        self.__rule_1 = rules_jrpc.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=sn_misc.get_today_utc(),
                date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=sn_misc.get_next_midnight() +
                datetime.timedelta(seconds=1),
                ending_time=sn_misc.get_next_midnight() +
                datetime.timedelta(hours=23, minutes=59, seconds=59)))

        # CHECK D: 3 availability slots (1 per day, almost 24 hours)
        #           should transform all pass slots into operational slots
        a_slots = availability_models.AvailabilitySlot.objects.values_list(
            'start', 'end')
        x_slots = [
            (sn_misc.get_today_utc() + datetime.timedelta(seconds=1),
             sn_misc.get_today_utc() +
             datetime.timedelta(hours=23, minutes=59, seconds=59)),
            (sn_misc.get_today_utc() + datetime.timedelta(days=1, seconds=1),
             sn_misc.get_today_utc() +
             datetime.timedelta(days=1, hours=23, minutes=59, seconds=59)),
            (sn_misc.get_today_utc() + datetime.timedelta(days=2, seconds=1),
             sn_misc.get_today_utc() +
             datetime.timedelta(days=2, hours=23, minutes=59, seconds=59))
        ]

        self.assertCountEqual(a_slots, x_slots)

        p_slots_applicable_objs = pass_models.PassSlots.objects.filter(
            groundstation__identifier=self.__gs_1_id,
            spacecraft__identifier=self.__sc_1_id,
            start__gte=sn_misc.get_now_utc())
        p_slots_applicable = p_slots_applicable_objs.values_list(
            'start', 'end')

        self.assertGreaterEqual(len(p_slots_2), len(p_slots_applicable))

        o_slots_1 = operational_models.OperationalSlot.objects.filter(
            pass_slot__in=p_slots_applicable_objs,
            state=operational_models.STATE_FREE).values_list('start', 'end')
        self.assertCountEqual(p_slots_applicable, o_slots_1)

        # CHECK E: RPC interface should return an equivalent set of slots:
        o_slots_gs = gs_ops_rpc.get_operational_slots(self.__gs_1_id)
        self.assertEqual(len(o_slots_gs[self.__sc_1_id]), len(o_slots_1))

        if self.__verbose_testing:
            sn_misc.print_list(o_slots_1, name='o_slots_1')
            sn_misc.print_list(o_slots_gs[self.__sc_1_id],
                               name='o_slots-' + self.__gs_1_id)
Ejemplo n.º 43
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False
        self.__test_slot_id = -1

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'gmsk-sc-1'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile, identifier=self.__gs_1_id,
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id
        )

        self.__rule_1 = jrpc_rules.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=sn_misc.get_today_utc(),
                date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=sn_misc.get_next_midnight() + datetime.timedelta(
                    seconds=1
                ),
                ending_time=sn_misc.get_next_midnight() + datetime.timedelta(
                    hours=23, minutes=59, seconds=59
                )
            )
        )
Ejemplo n.º 44
0
    def setUp(self):
        """Test setup
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        self.__gs_1_id = 'gs-castrelos'
        self.__gs_1_callsign = 'GS1GSGS'
        self.__gs_1_contact_elevation = 10.30
        self.__gs_1_longitude = -8.9330
        self.__gs_1_latitude = 42.6000
        self.__gs_1_configuration = (
            self.__gs_1_callsign,
            10.3,
            self.__gs_1_latitude,
            self.__gs_1_longitude
        )
        self.__gs_2_id = 'gs-calpoly'
        self.__gs_1_ch_1_id = 'fm-1'
        self.__gs_1_ch_2_id = 'afsk-2'

        self.__sc_1_id = 'sc-xatcobeo'
        self.__sc_1_callsign = 'BABA00'
        self.__sc_1_tle_id = str('HUMSAT-D')
        self.__sc_1_ch_1_id = 'xatcobeo-qpsk-1'
        self.__sc_1_ch_2_id = 'xatcobeo-gmsk-2'
        self.__sc_1_ch_1_f = 437000000
        self.__sc_1_configuration = (
            self.__sc_1_callsign,
            self.__sc_1_tle_id
        )

        self.__sc_2_id = 'sc-swisscube'
        self.__sc_2_tle_id = str('SWISSCUBE')

        self.__sc_3_id = 'sc-somp'
        self.__sc_3_tle_id = str('SOMP')

        self.__sc_4_id = 'sc-test'
        self.__sc_4_callsign = 'GOXX5'
        self.__sc_4_tle_id = 'GOES 4 [-]'

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__http_request = db_tools.create_request(
            user_profile=self.__user_profile
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
            callsign=self.__gs_1_callsign,
            contact_elevation=self.__gs_1_contact_elevation,
            latitude=self.__gs_1_latitude,
            longitude=self.__gs_1_longitude,
        )
        self.__gs_1_ch_1 = db_tools.gs_add_channel(
            self.__gs_1, self.__band, self.__gs_1_ch_1_id,
        )
        self.__gs_2 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_2_id
        )

        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            callsign=self.__sc_1_callsign,
            tle_id=self.__sc_1_tle_id
        )
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        self.__sc_2 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_2_id,
            tle_id=self.__sc_2_tle_id
        )

        if not self.__verbose_testing:
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
Ejemplo n.º 45
0
    def setUp(self):
        """
        This method populates the database with some information to be used
        only for this test.
        """
        self.__verbose_testing = False

        if not self.__verbose_testing:
            logging.getLogger('common').setLevel(level=logging.CRITICAL)
            logging.getLogger('configuration').setLevel(level=logging.CRITICAL)
            logging.getLogger('scheduling').setLevel(level=logging.CRITICAL)

        operational.OperationalSlot.objects.set_debug()

        self.__sc_1_id = 'xatcobeo-sc'
        self.__sc_1_tle_id = 'HUMSAT-D'
        self.__sc_1_ch_1_id = 'xatcobeo-fm'
        self.__sc_1_ch_1_cfg = {
            channel_serializers.FREQUENCY_K: '437000000',
            channel_serializers.MODULATION_K: 'FM',
            channel_serializers.POLARIZATION_K: 'LHCP',
            channel_serializers.BITRATE_K: '300',
            channel_serializers.BANDWIDTH_K: '12.500000000'
        }
        self.__gs_1_id = 'gs-la'
        self.__gs_1_ch_1_id = 'gs-la-fm'
        self.__gs_1_ch_1_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }
        self.__gs_1_ch_2_id = 'gs-la-fm-2'
        self.__gs_1_ch_2_cfg = {
            channel_serializers.BAND_K:
            'UHF / U / 435000000.000000 / 438000000.000000',
            channel_serializers.AUTOMATED_K: False,
            channel_serializers.MODULATIONS_K: ['FM'],
            channel_serializers.POLARIZATIONS_K: ['LHCP'],
            channel_serializers.BITRATES_K: [300, 600, 900],
            channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000]
        }

        self.__band = db_tools.create_band()
        self.__user_profile = db_tools.create_user_profile()
        self.__sc_1 = db_tools.create_sc(
            user_profile=self.__user_profile,
            identifier=self.__sc_1_id,
            tle_id=self.__sc_1_tle_id,
        )
        self.__gs_1 = db_tools.create_gs(
            user_profile=self.__user_profile,
            identifier=self.__gs_1_id,
        )

        self.assertEqual(
            jrpc_gs_chs.gs_channel_create(groundstation_id=self.__gs_1_id,
                                          channel_id=self.__gs_1_ch_1_id,
                                          configuration=self.__gs_1_ch_1_cfg),
            True, 'Channel should have been created!')
        self.assertRaises(Exception, jrpc_gs_scheduling.get_operational_slots,
                          self.__gs_1_ch_1_id)

        # 3) basic test, should generate 2 FREE slots
        self.assertEqual(
            jrpc_sc_chs.sc_channel_create(spacecraft_id=self.__sc_1_id,
                                          channel_id=self.__sc_1_ch_1_id,
                                          configuration=self.__sc_1_ch_1_cfg),
            True, 'Channel should have been created!')

        # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC
        #       all pass slots should became operational slots.
        self.__rule_1 = jrpc_rules.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=misc.get_today_utc(),
                date_f=misc.get_today_utc() + datetime.timedelta(days=50),
                starting_time=misc.get_next_midnight() +
                datetime.timedelta(seconds=1),
                ending_time=misc.get_next_midnight() +
                datetime.timedelta(hours=23, minutes=59, seconds=59)))