예제 #1
0
    def testRFInfoPkt(self):

        self.fei_dev, alloc_params = self.getAllocationContext(ALLOCATE_RCV)

        #create rf_info uses port and connect to MSDD
        out_rf_info_port=frontend.OutRFInfoPort("out_control")
        in_rf_info_port=self.fei_dev.getPort("RFInfo_in")
        out_rf_info_port.connectPort(in_rf_info_port,"test_rf_flow")

	bw=alloc_params['wbddc_bw']
	sr=alloc_params['wbddc_srate']
        # allocation params
        flow_id = "ca-710-flow-2"
        cf=100e6

        # send info pkto
        pkt=_generateRFInfoPkt(cf,bw,rf_flow_id=flow_id)
        out_rf_info_port._set_rfinfo_pkt(pkt)

        # check rf_flow_id was set
        n=len(self.fei_dev.frontend_tuner_status)
        expected=[flow_id]*n
        actual=[ x["FRONTEND::tuner_status::rf_flow_id"] for x in self.fei_dev.frontend_tuner_status ]
        self.assertEqual(expected,actual, "Mismatch of RF Flow Ids for tuners")

        # allocation for sample rate and rf_flow_id
        alloc1=frontend.createTunerAllocation(center_frequency=cf, sample_rate=sr, rf_flow_id=flow_id)
        ret=self.fei_dev.allocateCapacity( alloc1)
        alloc1_aid =  alloc1["FRONTEND::tuner_allocation"]["FRONTEND::tuner_allocation::allocation_id"]
        self.assertEqual(True,ret, "Allocation failed using rf_flow_id")
        self.alloc1=alloc1

        alloc2_aid = alloc1_aid
        if alloc_params['nbddc_srate'] is not None :
                # allocation for center freq and rf_flow_id
                alloc2=frontend.createTunerAllocation(center_frequency=cf,  rf_flow_id=flow_id)
                ret=self.fei_dev.allocateCapacity( alloc2)
                alloc2_aid =  alloc2["FRONTEND::tuner_allocation"]["FRONTEND::tuner_allocation::allocation_id"]
                self.assertEqual(True,ret, "Allocation failed using rf_flow_id again ")
                self.alloc2=alloc2

        # valid rf_flow_id was probagated downstream
        sink=sb.StreamSink()
        sdds_in=sb.launch('rh.SourceSDDS',  properties={'interface':INTERFACE})
        sb.start()
        self.fei_dev.connect(sdds_in, connectionId=alloc2_aid, usesPortName='dataSDDS_out')
        sdds_in.connect(sink, usesPortName="dataShortOut")

        kws=None
        try:
            sink_data=sink.read()
            kws=properties.props_to_dict(sink_data.sri.keywords)
        except:
            pass
        self.assertEqual( kws["FRONTEND::RF_FLOW_ID"] , flow_id, "Missing RF_FLOW_ID from keyword list")
예제 #2
0
    def testRFFlowIDFailure(self):

        #create rf_info uses port and connect to MSDD
        out_rf_info_port = frontend.OutRFInfoPort("out_control")
        in_rf_info_port = self.comp.getPort("RFInfo_in")
        out_rf_info_port.connectPort(in_rf_info_port, "test_rf_flow")

        # get params for allocations
        bw = float(self.comp.frontend_tuner_status[0]
                   ["FRONTEND::tuner_status::available_bandwidth"])
        sr = float(self.comp.frontend_tuner_status[0]
                   ["FRONTEND::tuner_status::available_sample_rate"])

        # allocation params
        flow_id = "ca-710-flow"
        cf = 100e6

        # set rf flow id
        out_rf_info_port._set_rf_flow_id(flow_id)

        # check rf_flow_id was set
        n = len(self.comp.frontend_tuner_status)
        expected = [flow_id] * n
        actual = [
            x["FRONTEND::tuner_status::rf_flow_id"]
            for x in self.comp.frontend_tuner_status
        ]
        self.assertEqual(expected, actual,
                         "Mismatch of RF Flow Ids for tuners")

        # allocation for sample rate and rf_flow_id
        alloc1 = frontend.createTunerAllocation(center_frequency=cf,
                                                sample_rate=sr,
                                                rf_flow_id=flow_id)
        ret = self.comp.allocateCapacity(alloc1)
        alloc1_aid = alloc1["FRONTEND::tuner_allocation"][
            "FRONTEND::tuner_allocation::allocation_id"]
        self.assertEqual(True, ret, "Allocation failed using rf_flow_id")

        # allocation for center freq and rf_flow_id
        alloc2 = frontend.createTunerAllocation(center_frequency=cf,
                                                rf_flow_id="noworkie")
        ret = self.comp.allocateCapacity(alloc2)
        self.assertEqual(
            False, ret,
            "Allocation should have failed for unknown rf_flow_id ")
