# Referencing QoS Configurations in Service Definitions

You can use QoS profiles and QoS parameters to define a service for a subscriber. For example, you can configure the shaping rate for traffic in a video service by using a QoS parameter instance.

To transmit the QoS configuration to the subscriber interface (that is, the forwarding interface at the top of the interface column), you must configure the QoS profiles and QoS parameter instances in static profiles.

## Specifying QoS Profiles in a Service Definition

You can configure one QoS profile per subscriber interface. We recommend that you specify the QoS profile in the first set of services applied to the subscriber's interface.

You can modify the QoS profile by modifying configurations referenced by the QoS profile, including QoS parameter instances. You can also attach a new QoS profile when activating a service, but make sure that the QoS profile is attached to the subscriber's interface.

For more information about configuring QoS profiles, see the Configuring and Attaching QoS Profiles to an Interface chapter in JunosE Quality of Service Configuration Guide.

### Configuring a QoS Profile for Service Manager

To configure a QoS profile for Service Manager:

1. Configure the profile.
   host1(config)#profile videoService
2. Configure the QoS profile.
   host1(config-profile)#qos-profile videoBandwidth1
3. (Optional) Complete the QoS profile configuration described in the Configuring and Attaching QoS Profiles to an Interface chapter in JunosE Quality of Service Configuration Guide.

profile

- Use to create a profile and enter Profile Configuration mode.
- You specify a profile name with up to 80 alphanumeric characters.
- Example
  host1(config)#profile iptv host1(config-profile)#
- Use the no version to remove a profile.
- See profile

qos-profile

- Use to add a QoS profile command for use with Service Manager. When the service is activated, the QoS profile is created and attached to the subscriber interface.
- Example
  host1(config)#profile iptv host1(config-profile)#qos-profile video
- Use the no version to remove the QoS profile from the profile.
- See qos-profile

### Specifying QoS Profiles in a Service Definition

After you configure a QoS profile for Service Manager, you can reference it in a service definition. For example:

profile <# eastcoast ; '\n' #> qos-profile <# video; '\n' #>

In this example, activating the service definition attaches the video QoS profile to the subscriber interface. Service Manager overwrites the existing QoS profile attachment at the subscriber interface.

Deactivating the service detaches the video QoS profile from the subscriber interface.

## Specifying QoS Parameter Instances in a Service Definition

You can specify that Service Manager create QoS parameter instances when the subscriber logs in (during service activation) or through RADIUS QoS parameter VSAs.

You can specify up to eight parameter instance commands within a profile. When you activate a service, Service Manager creates or modifies parameter instances for the subscriber interface that matches one of the subscriber-interface types configured in the QoS parameter definition.

Deactivating a service can modify or remove QoS parameter instances.

Using a service definition, you can also configure QoS parameters instances to add value to an existing parameter instance using the add keyword or dynamically create new parameter instances with an initial value using the initial-value keyword.

For more information about configuring QoS parameters, see JunosE Quality of Service Configuration Guide, QoS Parameter Overview.

### Creating a Parameter Instance in a Profile

To create a QoS parameter instance for Service Manager:

1. Configure the QoS parameter definition described in JunosE Quality of Service Configuration Guide, QoS Parameter Overview.

   You must configure at least one controlled-interface type and one subscriber-interface type. The range specified in the parameter definition controls the available value of the parameter instance.

2. Configure the QoS profile.
   host1(config)#profile video
3. Configure the QoS parameter instance command in the profile.
   host1(config-profile)#qos-parameter videoBandwidth1 add 40000

qos-parameter

- Use to create a parameter instance command in a profile. When the service is activated, the parameter instances are created for the subscriber interface.
- Use the add keyword in Profile Configuration mode to add a value to an existing parameter instance.
- Use the initial-value keyword to create a new instance with the specified value.
- Examples
  host1(config)#profile video host1(config-profile)#qos-parameter max-subscriber-bandwidth initial-value 15000
- In Profile Configuration mode, the no version removes the QoS parameter instance command in the profile.
- See qos-parameter

### Specifying QoS Parameter Instances in a Service Definition

After you configure a QoS parameter instance for Service Manager, you can reference it in a service definition. For example:

<# qosserviceone(bandwidth1, bandwidth2) #> profile <# profileName ; '\n' #> qos-parameter <# qosParameterName1 ; ' ' ; bandwidth1 ; '\n' #> qos-parameter <# qosParameterName2 ; ' ' ; bandwidth2 ; '\n' #><# endtmpl #>

