Example #1
0
    def test_sc_channel_create(self):
        """JRPC test: configuration.sc.channel.create
        """
        if self.__verbose_testing:
            print('>>> TEST (test_sc_channel_create)')

        try:
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id='FAKE-SC',
                channel_id=self.__sc_1_ch_2_id,
                configuration={
                    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.fail('An exception should have been thrown!')
        except Exception:
            pass

        self.assertTrue(
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_2_id,
                configuration={
                    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'
                }), 'Channel should have been created!')
        db_tools.remove_sc_channel(self.__sc_1_ch_2_id)
Example #2
0
    def test_compatibility_case_4(self):
        """INTR test: services.scheduling - basic MIXED compatibility test (2)
        (CHANGE-1) +SC_CH
        (CHANGE-2) +GS_CH (Compatible)
        (CHECK-1) len(SegmentCompatibility) = 1
        (CHANGE-3) -SC_CH
        (CHECK-2) len(SegmentCompatibility) = 0
        (CHANGE-4) +SC_CH (Compatible)
        (CHECK-3) len(SegmentCompatibility) = 1
        (CHANGE-5) -GS_CH
        (CHECK-3) len(SegmentCompatibility) = 0
        """
        if self.__verbose_testing:
            print('##### test_compatibility_case_4')

        # (CHANGE-1)
        db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHANGE-2)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id,
        )
        # (CHECK-1)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-3)
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        # (CHECK-2)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        # (CHANGE-4)
        db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHECK-3)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-5)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_1_id)
        # (CHECK-4)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        # Unchecked change, just for cleaning the database.
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
Example #3
0
    def test_compatibility_case_3(self):
        """INTR test: services.scheduling - basic MIXED compatibility test (1)
        (CHANGE-1) +SC_CH
        (CHANGE-2) +GS_CH (Non compatible)
        (CHECK-1) len(SegmentCompatibility) = 0
        (CHANGE-3) -SC_CH
        (CHECK-2) len(SegmentCompatibility) = 0
        (CHANGE-4) +SC_CH (Non compatible)
        (CHANGE-5) -GS_CH
        (CHECK-3) len(SegmentCompatibility) = 0
        """
        if self.__verbose_testing:
            print('##### test_compatibility_case_3')

        # (CHANGE-1)
        db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHANGE-2)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id,
            polarizations=[
                band_models.AvailablePolarizations.objects.get(
                    polarization='LHCP'
                )
            ]
        )
        # (CHECK-1)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        # (CHANGE-3)
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        # (CHECK-2)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        # (CHANGE-4)
        db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHANGE-5)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_1_id)
        # (CHECK-3)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        # Unchecked change, just for cleaning the database.
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
Example #4
0
    def test_sc_channel_get_configuration(self):
        """JRPC test: configuration.sc.channel.getConfiguration
        """
        try:
            jrpc_sc_channels_if.sc_channel_get_configuration(
                'FAKE-SC', 'FAKE-SC-CHANNEL'
            )
            self.fail('An exception should have been thrown!')
        except Exception:
            pass
        try:
            jrpc_sc_channels_if.sc_channel_get_configuration(
                self.__sc_1_id, 'FAKE-SC-CHANNEL'
            )
            self.fail('An exception should have been thrown!')
        except Exception:
            pass

        expected_c = {
            channel_serializers.CH_ID_K: self.__sc_1_ch_2_id,
            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.assertEqual(
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_2_id,
                configuration=expected_c
            ), True, 'Channel should have been created!'
        )

        actual_c = jrpc_sc_channels_if.sc_channel_get_configuration(
            self.__sc_1_id, self.__sc_1_ch_2_id
        )

        if self.__verbose_testing:
            misc.print_dictionary(actual_c)
            misc.print_dictionary(expected_c)

        self.assertEqual(
            actual_c, expected_c,
            'Configuration dictionaries do not match!'
        )
        db_tools.remove_sc_channel(self.__sc_1_ch_2_id)
