def test_rtc9757_tc_rec_011_delete_before_recording_start(stream):
    """
    Create a recording and delete it before it starts
    """
    start_time = utils.get_formatted_time(constants.SECONDS * 120,
                                          TimeFormat.TIME_FORMAT_MS, stream)
    end_time = utils.get_formatted_time(constants.SECONDS * 240,
                                        TimeFormat.TIME_FORMAT_MS, stream)
    recording = recording_model.Recording(StartTime=start_time,
                                          EndTime=end_time,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.no_content)

    assert is_valid, error

    time.sleep(constants.SECONDS * 60)
    response = a8.delete_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.no_content)

    assert is_valid, error

    recording_id = recording.get_entry(0).RecordingId
    is_valid, error = validate_recordings.validate_recording_deletion(
        recording_id)

    assert is_valid, error
def test_rtc9778_tc_arc_008_delete_after_archive_complete(stream):
    """
    Create a recording with copy type as UNIQUE and delete it after archival completes
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()

        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)

        assert is_valid, error

        archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE,
                                         Archive.COMPLETE)
        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED)

        assert is_valid, error

        response = a8.delete_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording_deletion(
            recording_id)

        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9816_tc_rec_007_update_stream_id_before_recording_start(stream):
    """
    Create a recording and update the stream ID before the recording starts
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 120,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 150,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        time.sleep(constants.SECONDS * 60)
        stream_list_rem = [x for x in STREAM_ID_LIST if x != stream]
        assert stream_list_rem, ValidationError.STREAM_NOT_CONFIGURED
        recording.get_entry(0).StreamId = stream_list_rem[0]

        # Update the previously created recording with the new stream ID
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_streams.validate_stream_id(
            recording_id, stream_list_rem[0])

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)

        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#4
0
def test_rtc9756_tc_rec_010_recording_stop_after_recording_start(stream):
    """
    Create a recording and once it starts, stop it by setting the end time as the current time
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 150, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()

        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error

        response = rio.find_recording(recording_id).json()
        LOGGER.debug("Response=%s", response)
        start_time = utils.get_parsed_time(response[0][RecordingAttribute.START_TIME][:-1])
        current_time = datetime.datetime.utcnow()

        # wait till the recording start time
        if current_time < start_time:
            utils.wait(start_time - current_time, constants.TIME_DELTA)
        is_valid, error = validate_recordings.validate_notification(web_service_obj, constants.RecordingStatus.STARTED)

        assert is_valid, error

        time.sleep(constants.SECONDS * 60)
        recording.get_entry(0).EndTime = utils.get_formatted_time(constants.SECONDS * 0, TimeFormat.TIME_FORMAT_MS, stream)
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error

        time.sleep(constants.SECONDS * 4)
        is_valid, error = validate_recordings.validate_recording_end_state(recording_id, [RecordingStatus.COMPLETE],
                                                                           web_service_obj=web_service_obj)
        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#5
0
def test_rtc9818_tc_rec_029_end_time_before_start_time(stream):
    """
    Create a unique copy recording with end time before start time
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 60,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 30,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert not is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#6
0
def delete_recordings(del_ct, rec_list, rec_dict):
    """
    Delete the list of Recording from recording list
    :param del_ct: deleting count
    :param rec_list: list of recording idenitifers to delete
    :param rec_dict: recording details of recording
    :return: (rec_list, rec_dict) - recording identifiers list, recording details list
    """

    rec_list_len = len(rec_list)
    print "[INFO: ] rec_list_len ", rec_list_len
    if del_ct <= rec_list_len:
        counts = del_ct
    else:
        counts = rec_list_len

    for inx in range(counts):
        rec_id = rec_list[inx]
        recording = recording_model.Recording(RecordingId=rec_id)
        print "[DEBUG: ] deletion on recid ", rec_id
        response = a8.delete_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)
        assert is_valid, error
        rec_list.remove(rec_id)
        rec_dict['items'].pop(rec_id)
    return rec_list, rec_dict
