Ejemplo n.º 1
0
    def test_ams_streaming_policy_cenc_disable_widevine(self, resource_group, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        streamingPolicyName = self.create_random_name(prefix='spn', length=10)

        self.kwargs.update({
            'streamingPolicyName': streamingPolicyName,
            'protocols': 'HLS SmoothStreaming',
            'clearTracks': '@' + _get_test_data_file('clearTracks.json'),
            'keyToTrackMappings': '@' + _get_test_data_file('keyToTrackMappings.json'),
            'label': 'label',
            'playReadyUrlTemplate': 'playReadyTemplate.foo.bar',
            'playReadyAttributes': 'awesomeAttributes'
        })

        self.cmd('az ams streaming-policy create -a {amsname} -n {streamingPolicyName} -g {rg} --cenc-protocols {protocols} --cenc-clear-tracks "{clearTracks}" --cenc-key-to-track-mappings "{keyToTrackMappings}" --cenc-default-key-label {label} --cenc-disable-widevine', checks=[
            self.check('name', '{streamingPolicyName}'),
            self.check('commonEncryptionCenc.enabledProtocols.hls', True),
            self.check('commonEncryptionCenc.enabledProtocols.smoothStreaming', True),
            self.check('commonEncryptionCenc.contentKeys.defaultKey.label', '{label}'),
            self.check('commonEncryptionCenc.drm.playReady.customLicenseAcquisitionUrlTemplate', None),
            self.check('commonEncryptionCenc.drm.playReady.playReadyCustomAttributes', None),
            self.check('commonEncryptionCenc.drm.widevine.customLicenseAcquisitionUrlTemplate', None),
        ])
    def test_ams_streaming_endpoint_scale(self, storage_account_for_scale):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep", length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_scale,
            'location': 'westindia',
            'streamingEndpointName': streaming_endpoint_name,
            'availabilitySetName': 'availaTest',
            'cdnProvider': 'StandardVerizon',
            'cdnProfile': 'testProfile',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 9,
            'scaleUnits2': 10,
            'tags': 'foo=bar',
            'clientAccessPolicy': '@' + self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': '@' + self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml'))
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --availability-set-name {availabilitySetName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}"', checks=[
            self.check('scaleUnits', '{scaleUnits}')
        ])

        self.cmd('az ams streaming-endpoint scale -g {rg} -a {amsname} -n {streamingEndpointName} --scale-unit {scaleUnits2}')

        self.cmd('az ams streaming-endpoint show -g {rg} -a {amsname} -n {streamingEndpointName}', checks=[
            self.check('scaleUnits', '{scaleUnits2}')
        ])

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}')
    def test_live_event_update(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        live_event_name = self.create_random_name(prefix='le', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2',
            'streamingProtocol': 'FragmentedMP4',
            'liveEventName': live_event_name
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')
        self.cmd('az ams live-event create -a {amsname} -n {liveEventName} -g {rg} --ips AllowAll --streaming-protocol {streamingProtocol}')

        self.kwargs.update({
            'tags': 'key=value',
            'keyFrameIntervalDuration': 'PT2S',
            'description': 'asd',
            'clientAccessPolicy': '@' + _get_test_data_file('clientAccessPolicy.xml'),
            'crossDomainPolicy': '@' + _get_test_data_file('crossDomainPolicy.xml')
        })

        live_event_updated = self.cmd('az ams live-event update -a {amsname} -n {liveEventName} -g {rg} --ips 1.2.3.4 5.6.7.8 9.10.11.12 --preview-ips 1.1.1.1 0.0.0.0 --key-frame-interval-duration {keyFrameIntervalDuration} --description {description} --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}" --tags {tags}', checks=[
            self.check('description', '{description}'),
            self.check('input.keyFrameIntervalDuration', '{keyFrameIntervalDuration}'),
            self.check('length(preview.accessControl.ip.allow)', 2),
            self.check('length(input.accessControl.ip.allow)', 3),
            self.check('tags.key', 'value')
        ]).get_output_in_json()

        self.assertIsNotNone(live_event_updated['crossSiteAccessPolicies']['crossDomainPolicy'])
        self.assertIsNotNone(live_event_updated['crossSiteAccessPolicies']['clientAccessPolicy'])
Ejemplo n.º 4
0
    def test_ams_streaming_endpoint_delete(self, storage_account_for_delete):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name1 = self.create_random_name(prefix="strep", length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_delete,
            'location': 'southindia',
            'streamingEndpointName1': streaming_endpoint_name1,
            'cdnProvider': 'StandardVerizon',
            'cdnProfile': 'testProfile',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 8,
            'tags': 'foo=bar',
            'clientAccessPolicy': self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml'))
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName1} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy @"{clientAccessPolicy}" --cross-domain-policy @"{crossDomainPolicy}"')

        self.cmd('az ams streaming-endpoint list -g {rg} -a {amsname}', checks=[
            self.check('length(@)', 2)
        ])

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName1}')

        self.cmd('az ams streaming-endpoint list -g {rg} -a {amsname}', checks=[
            self.check('length(@)', 1)
        ])
    def test_live_event_create(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        live_event_name = self.create_random_name(prefix='le', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2',
            'streamingProtocol': 'RTMP',
            'liveEventName': live_event_name,
            'encodingType': 'Basic',
            'tags': 'key=value',
            'previewLocator': self.create_guid(),
            'keyFrameIntervalDuration': 'PT2S',
            'description': 'asd',
            'accessToken': '0abf356884d74b4aacbd7b1ebd3da0f7',
            'clientAccessPolicy': '@' + _get_test_data_file('clientAccessPolicy.xml'),
            'crossDomainPolicy': '@' + _get_test_data_file('crossDomainPolicy.xml')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        live_event = self.cmd('az ams live-event create -a {amsname} -n {liveEventName} -g {rg} --auto-start --streaming-protocol {streamingProtocol} --encoding-type {encodingType} --tags {tags} --stream-options Default LowLatency --preview-locator {previewLocator} --ips 1.2.3.4 5.6.7.8 192.168.0.0/28 --preview-ips 192.168.0.0/28 0.0.0.0 --key-frame-interval-duration {keyFrameIntervalDuration} --access-token {accessToken} --description {description} --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}" --vanity-url', checks=[
            self.check('name', '{liveEventName}'),
            self.check('location', 'West US 2'),
            self.check('input.streamingProtocol', '{streamingProtocol}'),
            self.check('encoding.encodingType', '{encodingType}'),
            self.check('length(preview.accessControl.ip.allow)', 2),
            self.check('length(input.accessControl.ip.allow)', 3),
            self.check('preview.previewLocator', '{previewLocator}'),
            self.check('input.keyFrameIntervalDuration', '{keyFrameIntervalDuration}'),
            self.check('length(streamOptions)', 2),
            self.check('description', '{description}'),
            self.check('input.accessToken', '{accessToken}'),
            self.check('vanityUrl', True),
            self.check('input.accessControl.ip.allow[2].address', '192.168.0.0'),
            self.check('input.accessControl.ip.allow[2].subnetPrefixLength', '28'),
            self.check('preview.accessControl.ip.allow[0].address', '192.168.0.0'),
            self.check('preview.accessControl.ip.allow[0].subnetPrefixLength', '28')
        ]).get_output_in_json()

        self.assertIsNotNone(live_event['crossSiteAccessPolicies']['crossDomainPolicy'])
        self.assertIsNotNone(live_event['crossSiteAccessPolicies']['clientAccessPolicy'])

        self.assertNotEquals('Stopping', live_event['resourceState'])
        self.assertNotEquals('Stopped', live_event['resourceState'])

        self.cmd('az ams live-event stop -a {amsname} -n {liveEventName} -g {rg}')

        self.cmd('az ams live-event delete -a {amsname} -n {liveEventName} -g {rg}')
    def test_ams_streaming_endpoint_create_with_akamai(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep", length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'northeurope',
            'streamingEndpointName': streaming_endpoint_name,
            'availabilitySetName': 'availaTest',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 4,
            'tags': 'foo=bar',
            'ips': '1.1.1.1 2.2.2.2',
            'clientAccessPolicy': '@' + self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': '@' + self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml')),
            'identifier': 'id1',
            'expiration': '2030-12-31T16:00:00-08:00',
            'base64Key': 'dGVzdGlkMQ=='
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --availability-set-name {availabilitySetName} --ips {ips} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}"', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('location', 'North Europe'),
            self.check('availabilitySetName', '{availabilitySetName}'),
            self.check('length(accessControl.ip.allow)', '2'),
            self.check('description', '{description}'),
            self.check('maxCacheAge', '{maxCacheAge}'),
            self.check('scaleUnits', '{scaleUnits}'),
            self.check('length(tags)', 1)
        ])

        self.cmd('az ams streaming-endpoint akamai add -g {rg} -a {amsname} -n {streamingEndpointName} --identifier {identifier} --expiration {expiration} --base64-key {base64Key}', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('length(accessControl.akamai.akamaiSignatureHeaderAuthenticationKeyList)', 1)
        ])

        self.cmd('az ams streaming-endpoint akamai remove -g {rg} -a {amsname} -n {streamingEndpointName} --identifier {identifier}', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('length(accessControl.akamai.akamaiSignatureHeaderAuthenticationKeyList)', 0)
        ])

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}')
Ejemplo n.º 7
0
    def test_ams_transform_create_custom_preset_invalid(
            self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'centralindia'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}',
            checks=[
                self.check('name', '{amsname}'),
                self.check('location', 'Central India')
            ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName':
            transformName,
            'invalidPresetPath':
            _get_test_data_file('invalidCustomPreset.json')
        })

        with self.assertRaises(CLIError):
            self.cmd(
                'az ams transform create -a {amsname} -n {transformName} -g {rg} --preset "{invalidPresetPath}"'
            )
    def test_content_key_policy_create_with_fairplay_offline(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'eastasia',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration',
            'ask': '1234567890ABCDEF1234567890ABCDEF',
            'fairPlayPfx': _get_test_data_file('TestCert2.pfx'),
            'fairPlayPfxPassword': '******',
            'rentalAndLeaseKeyType': 'DualExpiry',
            'fairPlayPlaybackDurationSeconds': 60,
            'fairPlayStorageDurationSeconds': 60,
            'rentalDuration': 60,
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyOpenRestriction'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --open-restriction --description {description} --ask {ask} --fair-play-pfx "{fairPlayPfx}" --fair-play-pfx-password {fairPlayPfxPassword} --rental-and-lease-key-type {rentalAndLeaseKeyType} --fp-playback-duration-seconds {fairPlayPlaybackDurationSeconds} --fp-storage-duration-seconds {fairPlayStorageDurationSeconds} --rental-duration {rentalDuration} --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odataType', '{configurationODataType}'),
            self.check('options[0].restriction.odataType', '{restrictionODataType}'),
            self.check('options[0].configuration.rentalAndLeaseKeyType', '{rentalAndLeaseKeyType}'),
            self.check('options[0].configuration.rentalDuration', 0),
            self.check('options[0].configuration.offlineRentalConfiguration.playbackDurationSeconds', '{fairPlayPlaybackDurationSeconds}'),
            self.check('options[0].configuration.offlineRentalConfiguration.storageDurationSeconds', '{fairPlayStorageDurationSeconds}')
        ])
    def test_ams_transform_create_custom_preset(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName': transformName,
            'presetPath': _get_test_data_file('customPreset.json')
        })

        self.cmd('az ams transform create -a {amsname} -n {transformName} -g {rg} --preset "{presetPath}"', checks=[
            self.check('name', '{transformName}'),
            self.check('length(outputs[0].preset.codecs)', 2),
            self.check('length(outputs[0].preset.filters.overlays)', 1),
            self.check('length(outputs[0].preset.formats)', 1)
        ])