Example #5
0
    def test_sc_channel_get_configuration(self):
        """JRPC test: configuration.sc.channel.getConfiguration
        """
        try:
            jrpc_sc_channels_if.sc_channel_get_configuration(
                'FAKE-SC', 'FAKE-SC-CHANNEL')
            self.fail('An exception should have been thrown!')
        except Exception:
            pass
        try:
            jrpc_sc_channels_if.sc_channel_get_configuration(
                self.__sc_1_id, 'FAKE-SC-CHANNEL')
            self.fail('An exception should have been thrown!')
        except Exception:
            pass

        expected_c = {
            channel_serializers.CH_ID_K: self.__sc_1_ch_2_id,
            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.assertEqual(
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_2_id,
                configuration=expected_c), True,
            'Channel should have been created!')

        actual_c = jrpc_sc_channels_if.sc_channel_get_configuration(
            self.__sc_1_id, self.__sc_1_ch_2_id)

        if self.__verbose_testing:
            misc.print_dictionary(actual_c)
            misc.print_dictionary(expected_c)

        self.assertEqual(actual_c, expected_c,
                         'Configuration dictionaries do not match!')
        db_tools.remove_sc_channel(self.__sc_1_ch_2_id)
Example #6
0
    def test_compatibility_case_1(self):
        """INTR test: services.scheduling - basic SC_CH compatibility test (1)
        (CHANGE-1) +SC_CH
        (CHECK-1) len(SegmentCompatibility) = 0
        (CHANGE-2) -SC_CH
        (CHECK-2) len(SegmentCompatibility) = 0
        """
        if self.__verbose_testing:
            print('##### test_compatibility_case_1')

        db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must be empty!'
        )
Example #7
0
    def test_sc_channel_create(self):
        """JRPC test: configuration.sc.channel.create
        """
        if self.__verbose_testing:
            print('>>> TEST (test_sc_channel_create)')

        try:
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id='FAKE-SC',
                channel_id=self.__sc_1_ch_2_id,
                configuration={
                    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.fail('An exception should have been thrown!')
        except Exception:
            pass

        self.assertTrue(
            jrpc_sc_channels_if.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_2_id,
                configuration={
                    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'
                }
            ),
            'Channel should have been created!'
        )
        db_tools.remove_sc_channel(self.__sc_1_ch_2_id)
Example #8
0
    def test_compatibility_case_6(self):
        """INTR test: services.scheduling - complex MIXED compatibility test (2)
        (CHANGE-1) +SC-1
        (CHANGE-2) +SC-2
        (CHANGE-3) +GS-1 (SC-1 & SC-2 compatible)
        (CHANGE-4) +GS-2 (SC-1 & SC-2 compatible)
        (CHECK-1)   len(SegmentCompatibility) = 4
        (CHANGE-5) +SC-3 (GS-1 & GS-2 compatible)
        (CHANGE-6) +SC-4 (GS-1 & GS-2 compatible)
        (CHECK-2)   len(SegmentCompatibility) = 8
        (CHANGE-7) -GS-1
        (CHECK-3)   len(SegmentCompatibility) = 4
        (CHANGE-8) -GS-2
        (CHECK-4)   len(SegmentCompatibility) = 0
        """
        if self.__verbose_testing:
            print('##### test_compatibility_case_6')

        # (CHANGE-1)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHANGE-2)
        self.__sc_1_ch_2 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_2_id,
        )
        # (CHANGE-3)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id,
        )
        # (CHANGE-4)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_2_id,
        )
        # >>>>> (CHECK-1) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()),
            4,
            'Table must have 4 entr(ies)!'
        )
        # (CHANGE-5)
        self.__sc_1_ch_3 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_3_id,
        )
        # (CHANGE-6)
        self.__sc_1_ch_4 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_4_id,
        )
        # >>>>> (CHECK-2) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()),
            8,
            'Table must have 8 entr(ies)!'
        )
        # (CHANGE-7)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_1_id)
        # >>>>> (CHECK-3) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()),
            4,
            'Table must have 4 entr(ies)!'
        )
        # (CHANGE-8)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_2_id)
        # >>>>> (CHECK-4) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must have 0 entr(ies)!'
        )
        # Unchecked change, just for cleaning the database.
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        db_tools.remove_sc_channel(self.__sc_1_ch_2_id)
        db_tools.remove_sc_channel(self.__sc_1_ch_3_id)
        db_tools.remove_sc_channel(self.__sc_1_ch_4_id)