示例#7
0
def test_rtc9734_tc_er_010_playback_redirect_mode(stream, name, copy_type):
    """
    Playback of Active and Archive recording(UNIQUE and COMMON) with DO(Dash Origin) redirect enabled 
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream,
                                              copyType=copy_type)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ACTIVE_STORAGE, Cos.RECORDING_STORED)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)
        assert is_valid, error

        if copy_type == RecordingAttribute.COPY_TYPE_UNIQUE:
            archive_helper.wait_for_archival(stream, recording_id,
                                             Archive.ARCHIVE,
                                             Archive.IN_PROGRESS)
            response = rio.find_recording(recording_id).json()
            is_valid, error = validate_storage.validate_recording_in_storage(
                response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED)

            assert is_valid, error

            is_valid, error = validate_recordings.validate_playback(
                recording_id)
            assert is_valid, error

    finally:
        if web_service_obj:
            web_service_obj.stop_server()
        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s",
                         response.status_code)
def test_rtc9752_tc_rec_004_past_start_time_current_end_time(stream):
    """
    Create a recording with past start time and current end time
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * -120, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        minimum_start_time = datetime.datetime.utcnow() + datetime.timedelta(0, constants.MINIMUM_SEGMENT_TIME_DIFF)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error

        is_valid, status = validate_recordings.validate_recording(recording_id, web_service_obj, minimum_start_time)

        assert is_valid, status

        if status == constants.RecordingStatus.COMPLETE:
            is_valid, error = validate_recordings.validate_playback(recording_id)

            assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9762_tc_rec_016_multiple_unique(stream):
    """
    Create multiple recordings with copy type as UNIQUE
    """
    total_recordings = 3
    web_service_objs = []
    recording_pool = None
    recording = None

    try:
        queue = Queue.Queue()
        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(total_recordings=total_recordings, StartTime=start_time, EndTime=end_time,
                                              StreamId=stream)

        for i in range(total_recordings):
            recording_id = recording.get_entry(i).RecordingId
            web_service_objs.append(notification_utils.get_web_service_object(recording_id))
            recording.get_entry(i).UpdateUrl = web_service_objs[i].get_url()

        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error

        recording_pool = mp_pool.ThreadPool(processes=total_recordings)
        for i in range(total_recordings):
            recording_pool.apply_async(validate_recordings.validate_recording,
                                       (recording.get_entry(i).RecordingId, web_service_objs[i]), callback=queue.put)

        for i in range(total_recordings):
            is_valid, error = queue.get()
            assert is_valid, error

        for i in range(total_recordings):
            response = rio.find_recording(recording.get_entry(i).RecordingId).json()
            is_valid, error = validate_storage.validate_recording_in_storage(response, Cos.ACTIVE_STORAGE,
                                                                             Cos.RECORDING_STORED, i)

            assert is_valid, error

        for i in range(total_recordings):
            recording_pool.apply_async(validate_recordings.validate_playback,
                                       (recording.get_entry(i).RecordingId,), callback=queue.put)

        for i in range(total_recordings):
            is_valid, error = queue.get()
            assert is_valid, error
    finally:
        if recording_pool:
            recording_pool.close()
            recording_pool.join()
        for web_service_obj in web_service_objs:
            web_service_obj.stop_server()
        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_create_3hr_recording_ipdvrtests_64(channel, name, copy_type):
    """
    JIRA_URL : https://jira01.engit.synamedia.com/browse/IPDVRTESTS-64
    DESCRIPTION : Create 3 hr recording
    #Partially automated
        Skipped step(s) : Step 3 - No errors seen in MA/SR pods
    """
    stream = channel
    web_service_obj = None
    recording = None
    stream_name = nsa.get_stream(stream).json()[0][constants.STREAM_NAME]
    try:
        #STEP 1 - Create UC and CC recording with longer duration ~3hr
        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 10830, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, copyType=copy_type,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)

        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)
        assert is_valid, error

        #STEP 2 - Verify recording state is complete
        is_valid, error = validate_recordings.validate_recording(recording_id, web_service_obj)
        assert is_valid, error

        #Find recording
        LOGGER.info("Find recording in rio")
        response = rio.find_recording(recording_id).json()
        if not response:
            return False, ValidationError.RECORDING_RESPONSE_EMPTY.format(recording_id)
        print "[INFO: ] Recording status in rio : ",response[0]['Status']

        #Playback and Validate Playback
        LOGGER.info("Playback Recording")
        print "\nPlayback Recording"
        print "Recording ID :",recording.get_entry(0).RecordingId
        is_valid, error = validate_recordings.validate_playback(recording.get_entry(0).RecordingId)
        print "[INFO: ] ",is_valid
        assert is_valid, error

        #STEP 4 - memsql table has correct info for UC and CC
        LOGGER.info("Find recording in rio")
        response = rio.find_recording(recording_id).json()
        if not response:
            return False, ValidationError.RECORDING_RESPONSE_EMPTY.format(recording_id)
        print "[INFO: ] Recording status in rio : \n"
        pprint (response, width=1)

    finally:
        if web_service_obj:
            web_service_obj.stop_server()
        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#11