Ejemplo n.º 10
0
    def test_content_key_policy_create_with_playready_fail(
            self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname':
            amsname,
            'storageAccount':
            storage_account_for_create,
            'location':
            'westus2',
            'contentKeyPolicyName':
            policy_name,
            'description':
            'ExampleDescription',
            'policyOptionName':
            policy_option_name,
            'playReadyPath':
            '@' + _get_test_data_file('invalidPlayReadyTemplate.json'),
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )

        with self.assertRaises(CLIError):
            self.cmd(
                'az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg}  --open-restriction --play-ready-template "{playReadyPath}" --description {description} --policy-option-name {policyOptionName}'
            )
    def test_content_key_policy_show_with_secrets(self, storage_account_for_show):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_show,
            'location': 'canadaeast',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration',
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyOpenRestriction',
            'restrictionTokenType': 'Jwt',
            'issuer': 'issuer',
            'audience': 'audience',
            'tokenKey': _get_test_data_file('x509Token.pem'),
            'tokenType': 'X509'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -g {rg} -n {contentKeyPolicyName} --clear-key-configuration --policy-option-name {policyOptionName} --token-key "{tokenKey}" --token-key-type {tokenType} --issuer {issuer} --audience {audience} --token-type {restrictionTokenType}')

        self.cmd('az ams content-key-policy show -a {amsname} -n {contentKeyPolicyName} -g {rg}', checks=[
            self.check('options[0].restriction.primaryVerificationKey.rawBody', None)
        ])

        output = self.cmd('az ams content-key-policy show -a {amsname} -n {contentKeyPolicyName} -g {rg} --with-secrets').get_output_in_json()

        self.assertNotEquals(output.get('options')[0].get('restriction').get('primaryVerificationKey').get('rawBody'), None)
Ejemplo n.º 12
0
    def test_ams_transform_create_custom_preset(self,
                                                storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westindia'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}',
            checks=[
                self.check('name', '{amsname}'),
                self.check('location', 'West India')
            ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName':
            transformName,
            'presetPath':
            _get_test_data_file('customPreset.json')
        })

        self.cmd(
            'az ams transform create -a {amsname} -n {transformName} -g {rg} --preset "{presetPath}"',
            checks=[
                self.check('name', '{transformName}'),
                self.check('length(outputs[0].preset.codecs)', 2),
                self.check('length(outputs[0].preset.filters.overlays)', 1),
                self.check('length(outputs[0].preset.formats)', 1)
            ])
    def test_content_key_policy_show_with_secrets(self, storage_account_for_show):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_show,
            'location': 'canadaeast',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration',
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyOpenRestriction',
            'restrictionTokenType': 'Jwt',
            'issuer': 'issuer',
            'audience': 'audience',
            'tokenKey': _get_test_data_file('x509Token.pem'),
            'tokenType': 'X509'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -g {rg} -n {contentKeyPolicyName} --clear-key-configuration --policy-option-name {policyOptionName} --token-key "{tokenKey}" --token-key-type {tokenType} --issuer {issuer} --audience {audience} --token-type {restrictionTokenType}')

        self.cmd('az ams content-key-policy show -a {amsname} -n {contentKeyPolicyName} -g {rg}', checks=[
            self.check('options[0].restriction.primaryVerificationKey.rawBody', None)
        ])

        output = self.cmd('az ams content-key-policy show -a {amsname} -n {contentKeyPolicyName} -g {rg} --with-secrets').get_output_in_json()

        self.assertNotEquals(output.get('options')[0].get('restriction').get('primaryVerificationKey').get('rawBody'), None)
    def test_content_key_policy_create_with_fairplay(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'eastasia',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration',
            'ask': 'testtesttesttest',
            'fairPlayPfx': _get_test_data_file('TestCert2.pfx'),
            'fairPlayPfxPassword': '******',
            'rentalAndLeaseKeyType': 'Undefined',
            'rentalDuration': 60,
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyOpenRestriction'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --open-restriction --description {description} --ask {ask} --fair-play-pfx "{fairPlayPfx}" --fair-play-pfx-password {fairPlayPfxPassword} --rental-and-lease-key-type {rentalAndLeaseKeyType} --rental-duration {rentalDuration} --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odatatype', '{configurationODataType}'),
            self.check('options[0].restriction.odatatype', '{restrictionODataType}'),
            self.check('options[0].configuration.rentalAndLeaseKeyType', '{rentalAndLeaseKeyType}'),
            self.check('options[0].configuration.rentalDuration', '{rentalDuration}')
        ])
