Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
class QmfData:
      <constructor>( _values=map of "name"=<AMQP Type> pairs, 
                     _subtypes=optional map of "name"=<AMQP String> pairs for subtype information,
                     _tag=optional, application-specific tag applied to this QmfData instance
                     _object_id=optional AMQP string that uniquely identifies this QmfData instance.
                     _schema=optional <class SchemaClass> reference
                     _const=False )
      <constructor>( _map=map representation of QmfData, as generated by mapEncode() method, 
                     _schema=optional <class SchemaClass> reference
                     _const=False)
      .is_managed(): returns True if object identifier string assigned, else False.
      .is_described(): returns True if schema is associated with this instance
      .get_tag(): return this object's tag if present, else None
      .get_value(name): return the value of the named data item, returns None if named property is not present.
      .has_value(name): returns True if the named data item is present in the map, else False.
      .set_value(name, value, subType=None): set the value of the named data item. Creates a new item if the named data does not exist. Raises an exception if _const is True. 
      .get_subtype(name): returns the sub type description string, else None if not present. 
      .set_subtype(name, subType): set or modify the subtype associated with name.
      .get_object_id(): returns the object id string associated with the object instance, or None if no id assigned.
      .get_schema_class_id: returns the identifier of the Schema that describes the structure of the data, or None if no schema.
      .map_encode(): returns a map representation of the QmfData instance, suitable for use by the constructor.

...

No Format
class QmfEvent(QmfData):
      <constructor>( timestamp, 
                     _severity=<string>,
                     _values=map of "name"=<AMQP Type> pairs,
                     _subtypes=optional map of "name"=<AMQP String> pairs for subtype information,
                     _tag=optional, application-specific tag applied to this QmfEvent instance
                     _schema=optional <class SchemaEventClass> )
       <constructor>( _map= map encoding of a QmfEvent instance, 
                     _schema=optional <class SchemaEventClass> )
      .get_timestamp(): return a timestamp indicating when the Event occurred.
      .get_severity(): return the severity associated with the Event.
      .map_encode(): return a map encoding of the Event.

...

No Format
class SchemaClassId:
      <constructor>( package=<package-name-str>, 
                     class=<class-name-str>,
                     type=<SchemaTypeData|SchemaTypeEvent>)
                     hash=<hash-str, format="%08x-%08x-%08x-%08x">, 
      .get_package_name(): returns <package-name-str>
      .get_class_name(): returns <class-name-str>
      .get_hash_string(): returns <hash-str, "%08x-%08x-%08x-%08x">
      .get_type(): returns SchemaTypeObject or SchemaTypeEvent
      .map_encode(): returns a map encoding of the instance.

...

No Format
class SchemaProperty:
      <constructor>( name=<name-value>, 
                     type=<type-value>,
                     ...)
      .get_type(): AMQP typecode for encoding/decoding the property data
      .get_access(): "RC"=read/create, "RW"=read/write, "RO"=read only (default)
      .is_optional(): True if this property is optional
      .get_unit(): string describing units (optional)
      .get_min(): minimum value (optional)
      .get_max(): maximum value (optional)
      .get_max_len(): maximum length for string values (optional)
      .get_desc(): optional string description of this Property
      .get_direction(): "I"=input, "O"=output, or "IO"=input/output (required for method arguments, otherwise optional)
      .get_subtype(): string indicating the formal application type for the data, example: "URL", "Telephone number", etc.
      .is_polled(): True if changes to the data cannot be practically monitored by an Agent.  Such a data item can only
          be queried or polled - not published on change.
      .get_reference(): if type==objId, name (str) of referenced class (optional) 
      .is_parent_ref(): True if this property references an object in which this object is in a child-parent relationship.
      .get_attribute("name"): get the value of the attribute named "name". This method can be used to retrieve
          application-specific attributes.  "name" should start with the prefix "x-"
      .map_encode(): returns a map encoding of the instance.

...

No Format
class SchemaClass(QmfData):
      <constructor>( classId=<class SchemaClassId>, 
                     _desc=optional AMQP string containing a human-readable description for this schema)
      .get_class_id(): return the SchemaClassId that identifies this Schema instance.
      .generate_hash(): generate a hash over the body of the schema, and return a string representation of the hash in format  "%08x-%08x-%08x-%08x"

...

