Chapter 2

Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
CH A P T E R
2
Working with Mediator Framework
This chapter describes the Mediator framework and includes the following sections:
•
Framework Overview, page 2-1
•
Configurable Nodes, page 2-2
•
Composite Nodes, page 2-4
•
Getting and Setting Node Values, page 2-5
Framework Overview
Mediator framework is the software application that provides the core function of the Mediator. The
framework gives the Mediator its Multi-Protocol Exchange capabilities, including the following:
•
Assembling a running system from configuration data.
•
Getting and setting values.
•
Processing raw data.
•
Presenting data from disparate sources in a uniform format.
•
Making data easily available to end users.
•
Providing services such as data logging and HTTP services.
•
Providing an environment for custom system configuration.
•
Providing an environment for developing custom solutions.
There are two types of framework nodes:
•
Configurable Nodes
•
Composite Nodes
All nodes inherit framework from one of two base node types. The composite node may hold child nodes;
configurable nodes, on the other hand, are leaf nodes in the hierarchy. The composite node data type is
an extension to the configurable node, so all the methods discussed for configurable nodes apply to
composite nodes as well.
For more information on the framework, see the Cisco Network Building Mediator Release 3.1.0 User
Guide.
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01
2-1
Chapter 2
Working with Mediator Framework
Configurable Nodes
Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
Configurable Nodes
This section explains the operations that you can perform with the configurable nodes and includes the
following topics:
•
Starting and Stopping Nodes, page 2-2
•
Starting and Stopping Nodes, page 2-2
•
Getting and Setting Attributes, page 2-3
Configuring Nodes
This section lists the standard APIs used for configurable nodes and includes the following topics:
•
configure(), page 2-2
•
configuration(), page 2-2
configure()
This API function allows the client to configure those parameters or attributes of the node that have been
specified as configurable.
Inputs
Requires a single hash map type parameter providing name/value pairs for configurable attributes of the
node. The values are usually primitive type, and the appropriate conversions are applied internally.
Certain parameters will require explicit values, whereas others may have default values. The proper
mechanism for configuring a parent node and name is via this method.
Outputs
No return value.
Note
Invocations of configure() which modify the configuration of a node in the framework are never
persisted. Each time the framework starts or restarts, only the configuration information specified in the
Broadway XML configuration file is used.
configuration()
This API function allows the client to query a node for configured attributes.
Inputs
Accepts no parameters.
Outputs
Returns a hash map analogous to the hash map with which the node was configured.
Starting and Stopping Nodes
This section lists the standard APIs used for starting and stopping nodes and includes the following
topics:
2-2
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01
Chapter 2
Working with Mediator Framework
Configurable Nodes
Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
•
start(), page 2-3
•
stop(), page 2-3
start()
This API function allows the client to perform node-specific implementation to initialized configured
nodes.
Inputs
Accepts no parameters.
Outputs
No return value.
stop()
This API function allows the client to perform node-specific implementation to clean up node resources,
stop associated processes, and scheduled entries.
Inputs
Accepts no parameters.
Outputs
No return value.
Getting and Setting Attributes
This section lists the standard APIs used for getting and setting attributes and includes the following
topics:
•
getattr(), page 2-3
•
setattr(), page 2-3
•
hasattr(), page 2-4
getattr()
This API function provides the client with a method-based mechanism for retrieving arbitrary named
attributes of a node.
Inputs
Requires single parameter naming attribute to retrieve.
Outputs
Returns value of attribute if it exists.
setattr()
This API function provides the client with a method-based mechanism for setting the value of arbitrarily
named attributes of a node.
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01
2-3
Chapter 2
Working with Mediator Framework
Composite Nodes
Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
Inputs
Requires two parameters: name of attribute to be set, and the value it should be set to.
Outputs
No return value.
hasattr()
This API function provides the client with a method-based mechanism for querying the node about the
existence of attributes.
Inputs
Requires single parameter: name of attribute to check on.
Outputs
Returns Boolean value indicating whether the attribute exists.
Composite Nodes
This section describes the extended operations that you can perform with the composite nodes and
includes the following topics:
•
Starting and Stopping Nodes, page 2-4
•
Working with Node Children, page 2-4
Starting and Stopping Nodes
Composite Node extends the actions of the configurable nodes such that their invocation propagates to
all the node descendants. Starting or stopping a parent node automatically starts and stops each of the
child nodes in the parent also.
Working with Node Children
This section lists the standard APIs used for manipulating node children and includes the following
topics:
•
has_child(), page 2-4
•
get_child(), page 2-5
•
children_nodes(), page 2-5
•
children_names(), page 2-5
has_child()
This API function allows the client to query the node for existence of a child node based on the node
name.
Inputs
2-4
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01
Chapter 2
Working with Mediator Framework
Composite Nodes
Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
Requires on parameter: name of child node to check for.
Outputs
Returns Boolean value indicating whether child with specified name exists.
get_child()
This API function allows the client to query the node for a child node reference by name.
Inputs
Requires one parameter: the name of the child node to get.
Outputs
Returns child node instance if one exists.
Note
Although this method is part of the composite node API, invoking it remotely over XML-RPC will result
in an error. It is described here for completeness.
children_nodes()
This API function allows the client to query the node for a list of child nodes.
Inputs
Accepts no parameters.
Outputs
Returns list of child node instances.
Note
Although this method is part of the composite node API, invoking it remotely over XML-RPC will result
in an error. It is described here for completeness.
children_names()
This API function allows the client to query the node for a list of child node names.
Inputs
Accepts no parameter.
Outputs
Returns list of child node names.
Getting and Setting Node Values
This section lists the additional API functions that you can perform with the composite nodes, these
functions are not defined by the base classes. This section includes the following topics:
•
get(), page 2-6
•
set(), page 2-6
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01
2-5
Chapter 2
Working with Mediator Framework
Composite Nodes
Se n d d o c u m e n t a t i o n c o m m e n t s t o c b s b u - d o c f e e d b a ck @ c i s c o . c o m
get()
This API function allows the client to get the current value of a point node.
Inputs
Accepts no parameters.
Outputs
Returns current value of node.
set()
This API function allows the client to set the current value of a point node.
Inputs
Requires single parameter: new value of node.
Outputs
No return value.
2-6
Cisco Network Building Mediator Release 3.1.1 and Cisco Network Building Mediator Manager Release 1.1.1 XML-RPC API Guide
OL-22516-01