0
def test_tc_des_016_vmr_ntp_out_of_sync():
    LOGGER.info("vmr_ntp_out_of_sync test case...")
    recording = None
    web_service_obj = None
    timeout = int(os.environ.get(STREAM_ID))

    ntp_server_v2pc = CONFIG_INFO[Component.V2PC][Component.NTP]
    india_ntp = '1.in.pool.ntp.org'
    ntp_synchronization_time = 300

    # Initiate the recording
    try:
        start_time = utils.get_formatted_time((constants.SECONDS * 30) + timeout, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time((constants.SECONDS * 90) + timeout, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, StreamId=STREAM_ID)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)
        assert is_valid, error
        time.sleep(40)

        # Configure to the right ntp server in VMR
        cmd = "sed -i -E 's/" + ntp_server_v2pc + "/" + india_ntp + "/g' /etc/ntp.conf"
        update_vmr_ntp_server(cmd)
        time.sleep(ntp_synchronization_time)

        # Validate recording is incomplete
        is_valid, error = validate_recordings.validate_recording(recording_id, web_service_obj)
        LOGGER.info(is_valid)
        LOGGER.info(error)
        assert is_valid, error

        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(response, Cos.ACTIVE_STORAGE,
                                                                         Cos.RECORDING_STORED)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)

        assert is_valid, error
    finally:
        # revert back the ntp to the original value in vmr
        cmd = "sed -i -E 's/" + india_ntp + "/" + ntp_server_v2pc + "/g' /etc/ntp.conf"
        update_vmr_ntp_server(cmd)
        time.sleep(ntp_synchronization_time)
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
        # Check whether all the components are synchronized.
        times_are_synchronized, error = test_setup.are_times_synchronized()
        if not times_are_synchronized:
            pytest.fail(error)
