Prisma has been designed to natively support SCTE-224 ingest and provision programming event metadata. Prisma supports SCTE-224 version 2015.

SCTE-224 resources such as Media, Media Point, Audience, Viewing Policy and Policy shall be sent to Prisma at the following based URL endpoint: http\://\[prisma.controller.ip]:\[port]/api/esni/viewingPolicyManagers/\[prisma.service.name]

_Example_: `http://controller.example:8080/api/esni/viewingPolicyManagers/Provider1` where `Provider1` is the name provided to the Viewing Policy Manager service.

To configure SCTE-224 ingest, follow these steps:

1. Add a **Viewing Policy Manager** service.
2. Configure a **Name**: the name is important as it will be part of the endpoint used by the content provider to push SCTE-224 resources (Media, Media Points, Viewing Policy, Policy and Audience).
3. Select **SCTE-224 (ESNI)** from the **Import type** drop-down list.
4. Select **Save and exit** to return to **Services**.
5. Assign a server to run your service.

Once the service is started, SCTE-224 resources can be sent to Prisma at designated endpoint.

<blockquote data-callout="note"><strong>Note</strong><p>Compared to <a href="/traditional-products-and-appliances/components/vpm/ingest/manual-configuration">Manual configuration</a>, instead of manually configuring programming event data (blackout restriction, ad playlist etc.), everything will be ingested automatically.</p></blockquote>

## Examples

The following sections shows simple resources samples that are loaded onto Prisma, and the results from a web UI standpoint.

### Example of Media element configuration

To configure **Media** element, proceed as follows:

1. Select the **Media** tab.
2. Select **Add** to add a media resource.

<blockquote data-callout="note"><strong>Note</strong><p>See <a href="/traditional-products-and-appliances/components/vpm/ingest/manual-configuration#configure-a-media-element">Configure a Media element</a> for a description of the different fields.</p></blockquote>

3. Select **Ok**.

### Examples of Audience configuration

The examples below are basic use cases of SCTE-224 audience resources sent by the programmer to Prisma (specifying HTTP command, endpoint, as well as the body of the request, which is the resource itself).

#### Audience “State of Florida”

- Audience “State of Florida” is a list of ZIP codes
- **Audience ID**: /provider/audience/location/fl

```http
PUT  http://controller.example:8080/api/esni/viewingPolicyManagers/Provider1/provider/audience/location/fl
```

```xml
<Audience lastUpdated="2020-04-03T12:59:10.395Z" description="State of Florida" id="/provider/audience/location/fl" match="ANY" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:audience="urn:scte:224:audience">
    <Zip>33002</Zip>
    <Zip>33018</Zip>
</Audience>
```

To configure the Audience element, follow these steps:

1. go to the **Audience** tab and edit the resource to check the results:

<blockquote data-callout="note"><strong>Note</strong><p>See <a href="/traditional-products-and-appliances/components/vpm/ingest/manual-configuration#configure-an-audience">Configure an Audience</a> for a description of the different fields.</p></blockquote>

#### Audience “No Travel Restrictions”

- Audience “No Travel Restrictions” is a single ZIP with **Match** set to **None**
- **Audience ID**: /provider/audience/location/any

```http
PUT  http://controller.example:8080/api/esni/viewingPolicyManagers/Provider1/provider/audience/location/any
```

```xml
<Audience lastUpdated="2020-04-03T12:59:10.395Z" match="NONE" description="No Travel Restrictions" id="/provider/audience/location/any" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:audience="urn:scte:224:audience">
    <audience:Zip>00000</audience:Zip>
</Audience>
```

### Example of viewing policy configuration

Blackout Viewing Policy:

- Viewing policy “Blackout users in Florida”

- Action of type content (default blackout urn) over “State of Florida” audience

```xml
<ViewingPolicy lastUpdated="2020-04-03T12:59:10.395Z" description="Blackout users in Florida" id="/provider/viewingpolicy/location/fl/blackout" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:action="urn:scte:224:action" xmlns:xlink="http://www.w3.org/1999/xlink">
    <action:Content>urn:scte:224:action:blackout</action:Content>
    <Audience xlink:href="/provider/audience/location/fl"></Audience>
</ViewingPolicy>
```

To configure a Viewing policy, follow these steps:

1. Go to the **Viewing Policy** tab, and edit the resource to check the results:

<blockquote data-callout="note"><strong>Note</strong><p>See <a href="/traditional-products-and-appliances/components/vpm/ingest/manual-configuration#configure-a-viewing-policy">Configure a Viewing Policy</a> for a description of the different fields.</p></blockquote>

### Examples of policy

Policy “blackout”

