Policies

Policies tie conditions and actions together. Enable the policy for it to take effect.

Refer to the following sections for configuration examples:

■   GigaSMART Group Policy
■   Inlinetool Policy
■   Overloaded Tool Port Policy
■   Weekend Policy
■   Any Port Up Policy
■   All Ports Up Policy
■   Map Disable Policy
■   Redundant Map Policy
■   Revert a Redundant Map Policy
■   Save Memory Policy
■   High Availability Policy
■   Tool Optimization Policy
■   Automated Monitoring Policy
■   Enable Map Based on Time Policy

Refer also to the following sections:

■   Parameter Passing
■   How to Edit Policies

 

GigaSMART Group Policy

Use the following steps to configure a Gigasmart group policy. You must configure the gsgroup and the map1 before configuring GigaSMART Group policy.

(config) # policy alias GsGroupPolicy
(config policy alias p1) # condition add GsCpuUtilHigh param gsGroup gsgroup1 param threshPct 50
(config policy alias p1) # enable
(config policy alias p1) # action add MapGsRuleDelete param mapAlias map1 param ruleId 1
(config policy alias p1) # exit

Inlinetool Policy

Use the following steps to configure an Inlinetool policy. You must configure map1 and testinlinetool before configuring Inlinetool policy.

(config) # policy alias p1 (config policy alias p1) # condition add InlineToolReady param inlineToolAlias testinlinetool (config policy alias p1) # enable (config policy alias p1) # action add MapEnable param mapAlias map1 (config policy alias p1) # exit

Overloaded Tool Port Policy

Use the following steps to configure an overloaded tool port policy:

(config) # policy alias OverloadedToolPort condition add PortTxUtilHigh param portId 1/1/x1 param threshPct 80 (config) # policy alias OverloadedToolPort action add PortDisable param portId 1/1/x2 (config) # policy alias OverloadedToolPort enable

The following is the same example for an overloaded tool port, but using the prefix mode:

(config) # policy alias OverloadedToolPort

(config policy alias OverloadedToolPort) # condition add PortTxUtilHigh param portId 1/1/x1 param threshPct 80

(config policy alias OverloadedToolPort) # action add PortDisable param portId 1/1/x2 (config policy alias OverloadedToolPort) # enable

(config policy alias OverloadedToolPort) # exit

(config) #

Weekend Policy

Use the following steps to configure a weekend policy. The map, WeekendMap, would also have to be configured.

To enable a weekend map on the weekend:

(config) # policy alias WeekendEn (config policy alias WeekendEn) # condition add TimeWeekend (config policy alias WeekendEn) # action add MapEnable param mapAlias WeekendMap (config policy alias WeekendEn) # enable (config policy alias WeekendEn) # comment “Enable WeekendMap on the weekend” (config policy alias Weekend) # exit (config) #

To disable the weekend map on weekdays:

(config) # policy alias WeekendDis (config policy alias WeekendDis) # condition add TimeWeekday (config policy alias WeekendDis) # action add MapDisable param mapAlias WeekendMap (config policy alias WeekendDis) # enable (config policy alias WeekendDis) # comment “Disable WeekendMap on weekdays” (config policy alias WeekendDis) # exit (config) #

Any Port Up Policy

Use the following steps to configure a policy for any port up:

(config) # policy alias AnyPortUp (config policy alias AnyPortUp) # condition add PortUp param portId any(3/1/q4..q6) param period 300 (config policy alias AnyPortUp) # action add PortFilterAdd param portId &PortUp.portId& param ruleStr "add pass vlan 100" (config policy alias AnyPortUp) # enable (config policy alias AnyPortUp) # exit (config) #

This example uses parameter passing. Refer to Parameter Passing for details.

All Ports Up Policy

Use the following steps to configure a policy for all ports up:

(config) # policy alias AllPortUp

(config policy alias AllPortUp) # condition add PortUp param portId any(3/1/q4..q6) param period 300

(config policy alias AllPortUp) # action add PortFilterAdd param portId &PortUp.portId& param ruleStr "add pass vlan 100"

(config policy alias AllPortUp) # enable

(config policy alias AllPortUp) # exit

(config) #

Map Disable Policy

Use the following steps to configure a policy for disabling a map when a tool port is down:

Create the map and enable it:

(config) # map alias map1

(config map alias map1) # from 2/3/g1

(config map alias map1) # to 2/3/g2

(config map alias map1) # rule add pass vlan 100

(config map alias map1) # enable

(config map alias map1) # exit

(config) #

Create the policy and enable it:

(config) # policy alias MapMonitor

(config policy alias MapMonitor) # condition add PortDown param portId 2/3/g2