Ejemplo n.º 15
0
    def test_ams_asset_filter_show(self, storage_account_for_show):
        amsname = self.create_random_name(prefix='ams', length=12)
        container = self.create_random_name(prefix='cont', length=8)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_show,
            'location': 'westus2',
            'container': container
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')
        self.cmd('az ams account storage add -a {amsname} -g {rg} -n {storageAccount}')

        asset_name = self.create_random_name(prefix='asset', length=12)
        alternate_id = self.create_random_name(prefix='aid', length=12)
        description = self.create_random_name(prefix='desc', length=12)

        self.kwargs.update({
            'asset_name': asset_name,
            'alternate_id': alternate_id,
            'description': description
        })

        self.cmd('az ams asset create -a {amsname} -n {asset_name} -g {rg} --description {description} --alternate-id {alternate_id} --storage-account {storageAccount} --container {container}')

        filter_name = self.create_random_name(prefix='filter', length=12)

        self.kwargs.update({
            'filter_name': filter_name,
            'bitrate': 420,
            'endTimestamp': 100000000,
            'liveBackoffDuration': 60,
            'presentationWindowDuration': 1200000000,
            'startTimestamp': 40000000,
            'timescale': 10000000,
            'tracks': '@' + _get_test_data_file('filterTracks.json'),
        })

        self.cmd('az ams asset-filter create -a {amsname} --asset-name {asset_name} -g {rg} -n {filter_name} --bitrate {bitrate} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"')

        self.cmd('az ams asset-filter show -a {amsname} --asset-name {asset_name} -g {rg} -n {filter_name}', checks=[
            self.check('firstQuality.bitrate', '{bitrate}'),
            self.check('name', '{filter_name}'),
            self.check('presentationTimeRange.endTimestamp', '{endTimestamp}'),
            self.check('presentationTimeRange.liveBackoffDuration', '{liveBackoffDuration}'),
            self.check('presentationTimeRange.presentationWindowDuration', '{presentationWindowDuration}'),
            self.check('presentationTimeRange.startTimestamp', '{startTimestamp}'),
            self.check('presentationTimeRange.timescale', '{timescale}'),
            self.check('tracks[0].trackSelections[0].operation', 'Equal'),
            self.check('tracks[0].trackSelections[0].property', 'FourCC'),
            self.check('tracks[0].trackSelections[0].value', 'AVC1'),
            self.check('tracks[1].trackSelections[0].operation', 'NotEqual'),
            self.check('tracks[1].trackSelections[0].property', 'Unknown'),
            self.check('tracks[1].trackSelections[0].value', 'EC-3'),
            self.check('tracks[1].trackSelections[1].operation', 'Equal'),
            self.check('tracks[1].trackSelections[1].property', 'FourCC'),
            self.check('tracks[1].trackSelections[1].value', 'MP4A')
        ])
    def test_ams_account_filter_create_and_show(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        filter_name = self.create_random_name(prefix='filter', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'northcentralus',
            'filterName': filter_name,
            'bitrate': 420,
            'endTimestamp': 100000000,
            'liveBackoffDuration': 60,
            'presentationWindowDuration': 1200000000,
            'startTimestamp': 40000000,
            'timescale': 10000000,
            'tracks': '@' + _get_test_data_file('filterTracks.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName} --bitrate {bitrate} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"', checks=[
            self.check('firstQuality.bitrate', '{bitrate}'),
            self.check('name', '{filterName}'),
            self.check('presentationTimeRange.endTimestamp', '{endTimestamp}'),
            self.check('presentationTimeRange.liveBackoffDuration', '{liveBackoffDuration}'),
            self.check('presentationTimeRange.presentationWindowDuration', '{presentationWindowDuration}'),
            self.check('presentationTimeRange.startTimestamp', '{startTimestamp}'),
            self.check('presentationTimeRange.timescale', '{timescale}'),
            self.check('tracks[0].trackSelections[0].operation', 'Equal'),
            self.check('tracks[0].trackSelections[0].property', 'FourCC'),
            self.check('tracks[0].trackSelections[0].value', 'AVC1'),
            self.check('tracks[1].trackSelections[0].operation', 'NotEqual'),
            self.check('tracks[1].trackSelections[0].property', 'Unknown'),
            self.check('tracks[1].trackSelections[0].value', 'EC-3'),
            self.check('tracks[1].trackSelections[1].operation', 'Equal'),
            self.check('tracks[1].trackSelections[1].property', 'FourCC'),
            self.check('tracks[1].trackSelections[1].value', 'MP4A')
        ])

        self.cmd('az ams account-filter show -a {amsname} -g {rg} -n {filterName}', checks=[
            self.check('firstQuality.bitrate', '{bitrate}'),
            self.check('name', '{filterName}'),
            self.check('presentationTimeRange.endTimestamp', '{endTimestamp}'),
            self.check('presentationTimeRange.liveBackoffDuration', '{liveBackoffDuration}'),
            self.check('presentationTimeRange.presentationWindowDuration', '{presentationWindowDuration}'),
            self.check('presentationTimeRange.startTimestamp', '{startTimestamp}'),
            self.check('presentationTimeRange.timescale', '{timescale}'),
            self.check('tracks[0].trackSelections[0].operation', 'Equal'),
            self.check('tracks[0].trackSelections[0].property', 'FourCC'),
            self.check('tracks[0].trackSelections[0].value', 'AVC1'),
            self.check('tracks[1].trackSelections[0].operation', 'NotEqual'),
            self.check('tracks[1].trackSelections[0].property', 'Unknown'),
            self.check('tracks[1].trackSelections[0].value', 'EC-3'),
            self.check('tracks[1].trackSelections[1].operation', 'Equal'),
            self.check('tracks[1].trackSelections[1].property', 'FourCC'),
            self.check('tracks[1].trackSelections[1].value', 'MP4A')
        ])
    def test_ams_account_filter_create_and_show(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        filter_name = self.create_random_name(prefix='filter', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2',
            'filterName': filter_name,
            'bitrate': 420,
            'endTimestamp': 100000000,
            'liveBackoffDuration': 60,
            'presentationWindowDuration': 1200000000,
            'startTimestamp': 40000000,
            'timescale': 10000000,
            'tracks': '@' + _get_test_data_file('filterTracks.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName} --bitrate {bitrate} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"', checks=[
            self.check('firstQuality.bitrate', '{bitrate}'),
            self.check('name', '{filterName}'),
            self.check('presentationTimeRange.endTimestamp', '{endTimestamp}'),
            self.check('presentationTimeRange.liveBackoffDuration', '{liveBackoffDuration}'),
            self.check('presentationTimeRange.presentationWindowDuration', '{presentationWindowDuration}'),
            self.check('presentationTimeRange.startTimestamp', '{startTimestamp}'),
            self.check('presentationTimeRange.timescale', '{timescale}'),
            self.check('tracks[0].trackSelections[0].operation', 'Equal'),
            self.check('tracks[0].trackSelections[0].property', 'FourCC'),
            self.check('tracks[0].trackSelections[0].value', 'AVC1'),
            self.check('tracks[1].trackSelections[0].operation', 'NotEqual'),
            self.check('tracks[1].trackSelections[0].property', 'Unknown'),
            self.check('tracks[1].trackSelections[0].value', 'EC-3'),
            self.check('tracks[1].trackSelections[1].operation', 'Equal'),
            self.check('tracks[1].trackSelections[1].property', 'FourCC'),
            self.check('tracks[1].trackSelections[1].value', 'MP4A')
        ])

        self.cmd('az ams account-filter show -a {amsname} -g {rg} -n {filterName}', checks=[
            self.check('firstQuality.bitrate', '{bitrate}'),
            self.check('name', '{filterName}'),
            self.check('presentationTimeRange.endTimestamp', '{endTimestamp}'),
            self.check('presentationTimeRange.liveBackoffDuration', '{liveBackoffDuration}'),
            self.check('presentationTimeRange.presentationWindowDuration', '{presentationWindowDuration}'),
            self.check('presentationTimeRange.startTimestamp', '{startTimestamp}'),
            self.check('presentationTimeRange.timescale', '{timescale}'),
            self.check('tracks[0].trackSelections[0].operation', 'Equal'),
            self.check('tracks[0].trackSelections[0].property', 'FourCC'),
            self.check('tracks[0].trackSelections[0].value', 'AVC1'),
            self.check('tracks[1].trackSelections[0].operation', 'NotEqual'),
            self.check('tracks[1].trackSelections[0].property', 'Unknown'),
            self.check('tracks[1].trackSelections[0].value', 'EC-3'),
            self.check('tracks[1].trackSelections[1].operation', 'Equal'),
            self.check('tracks[1].trackSelections[1].property', 'FourCC'),
            self.check('tracks[1].trackSelections[1].value', 'MP4A')
        ])
    def test_ams_transform_output_add(self, storage_account_for_output_add):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_output_add,
            'location': 'japaneast'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location} --mi-system-assigned --default-action Allow')

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName': transformName,
            'presetName': 'AACGoodQualityAudio',
            'presetPath': _get_test_data_file('customPreset.json'),
            'onError': 'ContinueJob',
            'relativePriority': 'High'
        })

        self.cmd('az ams transform create -a {amsname} -n {transformName} -g {rg} --preset {presetName}')

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset "{presetPath}" --on-error {onError} --relative-priority {relativePriority}', checks=[
            self.check('outputs[1].onError', '{onError}'),
            self.check('outputs[1].relativePriority', '{relativePriority}')
        ])

        self.kwargs.update({
            'presetName': 'AudioAnalyzer',
            'presetName2': 'VideoAnalyzer',
            'presetName3': 'FaceDetector',
            'audioLanguage': 'es-ES',
            'audioLanguage2': 'en-US',
            'insightsToExtract': 'AudioInsightsOnly',
            'resolution': 'SourceResolution',
            'audioAnalysisMode': 'Basic',
            'videoAnalysisMode': 'Basic',
            'faceAnalysisMode': 'Redact',
            'blurType': 'Low'
        })

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName} --audio-language {audioLanguage} --audio-analysis-mode {audioAnalysisMode}', checks=[
            self.check('outputs[2].preset.audioLanguage', '{audioLanguage}'),
            self.check('outputs[2].preset.mode', '{audioAnalysisMode}')
        ])

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName2} --audio-language {audioLanguage2} --insights-to-extract {insightsToExtract} --video-analysis-mode {videoAnalysisMode}', checks=[
            self.check('outputs[3].preset.audioLanguage', '{audioLanguage2}'),
            self.check('outputs[3].preset.insightsToExtract', '{insightsToExtract}'),
            self.check('outputs[3].preset.mode', '{videoAnalysisMode}'),
        ])

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName3} --resolution {resolution} --face-detector-mode {faceAnalysisMode} --blur-type {blurType}', checks=[
            self.check('outputs[4].preset.resolution', '{resolution}')
        ])
    def test_live_event_show(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        live_event_name = self.create_random_name(prefix='le', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2',
            'streamingProtocol': 'RTMP',
            'liveEventName': live_event_name,
            'encodingType': 'Basic',
            'tags': 'key=value',
            'previewLocator': self.create_guid(),
            'keyFrameIntervalDuration': 'PT2S',
            'description': 'asd',
            'accessToken': '0abf356884d74b4aacbd7b1ebd3da0f7',
            'clientAccessPolicy': '@' + _get_test_data_file('clientAccessPolicy.xml'),
            'crossDomainPolicy': '@' + _get_test_data_file('crossDomainPolicy.xml')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        self.cmd('az ams live-event create -a {amsname} -n {liveEventName} -g {rg} --streaming-protocol {streamingProtocol} --encoding-type {encodingType} --tags {tags} --stream-options Default LowLatency --preview-locator {previewLocator} --ips 1.2.3.4 5.6.7.8 9.10.11.12 --preview-ips 1.1.1.1 0.0.0.0 --key-frame-interval-duration {keyFrameIntervalDuration} --access-token {accessToken} --description {description} --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}" --vanity-url')

        self.cmd('az ams live-event show -a {amsname} -n {liveEventName} -g {rg}', checks=[
            self.check('name', '{liveEventName}'),
            self.check('location', 'West US 2'),
            self.check('input.streamingProtocol', '{streamingProtocol}'),
            self.check('encoding.encodingType', '{encodingType}'),
            self.check('length(preview.accessControl.ip.allow)', 2),
            self.check('length(input.accessControl.ip.allow)', 3),
            self.check('preview.previewLocator', '{previewLocator}'),
            self.check('input.keyFrameIntervalDuration', '{keyFrameIntervalDuration}'),
            self.check('length(streamOptions)', 2),
            self.check('description', '{description}'),
            self.check('input.accessToken', '{accessToken}'),
            self.check('vanityUrl', True)
        ])

        self.cmd('az ams live-event delete -a {amsname} -n {liveEventName} -g {rg}')
Ejemplo n.º 20
0
    def test_ams_streaming_endpoint_show(self, storage_account_for_show):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep", length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_show,
            'location': 'australiasoutheast',
            'streamingEndpointName': streaming_endpoint_name,
            'cdnProvider': 'StandardVerizon',
            'cdnProfile': 'testProfile',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 7,
            'tags': 'foo=bar',
            'clientAccessPolicy': self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml'))
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy @"{clientAccessPolicy}" --cross-domain-policy @"{crossDomainPolicy}"')

        self.cmd('az ams streaming-endpoint show -g {rg} -a {amsname} -n {streamingEndpointName}', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('location', 'Australia Southeast'),
            self.check('cdnProvider', '{cdnProvider}'),
            self.check('cdnProfile', '{cdnProfile}'),
            self.check('description', '{description}'),
            self.check('maxCacheAge', '{maxCacheAge}'),
            self.check('scaleUnits', '{scaleUnits}'),
            self.check('length(tags)', 1)
        ])

        nonexits_streaming_endpoint_name = self.create_random_name(prefix='se', length=20)
        self.kwargs.update({
            'nonexits_streaming_endpoint_name': nonexits_streaming_endpoint_name
        })
        with self.assertRaisesRegex(SystemExit, '3'):
            self.cmd('az ams streaming-endpoint show -g {rg} -a {amsname} -n {nonexits_streaming_endpoint_name}')

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}')
    def test_ams_transform(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName': transformName,
            'presetName': 'AACGoodQualityAudio',
            'presetPath': _get_test_data_file('customPreset.json')
        })

        self.cmd('az ams transform create -a {amsname} -n {transformName} -g {rg} --preset {presetName}', checks=[
            self.check('name', '{transformName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('length(outputs)', 1)
        ])

        self.cmd('az ams transform show -a {amsname} -n {transformName} -g {rg}', checks=[
            self.check('name', '{transformName}'),
            self.check('resourceGroup', '{rg}')
        ])

        self.cmd('az ams transform update --description mydesc -a {amsname} -n {transformName} -g {rg}', checks=[
            self.check('name', '{transformName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('description', 'mydesc')
        ])

        self.cmd('az ams transform output add --preset "{presetPath}" -a {amsname} -n {transformName} -g {rg}', checks=[
            self.check('name', '{transformName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('length(outputs)', 2)
        ])

        self.cmd('az ams transform output remove --output-index 0 -a {amsname} -n {transformName} -g {rg}', checks=[
            self.check('name', '{transformName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('length(outputs)', 1)
        ])

        list = self.cmd('az ams transform list -a {amsname} -g {rg}').get_output_in_json()
        assert len(list) > 0

        self.cmd('az ams transform delete -n {transformName} -a {amsname} -g {rg}')
    def test_content_key_policy_create_with_token(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'southeastasia',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration',
            'jsonFile': '@' + _get_test_data_file('widevineTemplate.json'),
            'issuer': 'Issuer',
            'audience': 'Audience',
            'tokenKey': _get_test_data_file('rsaToken.pem'),
            'tokenType': 'RSA',
            'restrictionTokenType': 'Jwt',
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyTokenRestriction',
            'openIDConnectDiscoveryDocument': 'adocument',
            'tokenClaims': 'foo=baz baz=doo fus=rodahh'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --description {description} --issuer {issuer} --audience {audience} --token-key "{tokenKey}" --token-key-type {tokenType} --token-type {restrictionTokenType} --widevine-template "{jsonFile}" --token-claims {tokenClaims} --open-id-connect-discovery-document {openIDConnectDiscoveryDocument} --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odataType', '{configurationODataType}'),
            self.check('options[0].restriction.issuer', '{issuer}'),
            self.check('options[0].restriction.audience', '{audience}'),
            self.check('options[0].restriction.restrictionTokenType', '{restrictionTokenType}'),
            self.check('options[0].restriction.odataType', '{restrictionODataType}'),
            self.check('length(options[0].restriction.requiredClaims)', 3),
            self.check('options[0].restriction.openIdConnectDiscoveryDocument', '{openIDConnectDiscoveryDocument}')
        ])
    def test_ams_streaming_endpoint_create(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep", length=11)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'canadacentral',
            'streamingEndpointName': streaming_endpoint_name,
            'availabilitySetName': 'availaTest',
            'cdnProvider': 'StandardVerizon',
            'cdnProfile': 'testProfile',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 6,
            'tags': 'foo=bar',
            'clientAccessPolicy': '@' + _get_test_data_file('clientAccessPolicy.xml'),
            'crossDomainPolicy': '@' + _get_test_data_file('crossDomainPolicy.xml')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --availability-set-name {availabilitySetName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}"', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('location', 'Canada Central'),
            self.check('availabilitySetName', '{availabilitySetName}'),
            self.check('cdnProvider', '{cdnProvider}'),
            self.check('cdnProfile', '{cdnProfile}'),
            self.check('description', '{description}'),
            self.check('maxCacheAge', '{maxCacheAge}'),
            self.check('scaleUnits', '{scaleUnits}'),
            self.check('length(tags)', 1)
        ])

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}')
    def test_ams_streaming_policy_cenc(self, resource_group, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        streamingPolicyName = self.create_random_name(prefix='spn', length=10)

        self.kwargs.update({
            'streamingPolicyName': streamingPolicyName,
            'protocols': 'HLS SmoothStreaming',
            'clearTracks': '@' + _get_test_data_file('clearTracks.json'),
            'keyToTrackMappings': '@' + _get_test_data_file('keyToTrackMappings.json'),
            'label': 'label',
            'playReadyUrlTemplate': 'playReadyTemplate.foo.bar',
            'playReadyAttributes': 'awesomeAttributes',
            'widevineUrlTemplate': 'widevineTemplate.foo.bar'
        })

        self.cmd('az ams streaming-policy create -a {amsname} -n {streamingPolicyName} -g {rg} --cenc-protocols {protocols} --cenc-clear-tracks "{clearTracks}" --cenc-key-to-track-mappings "{keyToTrackMappings}" --cenc-default-key-label {label} --cenc-play-ready-template {playReadyUrlTemplate} --cenc-play-ready-attributes {playReadyAttributes} --cenc-widevine-template {widevineUrlTemplate}', checks=[
            self.check('name', '{streamingPolicyName}'),
            self.check('commonEncryptionCenc.enabledProtocols.hls', True),
            self.check('commonEncryptionCenc.enabledProtocols.smoothStreaming', True),
            self.check('commonEncryptionCenc.contentKeys.defaultKey.label', '{label}'),
            self.check('commonEncryptionCenc.drm.playReady.customLicenseAcquisitionUrlTemplate', '{playReadyUrlTemplate}'),
            self.check('commonEncryptionCenc.drm.playReady.playReadyCustomAttributes', '{playReadyAttributes}'),
            self.check('commonEncryptionCenc.drm.widevine.customLicenseAcquisitionUrlTemplate', '{widevineUrlTemplate}'),
        ])
    def test_content_key_policy_create_with_token(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'southeastasia',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration',
            'jsonFile': '@' + _get_test_data_file('widevineTemplate.json'),
            'issuer': 'Issuer',
            'audience': 'Audience',
            'tokenKey': _get_test_data_file('rsaToken.pem'),
            'tokenType': 'RSA',
            'restrictionTokenType': 'Jwt',
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyTokenRestriction',
            'openIDConnectDiscoveryDocument': 'adocument',
            'tokenClaims': 'foo=baz baz=doo fus=rodahh'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --description {description} --issuer {issuer} --audience {audience} --token-key "{tokenKey}" --token-key-type {tokenType} --token-type {restrictionTokenType} --widevine-template "{jsonFile}" --token-claims {tokenClaims} --open-id-connect-discovery-document {openIDConnectDiscoveryDocument} --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odatatype', '{configurationODataType}'),
            self.check('options[0].restriction.issuer', '{issuer}'),
            self.check('options[0].restriction.audience', '{audience}'),
            self.check('options[0].restriction.restrictionTokenType', '{restrictionTokenType}'),
            self.check('options[0].restriction.odatatype', '{restrictionODataType}'),
            self.check('length(options[0].restriction.requiredClaims)', 3),
            self.check('options[0].restriction.openIdConnectDiscoveryDocument', '{openIDConnectDiscoveryDocument}')
        ])
    def test_ams_account_filter_list_and_delete(self, storage_account_for_list_and_delete):
        amsname = self.create_random_name(prefix='ams', length=12)
        filter_name_1 = self.create_random_name(prefix='filter', length=12)
        filter_name_2 = self.create_random_name(prefix='filter', length=13)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_list_and_delete,
            'location': 'westus2',
            'filterName1': filter_name_1,
            'filterName2': filter_name_2,
            'bitrate1': 420,
            'bitrate2': 1000,
            'endTimestamp': 100000000,
            'liveBackoffDuration': 60,
            'presentationWindowDuration': 1200000000,
            'startTimestamp': 40000000,
            'timescale': 10000000,
            'tracks': '@' + _get_test_data_file('filterTracks.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 0)
        ])

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName1} --bitrate {bitrate1} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 1)
        ])

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName2} --bitrate {bitrate2} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 2)
        ])

        self.cmd('az ams account-filter delete -a {amsname} -g {rg} -n {filterName2}')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 1)
        ])
    def test_ams_transform_output_add(self, storage_account_for_output_add):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_output_add,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName': transformName,
            'presetName': 'AACGoodQualityAudio',
            'presetPath': _get_test_data_file('customPreset.json'),
            'onError': 'ContinueJob',
            'relativePriority': 'High'
        })

        self.cmd('az ams transform create -a {amsname} -n {transformName} -g {rg} --preset {presetName}')

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset "{presetPath}" --on-error {onError} --relative-priority {relativePriority}', checks=[
            self.check('outputs[1].onError', '{onError}'),
            self.check('outputs[1].relativePriority', '{relativePriority}')
        ])

        self.kwargs.update({
            'presetName': 'AudioAnalyzer',
            'presetName2': 'VideoAnalyzer',
            'audioLanguage': 'es-ES',
            'audioLanguage2': 'en-US',
            'insightsToExtract': 'AudioInsightsOnly'
        })

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName} --audio-language {audioLanguage}', checks=[
            self.check('outputs[2].preset.audioLanguage', '{audioLanguage}')
        ])

        self.cmd('az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName2} --audio-language {audioLanguage2} --insights-to-extract {insightsToExtract}', checks=[
            self.check('outputs[3].preset.audioLanguage', '{audioLanguage2}'),
            self.check('outputs[3].preset.insightsToExtract', '{insightsToExtract}')
        ])
    def test_ams_account_filter_list_and_delete(self, storage_account_for_list_and_delete):
        amsname = self.create_random_name(prefix='ams', length=12)
        filter_name_1 = self.create_random_name(prefix='filter', length=12)
        filter_name_2 = self.create_random_name(prefix='filter', length=13)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_list_and_delete,
            'location': 'southcentralus',
            'filterName1': filter_name_1,
            'filterName2': filter_name_2,
            'bitrate1': 420,
            'bitrate2': 1000,
            'endTimestamp': 100000000,
            'liveBackoffDuration': 60,
            'presentationWindowDuration': 1200000000,
            'startTimestamp': 40000000,
            'timescale': 10000000,
            'tracks': '@' + _get_test_data_file('filterTracks.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 0)
        ])

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName1} --bitrate {bitrate1} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 1)
        ])

        self.cmd('az ams account-filter create -a {amsname} -g {rg} -n {filterName2} --bitrate {bitrate2} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 2)
        ])

        self.cmd('az ams account-filter delete -a {amsname} -g {rg} -n {filterName2}')

        self.cmd('az ams account-filter list -a {amsname} -g {rg}', checks=[
            self.check('length(@)', 1)
        ])
    def test_content_key_policy_create_with_playready_fail(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'japanwest',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'playReadyPath': '@' + _get_test_data_file('invalidPlayReadyTemplate.json'),
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        with self.assertRaises(CLIError):
            self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg}  --open-restriction --play-ready-template "{playReadyPath}" --description {description} --policy-option-name {policyOptionName}')
    def test_content_key_policy_create_with_widevine(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration',
            'jsonFile': '@' + _get_test_data_file('widevineTemplate.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --description {description} --widevine-template "{jsonFile}" --open-restriction --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odataType', '{configurationODataType}')
        ])
    def test_content_key_policy_create_with_widevine(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyWidevineConfiguration',
            'jsonFile': '@' + _get_test_data_file('widevineTemplate.json')
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg} --description {description} --widevine-template "{jsonFile}" --open-restriction --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odatatype', '{configurationODataType}')
        ])
    def test_ams_transform_create_custom_preset_invalid(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}', checks=[
            self.check('name', '{amsname}'),
            self.check('location', 'West US 2')
        ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName': transformName,
            'invalidPresetPath': _get_test_data_file('invalidCustomPreset.json')
        })

        with self.assertRaises(CLIError):
            self.cmd('az ams transform create -a {amsname} -n {transformName} -g {rg} --preset "{invalidPresetPath}"')