예제 #3
0
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        FrontendTunerDevice.__init__(self, devmgr, uuid, label,
                                     softwareProfile, compositeDevice,
                                     execparams)
        ThreadedComponent.__init__(self)

        self.listeners = {}
        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 devices.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this device
        self.port_RFInfo_in = frontend.InRFInfoPort("RFInfo_in")
        self.port_AnalogTuner_in = frontend.InAnalogTunerPort("AnalogTuner_in")
        self.port_RFInfo_out = frontend.OutRFInfoPort("RFInfo_out")
        self.device_kind = "FRONTEND::TUNER"
        self.frontend_listener_allocation = frontend.fe_types.frontend_listener_allocation(
        )
        self.frontend_tuner_allocation = frontend.fe_types.frontend_tuner_allocation(
        )
예제 #4
0
    def testRFFlowID(self):

        #create rf_info uses port and connect to MSDD
        out_rf_info_port = frontend.OutRFInfoPort("out_control")
        in_rf_info_port = self.comp.getPort("RFInfo_in")
        out_rf_info_port.connectPort(in_rf_info_port, "test_rf_flow")

        # get params for allocations
        bw = self.alloc_params['wbddc_bw']
        sr = self.alloc_params['wbddc_srate']

        # allocation params
        flow_id = "ca-710-flow"
        cf = 100e6

        # set rf flow id
        out_rf_info_port._set_rf_flow_id(flow_id)

        # check rf_flow_id was set
        n = len(self.comp.frontend_tuner_status)
        expected = [flow_id] * n
        actual = [
            x["FRONTEND::tuner_status::rf_flow_id"]
            for x in self.comp.frontend_tuner_status
        ]
        self.assertEqual(expected, actual,
                         "Mismatch of RF Flow Ids for tuners")

        # allocation for sample rate and rf_flow_id
        alloc1 = frontend.createTunerAllocation(center_frequency=cf,
                                                sample_rate=sr,
                                                rf_flow_id=flow_id)
        ret = self.comp.allocateCapacity(alloc1)
        alloc1_aid = alloc1["FRONTEND::tuner_allocation"][
            "FRONTEND::tuner_allocation::allocation_id"]
        self.assertEqual(True, ret, "Allocation failed using rf_flow_id")

        alloc2_aid = alloc1_aid
        if self.alloc_params['nbddc_srate'] is not None:
            # dual channel we need to provide specific rate so the correct DDC is selected that matches the same rf_flow_id
            if '2w' in self.msdd_id:
                # allocation for center freq and rf_flow_id
                alloc2 = frontend.createTunerAllocation(
                    center_frequency=cf,
                    sample_rate=self.alloc_params['nbddc_srate'],
                    sample_rate_tolerance=1.0,
                    rf_flow_id=flow_id)
            else:
                # allocation for center freq and rf_flow_id
                alloc2 = frontend.createTunerAllocation(center_frequency=cf,
                                                        rf_flow_id=flow_id)
            ret = self.comp.allocateCapacity(alloc2)
            alloc2_aid = alloc2["FRONTEND::tuner_allocation"][
                "FRONTEND::tuner_allocation::allocation_id"]
            self.assertEqual(True, ret,
                             "Allocation failed using rf_flow_id again ")

        # valid rf_flow_id was probagated downstream
        sink = sb.StreamSink()
        sdds_in = sb.launch(
            'rh.SourceSDDS',
            properties={
                'interface': INTERFACE,
                'advanced_optimizations': {
                    'advanced_optimizations::sdds_pkts_per_bulkio_push': 5
                },
                'attachment_override': {
                    'attachment_override:endianness': "1234"
                }
            })
        sb.start()
        self.comp.connect(sdds_in,
                          connectionId=alloc2_aid,
                          usesPortName='dataSDDS_out')
        sdds_in.connect(sink, usesPortName="dataShortOut")

        kws = None
        try:
            sink_data = sink.read()
            kws = properties.props_to_dict(sink_data.sri.keywords)
        except:
            pass
        self.assertEqual(kws["FRONTEND::RF_FLOW_ID"], flow_id,
                         "Missing RF_FLOW_ID from keyword list")