No Format
class SchemaObjectClass(SchemaClass):
      <constructor>( classId=<class SchemaClassId>, 
                     _desc=optional AMQP string containing a human-readable description for this schema,
                     _props=map of "name"=<SchemaProperty> instances,
                     _meths=map of "name"=<SchemaMethod> instances,
                     _id_names=(optional) ordered list of "name"s used to identify the properties whose values are used to construct the object identifier)

      .get_id_names(): return an ordered list of names of the values that are used to construct the key for identifying 
          unique instances of this class.  Returns None if no list defined.
      .get_property_count(): return the count of SchemaProperty's in this instance.
      .get_properties(): return a map of "name":<SchemaProperty> entries for each value in the object.
      .get_property("name"): return the SchemaProperty associated with "name", else None if "name" value does not exist.

      .get_method_count(): return the count SchemaMethod's in this instance.
      .get_methods(): return a map of "name":<SchemaMethod> entries for each method associated with the object.
      .get_method("name"): return the SchemaMethod associated with the "name", else None if "name" does not exist or is not a method.

      .add_property("name", SchemaProperty): add a new property.
      .add_method("name", SchemaMethod): add a new method.
      .set_id_names([name-list]): set the value of the order list of names to use when constructing the object identifier.

...

No Format
{"query": {"what": {"object": None},
           "where": ["and" ["eq" "_package_name" ["quote" "aPackage]]
                           ["eq" ["quote" "someClass"] "_class_name"]
                           ["or" ["not" ["re_match" "state" ["quote" "$Error"]]]
                                 ["ne" "owner" ["quote" "Cartman"]]
                           ]
                    ]
          }
}

Subscriptions

TBD
A subscription is a mechanism for monitoring allows a Console application to monitor specific management data for
changes in its state. A Console creates a subscription with an Agent
based on a Query. The Query specifies the set of management data that
is to be monitored. When the Agent detects changes to the data within the selected
set, a notification is sent to the subscribing Console(s).  The notification contains a snapshot of the of the changed data. A
Subscription is represented by the SubscriptionId class. A Console
must  

A subscription remains in effect for a predetermined amount of time, as configured on the Agent.  Once the subscription expires, no further notifications are generated should the data change.  A console may elect to refresh a subscription prior to its expiration.   Alternatively, a Console may explicitly cancel the subscription when the console data no longer needs to
monitor the data.

...

be monitored.

Invoking Methods

QMF allows a Console application to perform a "remote procedure call" on the Agent. The procedure - or method - call executes on the Agent. On completion a result is passed back to the Console. Method calls can be associated with an instance of a data object, or applied to the Agent as a whole.

...

No Format
class Notifier:
    .indication():  Called when the internal work queue becomes non-empty due to the arrival of one or more WorkItems. 
        This method will be called by the internal QMF management thread - it is illegal to invoke any QMF APIs from 
        within this callback.  The purpose of this callback is to indicate that the application should schedule itself
        to process the work items.  

The WorkItem class represents a single notification event that is read from the work queue:

...

No Format
class QmfConsoleData(QmfData):
      .get_timestamps(): returns a list of timestamps describing the
                        lifecycle of the object.  All timestamps are
                        represented by the AMQP timestamp type.
                        [0] = time of last update from Agent,
                        [1] = creation timestamp 
                        [2] = deletion timestamp, or zero if not deleted.
      .get_create_time(): returns the creation timestamp
      .get_update_time(): returns the update timestamp
      .get_delete_time(): returns the deletion timestamp, or zero if not yet deleted.
      .is_deleted(): True if deletion timestamp not zero.

      .refresh([reply-handle | timeout]): request that the Agent update the value of this object's contents.
      .invoke_method(name, inArgs{}, [[reply-handle] | [timeout]]): invoke the named method on this instance.

...

  • AGENT_ADDED
  • AGENT_DELETED
  • NEW_PACKAGE
  • NEW_CLASS
  • OBJECT_UPDATE
  • EVENT_RECEIVED
  • AGENT_HEARTBEAT
  • SUBSCRIPTION_RESPONSE
  • SUBSCRIPTION_INDICATION

These WorkItem types are described in detail below:

...

NEW_PACKAGE

TBD.

NEW_CLASS

TBD.

OBJECT_UPDATE

TBD.

EVENT_RECEIVED

TBD

_UPDATE

TBD.

EVENT_RECEIVED

TBD

SUBSCRIPTION_RESPONSE

The SUBSCRIPTION_RESPONSE WorkItem returns the result of a subscription request made by this Console.  This WorkItem is generated when the Console's create_subscription() is called in an asychronous manner, rather than pending for the result.  

The get_params() method of a SUBSCRIPTION_RESPONSE  WorkItem will return an instance of the following object:

No Format

class SubscriptionParams:
      .get_subscription(): If the subscription is successful, this method returns a SubscriptionId object.
          Should the subscription fail, this method returns None, and get_error() can be used to obtain an
          application-specific QmfData error object.
      .get_expiration_date(): returns a datetime object containing the timestamp (utc) when the subscription
          will automatically expire if not renewed by the console.
      .get_error(): (optional) returns an application-specific QmfData object indicating why the subscription
          request failed.  Returns None if not supported.

The SubscriptionId object must be used when the subscription is refreshed or cancelled.  The SubscriptionId must be passed to the Console's refresh_subscription() and cancel_subscription() methods.

The get_handle() method returns the application handle provided to the create_subscription() method call.

Once a subscription is created, the Agent that maintains the subscription will issue an initial update for the subscribed data.  This update will contain the current values of the subscribed data, and will appear as the first SUBSCRIPTION_INDICATION WorkItem for this subscription.

SUBSCRIPTION_INDICATION

The SUBSCRIPTION_INDICATION WorkItem signals the arrival of an update to subscribed data from the Console.

The get_params() method will return a list of updated data objects.

The get_handle() method will return the application's subscription context handle originally supplied to the Console's create_subscription() method call for this subscription.

Local representation of a remote Agent.

...

No Format
class Console:
      <constructor>(name=<name-str>, 
                    domain=(optional) domain string for console's AMQP address,
                    notifier=<class Notifier>,
                    reply_timeout=<default for all blocking calls>,
                    agent_timeout=<default timeout for agent heartbeat>,
                    subscription_duration=<default lifetime of a subscription>)

      .destroy(timeout=None): Must be called to release Console's resources.

      .add_connection(QPID Connection): Connect the console to the AMQP cloud.

      .remove_connection(conn): Remove the AMQP connection from the console.  Un-does the add_connection() operation, and
          releases any agents associated with the connection.  All blocking methods are unblocked and given a failure status.
          All outstanding asynchronous operations are cancelled without producing WorkItems.

      .get_address():
          Get the AMQP address this Console is listening to (type str).

      .find_agent( name string, [timeout] ): Query for the presence of a specific agent in the QMF domain. Returns a 
          class Agent if the agent is present.  If the agent is not already known to the console, this call will send 
          a query for the agent and block (with default timeout override) waiting for a response.

      .enable_agent_discovery( [Query] ): Called to enable the asynchronous Agent Discovery process. Once enabled, AGENT_ADDED
          and AGENT_DELETED work items can arrive on the WorkQueue.  If a query is supplied, it will be used to filter agent 
          notifications.

      .disable_agent_discovery(): Called to disable the async Agent Discovery process enabled by calling enable_agent_discovery().  

      .get_workitem_count(): Returns the count of pending WorkItems that can be retrieved. 

      .get_next_workitem([timeout=0]): Obtains the next pending work item, or None if none available. 

      .release_workitem(wi): Releases a WorkItem instance obtained by getNextWorkItem(). Called when the application has finished
          processing the WorkItem. 

      .get_agents(): Returns a list of available agents (class Agent)

      .get_agent( name string ): Return the class Agent for the named agent, if known. 

      .get_packages( [class Agent] ): Returns a list of the names of all known packages.  If an optional Agent is provided, then
          only those packages available from that Agent are returned.

      .get_classes( [class Agent] ):  Returns a list of SchemaClassIds for all available Schema.  If an optional Agent is provided,
          then the returned SchemaClassIds are limited to those Schema known to the given Agent.

      .get_schema( class SchemaClassId [, class Agent]): Return a list of all available class SchemaClass across all known agents.
          If an optional Agent is provided, restrict the returned schema to those supported by that Agent.

      .get_objects( _SchemaClassId= | _package=, _class= |
                    _object_identifier=,
                   [timeout=],
                   [list-of-class-Agent] ): perform a blocking query for QmfConsoleObjects.  Returns a list (possibly empty) of matching
           objects. The selector for the query may be either:
           * class SchemaClassId - all objects whose schema match the schema identified by _SchemaClassId parameter.
           * package/class name - all objects whose schema are contained by the named package and class.
           * the object identified by _object_identifier
           This method will block until all known agents reply, or the timeout expires. Once the timeout expires, all
           data retrieved to date is returned. If a list of agents is supplied, then the query is sent to only those agents.  


      .create_subscription( agent, class Query, app_context [, duration=<secs>reply_handle] [, list of agentstimeout] ): creates a subscription to the agent
          using the given Query.  If a list of agentsThe app_context is an application-provided handle that will accompany each subscription update
          send from the agent.  Subscription updates will appear as SUBSCRIPTION_INDICATION WorkItems on the Console's work queue.
          is provided, the Query will apply only to those agents. Otherwise it will apply to all active agents, including
This method may be called asynchronously by providing a reply_handle argument.  When called asynchronously, the result
          of this method thosecall discoveredis duringreturned thein lifetimea of the subscriptionSUBSCRIPTION_RESPONSE WorkItem. The durationTimeout argument can be used to override the console's
          console's default subscription lifetime for default reply timeout.  When called synchronously, this subscription.method returns Returns a class SubscriptionId SubscriptionParams object containing
          the result of the subscription request.

      .refresh_subscription( SubscriptionId [, duration=<secs>] ): (re)activates a subscription.  Uses the console default duration
          unless the duration is explicitly specified.

      .cancel_subscription( SubscriptionId ): terminates the given subscription. 

Example Console Application

...

No Format
class Agent:
      <constructor>( name=<name-string>,
                     domain=(optional) domain string for agent's AMQP address,
                     notifier=class Notifier,
                     heartbeat_interval=30,
                     max_msg_size=0)
      .get_name(): return the name string of the agent.
      .set_connection( QPID Connection ): connect the agent to the AMQP cloud.
      .register_object_class( class SchemaObjectClass ): Register a schema for an object class with the agent.  The agent must
            have a registered schema for an object class before it can handle objects of that class.
      .register_event_class( class SchemaEventClass ) : Register a schema for an event class with the agent.  The agent must
            have a registered schema for an event class before it can handle events of that class.
      .raise_event( class QmfEvent ): Cause the agent to raise the given event.
      .add_object( class QmfAgentData ): passes a reference to an instance of a managed QMF object to the agent. The object's 
          name must uniquely identify this object among all objects known to this agent.
      .get_workitem_count(): Returns the count of pending WorkItems that can be retrieved.
      .get_next_workitem([timeout=0]): Obtains the next pending work item, or None if none available. 
      .release_workitem(wi): Releases a WorkItem instance obtained by get_next_workitem(). Called when the application has finished
          processing the WorkItem. 
      .method_response(name="method name",
                       handle=<handle from WorkItem>,
                       out_args={output argument map}
                       error=<QmfData> ): Indicate to the agent that the application has completed processing a method
                       request. See the description of the METHOD_CALL WorkItem.

...

No Format
class AgentExternal(Agent):
      <constructor>(name=<name-string>,
                    domain=(optional) domain string for agent's AMQP address,
                    notifier= class Notifier,
                    heartbeat_interval=30,
                    max_msg_size=65535)
      .alloc_object_id( name="object name"): indicate to QMF that the named object is available to be managed.  Once this method returns, 
          the agent will service requests from consoles referencing this data.
      .free_object_id( name="object name" ): indicate to QMF that the named object is no longer available to be managed.
      .query_response( handle=<handle from WorkItem>,
                      class QmfAgentObject): send a managed object in reply to a received query. Note that ownership of the object 
          instance is returned to the caller on return from this call. 
      .query_complete( handle=<handle from WorkItem>, 
                      result=<status code> ):  Indicate to the agent that the application has completed processing a query request.
          Zero or more calls to the queryResponse() method should be invoked before calling query_complete().  If the query should
          fail - for example, due to authentication error - the result should be set to a non-zero error code ?TBD?.
      .subscription_response( handle=<handle from WorkItem>,
                             result=<status code>,
                             subscription_handle=<application context>): Indicate the status of a subscription request.  If result
          is zero, the subscription is accepted by the application, and an subscription handle is provided.  This handle must
          be passed to the application when the agent unsubscribes.

...

No Format
class MethodCallParams:
      .get_name(): returns a string containing the name of the method call.
      .get_object_id(): returns the identifier for the object on which this 
          method needs to be invoked.  Returns None iff there is no associated 
          object (a method call against the agent itself).
      .get_args(): returns a map of input arguments for the method. Arguments 
          are in "name"=<value> pairs.  Returns None if no arguments are supplied.
      .get_user_id(): returns authenticated user id of caller if present, else None.

...

No Format
  QUERY parameters: ( class Query, 
                      user_id=<authenticated id of the user> )

...

No Format
  SUBSCRIBE parameters: ( class Query, 
                          user_id=<authenticated id of the user> )

...