When you activate a service, Service Manager creates the parameter instance and overwrites previous parameter instances. For example, activating the qosserviceone service definition creates a profile containing two QoS parameter instances. Service Manager creates the qosParameterName1 parameter instance with the value of bandwidth1, and creates qosParameterName2 with a value of bandwidth2.

If you activate the service definition using qosserviceone(2000000,3000000), Service Manager creates qosParameterName1 with a value of 2000000 and qosParameterName2 instance with a value of 3000000.

#### Specifying the Add and Initial-Value Keywords

You can use the add keyword to add value to an existing parameter instance. For example:

<# qosserviceone(bandwidth1, bandwidth2) #> profile <# profileName ; '\n' #> qos-parameter <# qosParameterName3 ; ' add ' ; bandwidth2 ; '\n' #>
<# endtmpl #>

When you specify parameter instances using the add keyword, you can also use the initial-value keyword to specify an initial value. For example:

<# qosserviceone(bandwidth1, bandwidth2) #> profile <# profileName ; '\n' #> qos-parameter <# qosParameterName4 ; ' add ' ; bandwidth2 ; ' initial-value 1000000' ; '\n' #><# endtmpl #>

When you activate the service, Service Manager locates the existing QoS parameter instance in the interface column. If Service Manager does not find a parameter instance, it creates one with a value specified in the initial-value keyword (in this case, 100000). The value in the command is then added to the initial value. If an existing parameter instance is found, Service Manager adds the value to the existing interface.

For example, when you activate qosServiceOne as qosServiceOne(2000000,3000000), Service Manager attempts to locate the parameter instance qosParameterName4 for the subscriber's interface. If it finds a parameter instance, it adds bandwidth2 (3,000,000) to the current value. If Service Manager does not find a parameter instance, it creates one with an initial value of 1,000,000 and adds 3,000,000. The final parameter instance value is 4,000,000.

When deactivating the service, Service Manager locates the QoS parameter instance and subtracts the value in the command from the existing instance value. If the parameter is no longer referenced, the parameter instance is removed.

## Modifying QoS Configurations with Service Manager

This section describes how to modify QoS configurations with Service Manager.

### Modifying Parameter Instances

Service Manager activates services without considering current parameter instance values. For example, when you deactivate a video service, Service Manager can add 5 Mbps to a parameter associated with the shaping rate of a video queue.

Similarly, Service Manager can deactivate services and restore parameter instances to their previous value. For example, when you deactivate a video service, Service Manager can subtract 5 Mbps from a parameter associated with the shaping rate of a video queue.

Table 140 lists the results of a series of activations and deactivations of parameters using the add and initial-value keywords.

Table 140: Sample Modifications Using the Add and Initial-Value Keywords

Action | QoS Parameter Instance | Result
--- | --- | ---
Activate | qos-parameter video-bw add 5000000 initial-value 0 | Parameter instance video-bw is created with a value of 5000000
Activate | qos-parameter video-bw add 1000000 initial-value 0 | Parameter instance video-bw is increased by 1000000, for a total of 6000000
Deactivate | qos-parameter video-bw add 1000000 initial-value 0 | Parameter instance video-bw is decreased by 1000000, for a total of 500000
Deactivate | qos-parameter video-bw add 5000000 initial-value 0 | Parameter instance video-bw is removed

Removing a parameter instance using profiles is based on the number of times a parameter instance is modified, not the value added.

Modifying parameter instances in profiles and modifying explicit parameter instances can cause invalid parameter instance values. Table 141 lists a series of activations and deactivations using parameter instances in profiles and explicit parameter instances. By the second deactivation, the parameter has a negative value (-4000000).

| Note: We recommend that you do not configure negative values for Service Manager.

Table 141: Sample Modifications Using Parameter Instances

Action | QoS Parameter Instance | Result
--- | --- | ---
Activate | qos-parameter video-bw add 5000000 initial-value 0 | Parameter instance video-bw is created with a value of 5000000
Activate | qos-parameter video-bw add 1000000 initial-value 0 | 1000000 is added to parameter instance video-bw, for a total of 6000000
Activate | qos-parameter video-bw 2000000 | Parameter instance video-bw is set to 2000000
Deactivate | qos-parameter video-bw add 1000000 initial-value 0 | 1000000 is subtracted from parameter instance video-bw for a total of 1000000
Deactivate | qos-parameter video-bw add 5000000 initial-value 0 | 5000000 is subtracted from parameter instance video-bw for a total of -4000000
Deactivate | qos-parameter video-bw 2000000 | Parameter instance video-bw is removed

### Modifying QoS Configurations in a Single Service Manager Event

QoS accepts QoS profile attachments and parameter instances created using multiple sources (profiles, RADIUS, or Service Manager) within a single Service Manager event. Events include:

- Subscriber login
- Subscriber logout
- RADIUS Change of Authority (CoA)

QoS prioritizes the creation of QoS profiles and parameter instances within events. Table 142 lists the sources that overwrite QoS profiles and parameter instances created by other sources. Each row represents new QoS profiles and parameter instances; columns represent existing QoS profiles and parameter instances.

Table 142: Configuration Within a Single Service Manager Event

| Profile | RADIUS | Service Manager
--- | --- | --- | ---
Profile | ✓ | – | –
RADIUS | ✓ | ✓ | –
Service Manager | ✓ | ✓ | ✓

### Modifying QoS Configurations Using Other Sources

You can modify QoS configurations with Service Manager by using other QoS sources. For example, you can modify a parameter instance that was created with Service Manager by using the CLI. Similarly, you can use SNMP to detach a QoS profile attached by Service Manager.

Table 143 lists the sources that you can use to modify QoS profile attachments and parameter instances.

Table 143: Modifying QoS Configurations with Other Sources

| QoS Profile Attachment | QoS Parameter Instances
--- | --- | ---
Service Manager | ✓ | ✓
RADIUS | ✓ | ✓
SNMP | ✓ | –
SRC software | ✓ | –
CLI | ✓ | ✓

The following sections describe the precedence of each source when modifying configurations.

#### Service Manager

QoS profile attachments and parameter instances created through Service Manager have precedence over all other sources. For example, Service Manager can overwrite a QoS profile attachment modified through RADIUS, SNMP, the SRC software, or the CLI.

Conversely, Service Manager configurations can be overwritten through SNMP, the SRC software, and the CLI, but not by RADIUS.

Service Manager counts references of parameter instances. You can modify parameter instances created by Service Manager using other sources without affecting the reference counts. For more information, see QoS Statistics.

#### RADIUS

QoS profile attachments and parameter instances configured through RADIUS can overwrite QoS profile attachments and parameter instances configured through the SNMP, the SRC software, and the CLI, but not those created by Service Manager.

Conversely, QoS profiles and parameter instances configured through RADIUS can be overwritten by any source (SNMP, the SRC software, CLI, and Service Manager).

#### SNMP, the SRC Software, and the CLI

QoS profile attachments and parameter instances configured through the CLI can overwrite QoS profile attachments and parameter instances configured through any source.

QoS profiles attached through SNMP and the SRC software can also overwrite QoS profile attachments configured through any source.

Conversely, QoS profiles and parameter instances configured through the CLI, SNMP, or the SRC software can be overwritten by any source.

## Removing QoS Configurations Referenced by Service Manager

When Service Manager no longer references a QoS configuration, it must be removed from the service definition.

Figure 30 shows the references for QoS configurations.

Figure 30: QoS Configuration Dependency Chain

Service Manager automatically removes QoS profiles and parameter instances. After removing the QoS profile and parameter instances, Service Manager automatically removes the following QoS configurations in the following order:

1. QoS profiles
2. Scheduler profiles
3. Queue profiles
4. Drop profiles
5. Statistics profiles

Service Manager does not automatically remove the following QoS configurations:

- Parameter definitions
- Traffic classes
- Traffic-class groups
- QoS-port-type profiles

## QoS for Service Manager Considerations

When you specify QoS configurations in Service Manager, the following considerations apply.

### RADIUS or Service Manager

We recommend that you choose either RADIUS or Service Manager to create a single parameter instance. If you use both RADIUS and Service Manager, parameter instances activated using Service Manager take precedence.

### Interoperability with Other Service Components

Service Manager removes QoS profiles and parameter instances if other components in the service definition (for example, policies) cause an error.

### QoS Statistics

Service Manager counts references of parameter instances in profiles. The reference count is incremented each time the parameter is configured through the CLI, RADIUS, or Service Manager. The reference count is decremented each time the parameter is unconfigured, such as through service deactivation. Modifications to parameter instances are also reference counted, using a separate reference count. Parameter instances are removed when both reference counts reach zero.

Service Manager also counts references of modified parameters in profiles using the add keyword. The reference count is incremented each time the parameter is modified though service activation with the add keyword. The reference count is decremented each time the parameter is modified through service deactivation. References of regular parameter instances are also counted, using a separate reference count. Parameter instances are removed when both reference counts reach zero.

### Ranges

You can verify ranges for parameter instances by specifying a range in the parameter definition using the range command.

When activating the service or modifying parameters, Service Manager verifies the value of the parameter instance to be within the specified range and generates an informational log message indicating the value is outside the range. Service Manager does not verify ranges when you specify the parameter instances within profiles at the time of configuration.