Ejemplo n.º 33
0
    def test_ams_streaming_endpoint_update(self, storage_account_for_create):
        if sys.version_info.major == 2:  # azure-cli/issues/9386
            return
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep",
                                                          length=11)

        self.kwargs.update({
            'amsname':
            amsname,
            'storageAccount':
            storage_account_for_create,
            'location':
            'australiaeast',
            'streamingEndpointName':
            streaming_endpoint_name,
            'availabilitySetName':
            'availaTest',
            'cdnProvider':
            'StandardVerizon',
            'cdnProfile':
            'testProfile',
            'description':
            'test streaming description',
            'maxCacheAge':
            11,
            'scaleUnits':
            5,
            'tags':
            'foo=bar',
            'clientAccessPolicy':
            self._normalize_filename(
                _get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy':
            self._normalize_filename(
                _get_test_data_file('crossDomainPolicy.xml')),
            'ip':
            '4.4.4.4'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )

        self.cmd(
            'az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --availability-set-name {availabilitySetName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy @"{clientAccessPolicy}" --cross-domain-policy @"{crossDomainPolicy}"',
            checks=[
                self.check('name', '{streamingEndpointName}'),
                self.check('resourceGroup', '{rg}'),
                self.check('location', 'Australia East'),
                self.check('availabilitySetName', '{availabilitySetName}'),
                self.check('cdnProvider', '{cdnProvider}'),
                self.check('cdnProfile', '{cdnProfile}'),
                self.check('description', '{description}'),
                self.check('maxCacheAge', '{maxCacheAge}'),
                self.check('scaleUnits', '{scaleUnits}'),
                self.check('length(tags)', 1)
            ])

        with self.assertRaises(CLIError):
            self.cmd(
                'az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --add access_control.ip.allow {ip}'
            )

        self.kwargs.update({
            'streamingEndpointName':
            streaming_endpoint_name,
            'availabilitySetName':
            'availaTest2',
            'cdnProvider':
            'PremiumVerizon',
            'cdnProfile':
            'testProfile2',
            'description':
            'test streaming description2',
            'maxCacheAge':
            9,
            'tags':
            'foo2=bar2 foo3=bar3',
            'clientAccessPolicy':
            self._normalize_filename(
                _get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy':
            self._normalize_filename(
                _get_test_data_file('crossDomainPolicy.xml')),
            'ips':
            '1.1.1.1 2.2.2.2 192.168.0.0/28'
        })

        self.cmd(
            'az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --tags {tags} --client-access-policy @"{clientAccessPolicy}" --cross-domain-policy @"{crossDomainPolicy}"',
            checks=[
                self.check('name', '{streamingEndpointName}'),
                self.check('cdnProvider', '{cdnProvider}'),
                self.check('cdnProfile', '{cdnProfile}'),
                self.check('description', '{description}'),
                self.check('maxCacheAge', '{maxCacheAge}'),
                self.check('length(tags)', 2)
            ])

        self.cmd(
            'az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --ips {ips} --disable-cdn'
        )

        self.cmd(
            'az ams streaming-endpoint show -g {rg} -a {amsname} -n {streamingEndpointName}',
            checks=[
                self.check('name', '{streamingEndpointName}'),
                self.check('cdnProvider', None),
                self.check('cdnProfile', ''),
                self.check('cdnEnabled', False),
                self.check('length(accessControl.ip.allow)', 3),
                self.check('accessControl.ip.allow[2].address', '192.168.0.0'),
                self.check('accessControl.ip.allow[2].subnetPrefixLength',
                           '28')
            ])

        self.cmd(
            'az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}'
        )
    def test_ams_streaming_endpoint_update(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        streaming_endpoint_name = self.create_random_name(prefix="strep", length=11)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'australiaeast',
            'streamingEndpointName': streaming_endpoint_name,
            'availabilitySetName': 'availaTest',
            'cdnProvider': 'StandardVerizon',
            'cdnProfile': 'testProfile',
            'description': 'test streaming description',
            'maxCacheAge': 11,
            'scaleUnits': 5,
            'tags': 'foo=bar',
            'clientAccessPolicy': '@' + self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': '@' + self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml')),
            'ip': '4.4.4.4'
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams streaming-endpoint create -g {rg} -a {amsname} -n {streamingEndpointName} --availability-set-name {availabilitySetName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --scale-units {scaleUnits} --tags "{tags}" --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}"', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('resourceGroup', '{rg}'),
            self.check('location', 'Australia East'),
            self.check('availabilitySetName', '{availabilitySetName}'),
            self.check('cdnProvider', '{cdnProvider}'),
            self.check('cdnProfile', '{cdnProfile}'),
            self.check('description', '{description}'),
            self.check('maxCacheAge', '{maxCacheAge}'),
            self.check('scaleUnits', '{scaleUnits}'),
            self.check('length(tags)', 1)
        ])

        with self.assertRaises(CLIError):
            self.cmd('az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --add access_control.ip.allow {ip}')

        self.kwargs.update({
            'streamingEndpointName': streaming_endpoint_name,
            'availabilitySetName': 'availaTest2',
            'cdnProvider': 'PremiumVerizon',
            'cdnProfile': 'testProfile2',
            'description': 'test streaming description2',
            'maxCacheAge': 9,
            'tags': 'foo2=bar2 foo3=bar3',
            'clientAccessPolicy': '@' + self._normalize_filename(_get_test_data_file('clientAccessPolicy.xml')),
            'crossDomainPolicy': '@' + self._normalize_filename(_get_test_data_file('crossDomainPolicy.xml')),
            'ips': '1.1.1.1 2.2.2.2 192.168.0.0/28'
        })

        self.cmd('az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --cdn-provider {cdnProvider} --cdn-profile {cdnProfile} --description "{description}" --max-cache-age {maxCacheAge} --tags {tags} --client-access-policy "{clientAccessPolicy}" --cross-domain-policy "{crossDomainPolicy}"', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('cdnProvider', '{cdnProvider}'),
            self.check('cdnProfile', '{cdnProfile}'),
            self.check('description', '{description}'),
            self.check('maxCacheAge', '{maxCacheAge}'),
            self.check('length(tags)', 2)
        ])

        self.cmd('az ams streaming-endpoint update -g {rg} -a {amsname} -n {streamingEndpointName} --ips {ips} --disable-cdn')

        self.cmd('az ams streaming-endpoint show -g {rg} -a {amsname} -n {streamingEndpointName}', checks=[
            self.check('name', '{streamingEndpointName}'),
            self.check('cdnProvider', None),
            self.check('cdnProfile', ''),
            self.check('cdnEnabled', False),
            self.check('length(accessControl.ip.allow)', 3),
            self.check('accessControl.ip.allow[2].address', '192.168.0.0'),
            self.check('accessControl.ip.allow[2].subnetPrefixLength', '28')
        ])

        self.cmd('az ams streaming-endpoint delete -g {rg} -a {amsname} -n {streamingEndpointName}')
