6. WBEM indication API¶
New in pywbem 0.9 as experimental and finalized in 0.10.
The WBEM indication API supports subscription for and receiving of CIM indications.
This chapter has the following sections:
- WBEMListener - The
WBEMListener
class provides a thread-based WBEM listener service for receiving indications. - WBEMSubscriptionManager - The
WBEMSubscriptionManager
class provides for managing subscriptions for indications.
6.1. WBEMListener¶
New in pywbem 0.9 as experimental and finalized in 0.10.
The WBEMListener
class provides a thread-based WBEM listener
service that can receive CIM indications from multiple WBEM servers and that
calls registered callback functions to deliver the received indications.
6.1.1. Examples¶
The following example creates and runs a listener:
import sys
import logging
from socket import getfqdn
from pywbem import WBEMListener
def process_indication(indication, host):
'''This function gets called when an indication is received.'''
print("Received CIM indication from {host}: {ind!r}". \
format(host=host, ind=indication))
def main():
# Configure logging of the listener via the Python root logger
logging.basicConfig(filename='listener.log', level=logging.WARNING,
format='%(asctime)s - %(levelname)s - %(message)s)
certkeyfile = 'listener.pem'
listener = WBEMListener(host=getfqdn()
http_port=5988,
https_port=5989,
certfile=certkeyfile,
keyfile=certkeyfile)
listener.add_callback(process_indication)
try:
listener.start()
# process_indication() will be called for each received indication
... # wait for some condition to end listening
finally:
listener.stop()
Alternative code using the class as a context manager:
with WBEMListener(...) as listener:
listener.add_callback(process_indication)
listener.start()
# process_indication() will be called for each received indication
... # wait for some condition to end listening
# listener.stop() has been called automatically
See the example in section WBEMSubscriptionManager for an example of using a listener in combination with a subscription manager.
Another listener example is in the script examples/listen.py
(when you
clone the GitHub pywbem/pywbem project). It is an interactive Python shell that
creates a listener and displays any indications it receives, in MOF format.
6.1.2. Logging in the listener¶
Each WBEMListener
object has its own separate Python logger
object with the name:
‘pywbem.listener.{id}’
where {id} is a string that is unique for each WBEMListener
object within the Python process.
The logger
property of a
WBEMListener
object provides access to that Python logger
object, if needed.
The listener will log any indications it receives and any responses it sends
back to the indication sender, at the logging.INFO
logging level.
In addition, it will log errors at the logging.ERROR
logging level.
Since Python 2.7, the Python root logger will by default (i.e. when not being
configured) print log records of logging level logging.WARNING
or
greater to sys.stderr. So the indication and response interactions will not
be printed by default, but any errors logged at the logging.ERROR
logging level will be printed by default.
Pywbem adds a null handler to the logger named ‘pywbem’, in order to prevent the “No handlers could be found for logger …” warning. This follows best practices recommended in Configuring logging for a library and in several articles, for example in this article. Because this warning is no longer issued on Python 3.4 and higher, pywbem adds a null handler only on Python 2.6 and 2.7.
6.1.3. WBEMListener class¶
-
class
pywbem.
WBEMListener
(host, http_port=None, https_port=None, certfile=None, keyfile=None)[source]¶ New in pywbem 0.9 as experimental and finalized in 0.10.
A WBEM listener.
The listener supports starting and stopping threads that listen for CIM-XML ExportIndication messages using HTTP and/or HTTPS, and that pass any received indications on to registered callback functions.
The listener must be stopped in order to free the TCP/IP port it listens on. Using this class as a context manager ensures that the listener is stopped when leaving the context manager scope.
Parameters: - host (string) – IP address or host name at which this listener can be reached.
- http_port (string or integer) –
HTTP port at which this listener can be reached. Note that at least one port (HTTP or HTTPS) must be set.
None means not to set up a port for HTTP.
- https_port (string or integer) –
HTTPS port at which this listener can be reached.
None means not to set up a port for HTTPS.
- certfile (string) –
File path of certificate file to be used as server certificate during SSL/TLS handshake when creating the secure HTTPS connection.
It is valid for the certificate file to contain a private key; the server certificate sent during SSL/TLS handshake is sent without the private key.
None means not to use a server certificate file. Setting up a port for HTTPS requires specifying a certificate file.
- keyfile (string) –
File path of private key file to be used by the server during SSL/TLS handshake when creating the secure HTTPS connection.
It is valid to specify a certificate file that contains a private key.
None means not to use a private key file. Setting up a port for HTTPS requires specifying a private key file.
-
__repr__
()[source]¶ Return a representation of the
WBEMListener
object with all attributes, that is suitable for debugging.
-
__enter__
()[source]¶ New in pywbem 0.12.
Enter method when the class is used as a context manager.
Returns the listener object.
-
__exit__
(exc_type, exc_value, traceback)[source]¶ New in pywbem 0.12.
Exit method when the class is used as a context manager.
Stops the listener by calling
stop()
.
-
http_port
¶ integer – HTTP port at which this listener can be reached.
None means there is no port set up for HTTP.
-
https_port
¶ integer – HTTPS port at which this listener can be reached.
None means there is no port set up for HTTPS.
-
http_started
¶ bool
– Boolean indicating whether the listener is started for the HTTP port.If no port is set up for HTTP, False is returned.
New in pywbem 0.12.
-
https_started
¶ bool
– Boolean indicating whether the listener is started for the HTTPS port.If no port is set up for HTTPS, False is returned.
New in pywbem 0.12.
-
certfile
¶ string – File path of the certificate file used as server certificate during SSL/TLS handshake when creating the secure HTTPS connection.
None means there is no certificate file being used (that is, no port is set up for HTTPS).
-
keyfile
¶ string – File path of the private key file used by the server during SSL/TLS handshake when creating the secure HTTPS connection.
None means there is no certificate file being used (that is, no port is set up for HTTPS).
-
logger
¶ logging.Logger
– Logger object for this listener.Each listener object has its own separate logger object with the name:
‘pywbem.listener.{id}’where {id} is a unique string for each listener object.
Users of the listener should not look up the logger object by name, but should use this property to get to it.
-
start
()[source]¶ Start the WBEM listener threads, if they are not yet running.
A thread serving CIM-XML over HTTP is started if an HTTP port was specified for the listener. A thread serving CIM-XML over HTTPS is started if an HTTPS port was specified for the listener.
These server threads will handle the ExportIndication export message described in DSP0200 and they will invoke the registered callback functions for any received CIM indications.
The listener must be stopped again in order to free the TCP/IP port it listens on. The listener can be stopped explicitly using the
stop()
method. The listener will be automatically stopped when the main thread terminates (i.e. when the Python process terminates), or whenWBEMListener
is used as a context manager when leaving its scope.Raises: OSError
– witherrno
=errno.EADDRINUSE
when the WBEM listener port is already in use.
-
deliver_indication
(indication, host)[source]¶ This function is called by the listener threads for each received indication. It is not supposed to be called by the user.
It delivers the indication to all callback functions that have been added to the listener.
If a callback function raises any exception this is logged as an error using the listener logger and the next registered callback function is called.
Parameters: - indication (
CIMInstance
) – Representation of the CIM indication to be delivered. - host (string) – Host name or IP address of WBEM server sending the indication.
- indication (
-
add_callback
(callback)[source]¶ Add a callback function to the listener.
The callback function will be called for each indication this listener receives from any WBEM server.
If the callback function is already known to the listener, it will not be added.
Parameters: callback ( callback_interface()
) – Callable that is being called for each CIM indication that is received while the listener threads are running.
-
pywbem.
callback_interface
(indication, host)[source]¶ New in pywbem 0.9 as experimental and finalized in 0.10.
Interface of a callback function that is provided by the user of the API and that will be called by the listener for each received CIM indication.
Parameters: - indication (
CIMInstance
) – Representation of the CIM indication that has been received. Its path attribute is None. - host (string) – Host name or IP address of WBEM server sending the indication.
Raises: Exception
– If a callback function raises any exception this is logged as an error using the listener logger and the next registered callback function is called.- indication (
6.2. WBEMSubscriptionManager¶
New in pywbem 0.9 as experimental and finalized in 0.10.
The WBEMSubscriptionManager
class is a subscription manager
that provides for creating and removing indication subscriptions (including
indication filters and listener destinations) for multiple WBEM servers and
multiple WBEM listeners and for getting information about existing indication
subscriptions.
The WBEM listener is identified through its URL, so it may be the pywbem
listener (that is, a WBEMListener
object) or any other WBEM
listener.
This subscription manager supports three types of ownership of the CIM instances in WBEM servers that represent subscriptions, filters and listener destinations:
Owned
Owned CIM instances are created via the subscription manager and their life cycle is bound to the life cycle of the registration of that WBEM server with the subscription manager via
add_server()
.Owned CIM instances are deleted automatically when their WBEM server is deregistered from the subscription manager via
remove_server()
orremove_all_servers()
. In addition, they can be deleted by the user via the removal methods of theWBEMSubscriptionManager
class.Permanent
Permanent CIM instances are created via the subscription manager and their life cycle is independent of the life cycle of the registration of that WBEM server with the subscription manager.
Permanent CIM instances are not deleted automatically when their WBEM server is deregistered from the subscription manager. The user is responsible for their lifetime management: They can be deleted via the removal methods of the
WBEMSubscriptionManager
class.Static
Static CIM instances pre-exist in the WBEM server and cannot be deleted (or created) by a WBEM client.
If a client creates a subscription between a filter and a listener destination, the types of ownership of these three CIM instances may be arbitrarily mixed, with one exception:
- A permanent subscription cannot be created on an owned filter or an owned
listener destination. Allowing that would prevent the automatic life cycle
management of the owned filter or listener destination by the subscription
manager. This restriction is enforced by the
WBEMSubscriptionManager
class.
The WBEMSubscriptionManager
object remembers owned
subscriptions, filters, and listener destinations. If for some reason that
object gets deleted before all servers could be removed (e.g. because the
Python program aborts), the corresponding CIM instances in the WBEM server
still exist, but the knowledge is lost that these instances were owned by that
subscription manager. Therefore, the subscription manager discovers owned
subscriptions, filters, and listener destinations when a server is added.
For filters, this discovery is based upon the Name property. Therefore, if
the Name property is set by the user (e.g. because a management profile
requires a particular name), the filter must be permanent and cannot be owned.
6.2.1. Examples¶
The following example code demonstrates the use of a subscription manager to subscribe for a CIM alert indication on a WBEM server. The WBEM listener is assumed to exist somewhere and is identified by its URL:
import sys
from socket import getfqdn
from pywbem import WBEMConnection, WBEMServer, WBEMSubscriptionManager
server_url = 'http://myserver'
server_credentials = (user, password)
listener_url = 'http://mylistener'
conn = WBEMConnection(server_url, server_credentials)
server = WBEMServer(conn)
sub_mgr = WBEMSubscriptionManager(subscription_manager_id='fred')
# Register the server in the subscription manager:
server_id = sub_mgr.add_server(server)
# Add a listener destination in the server:
dest_inst = sub_mgr.add_listener_destinations(server_id, listener_url)
# Subscribe to a static filter of a given name:
filter1_name = "DMTF:Indications:GlobalAlertIndicationFilter"
filter1_insts = sub_mgr.get_all_filters(server_id)
for inst in filter1_insts:
if inst['Name'] == filter1_name:
sub_mgr.add_subscriptions(server_id, inst.path, dest_inst.path)
break
# Create a dynamic alert filter and subscribe to it:
filter2_source_ns = "root/cimv2"
filter2_query = "SELECT * FROM CIM_AlertIndication " \
"WHERE OwningEntity = 'DMTF' " \
"AND MessageID LIKE 'SVPC0123|SVPC0124|SVPC0125'"
filter2_language = "DMTF:CQL"
filter2_inst = subscription_manager.add_filter(server_id,
filter2_source_ns, filter2_query, filter2_language, owned=True,
filter_id="myalert")
sub_mgr.add_subscriptions(server_id, filter2_inst.path, dest_inst.path)
The following example code briefly shows how to use a subscription manager as a context manager, in order to get automatic cleanup of owned instances:
with WBEMSubscriptionManager('fred') as sub_mgr:
server_id = sub_mgr.add_server(server)
. . .
# The exit method automatically calls remove_all_servers(), which deletes
# all owned subscription, filter and destination instances in the servers
# that were registered.
The Tutorial section contains a tutorial about the subscription manager.
-
class
pywbem.
WBEMSubscriptionManager
(subscription_manager_id)[source]¶ New in pywbem 0.9 as experimental and finalized in 0.10.
A class for managing subscriptions for CIM indications in a WBEM server.
The class may be used as a Python context manager, in order to get automatic clean up (see
__exit__()
).Parameters: subscription_manager_id (string) –
A subscription manager ID string that is used as a component in the value of the Name property of indication filter and listener destination instances to help the user identify these instances in a WBEM server.
Must not be None.
The string must consist of printable characters, and must not contain the character ‘:’ because that is the separator between components within the value of the Name property.
The subscription manager ID must be unique on the current host.
For example, the form of the Name property of a filter instance is (for details, see
add_filter()
):"pywbemfilter:" {ownership} ":" {subscription_manager_id} ":" {filter_id} ":" {guid}
Raises: ValueError
– Incorrect input parameter values.TypeError
– Incorrect input parameter types.
-
__repr__
()[source]¶ Return a representation of the
WBEMSubscriptionManager
object with all attributes, that is suitable for debugging.
-
__enter__
()[source]¶ New in pywbem 0.10.
Enter method when the class is used as a context manager. Returns the subscription manager object
-
__exit__
(exc_type, exc_value, traceback)[source]¶ New in pywbem 0.10.
Exit method when the class is used as a context manager.
It cleans up by calling
remove_all_servers()
.
-
add_server
(server)[source]¶ Register a WBEM server with the subscription manager. This is a prerequisite for adding listener destinations, indication filters and indication subscriptions to the server.
This method discovers listener destination, indication filter, and subscription instances in the WBEM server owned by this subscription manager, and registers them in the subscription manager as if they had been created through it.
In this discovery process, listener destination and indication filter instances are matched based upon the value of their Name property. Subscription instances are matched based upon the ownership of the referenced destination and filter instances: If a subscription references a filter or a destination that is owned by this subscription manager, it is considered owned by this subscription manager as well.
Parameters: server (
WBEMServer
) – The WBEM server.Returns: An ID for the WBEM server, for use by other methods of this class.
Return type: Raises: - Exceptions raised by
WBEMConnection
. ValueError
– Incorrect input parameter values.TypeError
– Incorrect input parameter types.
- Exceptions raised by
-
remove_server
(server_id)[source]¶ Remove a registered WBEM server from the subscription manager. This also unregisters listeners from that server and removes all owned indication subscriptions, owned indication filters and owned listener destinations.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Raises: Exceptions raised by WBEMConnection
.
-
remove_all_servers
()[source]¶ Remove all registered WBEM servers from the subscription manager. This also unregisters listeners from these servers and removes all owned indication subscriptions, owned indication filters, and owned listener destinations.
Raises: Exceptions raised by WBEMConnection
.
-
add_listener_destinations
(server_id, listener_urls, owned=True)[source]¶ Register WBEM listeners to be the target of indications sent by a WBEM server.
This function automatically creates a listener destination instance (of CIM class “CIM_ListenerDestinationCIMXML”) for each specified listener URL in the Interop namespace of the specified WBEM server.
The form of the Name property of the created destination instance is:
"pywbemdestination:" {ownership} ":" {subscription_manager_id} ":" {guid}
where
{ownership}
is"owned"
or"permanent"
dependent on the owned argument;{subscription_manager_id}
is the subscription manager ID; and{guid}
is a globally unique identifier.Owned listener destinations are added or updated conditionally: If the listener destination instance to be added is already registered with this subscription manager and has the same property values, it is not created or modified. If it has the same path but different property values, it is modified to get the desired property values. If an instance with this path does not exist yet (the normal case), it is created.
Permanent listener destinations are created unconditionally, and it is up to the user to ensure that such an instance does not exist yet.
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - listener_urls (string or list of string) –
The URL or URLs of the WBEM listeners to be registered.
The WBEM listener may be a
WBEMListener
object or any external WBEM listener.Each listener URL string must have the format:
[{scheme}://]{host}:{port}
The following URL schemes are supported:
https
: Causes HTTPS to be used.http
: Causes HTTP to be used. This is the default
The host can be specified in any of the usual formats:
- a short or fully qualified DNS hostname
- a literal (= dotted) IPv4 address
- a literal IPv6 address, formatted as defined in RFC3986
with the extensions for zone identifiers as defined in
RFC6874, supporting
-
(minus) for the delimiter before the zone ID string, as an additional choice to%25
.
Note that the port is required in listener URLs.
See
WBEMConnection
for examples of valid URLs, with the caveat that the port in server URLs is optional. - owned (
bool
) – Defines the ownership type of the created listener destination instances: If True, they will be owned. Otherwise, they will be permanent. See WBEMSubscriptionManager for details about these ownership types.
Returns: The created listener destination instances for the defined listener URLs.
Return type: list
ofCIMInstance
Raises: Exceptions raised by
WBEMConnection
.- server_id (string) – The server ID of the WBEM server, returned by
-
get_owned_destinations
(server_id)[source]¶ Return the listener destinations in a WBEM server owned by this subscription manager.
This function accesses only the local list of owned destinations; it does not contact the WBEM server. The local list of owned destinations is discovered from the WBEM server when the server is registered with the subscription manager, and is maintained from then on as changes happen through this subscription manager.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The listener destination instances. Return type: list
ofCIMInstance
-
get_all_destinations
(server_id)[source]¶ Return all listener destinations in a WBEM server.
This function contacts the WBEM server and retrieves the listener destinations by enumerating the instances of CIM class “CIM_ListenerDestinationCIMXML” in the Interop namespace of the WBEM server.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The listener destination instances. Return type: list
ofCIMInstance
Raises: Exceptions raised by WBEMConnection
.
-
remove_destinations
(server_id, destination_paths)[source]¶ Remove listener destinations from a WBEM server, by deleting the listener destination instances in the server.
The listener destinations must be owned or permanent (i.e. not static).
This method verifies that there are not currently any subscriptions on the listener destinations to be removed, in order to handle server implementations that do not ensure that on the server side as required by DSP1054.
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - destination_paths (
CIMInstanceName
or list ofCIMInstanceName
) – Instance path(s) of the listener destination instance(s) in the WBEM server.
Raises: - Exceptions raised by
WBEMConnection
. CIMError
– CIM_ERR_FAILED, if there are referencing subscriptions.
- server_id (string) – The server ID of the WBEM server, returned by
-
add_filter
(server_id, source_namespace, query, query_language='WQL', owned=True, filter_id=None, name=None)[source]¶ Add a dynamic indication filter to a WBEM server, by creating an indication filter instance (of CIM class “CIM_IndicationFilter”) in the Interop namespace of the server.
The Name property of the created filter instance can be set in one of two ways:
directly by specifying the name parameter.
In this case, the Name property is set directly to the name parameter.
This should be used in cases where the user needs to have control over the filter name (e.g. because a DMTF management profile requires a particular name), but it cannot be used for owned filters.
indirectly by specifying the filter_id parameter.
In this case, the value of the Name property will be:
"pywbemfilter:" {ownership} ":" {subscription_manager_id} ":" {filter_id} ":" {guid}
where
{ownership}
is"owned"
or"permanent"
dependent on whether the filter is owned or permmanent;{subscription_manager_id}
is the subscription manager ID;{filter_id}
is the filter ID; and{guid}
is a globally unique identifier.This can be used for both owned and permanent filters.
Owned indication filters are added or updated conditionally: If the indication filter instance to be added is already registered with this subscription manager and has the same property values, it is not created or modified. If it has the same path but different property values, it is modified to get the desired property values. If an instance with this path does not exist yet (the normal case), it is created.
Permanent indication filters are created unconditionally, and it is up to the user to ensure that such an instance does not exist yet.
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - source_namespace (string) – Source namespace of the indication filter.
- query (string) – Filter query in the specified query language.
- query_language (string) –
Query language for the specified filter query.
Examples: ‘WQL’, ‘DMTF:CQL’.
- owned (
bool
) – Defines the ownership type of the created indication filter instance: If True, it will be owned. Otherwise, it will be permanent. See WBEMSubscriptionManager for details about these ownership types. - filter_id (string) –
A filter ID string that is used as a component in the value of the Name property of filter instances to help the user identify these instances in a WBEM server, or None if the name parameter is specified.
The string must consist of printable characters, and must not contain the character ‘:’ because that is the separator between components within the value of the Name property.
There is no requirement that the filter ID be unique. This can be used to identify groups of filters by using the same value for multiple filters.
- name (string) –
New in pywbem 0.10.
The filter name to be used directly for the Name property of the filter instance, or None if the filter_id parameter is specified.
Returns: The created indication filter instance.
Return type: Raises: - Exceptions raised by
WBEMConnection
. ValueError
– Incorrect input parameter values.TypeError
– Incorrect input parameter types.
-
get_owned_filters
(server_id)[source]¶ Return the indication filters in a WBEM server owned by this subscription manager.
This function accesses only the local list of owned filters; it does not contact the WBEM server. The local list of owned filters is discovered from the WBEM server when the server is registered with the the subscription manager, and is maintained from then on as changes happen through this subscription manager.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The indication filter instances. Return type: list
ofCIMInstance
-
get_all_filters
(server_id)[source]¶ Return all indication filters in a WBEM server.
This function contacts the WBEM server and retrieves the indication filters by enumerating the instances of CIM class “CIM_IndicationFilter” in the Interop namespace of the WBEM server.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The indication filter instances. Return type: list
ofCIMInstance
Raises: Exceptions raised by WBEMConnection
.
-
remove_filter
(server_id, filter_path)[source]¶ Remove an indication filter from a WBEM server, by deleting the indication filter instance in the WBEM server.
The indication filter must be owned or permanent (i.e. not static).
This method verifies that there are not currently any subscriptions on the specified indication filter, in order to handle server implementations that do not ensure that on the server side as required by DSP1054.
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - filter_path (
CIMInstanceName
) – Instance path of the indication filter instance in the WBEM server.
Raises: - Exceptions raised by
WBEMConnection
. CIMError
– CIM_ERR_FAILED, if there are referencing subscriptions.
- server_id (string) – The server ID of the WBEM server, returned by
-
add_subscriptions
(server_id, filter_path, destination_paths=None, owned=True)[source]¶ Add subscriptions to a WBEM server for a particular set of indications defined by an indication filter and for a particular set of WBEM listeners defined by the instance paths of their listener destinations, by creating indication subscription instances (of CIM class “CIM_IndicationSubscription”) in the Interop namespace of that server.
The specified indication filter may be owned, permanent or static.
The specified listener destinations may be owned, permanent or static.
When creating permanent subscriptions, the indication filter and the listener destinations must not be owned.
Owned subscriptions are added or updated conditionally: If the subscription instance to be added is already registered with this subscription manager and has the same property values, it is not created or modified. If it has the same path but different property values, it is modified to get the desired property values. If an instance with this path does not exist yet (the normal case), it is created.
Permanent subscriptions are created unconditionally, and it is up to the user to ensure that such an instance does not exist yet.
Upon successful return of this method, the added subscriptions are active, so that the specified WBEM listeners may immediately receive indications.
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - filter_path (
CIMInstanceName
) – Instance path of the indication filter instance in the WBEM server that specifies the indications to be sent. - destination_paths (
CIMInstanceName
or list ofCIMInstanceName
) –Instance paths of the listener destination instances in the WBEM server that specify the target WBEM listener.
If None, subscriptions will be created for all owned listener destinations registered to this subscription manager.
- owned (
bool
) – Defines the ownership type of the created subscription instances: If True, they will be owned. Otherwise, they will be permanent. See WBEMSubscriptionManager for details about these ownership types.
Returns: The indication subscription instances created in the WBEM server.
Return type: list
ofCIMInstance
Raises: - Exceptions raised by
WBEMConnection
. ValueError
– Incorrect input parameter values.
- server_id (string) – The server ID of the WBEM server, returned by
-
get_owned_subscriptions
(server_id)[source]¶ Return the indication subscriptions in a WBEM server owned by this subscription manager.
This function accesses only the local list of owned subscriptions; it does not contact the WBEM server. The local list of owned subscriptions is discovered from the WBEM server when the server is registered with the subscription manager, and is maintained from then on as changes happen through this subscription manager.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The indication subscription instances. Return type: list
ofCIMInstance
-
get_all_subscriptions
(server_id)[source]¶ Return all indication subscriptions in a WBEM server.
This function contacts the WBEM server and retrieves the indication subscriptions by enumerating the instances of CIM class “CIM_IndicationSubscription” in the Interop namespace of the WBEM server.
Parameters: server_id (string) – The server ID of the WBEM server, returned by add_server()
.Returns: The indication subscription instances. Return type: list
ofCIMInstance
Raises: Exceptions raised by WBEMConnection
.
-
remove_subscriptions
(server_id, sub_paths)[source]¶ Remove indication subscription(s) from a WBEM server, by deleting the indication subscription instances in the server.
The indication subscriptions must be owned or permanent (i.e. not static).
Parameters: - server_id (string) – The server ID of the WBEM server, returned by
add_server()
. - sub_paths (
CIMInstanceName
or list ofCIMInstanceName
) – Instance path(s) of the indication subscription instance(s) in the WBEM server.
Raises: Exceptions raised by
WBEMConnection
.- server_id (string) – The server ID of the WBEM server, returned by