예제 #5
0
    def testRFFlowID(self):

        #create rf_info uses port and connect to MSDD
        out_rf_info_port = frontend.OutRFInfoPort("out_control")
        in_rf_info_port = self.comp.getPort("RFInfo_in")
        out_rf_info_port.connectPort(in_rf_info_port, "test_rf_flow")

        # get params for allocations
        bw = float(self.comp.frontend_tuner_status[0]
                   ["FRONTEND::tuner_status::available_bandwidth"])
        sr = float(self.comp.frontend_tuner_status[0]
                   ["FRONTEND::tuner_status::available_sample_rate"])

        # allocation params
        flow_id = "ca-710-flow"
        cf = 100e6

        # set rf flow id
        out_rf_info_port._set_rf_flow_id(flow_id)

        # check rf_flow_id was set
        n = len(self.comp.frontend_tuner_status)
        expected = [flow_id] * n
        actual = [
            x["FRONTEND::tuner_status::rf_flow_id"]
            for x in self.comp.frontend_tuner_status
        ]
        self.assertEqual(expected, actual,
                         "Mismatch of RF Flow Ids for tuners")

        # allocation for sample rate and rf_flow_id
        alloc1 = frontend.createTunerAllocation(center_frequency=cf,
                                                sample_rate=sr,
                                                rf_flow_id=flow_id)
        ret = self.comp.allocateCapacity(alloc1)
        alloc1_aid = alloc1["FRONTEND::tuner_allocation"][
            "FRONTEND::tuner_allocation::allocation_id"]
        self.assertEqual(True, ret, "Allocation failed using rf_flow_id")

        # allocation for center freq and rf_flow_id
        alloc2 = frontend.createTunerAllocation(center_frequency=cf,
                                                rf_flow_id=flow_id)
        ret = self.comp.allocateCapacity(alloc2)
        alloc2_aid = alloc2["FRONTEND::tuner_allocation"][
            "FRONTEND::tuner_allocation::allocation_id"]
        self.assertEqual(True, ret,
                         "Allocation failed using rf_flow_id again ")

        # valid rf_flow_id was probagated downstream
        sink = sb.StreamSink()
        sdds_in = sb.launch('rh.SourceSDDS',
                            properties={'interface': INTERFACE})
        sb.start()
        self.comp.connect(sdds_in,
                          connectionId=alloc2_aid,
                          usesPortName='dataSDDS_out')
        sdds_in.connect(sink, usesPortName="dataShortOut")

        kws = None
        try:
            sink_data = sink.read()
            kws = properties.props_to_dict(sink_data.sri.keywords)
        except:
            pass
        self.assertEqual(kws["FRONTEND::RF_FLOW_ID"], flow_id,
                         "Missing RF_FLOW_ID from keyword list")