Ejemplo n.º 35
0
    def test_ams_transform_output_add(self, storage_account_for_output_add):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_output_add,
            'location': 'japaneast'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName':
            transformName,
            'presetName':
            'AACGoodQualityAudio',
            'presetPath':
            _get_test_data_file('customPreset.json'),
            'onError':
            'ContinueJob',
            'relativePriority':
            'High'
        })

        self.cmd(
            'az ams transform create -a {amsname} -n {transformName} -g {rg} --preset {presetName}'
        )

        self.cmd(
            'az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset "{presetPath}" --on-error {onError} --relative-priority {relativePriority}',
            checks=[
                self.check('outputs[1].onError', '{onError}'),
                self.check('outputs[1].relativePriority', '{relativePriority}')
            ])

        self.kwargs.update({
            'presetName': 'AudioAnalyzer',
            'presetName2': 'VideoAnalyzer',
            'audioLanguage': 'es-ES',
            'audioLanguage2': 'en-US',
            'insightsToExtract': 'AudioInsightsOnly'
        })

        self.cmd(
            'az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName} --audio-language {audioLanguage}',
            checks=[
                self.check('outputs[2].preset.audioLanguage',
                           '{audioLanguage}')
            ])

        self.cmd(
            'az ams transform output add -a {amsname} -n {transformName} -g {rg} --preset {presetName2} --audio-language {audioLanguage2} --insights-to-extract {insightsToExtract}',
            checks=[
                self.check('outputs[3].preset.audioLanguage',
                           '{audioLanguage2}'),
                self.check('outputs[3].preset.insightsToExtract',
                           '{insightsToExtract}')
            ])