- Policy “Blackout users in Florida”

  ```xml
  <Policy lastUpdated="2020-04-03T12:59:10.395Z" description="Blackout users in Florida" id="/provider/policy/location/fl/blackout" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:xlink="http://www.w3.org/1999/xlink">
      <ViewingPolicy xlink:href="/provider/viewingpolicy/location/fl/blackout"></ViewingPolicy>
  </Policy>
  ```

To configure Policy element, follow these steps:

1. Go to the **Policy** tab, and edit the resource to check the results:

<blockquote data-callout="note"><strong>Note</strong><p>See <a href="/traditional-products-and-appliances/components/vpm/ingest/manual-configuration#configure-a-policy">Configure a Policy</a> for a description of the different fields.</p></blockquote>

### Example of Media Point

Audience, viewing policy and policy resources are positioned. Media points can be provisioned to schedule the application or removal of a given policy to enable blackout for instance. This scheduling can be:

- Time-based (using @matchTime for instance)
- And/or Signal-based (using @matchSignal)

Two media points are usually created to identify the beginning and end of a given event restriction:

- Media point start
- Media point end

#### Media point start

- @matchTime indicating the time blackout is supposed to start
- @effective and @expires define the validity window for SCTE-35 matching
- @matchSignal indicates SCTE-35 matching criteria **(SegmentationTypeID = 16 (program start))**

```http
PUT  http://controller.example:8080/api/esni/viewingPolicyManagers/Provider1/provider/media/channel1/mp/11/start
```

```xml
<MediaPoint matchTime="2020-09-18T12:10:42.826Z" effective="2020-09-18T12:10:12.826Z" expires="2020-09-18T12:11:12.826Z" lastUpdated="2020-09-18T10:10:30.826Z" id="/mp/11/start" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:xlink="http://www.w3.org/1999/xlink">
    <Apply>
        <Policy xlink:href="/provider/policy/location/fl/blackout"></Policy>
    </Apply>
    <MatchSignal match="ANY">
        <Assert>/SpliceInfoSection/SegmentationDescriptor[@segmentationTypeId = 16]</Assert>
    </MatchSignal>
</MediaPoint>
```

### Media point end

- @matchTime indicating the time blackout is supposed to end
- @matchSignal indicates SCTE-35 matching criteria **(SegmentationTypeID = 17)**

```http
PUT  http://controller.example:8080/api/esni/viewingPolicyManagers/Provider1/provider/media/channel1/mp/11/end
```

```xml
<MediaPoint matchTime="2020-09-18T12:15:46.888Z" effective="2020-09-18T12:14:46.888Z" expires="2020-09-18T12:16:46.888Z" id="/mp/11/end" lastUpdated="2020-09-18T12:59:10.888Z" xml:base="/api/esni/viewingPolicyManagers/Provider1" xmlns:xlink="http://www.w3.org/1999/xlink">
    <Remove>
        <Policy xlink:href="/provider/policy/location/fl/blackout"></Policy>
    </Remove>
    <MatchSignal match="ANY">
        <Assert>/SpliceInfoSection/SegmentationDescriptor[@segmentationTypeId = 17]</Assert>
    </MatchSignal>
</MediaPoint>
```

1. Select the timeline button to access the timeline of events scheduled via media point:

2. Mediapoints are identified by the flags. Clicking on it will provide information regarding @matchTime, validity window (using @effective and @expires), SCTE-35 matching criteria (@matchSignal), as well as the policy being applied (or removed).

## Check signed requests

The Viewing Policy Manager supports the [SCTE-224 signing process](https://account.scte.org/standards/library/catalog/scte-224-event-scheduling-and-notification-interface/) and [AWS Signature Version 4](https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html). Enable HTTPS and send the `Check-Signature: true` header for requests that require signature verification.

The worker reads the authentication configuration for the service on startup. CRPM deployments use the `prisma-viewing-policy-manager-worker-auth` Kubernetes Secret. RPM deployments use the file specified in `settings.ini`, which defaults to `/opt/ericsson/viewing-policy-manager-worker/etc/authentication.json`. A missing service authentication configuration raises a NOTICE alarm.

For a signed request, the worker checks the algorithm, credential, signed headers, and signature in the authorization header. It checks the credential against the service configuration and the resource path against any configured `rootId`. An incomplete header, unrecognized credential, invalid root ID, unsupported algorithm, or signature mismatch returns HTTP 401. A valid signature allows the worker to process the request.

For SCTE-224 signing, create the canonical request from the method, path, headers, and payload hash. Hash the canonical request, derive the signing key, calculate the signature, and include it in the authorization header with the credential and signed header names.
