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_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)
def test_rtc9763_tc_rec_027_multiple_delete_playback_unique(stream): """ Create multiple recordings with copy type as UNIQUE, delete one and playback the rest """ total_recordings = 3 web_service_objs = [] playback_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_id_0 = recording.get_entry(0).RecordingId 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_copy_count( response, Cos.ACTIVE_STORAGE, total_recordings) assert is_valid, error recording_to_delete = copy.deepcopy(recording) del recording_to_delete.get_entries()[1:] del recording.get_entries()[:1] # to clean up recordings later response = a8.delete_recording(recording_to_delete) 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_0) assert is_valid, error is_valid, error = validate_recordings.validate_playback_using_vle( recording_id_0) assert not is_valid, ValidationError.DELETED_RECORDING_PLAYED_BACK.format( recording_id_0) playback_pool = mp_pool.ThreadPool( processes=len(recording.get_entries())) for recording_entry in recording.get_entries(): playback_pool.apply_async( validate_recordings.validate_playback_using_vle, (recording_entry.RecordingId, ), callback=queue.put) for i in range(len(recording.get_entries())): is_valid, error = queue.get() assert is_valid, error finally: if playback_pool: playback_pool.close() playback_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_tc_rec_038_013_active_asset(stream, name, total_recording): """ Bulk deletion of assets in Active(20 requests) """ recording = None web_service_objects = [] recording_pool = None recording_id_list = [] 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) copy_type = RecordingAttribute.COPY_TYPE_COMMON recording = recording_model.Recording(total_recordings=total_recording, StartTime=start_time, EndTime=end_time, copyType=copy_type, StreamId=stream) for i in range(total_recording): recording_id = recording.get_entry(i).RecordingId recording_id_list.append(recording_id) web_service_objects.append( notification_utils.get_web_service_object(recording_id)) recording.get_entry(i).UpdateUrl = web_service_objects[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_recording) for i in range(total_recording): recording_pool.apply_async( validate_recordings.validate_recording, (recording.get_entry(i).RecordingId, web_service_objects[i]), callback=queue.put) for i in range(total_recording): is_valid, error = queue.get() assert is_valid, error for i in range(total_recording): response = rio.find_recording(recording_id_list[i]).json() is_valid, error = validate_storage.validate_recording_in_storage( response, Cos.ACTIVE_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 for i in range(total_recording): is_valid, error = validate_recordings.validate_recording_deletion( recording_id_list[i]) assert is_valid, error is_valid, error = validate_recordings.validate_playback_using_vle( recording_id_list[i]) assert not is_valid, ValidationError.DELETED_RECORDING_PLAYED_BACK.format( recording_id_list[i]) finally: if recording_pool: recording_pool.close() recording_pool.join() for web_service_obj in web_service_objects: web_service_obj.stop_server() response = a8.delete_recording(recording) LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9760_tc_rec_014_delete_playback_in_progress_recording(stream): """ Delete a recording while the playback is in progress and verify the playback """ recording = None playback_pool = 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 is_valid, error = validate_recordings.validate_recording( recording_id, web_service_obj) assert is_valid, error queue = Queue.Queue() playback_pool = mp_pool.ThreadPool(processes=1) playback_pool.apply_async( validate_recordings.validate_playback_using_vle, (recording_id, ), callback=queue.put) time.sleep(10 * constants.SECONDS) 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 is_valid, error = queue.get() if is_valid: # verifying whether the playback fails now, even though it succeeded previously 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 playback_pool: playback_pool.close() playback_pool.join() web_service_obj.stop_server() response = a8.delete_recording(recording) LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_rtc9782_tc_arc_012_playback_after_archival_delete_during_playback( stream): """ Create a recording with unique copy, wait until archiving completes, playback the recording and delete the recording during 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) 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 vmr_plybk_url = utils.get_vmr_playback_url(recording_id=recording_id) print "[INFO: ] vmr playback url ", vmr_plybk_url archive_helper.wait_for_archival(stream, recording_id, Archive.ARCHIVE, Archive.COMPLETE) response = rio.find_recording(recording_id).json() print "[INFO: ] recording details ", response is_valid, error = validate_storage.validate_recording_in_storage( response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED) assert is_valid, error queue = Queue.Queue() playback_pool = mp_pool.ThreadPool(processes=1) playback_pool.apply_async( validate_recordings.validate_playback_using_vle, (recording_id, ), callback=queue.put) #time.sleep(10 * constants.SECONDS) is_valid, error = validate_storage.validate_recording_in_storage( response, Cos.RECON_STORAGE, Cos.RECORDING_STORED) assert is_valid, ValidationError.SEGMENT_NOT_MOVED.format( Cos.RECON_STORAGE, response) del_resp = a8.delete_recording(recording) is_valid, error = validate_common.validate_http_response_status_code( del_resp, requests.codes.no_content) assert is_valid, error is_valid, error = validate_recordings.validate_recording_deletion( recording_id) assert is_valid, error is_valid, error = queue.get() assert is_valid, error if is_valid: # verifying whether the recording available in VMR vmr_plybk_url = utils.get_vmr_playback_url( recording_id=recording_id) resp = requests.get(vmr_plybk_url) assert not ( resp.status_code == requests.codes.ok ), ValidationError.INCORRECT_HTTP_RESPONSE_STATUS_CODE.format( resp.status_code, resp.reason, resp.url) finally: web_service_obj.stop_server() response = a8.delete_recording(recording) LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_tc_arc(name, stream, archive_playback): """ Schedule recording with same start time, end time with unique copy, playback recording single recording and delete it, finally playback remaining records. """ total_recordings = 3 recording = None web_service_objs = [] recording_pool = 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) copy_type = RecordingAttribute.COPY_TYPE_UNIQUE recording = recording_model.Recording( total_recordings=total_recordings, StartTime=start_time, EndTime=end_time, copyType=copy_type, 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=%s, UpdateURL=%s", recording_id, 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 # Validating the copy count of unique copy recording in active storage for i in range(total_recordings): response = rio.find_recording( recording.get_entry(i).RecordingId).json() is_valid, error = validate_storage.validate_copy_count( response, Cos.ACTIVE_STORAGE, total_recordings) assert is_valid, error # Wait till archival completes recording_id_0 = recording.get_entry(0).RecordingId archive_helper.wait_for_archival(stream, recording_id_0, Archive.ARCHIVE, Archive.COMPLETE) # Validating copy count in archive storage after archival duration 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_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_storage.validate_copy_count( response, Cos.ARCHIVE_STORAGE, 1) assert is_valid, error if archive_playback: response = rio.find_recording(recording_id_0).json() # Validating the first recording for playback is_valid, error = validate_recordings.validate_playback_using_vle( recording_id_0) assert is_valid, error # Validating the copy of segments in the archive folder after playback is_valid, error = validate_storage.validate_recording_in_storage( response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED) assert is_valid, error # Validating the segments in recon folder after playback is_valid, error = validate_storage.validate_recording_in_storage( response, Cos.RECON_STORAGE, Cos.RECORDING_STORED) assert is_valid, error response = a8.delete_recording(recording, recording.get_entry(0).RecordingId) 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_0) assert is_valid, error is_valid, error = validate_recordings.validate_playback_using_vle( recording_id_0) assert not is_valid, ValidationError.DELETED_RECORDING_PLAYED_BACK.format( recording_id_0) del recording.get_entries()[:1] # Check remaining records still in archive if archive_playback: for recording_entry in recording.get_entries(): response = rio.find_recording( recording_entry.RecordingId).json() recording_pool.apply_async( validate_storage.validate_recording_in_storage, (response, Cos.ARCHIVE_STORAGE, Cos.RECORDING_STORED), callback=queue.put) for i in range(len(recording.get_entries())): is_valid, error = queue.get() assert is_valid, error for recording_entry in recording.get_entries(): recording_pool.apply_async( validate_recordings.validate_playback_using_vle, (recording_entry.RecordingId, ), callback=queue.put) for i in range(len(recording.get_entries())): 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() response = a8.delete_recording(recording) LOGGER.debug("Recording clean up status code=%s", response.status_code)
def test_delete_hot_recording_ipdvrtests_52(stream): """ JIRA ID : IPDVRTESTS-52 TITLE : "Delete Rec(Hot recording)" STEPS : Create a 30 min recording, when program is already started, mark the recording for deletion. Check memsql to verify erase time is set. Check cos http logs for delete segments. Playback should not be possible after marking it for delete. """ recording = None web_service_obj = None try: rec_duration = utils.get_rec_duration(dur_confg_key=Component.LARGE_REC_LEN_IN_SEC) start_time = utils.get_formatted_time(constants.SECONDS, TimeFormat.TIME_FORMAT_MS, stream) end_time = utils.get_formatted_time((constants.SECONDS * rec_duration), 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 recording_id = recording.get_entry(0).RecordingId 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(15 * constants.SECONDS) delete_time = utils.get_formatted_time(constants.SECONDS * 0, TimeFormat.TIME_FORMAT_MS, stream) 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 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_recordings.validate_playback_using_vle(recording_id, EndTime=delete_time) 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)
def test_rtc9758_tc_rec_012_IPDVRTESTS_52_delete_and_playback_after_recording_start( recording_start_delay, stream): """ Create a recording, delete and play it back after it starts """ recording = None web_service_obj = None try: start_time = utils.get_formatted_time( constants.SECONDS * recording_start_delay, 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 recording_id = recording.get_entry(0).RecordingId 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(15 * constants.SECONDS) delete_time = utils.get_formatted_time(constants.SECONDS * 0, TimeFormat.TIME_FORMAT_MS, stream) 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 is_valid, error = validate_recordings.validate_playback_using_vle( recording_id, EndTime=delete_time) assert not is_valid, ValidationError.DELETED_RECORDING_PLAYED_BACK.format( recording_id) finally: web_service_obj.stop_server() response = a8.delete_recording(recording) LOGGER.debug("Recording clean up status code=%s", response.status_code)