Ejemplo n.º 36
0
    def test_ams_transform(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'southindia'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}',
            checks=[
                self.check('name', '{amsname}'),
                self.check('location', 'South India')
            ])

        transformName = self.create_random_name(prefix='tra', length=10)

        self.kwargs.update({
            'transformName':
            transformName,
            'presetName':
            'AACGoodQualityAudio',
            'presetPath':
            _get_test_data_file('customPreset.json')
        })

        self.cmd(
            'az ams transform create -a {amsname} -n {transformName} -g {rg} --preset {presetName}',
            checks=[
                self.check('name', '{transformName}'),
                self.check('resourceGroup', '{rg}'),
                self.check('length(outputs)', 1)
            ])

        self.cmd(
            'az ams transform show -a {amsname} -n {transformName} -g {rg}',
            checks=[
                self.check('name', '{transformName}'),
                self.check('resourceGroup', '{rg}')
            ])

        self.cmd(
            'az ams transform update --description mydesc -a {amsname} -n {transformName} -g {rg}',
            checks=[
                self.check('name', '{transformName}'),
                self.check('resourceGroup', '{rg}'),
                self.check('description', 'mydesc')
            ])

        self.cmd(
            'az ams transform output add --preset "{presetPath}" -a {amsname} -n {transformName} -g {rg}',
            checks=[
                self.check('name', '{transformName}'),
                self.check('resourceGroup', '{rg}'),
                self.check('length(outputs)', 2)
            ])

        self.cmd(
            'az ams transform output remove --output-index 0 -a {amsname} -n {transformName} -g {rg}',
            checks=[
                self.check('name', '{transformName}'),
                self.check('resourceGroup', '{rg}'),
                self.check('length(outputs)', 1)
            ])

        list = self.cmd(
            'az ams transform list -a {amsname} -g {rg}').get_output_in_json()
        assert len(list) > 0

        self.cmd(
            'az ams transform delete -n {transformName} -a {amsname} -g {rg}')
    def test_ams_streaming_policy_cenc_default_drm(self, resource_group,
                                                   storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'westus2'
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}',
            checks=[
                self.check('name', '{amsname}'),
                self.check('location', 'West US 2')
            ])

        policy_option_name1 = self.create_random_name(prefix='pon', length=12)
        policy_option_name2 = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'description':
            'ExampleDescription',
            'playReadyPath':
            '@' + _get_test_data_file('validPlayReadyTemplate.json'),
            'policyNameFromKeyToTrackMappings1':
            'ckp',
            'policyNameFromKeyToTrackMappings2':
            'demoPolicy15',
            'policyOptionName1':
            policy_option_name1,
            'policyOptionName2':
            policy_option_name2
        })

        self.cmd(
            'az ams content-key-policy create -a {amsname} -n {policyNameFromKeyToTrackMappings1} -g {rg} --description {description} --open-restriction --play-ready-template "{playReadyPath}"  --policy-option-name {policyOptionName1}',
            checks=[self.check('name', '{policyNameFromKeyToTrackMappings1}')])

        self.cmd(
            'az ams content-key-policy create -a {amsname} -n {policyNameFromKeyToTrackMappings2} -g {rg} --description {description} --open-restriction --clear-key-configuration --policy-option-name {policyOptionName2}',
            checks=[self.check('name', '{policyNameFromKeyToTrackMappings2}')])

        streamingPolicyName = self.create_random_name(prefix='spn', length=10)

        self.kwargs.update({
            'streamingPolicyName':
            streamingPolicyName,
            'protocols':
            'HLS SmoothStreaming',
            'clearTracks':
            '@' + _get_test_data_file('clearTracks.json'),
            'keyToTrackMappings':
            '@' + _get_test_data_file('keyToTrackMappings.json'),
            'label':
            'label',
            'playReadyUrlTemplate':
            'playReadyTemplate.foo.bar',
            'playReadyAttributes':
            'awesomeAttributes'
        })

        self.cmd(
            'az ams streaming-policy create -a {amsname} -n {streamingPolicyName} -g {rg} --cenc-protocols {protocols} --cenc-clear-tracks "{clearTracks}" --cenc-key-to-track-mappings "{keyToTrackMappings}" --cenc-default-key-label {label}',
            checks=[
                self.check('name', '{streamingPolicyName}'),
                self.check('commonEncryptionCenc.enabledProtocols.hls', True),
                self.check(
                    'commonEncryptionCenc.enabledProtocols.smoothStreaming',
                    True),
                self.check('commonEncryptionCenc.contentKeys.defaultKey.label',
                           '{label}'),
                self.check(
                    'commonEncryptionCenc.drm.playReady.customLicenseAcquisitionUrlTemplate',
                    None),
                self.check(
                    'commonEncryptionCenc.drm.playReady.playReadyCustomAttributes',
                    None),
                self.check(
                    'commonEncryptionCenc.drm.widevine.customLicenseAcquisitionUrlTemplate',
                    None),
            ])
    def test_content_key_policy_create_with_playready_success(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_create,
            'location': 'japaneast',
            'contentKeyPolicyName': policy_name,
            'description': 'ExampleDescription',
            'policyOptionName': policy_option_name,
            'configurationODataType': '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration',
            'restrictionODataType': '#Microsoft.Media.ContentKeyPolicyOpenRestriction',
            'playReadyPath': '@' + _get_test_data_file('validPlayReadyTemplate.json'),
            'responseCustomData': 'custom data',
            'allowTestDevices': True,
            'beginDate': None,
            'expirationDate': '2098-09-15T18:53:00+00:00',
            'relativeBeginDate': '1:01:01',
            'relativeExpirationDate': None,
            'gracePeriod': '2:02:02',
            'licenseType': 'Persistent',
            'contentType': 'Unspecified',
            'keyLocationODataType': '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier',
            'keyId': '12345678-aaaa-bbbb-cccc-ddddeeeeffff',
            'firstPlayExpiration': '12:00:00',
            'scmsRestriction': 1,
            'agcAndColorStripeRestriction': 2,
            'digitalVideoOnlyContentRestriction': False,
            'imageConstraintForAnalogComponentVideoRestriction': False,
            'imageConstraintForAnalogComputerMonitorRestriction': False,
            'allowPassingVideoContentToUnknownOutput': 'Allowed',
            'uncompressedDigitalVideoOpl': 300,
            'compressedDigitalVideoOpl': 500,
            'analogVideoOpl': 200,
            'compressedDigitalAudioOpl': 300,
            'uncompressedDigitalAudioOpl': 300,
            'bestEffort': True,
            'configurationData': 0
        })

        self.cmd('az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}')

        self.cmd('az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg}  --open-restriction --play-ready-template "{playReadyPath}" --description {description} --policy-option-name {policyOptionName}', checks=[
            self.check('name', '{contentKeyPolicyName}'),
            self.check('options[0].configuration.odatatype', '{configurationODataType}'),
            self.check('options[0].restriction.odatatype', '{restrictionODataType}'),
            self.check('options[0].configuration.responseCustomData', '{responseCustomData}'),
            self.check('options[0].configuration.licenses[0].allowTestDevices', '{allowTestDevices}'),
            self.check('options[0].configuration.licenses[0].beginDate', '{beginDate}'),
            self.check('options[0].configuration.licenses[0].expirationDate', '{expirationDate}'),
            self.check('options[0].configuration.licenses[0].relativeBeginDate', '{relativeBeginDate}'),
            self.check('options[0].configuration.licenses[0].relativeExpirationDate', '{relativeExpirationDate}'),
            self.check('options[0].configuration.licenses[0].gracePeriod', '{gracePeriod}'),
            self.check('options[0].configuration.licenses[0].licenseType', '{licenseType}'),
            self.check('options[0].configuration.licenses[0].contentType', '{contentType}'),
            self.check('options[0].configuration.licenses[0].contentKeyLocation.odatatype', '{keyLocationODataType}'),
            self.check('options[0].configuration.licenses[0].contentKeyLocation.keyId', '{keyId}'),
            self.check('options[0].configuration.licenses[0].playRight.firstPlayExpiration', '{firstPlayExpiration}'),
            self.check('options[0].configuration.licenses[0].playRight.scmsRestriction', '{scmsRestriction}'),
            self.check('options[0].configuration.licenses[0].playRight.agcAndColorStripeRestriction', '{agcAndColorStripeRestriction}'),
            self.check('options[0].configuration.licenses[0].playRight.digitalVideoOnlyContentRestriction', '{digitalVideoOnlyContentRestriction}'),
            self.check('options[0].configuration.licenses[0].playRight.imageConstraintForAnalogComponentVideoRestriction', '{imageConstraintForAnalogComponentVideoRestriction}'),
            self.check('options[0].configuration.licenses[0].playRight.imageConstraintForAnalogComputerMonitorRestriction', '{imageConstraintForAnalogComputerMonitorRestriction}'),
            self.check('options[0].configuration.licenses[0].playRight.allowPassingVideoContentToUnknownOutput', '{allowPassingVideoContentToUnknownOutput}'),
            self.check('options[0].configuration.licenses[0].playRight.uncompressedDigitalVideoOpl', '{uncompressedDigitalVideoOpl}'),
            self.check('options[0].configuration.licenses[0].playRight.compressedDigitalVideoOpl', '{compressedDigitalVideoOpl}'),
            self.check('options[0].configuration.licenses[0].playRight.analogVideoOpl', '{analogVideoOpl}'),
            self.check('options[0].configuration.licenses[0].playRight.compressedDigitalAudioOpl', '{compressedDigitalAudioOpl}'),
            self.check('options[0].configuration.licenses[0].playRight.uncompressedDigitalAudioOpl', '{uncompressedDigitalAudioOpl}'),
            self.check('options[0].configuration.licenses[0].playRight.explicitAnalogTelevisionOutputRestriction.bestEffort', '{bestEffort}'),
            self.check('options[0].configuration.licenses[0].playRight.explicitAnalogTelevisionOutputRestriction.configurationData', '{configurationData}')
        ])