示例#12
0
def test_rtc9750_tc_rec_002_future_start_time_future_end_time_common(stream):
    """
    Create a recording with future start time, future end time and COMMON copy type
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        copy_type = RecordingAttribute.COPY_TYPE_COMMON
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              copyType=copy_type,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error

        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ACTIVE_STORAGE, Cos.RECORDING_STORED)

        assert is_valid, error

        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ACTIVE_STORAGE, Cos.RECORDING_NOT_STORED, 1)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)

        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9737_tc_er_013_vertical_grouping(stream, name, copy_type):
    """
    Vertical Grouping - Enable vertical grouping on all profiles in MA.
    """

    web_service_obj = None
    recording = None
    service_name = V2pc.MANIFEST_AGENT
    stream_name = nsa.get_stream(stream).json()[0][constants.STREAM_NAME]
    profile_data = v2pc.get_all_stream_profile_data(stream_name)
    assert len(profile_data)>=3, "Vertical grouping required minimum 3 profile for a stream"

    try:
        #Taking backup of v2pc pod config info and editing the config and then restarting the services
        is_valid, error = cleanup(redeploy_config_map, service_name, revert=True)
        assert is_valid, error

        is_valid, error = v2pc_edit_manifest_config(V2pc.MANIFEST_AGENT, vertical_grouping="*")
        assert is_valid, error

        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, copyType=copy_type, StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(recording_id, web_service_obj)
        assert is_valid, error

        is_valid, error = verify_vertical_grouping(recording_id)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)
        assert is_valid, error
    
        	
    finally:
        #Revert back the v2pc config changes
        is_valid, error = cleanup(redeploy_config_map, service_name, revert=True)
        assert is_valid, error

        if web_service_obj:
            web_service_obj.stop_server()

        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_tc10367_restart_channel_when_recording(channel):
    """
    JIRA ID : IPDVRTESTS-58 
    JIRA Link : https://jira01.engit.synamedia.com/browse/IPDVRTESTS-58
    TC10367: Restart the channel during recording and then playback
    """
    stream = channel
    recording = None
    web_service_obj = None
    try:
        rec_buffer_time = utils.get_rec_duration(
            dur_confg_key=Component.REC_BUFFER_LEN_IN_SEC)
        rec_duration = utils.get_rec_duration()
        start_time = utils.get_formatted_time(
            (constants.SECONDS * rec_buffer_time), TimeFormat.TIME_FORMAT_MS,
            stream)
        end_time = utils.get_formatted_time(
            (constants.SECONDS * (rec_buffer_time + rec_duration)),
            TimeFormat.TIME_FORMAT_MS, stream)
        copy_type = RecordingAttribute.COPY_TYPE_UNIQUE
        LOGGER.debug("Stream Id : %s", stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              copyType=copy_type,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        LOGGER.info("Recording Id :%s", recording_id)
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error

        LOGGER.info("Restart Channel : %s", stream)

        # Restart the stream
        is_valid, error = v2pc.restart_stream(stream, count=3)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

    finally:
        if web_service_obj: web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9828_tc_rec_025_blank_station_id(stream):
    """
    Schedule a recording with a blank Station ID
    """
    recording = recording_model.Recording(StationId=constants.BLANK, StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(response, RecordingError.INVALID_STATION_ID)

    assert is_valid, error
def test_rtc9773_tc_arc_003_common(stream):
    """
    Create a recording with copy type as COMMON and check whether archival is happening or not
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        copy_type = RecordingAttribute.COPY_TYPE_COMMON
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream,
                                              copyType=copy_type)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error

        archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE,
                                         Archive.IN_PROGRESS)
        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)

        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#17
0
def test_rtc9744_tc_er_018_private_copy(stream, name, copy_type):
    """
    Private copy - Archive/Pre-gen
    """

    web_service_obj = None
    recording = None
    stream = str(private_copy_stream)

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 80,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

        # wait for georbage collect
        archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE,
                                         Archive.COMPLETE)

        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED)
        assert is_valid, error

    finally:
        if web_service_obj:
            web_service_obj.stop_server()

        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s",
                         response.status_code)