(config policy alias MapMonitor) # action add MapDisable param mapAlias map1

(config policy alias MapMonitor) # enable

(config policy alias MapMonitor) # exit

(config) #

Redundant Map Policy

Use the following steps to configure a policy for a redundant map. This policy has multiple actions.

(config) # policy alias RedundantMap

(config policy alias RedundantMap) # condition add PortDown param portId 2/2/c1

(config policy alias RedundantMap) # action add MapEnable param mapAlias map2

(config policy alias RedundantMap) # action add MapDisable param mapAlias map1

(config policy alias RedundantMap) # enable

(config policy alias RedundantMap) # exit

(config) #

Revert a Redundant Map Policy

Use the following steps to configure a policy for reverting a redundant map. This policy also has multiple actions.

(config) # policy alias RevertRedundantMap

(config policy alias RevertRedundantMap) # condition add PortUp param portId 2/2/c1

(config policy alias RevertRedundantMap) # action add MapEnable param mapAlias map1

(config policy alias RevertRedundantMap) # action add MapDisable param mapAlias map2

(config policy alias RevertRedundantMap) # enable

(config policy alias RevertRedundantMap) # exit

(config) #

Save Memory Policy

Use the following steps to configure a policy for saving memory:

(config) # policy alias SaveMemory

(config policy alias SaveMemory) # condition add TimeOfDay param timeStr “( 45 10 * * * * )”

(config policy alias SaveMemory) # action add WriteMemory

(config policy alias SaveMemory) # enable

(config policy alias SaveMemory) # exit

(config) #

High Availability Policy

Use the following steps to configure policies for high availability. In this example, there are two maps, each to a different tool port, for example, tool1 and tool2. The policies define that if tool1 is down, use tool2. If tool1 comes back up, switch back to it.

Configure two maps:

(config) # map alias map1

(config map alias map1) # from 1/1/x1

(config map alias map1) # to 1/1/x11

(config map alias map1) # rule add pass vlan 100

(config map alias map1) # enable

(config map alias map1) # exit

(config) #

(config) # map alias map2

(config map alias map2) # from 1/1/x1

(config map alias map2) # to 1/1/x12

(config map alias map2) # rule add pass vlan 100

(config map alias map2) # no enable

(config map alias map2) # exit

(config) #

Configure two policies, each with multiple actions:

(config) # policy alias HA1

(config policy alias HA1) # condition add PortDown param portId 1/1/x11

(config policy alias HA1) # action add MapEnable param mapAlias map2

(config policy alias HA1) # action add MapDisable param mapAlias map1

(config policy alias HA1) # action add PolicyEnable param policyAlias HA2

(config policy alias HA1) # enable

(config policy alias HA1) # exit

(config) #

(config) # policy alias HA2

(config policy alias HA2) # condition add PortUp param portId 1/1/x11

(config policy alias HA2) # action add MapDisable param mapAlias map2

(config policy alias HA2) # action add MapEnable param mapAlias map1

(config policy alias HA2) # enable

(config policy alias HA2) # exit

(config) #

Tool Optimization Policy

Use the following steps to configure policies for tool optimization.

Configure a map:

(config) # map alias map1

(config map alias map1) # from 1/1/x3

(config map alias map1) # to 1/1/x5

(config map alias map1) # rule add pass vlan 200

(config map alias map1) # rule add pass vlan 100

(config map alias map1) # enable

(config map alias map1) # exit

(config) #

Configure two policies:

(config) # policy alias ToolOpt1

(config policy alias ToolOpt1) # condition add PortRxUtilHigh param portId 1/1/x3 param threshPct 80

(config policy alias ToolOpt1) # action add MapRuleDelete param mapAlias map1 param ruleId 2

(config policy alias ToolOpt1) # action add PolicyEnable param policyAlias ToolOpt2

(config policy alias ToolOpt1) # enable

(config policy alias ToolOpt1) # exit

(config) #

(config) # policy alias ToolOpt2

(config policy alias ToolOpt2) # condition add PortRxUtilLow param portId 1/1/x3 param threshPct 81

(config policy alias ToolOpt2) # action add MapRuleAdd param mapAlias map1 param ruleStr “pass vlan 100”

(config policy alias ToolOpt2) # action add PolicyEnable param policyAlias ToolOpt1

(config policy alias ToolOpt2) # no enable

(config policy alias ToolOpt2) # exit

(config) #

Automated Monitoring Policy

Use the following steps to configure a policy for automated monitoring. In this example, if the source leader in a bidirectional clock relationship (formerly master) is 1.1.1.1, enable the map.

Configure a map:

(config) # map alias map1

(config map alias map1) # from 1/1/x1

(config map alias map1) # to 1/1/x2

(config map alias map1) # no enable