Example #9
0
    def test_compatibility_case_5(self):
        """INTR test: services.scheduling - complex MIXED compatibility test (1)
        (CHANGE-1) +SC_CH
        (CHANGE-2) +GS_CH (Compatible)
        (CHANGE-3) +GS_CH
        (CHANGE-4) +GS_CH (Compatible)
        (CHECK-1)   len(SegmentCompatibility) = 2
        (CHANGE-5) -GS_CH (Compatible)
        (CHECK-2)   len(SegmentCompatibility) = 1
        (CHANGE-6) -GS_CH
        (CHECK-3)   len(SegmentCompatibility) = 1
        (CHANGE-7) -GS_CH (Compatible)
        (CHECK-4)   len(SegmentCompatibility) = 0
        (CHANGE-8) -SC_CH
        (CHECK-5)   len(SegmentCompatibility) = 0
        (CHANGE-9) +GS_CH (GS-1)
        (CHANGE-A) +GS_CH (GS-2)
        (CHANGE-B) +SC_CH (Compatible with GS-2)
        (CHECK-6)   len(SegmentCompatibility) = 1
        (CHANGE-C) -GS_CH (GS-1)
        (CHECK-7)   len(SegmentCompatibility) = 1
        (CHANGE-D) +GS_CH (GS-3, Compatible)
        (CHECK-8)   len(SegmentCompatibility) = 2
        (CHANGE-E) -SC_CH
        (CHECK-9)   len(SegmentCompatibility) = 0
        (CHANGE-F) +SC_CH (Compatible with GS-2 & GS-3)
        (CHECK-A)   len(SegmentCompatibility) = 2
        """
        if self.__verbose_testing:
            print('##### test_compatibility_case_5')

        # (CHANGE-1)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # (CHANGE-2)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id,
        )
        # (CHANGE-3)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_2_id,
            polarizations=[
                band_models.AvailablePolarizations.objects.get(
                    polarization='LHCP'
                )
            ]
        )
        # (CHANGE-4)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_3_id,
        )
        # >>>>> (CHECK-1) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            2,
            'Table must have 2 entr(ies)!'
        )
        # (CHANGE-5)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_1_id)
        # >>>>> (CHECK-2) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-6)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_2_id)
        # >>>>> (CHECK-3) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-7)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_3_id)
        # >>>>> (CHECK-4) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must have 0 entr(ies)!'
        )
        # (CHANGE-8)
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        # >>>>> (CHECK-5) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must have 0 entr(ies)!'
        )
        # (CHANGE-9)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_1_id,
            polarizations=[
                band_models.AvailablePolarizations.objects.get(
                    polarization='LHCP'
                )
            ]
        )
        # (CHANGE-A)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_2_id,
        )
        # (CHANGE-B)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # >>>>> (CHECK-6) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-C)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_1_id)
        # >>>>> (CHECK-7) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            1,
            'Table must have 1 entr(ies)!'
        )
        # (CHANGE-D)
        db_tools.gs_add_channel(
            self.__gs, self.__band, self.__gs_1_ch_3_id,
        )
        # >>>>> (CHECK-8) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            2,
            'Table must have 2 entr(ies)!'
        )
        # (CHANGE-E)
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        # >>>>> (CHECK-9) <<<<< #
        self.assertEqual(
            len(compat_models.ChannelCompatibility.objects.all()), 0,
            'Table must have 0 entr(ies)!'
        )
        # (CHANGE-F)
        self.__sc_1_ch_1 = db_tools.sc_add_channel(
            self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id,
        )
        # >>>>> (CHECK-A) <<<<< #
        self.assertEqual(
            compat_models.ChannelCompatibility.objects.filter(
                spacecraft_channel__identifier=self.__sc_1_ch_1_id
            ).count(),
            2,
            'Table must have 2 entr(ies)!'
        )
        # Unchecked change, just for cleaning the database.
        db_tools.remove_sc_channel(self.__sc_1_ch_1_id)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_2_id)
        db_tools.remove_gs_channel(self.__gs_1_id, self.__gs_1_ch_3_id)