示例#18
0
def test_rtc9775_tc_arc_005_playback_archive_in_progress(stream):
    """
    Create a recording with copy type as UNIQUE and play it back when archival is in progress
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 90, TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()

        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(recording_id, web_service_obj)

        assert is_valid, error

        archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE, Archive.IN_PROGRESS)
        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(response, Cos.ARCHIVE_STORAGE,
                                                                         [Cos.RECORDING_STORED, Cos.RECORDING_PARTIALLY_STORED])

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback_using_vle(recording_id)

        assert is_valid, error

        # If we playback recording when archival is INPROGRESS, There is a chance of few segments being played from
        # Active storage. This means that only part of the segments would move from archive to recon.
        # The rest will move from active to archive. So both PARTIALLY_STORED and STORED are valid
        is_valid, error = validate_storage.validate_recording_in_storage(response, Cos.RECON_STORAGE,
                                                                         [Cos.RECORDING_STORED, Cos.RECORDING_PARTIALLY_STORED])

        assert is_valid, ValidationError.SEGMENT_NOT_MOVED.format(Cos.RECON_STORAGE, recording_id)

    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#19
0
def test_rtc9827_tc_rec_024_invalid_stream_id_value(stream):
    """
    Schedule a recording with an invalid Stream ID
    """
    recording = recording_model.Recording(StreamId=constants.INVALID)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.INVALID_STREAM_ID)

    assert is_valid, error
示例#20
0
def test_sanity_hybrid_copy(stream, name, copy_type):
    """
    Schedule UNIQUE and COMMON copy on same channel and verify the recording and playback.
    """
    recording = None
    web_service_obj = None
    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 80,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream,
                                              copyType=copy_type)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

        archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE,
                                         Archive.COMPLETE)
        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ACTIVE_STORAGE, Cos.RECORDING_NOT_STORED)
        assert is_valid, error

        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)
        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9822_tc_rec_019_invalid_copy_type(stream):
    """
    Schedule a recording with an invalid copy type, i.e. non-UNIQUE, non-COMMON
    """
    recording = recording_model.Recording(copyType=constants.INVALID,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.INVALID_COPY_TYPE)

    assert is_valid, error
示例#22
0
def test_rtc9820_tc_rec_017_blank_action_value(stream):
    """
    Schedule a recording with a blank value in the Action field
    """
    recording = recording_model.Recording(Action=constants.BLANK,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.INVALID_ACTION)

    assert is_valid, error
def test_rtc9829_tc_rec_026_blank_ad_zone_value(stream):
    """
    Schedule a recording with a blank Ad Zone
    """
    recording = recording_model.Recording(AdZone=constants.BLANK,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.INVALID_AD_ZONE)

    assert is_valid, error
def test_rtc9823_tc_rec_020_invalid_scheduled_time(stream):
    """
    Schedule a recording with an invalid scheduled time
    """
    recording = recording_model.Recording(ScheduledTime=constants.INVALID_TIME,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.INVALID_TIME)

    assert is_valid, error
def test_rtc9825_tc_rec_022_blank_account_id(stream):
    """
    Schedule a recording with a blank Account ID
    """
    recording = recording_model.Recording(AccountId=constants.BLANK,
                                          StreamId=stream)
    LOGGER.debug("Recording instance created=%s", recording.serialize())
    response = a8.create_recording(recording)
    is_valid, error = validate_common.validate_http_response_status_code(
        response, requests.codes.bad_request)

    assert is_valid, error

    is_valid, error = validate_recordings.validate_recording_error_code(
        response, RecordingError.MISSING_ACCOUNT_ID)

    assert is_valid, error
def test_tc_ply_lang(name, stream, audio_lang):
    """
    Playback recording using different audio languages like eng, fre and spa and validate playback
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        copy_type = RecordingAttribute.COPY_TYPE_UNIQUE
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              copyType=copy_type,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error
        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error
        vle_request_params = {}
        LOGGER.debug(
            "Configuring vle to playback with clients=%s and audio language=%s",
            1, audio_lang)
        vle_request_params[Vle.CLIENTS_NUM_MAX] = 1
        vle_request_params[Vle.AUDIO_LANGUAGE] = audio_lang
        is_valid, error = validate_recordings.validate_playback(
            recording_id, VLE_REQUEST_PARAMS=vle_request_params)
        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#27
0
def test_sanity_rtc10065_private_copy(stream):
    """
    Schedule Private copy and verify the recording and playback.
    """
    recording = None
    web_service_obj = None
    stream = str(private_copy_stream)
    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 80,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

        response = rio.find_recording(recording_id).json()
        is_valid, error = validate_storage.validate_recording_in_storage(
            response, Cos.ACTIVE_STORAGE, Cos.RECORDING_STORED)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_playback(recording_id)
        assert is_valid, error
    finally:
        if web_service_obj:
            web_service_obj.stop_server()
        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s",
                         response.status_code)