(config map alias map1) # exit

(config) #

Configure the policy:

(config) # policy alias AutoMon

(config policy alias AutoMon) # condition add PortRxUtilHigh param portId 1/1/x1 param threshPct 30

(config policy alias AutoMon) # action add MapEnable param mapAlias map1

(config policy alias AutoMon) # enable

(config policy alias AutoMon) # exit

(config) #

Enable Map Based on Time Policy

Use the following steps to configure policies for enabling a map based on time, such as between the hours of 8:00am and 5:00pm (17:00). During the other hours (from midnight to 8:00am and from 5:00pm to midnight), disable the map.

(config) # policy alias WorkHours

(config policy alias WorkHours) # condition add TimeOfDay param timeStr “( 0 8-17 * * * * )”

(config policy alias WorkHours) # action add MapEnable param mapAlias map1

(config policy alias WorkHours) # enable

(config policy alias WorkHours) # comment “Enable map1 from 8:00 to 17:00 daily”

(config policy alias WorkHours) # exit

(config) # (config) # policy alias MidnightHours

(config policy alias MidnightHours) # condition add TimeOfDay param timeStr “( 0 0-8 * * * * )”

(config policy alias MidnightHours) # action add MapDisable param mapAlias map1

(config policy alias MidnightHours) # enable

(config policy alias MidnightHours) # comment “Disable map1 from midnight to 8:00 daily”

(config policy alias MidnightHours) # exit

(config) # (config) # policy alias AfterWorkHours

(config policy alias AfterWorkHours) # condition add TimeOfDay param timeStr “( 0 17-0 * * * * )”

(config policy alias AfterWorkHours) # action add MapDisable param mapAlias map1

(config policy alias AfterWorkHours) # enable

(config policy alias AfterWorkHours) # comment “Disable map1 from 17:00 to midnight daily”

(config policy alias AfterWorkHours) # exit

(config) #

Parameter Passing

Parameters can be passed from a condition to an action in a policy. Parameter passing is currently only for ports.

For example:

(config) # policy alias PortPolicy

(config policy alias PortPolicy) # condition add PortUp param portId any(1/1/x1..x3)

(config policy alias PortPolicy) # action add PortDisable param portId &PortUp.portId&

(config policy alias PortPolicy) # enable

(config policy alias PortPolicy) # exit

(config) #

Parameter passing is specified using two ampersand (&) symbols, for example, &PortUp.portId& in the action. The PortUp and the portId in the action match the PortUp and portId in the condition, as specified between the two ampersands.

The value for the parameter will be substituted and only the condition that was met will be substituted.

In this example, the condition is for any port in the range of 1/1/x1..x3 to be up. If only port x3 is up (matching the condition), only x3 will be passed to the action. If port x1 and x2 are both up at the same time, both will be passed to the action.

If the condition had been specified without the keyword, any, as follows:

(config policy alias PortPolicy) # condition add PortUp param portId 1/1/x1..x3

The ports x1, x2, and x3 would all have to be up at the same time to match the condition and be passed to the action.

Note:  Use caution with parameter passing. When a parameter is passed from a condition to an action, the system does not validate the parameter that is passed. For example, you can configure a policy that attempts to pass a TimeofDay parameter, timeStr in a condition to a PortEnable action. But parameter passing is currently only supported for ports, so timeStr is not a valid parameter to pass. If the policy is triggered, the action will not be successful.

How to Edit Policies

To edit a policy, it is recommended that you disable the policy first. To disable a policy, use the following line-by-line command:

(config) # no policy alias policy1 enable

Using the prefix mode is not recommended The changes only take effect when you exit. The following is an example of the prefix mode:

(config) # policy alias policy1

(config policy alias policy1) # no enable

(config policy alias policy1) # exit

Edit the policy. The following edits are supported:

■   Add a new condition or a new action to a policy, so long as the limits of 5 conditions and 5 actions in a policy are not exceeded.
■   Delete an existing condition or an existing action from a policy.
■   Modify a condition only by deleting it and adding it back in with the change. An existing condition cannot be modified by editing it.

Note:  An action or a condition is deleted by its ID (action ID or condition ID). These IDs are incremented. For example, if three conditions are defined, they will be numbered 1, 2, and 3. If 2 is deleted, the other IDs will be numbered 1, 3. Once 2 is deleted, it is no longer used. If a condition is added, it will take the next available number, in this case 4.

Finally, re-enable the policy with the following command:

(config) # policy alias policy1 enable

Note that editing a policy automatically resets the policy, meaning the run counts are reset to zero. The run counts and action status are reset when the node reboots or when there are cluster changes, such as a leader leader in clustering node relationship (formerly master) switchover.