Package onep :: Package policyservice :: Module bulk :: Class BulkService
[frames] | no frames]

Class BulkService


BulkService class.

The BulkService class provides the enhanced Policy API for submitting and activating policy in bulk fashion.

ActivationHolder in BulkService is provided as a container to group a policy with its intended targets.

The ActivationHolder object is then used to activate the policy in the network element.

Instance Methods
 
__init__(self, element)
Constructs a BulkService object.
 
create_class(self, type, element, class_name=None)
Create an instance of ClassMap class
 
create_policy(self, type, element, policy_name=None)
Create an instance of PolicyMap class
 
submit_class_map(self, *class_maps)
Submits a list of class maps.
 
get_all_bulk_listeners(self)
Returns dict of tuples containing all active bulk listeners in element
 
async_submit_class_map(self, listener, app_context, *class_maps)
Submits a list of class maps asynchronously.
 
update_class_map(self, *class_maps)
Update a list of class maps in the network element.
 
delete_class_map(self, *class_maps)
Deletes a list of class maps from the network element.
 
submit_policy_map(self, *policy_maps)
Submits a list of policy maps.
 
async_submit_policy_map(self, listener, app_context, *policy_maps)
Submits a list of policy maps asynchronously.
 
update_policy_map(self, *policy_maps)
Update a list of policy maps in the network element.
 
delete_policy_map(self, *policy_maps)
Deletes a list of policy maps from the network element.
BulkService.ActivationHolder
create_activation_holder(self, policy_map, *targets)
Creates a ActivationHolder with the supplied policy and targets.
 
activate_policy(self, *activations)
Activates the policy to its targets that are specified in the ActivationHolder list.
 
async_activate_policy(self, listener, app_context, *activations)
Asynchronously activates the policy to its targets that are specified in the ActivationHolder list.
 
deactivate_policy(self, *activations)
De-activates the policy from its targets that are specified in the ActivationHolder list.
 
remove_statistic_listener(self, listener)
Removes client statistic listener
 
get_policy_statistics(self, filters, listener=None, app_context=None, opcode=None)
Retrieves statistics according to filter specifications.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, element)
(Constructor)

 

Constructs a BulkService object.

Parameters:
Raises:
Overrides: object.__init__

create_class(self, type, element, class_name=None)

 

Create an instance of ClassMap class

@param type @type {PolicyCapabilitiesType<onep.policyservice.PolicyiCapabilities.PolicyCapabilitiesType>}

@param element @type {NetworkElement<onep.element.NetworkElement.NetworkElement>}

@param class_name

create_policy(self, type, element, policy_name=None)

 

Create an instance of PolicyMap class

@param type @type {PolicyCapabilitiesType<onep.policyservice.PolicyCapabilities.PolicyCapabilitiesType>}

@param element @type {NetworkElement<onep.element.NetworkElement.NetworkElement>}

@param policy_name

submit_class_map(self, *class_maps)

 

Submits a list of class maps.

This will create the class maps in the network element.

Parameters:
  • class_maps (Variable length argument list of ClassMap) - The class maps.
Raises:

get_all_bulk_listeners(self)

 

Returns dict of tuples containing all active bulk listeners in element

dict of tuple - {(Policy listening class, application context, ClassMap objects), ...}

async_submit_class_map(self, listener, app_context, *class_maps)

 

Submits a list of class maps asynchronously.

This will create the class maps in the network element.

Parameters:
  • event_id (int) - ID retrieved from BulkService.get_event_id(). Match to listener event_id.
  • class_maps (Variable length argument list of ClassMap) - The class maps.
Raises:

update_class_map(self, *class_maps)

 

Update a list of class maps in the network element.

Parameters:
  • class_maps (Variable length argument list of ClassMap) - The class maps to update.
Raises:

delete_class_map(self, *class_maps)

 

Deletes a list of class maps from the network element.

Parameters:
  • class_maps (Variable length argument list of ClassMap) - The class maps to delete.
Raises:

submit_policy_map(self, *policy_maps)

 

Submits a list of policy maps.

This will create the policy maps in the network element.

Parameters:
  • policy_maps (Variable length argument list of PolicyMap) - The policy maps.
Raises:

async_submit_policy_map(self, listener, app_context, *policy_maps)

 

Submits a list of policy maps asynchronously.

This will create the policy maps in the network element.

Parameters:
  • listener (PolicySubmitEvent) - PolicySubmitEvent class created by user
  • app_context (Any Python object) - Object sent from user for providing context specific to user
  • policy_maps (Variable length argument list of PolicyMap) - The policy maps.
Raises:

update_policy_map(self, *policy_maps)

 

Update a list of policy maps in the network element.

Parameters:
  • policy_maps (Variable length argument list of PolicyMap) - The policy maps to update.
Raises:

delete_policy_map(self, *policy_maps)

 

Deletes a list of policy maps from the network element.

Parameters:
  • policy_maps (Variable length argument list of PolicyMap) - The policy maps to delete.
Raises:

create_activation_holder(self, policy_map, *targets)

 

Creates a ActivationHolder with the supplied policy and targets.

Parameters:
  • policy_map (PolicyMap) - The policy to be activated.
  • targets (Variable length argument list of Target) - The targets to apply to.
Returns: BulkService.ActivationHolder
Returns an ActivationHolder object.
Raises:

activate_policy(self, *activations)

 

Activates the policy to its targets that are specified in the ActivationHolder list.

Parameters:
Raises:

async_activate_policy(self, listener, app_context, *activations)

 

Asynchronously activates the policy to its targets that are specified in the ActivationHolder list.

Parameters:
Raises:

deactivate_policy(self, *activations)

 

De-activates the policy from its targets that are specified in the ActivationHolder list.

Parameters:
Raises:

remove_statistic_listener(self, listener)

 

Removes client statistic listener

Parameters:
  • listener ({PolicyStatsListener<onep.policyservice.policymap.PolicyStatsListener>}) - PolicyStatsListener class

get_policy_statistics(self, filters, listener=None, app_context=None, opcode=None)

 

Retrieves statistics according to filter specifications.
A list of PolicyStatistics classes are populated in PolicyStatFilter.stats_result.

@param filters: one or more PolicyStatFilter classes
@type filters: {PolicyMap<onep.policyservice.PolicyMap.PolicyStatFilter>}

@param listener: PolicyStatsListener class created by user
@type listener: l{PolicyStatsListener<policymap.PolicyStatsListener>)

@param app_context: Optional context for application
@type: app_context: Any Python object

@raise OnepIllegalArgumentException: If nif or policy_map is invalid.
@raise OnepRemoteProcedureException: If error occurs when remote procedure call is made to network element.
@raise OnepConnectionException: If connection to network element fails.