示例#28
0
def test_tc_ply_stream_style(name, stream, stream_style):
    """
    Playback vle using multiple/single bit rates and using different stream styles
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30, TimeFormat.TIME_FORMAT_MS, stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60, TimeFormat.TIME_FORMAT_MS, stream)
        copy_type = RecordingAttribute.COPY_TYPE_UNIQUE
        recording = recording_model.Recording(StartTime=start_time, EndTime=end_time, copyType=copy_type,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(response, requests.codes.no_content)

        assert is_valid, error
        is_valid, error = validate_recordings.validate_recording(recording_id, web_service_obj)

        assert is_valid, error
        vle_request_params = {}
        LOGGER.debug("Configuring vle to playback with clients=%s and stream style=%s", 1, stream_style)
        vle_request_params[Vle.CLIENTS_NUM_MAX] = 1
        vle_request_params[Vle.STREAM_STYLE] = stream_style
        if Vle.STREAM_STYLE_DEFAULT == stream_style:
            is_valid, msg = utils.get_video_profiles_from_m3u8(recording_id)

            assert is_valid, msg

            # If Valid, msg will contain the list of video profiles
            assert msg, ValidationError.VIDEO_PROFILES_NOT_FOUND.format(recording_id)
            vle_request_params[Vle.DOWNLOAD_BITRATE] = msg[0]

        is_valid, error = validate_recordings.validate_playback(recording_id,
                                                                VLE_REQUEST_PARAMS=vle_request_params)
        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9771_tc_ply_009_playback_subtitles(stream):
    """
    Playback recording with subtitles and validate playback in  Direct Mode
    """
    recording = None
    web_service_obj = None

    try:
        start_time = utils.get_formatted_time(constants.SECONDS * 30,
                                              TimeFormat.TIME_FORMAT_MS,
                                              stream)
        end_time = utils.get_formatted_time(constants.SECONDS * 60,
                                            TimeFormat.TIME_FORMAT_MS, stream)
        recording = recording_model.Recording(StartTime=start_time,
                                              EndTime=end_time,
                                              StreamId=stream)
        recording_id = recording.get_entry(0).RecordingId
        web_service_obj = notification_utils.get_web_service_object(
            recording_id)
        recording.get_entry(0).UpdateUrl = web_service_obj.get_url()
        LOGGER.debug("Recording instance created=%s", recording.serialize())
        response = a8.create_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)

        assert is_valid, error

        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)

        assert is_valid, error

        vle_request_params = {}
        LOGGER.debug(
            "Configuring vle to playback with subtitle in VMR direct mode")
        vle_request_params[Vle.VLE_CALL_FLOW_KEY] = Vle.VLE_CALL_FLOW_SUBTITLE
        is_valid, error = validate_recordings.validate_playback(
            recording_id, VLE_REQUEST_PARAMS=vle_request_params)
        assert is_valid, error
    finally:
        web_service_obj.stop_server()
        response = a8.delete_recording(recording)
        LOGGER.debug("Recording clean up status code=%s", response.status_code)
示例#30
0
def test_deleted_recording_cannot_be_played_back_ipdvrtests_166(
        common_lib, stream):
    """
    JIRA ID : IPDVRTESTS-166
    JIRA LINK : https://jira01.engit.synamedia.com/browse/IPDVRTESTS-166
    """
    recording = None
    web_service_obj = None

    try:
        # Step1: Create a 30 minute recording
        recording, web_service_obj = common_lib.create_recording(
            stream, rec_duration=Component.LARGE_REC_LEN_IN_SEC)
        recording_id = recording.get_entry(0).RecordingId
        is_valid, error = validate_recordings.validate_recording(
            recording_id, web_service_obj)
        assert is_valid, error

        # Step2: Delete the recording
        response = a8.delete_recording(recording)
        is_valid, error = validate_common.validate_http_response_status_code(
            response, requests.codes.no_content)
        assert is_valid, error
        is_valid, error = validate_recordings.validate_recording_deletion(
            recording_id)
        assert is_valid, error

        # Step 3: Validating playback
        is_valid, error = validate_recordings.validate_playback_using_vle(
            recording_id)
        assert not is_valid, ValidationError.DELETED_RECORDING_PLAYED_BACK.format(
            recording_id)

    finally:
        if web_service_obj: web_service_obj.stop_server()
        if recording:
            response = a8.delete_recording(recording)
            LOGGER.debug("Recording clean up status code=%s",
                         response.status_code)