Table Of Contents
Policy Management Functions
create_policy
delete_policy
enumerate_device_filter_attribute
enumerate_sku_filter_attribute
execute_policy
list_all_policies
list_filtered_devices
list_filtered_skus
read_policy
write_policy
Policy Management Functions
This chapter provides information about the following policy management functions:
•
create_policy
•
delete_policy
•
enumerate_device_filter_attribute
•
enumerate_sku_filter_attribute
•
execute_policy
•
list_all_policies
•
list_filtered_devices
•
list_filtered_skus
•
read_policy
•
write_policy
create_policy
Synopsis
create_policy ($token, $name,$sku_filter, $dev_filter)
Description
This function creates a Cisco::CLM::Common::Policy object that represents a set of rules for selecting SKUs and devices from the inventory.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
name
|
String, mandatory
|
—
|
Name of the Policy object.
|
sku_filter
|
SKUFilter, mandatory
|
—
|
The input SKUFilter object specifies the criteria for searching the interested devices. If the filter is set to null, filtering is not performed.
|
dev_filter
|
DeviceFilter, mandatory
|
—
|
The input DeviceFilter object specifies the criteria for searching the interested devices. If the filter is set to null, filtering is not performed.
|
Return
This function returns a Cisco::CLM::Common::PolicyStatus object. The Status and the Policy object are contained in PolicyStatus.
Error and Exception
When an error occurs, this function returns null.
delete_policy
Synopsis
delete_policy ($token, $policy_id)
Description
This function deletes from the system the policy object identified by the given name.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
policy_id
|
String, mandatory
|
ID can be a string containing up to 64 ASCII characters in the range of x21 to x7A
|
ID of the Policy object.
|
Return
This function returns a Cisco::CLM::Common::Status object.
Error and Exception
When an error occurs, the information is contained in the returned status object.
enumerate_device_filter_attribute
Synopsis
enumerate_device_filter_attribute ($token, $attrib)
Description
This function returns a list of all possible values for the given attribute in DeviceFilter.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
attrib
|
Cisco::CLM::Common::Policy::DeviceAttribute, mandatory
|
—
|
This attribute name can be one of the following:
• MODEL
• GROUP
|
Return
This function returns an array of string representing all possible values for the attribute.
Error and Exception
When an error occurs, this function returns null.
enumerate_sku_filter_attribute
Synopsis
enumerate_sku_filter_attribute ($token, $attrib)
Description
This function returns a list of all possible values for the given attribute in SKUFilter.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
attrib
|
SKUAttribute, mandatory
|
—
|
The attribute name can be Policy.SKUAttribute.FEATURE_NAME.
|
Return
This function returns an array of string representing all possible values for the attribute.
Error and Exception
When an error occurs, this function returns null.
execute_policy
Synopsis
execute_policy ($token, $policy_id)
Description
This function executes the given policy by using the policy filters to select devices and stock-keeping units (SKUs), and obtain and deploy licenses for those devices.
This function blocks until the call completes. It returns a Cisco::CLM::Common::IDStatus object containing the staus of the operation
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents the user's authorization pass, which is obtained after the user invokes the login function and is authenticated by the back-end server.
|
policy_id
|
String, mandatory
|
ID can be a string containing up to 64 ASCII characters in the range from x21 to x7A
|
ID of the Policy object.
|
Return
The function returns a Cisco::CLM::Common::IDStatus on completion.
Error and Exception
More than one error code and message may be contained in the IDStatus object. Each ID in the status object represents a device ID that participates in the execution of the policy.
list_all_policies
Synopsis
list_all_policies ($token)
Description
This function returns a list of all policies that can be accessed by the user, including both the private policies owned by this user and all public policies.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents the user's authorization pass, which is obtained after the user invokes the login function and is authenticated by the back-end server.
|
Return
This function returns an array of string representing the IDs of the policies.
Error and Exception
When an error occurs, this function returns null.
list_filtered_devices
Synopsis
list_filtered_devices ($token, $dev_filter)
Description
This function generates a list of devices obtained by running the device filter in the policy.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
dev_filter
|
DeviceFilter, mandatory
|
—
|
The input DeviceFilter object specifies the criteria for searching the list of devices.
|
Return
This function returns an array of string representing the IDs of the devices.
Error and Exception
When an error occurs, this function returns null.
list_filtered_skus
Synopsis
list_filtered_skus ($token, $sku_filter)
Description
This function returns a list of SKU identifiers obtained by running the SKU filter in the policy.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
sku_filter
|
SKUFilter, mandatory
|
—
|
The input SKUFilter object specifies the criteria for searching the list of devices.
|
Return
This function returns an arrayof Cisco::CLM::Common::SKUIdentifier objects.
Error and Exception
When an error occurs, this function returns null.
read_policy
Synopsis
read_policy ($token, $name)
Description
This function retrieves the Cisco::CLM::Common::Policy object from data storage using the given name.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
name
|
String, mandatory
|
Name is a string containing up to 64 ASCII characters in the range from x21 to x7A
|
Name of the Policy object.
|
Return
This function returns a Cisco::CLM::Common::PolicyStatus object. The status and the policy object are contained in the PolicyStatus object.
Error and Exception
When an error occurs, the error code is present in the PolicyStatus object.
write_policy
Synopsis
write_policy ($token, $policy)
Description
This function writes the given Cisco::CLM::Common::Policy objects into data storage. The input Policy objects can be new instances of Policy returned by the create_policy function or existing ones retrieved from the data storage by the read_policy function.
Input Parameters
Parameter
|
Type
|
Value
|
Description
|
token
|
UserToken, mandatory
|
—
|
A token that represents your authorization pass, which is obtained after you invoke the login function and are authenticated by the back-end server.
|
policy
|
Policy, mandatory
|
—
|
Policy objects, which can be new instances of Policy class or existing ones retrieved from the inventory by the read_policy function.
|
Return
This function returns a Cisco::CLM::Common::Status object.
Error and Exception
When an error occurs, the information is contained in the returned status object.