Ejemplo n.º 39
0
    def test_content_key_policy_create_with_playready_success(
            self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        policy_name = self.create_random_name(prefix='pn', length=12)
        policy_option_name = self.create_random_name(prefix='pon', length=12)

        self.kwargs.update({
            'amsname':
            amsname,
            'storageAccount':
            storage_account_for_create,
            'location':
            'westus2',
            'contentKeyPolicyName':
            policy_name,
            'description':
            'ExampleDescription',
            'policyOptionName':
            policy_option_name,
            'configurationODataType':
            '#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration',
            'restrictionODataType':
            '#Microsoft.Media.ContentKeyPolicyOpenRestriction',
            'playReadyPath':
            '@' + _get_test_data_file('validPlayReadyTemplate.json'),
            'responseCustomData':
            'custom data',
            'allowTestDevices':
            True,
            'beginDate':
            None,
            'expirationDate':
            '2098-09-15T18:53:00+00:00',
            'relativeBeginDate':
            '1:01:01',
            'relativeExpirationDate':
            None,
            'gracePeriod':
            '2:02:02',
            'licenseType':
            'Persistent',
            'contentType':
            'Unspecified',
            'keyLocationODataType':
            '#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier',
            'keyId':
            '12345678-aaaa-bbbb-cccc-ddddeeeeffff',
            'firstPlayExpiration':
            '12:00:00',
            'scmsRestriction':
            1,
            'agcAndColorStripeRestriction':
            2,
            'digitalVideoOnlyContentRestriction':
            False,
            'imageConstraintForAnalogComponentVideoRestriction':
            False,
            'imageConstraintForAnalogComputerMonitorRestriction':
            False,
            'allowPassingVideoContentToUnknownOutput':
            'Allowed',
            'uncompressedDigitalVideoOpl':
            300,
            'compressedDigitalVideoOpl':
            500,
            'analogVideoOpl':
            200,
            'compressedDigitalAudioOpl':
            300,
            'uncompressedDigitalAudioOpl':
            300,
            'bestEffort':
            True,
            'configurationData':
            0
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )

        self.cmd(
            'az ams content-key-policy create -a {amsname} -n {contentKeyPolicyName} -g {rg}  --open-restriction --play-ready-template "{playReadyPath}" --description {description} --policy-option-name {policyOptionName}',
            checks=[
                self.check('name', '{contentKeyPolicyName}'),
                self.check('options[0].configuration.odatatype',
                           '{configurationODataType}'),
                self.check('options[0].restriction.odatatype',
                           '{restrictionODataType}'),
                self.check('options[0].configuration.responseCustomData',
                           '{responseCustomData}'),
                self.check(
                    'options[0].configuration.licenses[0].allowTestDevices',
                    '{allowTestDevices}'),
                self.check('options[0].configuration.licenses[0].beginDate',
                           '{beginDate}'),
                self.check(
                    'options[0].configuration.licenses[0].expirationDate',
                    '{expirationDate}'),
                self.check(
                    'options[0].configuration.licenses[0].relativeBeginDate',
                    '{relativeBeginDate}'),
                self.check(
                    'options[0].configuration.licenses[0].relativeExpirationDate',
                    '{relativeExpirationDate}'),
                self.check('options[0].configuration.licenses[0].gracePeriod',
                           '{gracePeriod}'),
                self.check('options[0].configuration.licenses[0].licenseType',
                           '{licenseType}'),
                self.check('options[0].configuration.licenses[0].contentType',
                           '{contentType}'),
                self.check(
                    'options[0].configuration.licenses[0].contentKeyLocation.odatatype',
                    '{keyLocationODataType}'),
                self.check(
                    'options[0].configuration.licenses[0].contentKeyLocation.keyId',
                    '{keyId}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.firstPlayExpiration',
                    '{firstPlayExpiration}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.scmsRestriction',
                    '{scmsRestriction}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.agcAndColorStripeRestriction',
                    '{agcAndColorStripeRestriction}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.digitalVideoOnlyContentRestriction',
                    '{digitalVideoOnlyContentRestriction}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.imageConstraintForAnalogComponentVideoRestriction',
                    '{imageConstraintForAnalogComponentVideoRestriction}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.imageConstraintForAnalogComputerMonitorRestriction',
                    '{imageConstraintForAnalogComputerMonitorRestriction}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.allowPassingVideoContentToUnknownOutput',
                    '{allowPassingVideoContentToUnknownOutput}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.uncompressedDigitalVideoOpl',
                    '{uncompressedDigitalVideoOpl}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.compressedDigitalVideoOpl',
                    '{compressedDigitalVideoOpl}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.analogVideoOpl',
                    '{analogVideoOpl}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.compressedDigitalAudioOpl',
                    '{compressedDigitalAudioOpl}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.uncompressedDigitalAudioOpl',
                    '{uncompressedDigitalAudioOpl}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.explicitAnalogTelevisionOutputRestriction.bestEffort',
                    '{bestEffort}'),
                self.check(
                    'options[0].configuration.licenses[0].playRight.explicitAnalogTelevisionOutputRestriction.configurationData',
                    '{configurationData}')
            ])
    def test_ams_asset_filter_update(self, storage_account_for_update):
        amsname = self.create_random_name(prefix='ams', length=12)
        container = self.create_random_name(prefix='cont', length=8)

        self.kwargs.update({
            'amsname': amsname,
            'storageAccount': storage_account_for_update,
            'location': 'japaneast',
            'container': container
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )
        self.cmd(
            'az ams account storage add -a {amsname} -g {rg} -n {storageAccount}'
        )

        asset_name = self.create_random_name(prefix='asset', length=12)
        alternate_id = self.create_random_name(prefix='aid', length=12)
        description = self.create_random_name(prefix='desc', length=12)

        self.kwargs.update({
            'asset_name': asset_name,
            'alternate_id': alternate_id,
            'description': description
        })

        self.cmd(
            'az ams asset create -a {amsname} -n {asset_name} -g {rg} --description {description} --alternate-id {alternate_id} --storage-account {storageAccount} --container {container}'
        )

        filter_name = self.create_random_name(prefix='filter', length=12)

        self.kwargs.update({
            'filter_name':
            filter_name,
            'bitrate':
            420,
            'endTimestamp':
            100000000,
            'liveBackoffDuration':
            60,
            'presentationWindowDuration':
            1200000000,
            'startTimestamp':
            40000000,
            'timescale':
            10000000,
            'tracks':
            '@' + _get_test_data_file('filterTracks.json'),
            'newBitrate':
            1000,
            'newStartTimestamp':
            40000001,
            'newEndTimestamp':
            100000001,
            'newTrackOperation':
            'Equal',
            'newTrackProperty':
            'FourCC',
            'newTrackValue':
            'EC-3'
        })

        self.cmd(
            'az ams asset-filter create -a {amsname} --asset-name {asset_name} -g {rg} -n {filter_name} --first-quality {bitrate} --end-timestamp {endTimestamp} --live-backoff-duration {liveBackoffDuration} --presentation-window-duration {presentationWindowDuration} --start-timestamp {startTimestamp} --timescale {timescale} --tracks "{tracks}"'
        )

        # Use deprecated --bitrate parameter to see the deprecation message. Update when fully deprecated.
        self.cmd(
            'az ams asset-filter update -a {amsname} --asset-name {asset_name} -g {rg} -n {filter_name} --bitrate {newBitrate} --start-timestamp {newStartTimestamp} --end-timestamp {newEndTimestamp} --set tracks[1].trackSelections[0].operation={newTrackOperation} tracks[1].trackSelections[0].property={newTrackProperty} tracks[1].trackSelections[0].value={newTrackValue}',
            checks=[
                self.check('firstQuality.bitrate', '{newBitrate}'),
                self.check('name', '{filter_name}'),
                self.check('presentationTimeRange.endTimestamp',
                           '{newEndTimestamp}'),
                self.check('presentationTimeRange.liveBackoffDuration',
                           '{liveBackoffDuration}'),
                self.check('presentationTimeRange.presentationWindowDuration',
                           '{presentationWindowDuration}'),
                self.check('presentationTimeRange.startTimestamp',
                           '{newStartTimestamp}'),
                self.check('presentationTimeRange.timescale', '{timescale}'),
                self.check('tracks[0].trackSelections[0].operation', 'Equal'),
                self.check('tracks[0].trackSelections[0].property', 'FourCC'),
                self.check('tracks[0].trackSelections[0].value', 'AVC1'),
                self.check('tracks[1].trackSelections[0].operation',
                           '{newTrackOperation}'),
                self.check('tracks[1].trackSelections[0].property',
                           '{newTrackProperty}'),
                self.check('tracks[1].trackSelections[0].value',
                           '{newTrackValue}'),
                self.check('tracks[1].trackSelections[1].operation', 'Equal'),
                self.check('tracks[1].trackSelections[1].property', 'FourCC'),
                self.check('tracks[1].trackSelections[1].value', 'MP4A')
            ])
    def test_ams_asset_track_show(self, storage_account_for_create):
        amsname = self.create_random_name(prefix='ams', length=12)
        outputContainer = self.create_random_name(prefix='output', length=14)

        self.kwargs.update({
            'amsname':
            amsname,
            'storageAccount':
            storage_account_for_create,
            'location':
            'westeurope',
            'outputContainer':
            outputContainer,
            'assetTrackFilePath':
            _get_test_data_file('assetTrack.ttml'),
            'assetTrackFileName':
            'assetTrack.ttml',
            'sampleIsmFilePath':
            _get_test_data_file('sampleIsmFile.ism'),
            'trackName':
            self.create_random_name(prefix='track', length=12)
        })

        self.cmd(
            'az ams account create -n {amsname} -g {rg} --storage-account {storageAccount} -l {location}'
        )
        self.cmd(
            'az ams account storage add -a {amsname} -g {rg} -n {storageAccount}'
        )

        outputAssetName = self.create_random_name(prefix='asset', length=12)

        self.kwargs.update({'outputAssetName': outputAssetName})

        self.cmd(
            'az ams asset create -a {amsname} -n {outputAssetName} -g {rg} --container {outputContainer}'
        )

        self.kwargs['storage_key'] = str(
            self.cmd(
                'az storage account keys list -n {storageAccount} -g {rg} --query "[0].value"'
            ).output)

        self.cmd(
            'az storage blob upload --no-progress --account-name {storageAccount} --container {outputContainer} --file "{assetTrackFilePath}" --name {assetTrackFileName} --account-key {storage_key}'
        )

        self.cmd(
            'az storage blob upload --no-progress --account-name {storageAccount} --container {outputContainer} --file "{sampleIsmFilePath}" --account-key {storage_key}'
        )

        _RETRY_TIMES = 5
        for retry_time in range(0, _RETRY_TIMES):
            try:
                self.cmd(
                    'az ams asset-track create -a {amsname} -g {rg} --track-name {trackName} --track-type Text --asset-name {outputAssetName} --file-name {assetTrackFileName}',
                    checks=[
                        self.check('name', '{trackName}'),
                        self.check('track.fileName', '{assetTrackFileName}')
                    ])
                self.cmd(
                    'az ams asset-track show -a {amsname} -g {rg} --track-name {trackName} --asset-name {outputAssetName}',
                    checks=[self.check('name', '{trackName}')])
                break
            except Exception:  # pylint: disable=broad-except
                if retry_time < _RETRY_TIMES:
                    time.sleep(10)
                else:
                    raise