# Pegasus Project Working Paper

# Expanding the Pegasus Provider Interface Proposal

AUTHORS: Mike Brasher, Karl Schopmeyer, Chip Vincent 22 May 2001

Last Update Thursday, May 31, 2001 02:38 PM

Revision Status

Revision | Date | Author(s) | Reason
1.0 | 20 May 2001 | Karl | Original
1.1 | 30 May 2001 | Karl | Add comments.

## Introduction

We have already defined a set of interfaces for Pegasus providers based on the CIM Operations. We recognized several limitations in that first set of interfaces, particularly the fact that there was no easy path back to the CIMOM from the provider. The initial interfaces provides a handle to get to the repository but not to put CIM operations back into the CIMOM. At a recent work group meeting, IBM proposed a further set of changes to provide a more consistent interface and to reduce the possibility that the interface will have to change with future changes to the CIM Operations.

This document is a proposal to make these changes.

## Objectives

1. Extend for the next set of functionality primarily indications.
2. Provide more information to the provider
3. Enable providers to perform varying levels of operation (dump and smart providers).
4. Support implementation specific objects.
5. Isolate the API from changes to the CIM standard and implementation specific objects.
6. Prepare for the implementation of standardized provider registration

## Summary of Proposed Changes

We propose the following changes:

1. Create an operational context for each transaction. This context would allow us to pass information such as security and locale to the provider. In addition, we have considered that this interface could also make the target CIM class available to the provider so it would not have to be specifically requested.
2. Modify the boolean parameters passed so they get passed in a single variable. Today several of the CIM Operations include boolean parameters. While we are not sure these will change, any change would cause a signature change to the provider
3. Simplify and unify the object identity parameters. - Today the object ID is passed as a set of parameters, Namespace, Class/instance ID. This could easily be consolidated into a single CIMReference parameter so that the namespace, object ID, etc. could be broken out by the provider. WHY?
4. Subdivide the Provider interface. - Today we have a single interface to the provider that allows the provider to implement all of the possible CIM operations. First, it is not clear that the provider needs all of the operations. Second, there are subsets of provider functionality (method providers, property providers, etc.) that only implement a subset of the CIM Operations. The proposal is to create specific interfaces to support just these subsets.
5. Add a provider operation to shutdown a provider. We will have to provide a more organized shutdown than is provided today. One of the operations will be to shutdown the providers. To do this in an organized manner we will need to communicate the shutdown command to the providers.
6. Add the indication interfaces. - We are beginning to do the design for indications now. One of the interfaces will be the provider interface for moving indications from the provider to the Object Manager.

## Definition of the Proposed Changes

This section defines the proposed implementation for each of these changes.

### Context for each Provider and for each Operation

Operations do not currently support parameters to describe context information (such as security or localization parameters). In addition, there will be additional requirements for the provider to request information for things like system parameters, system state information, etc.

As part of this we also want to create a handle so that CIM Operations can be effecitively passed from the provider back to the Object Manager.

We propose modifying both the provider context and adding an operational context parameter.

#### Provider Context

Today - one parameter, the CIM Repository handle provided with the initialize as follows:

    virtual void initialize(CIMOMHandle& repository);

The provider saves the repository handle for later access using the CIMRepository interface. We don't want providers to have access to the repository but we do want them to have easy access back to the Object Manager with CIM Operations.

We could provide access to the Object Manager delegator except that this would bypass any security features that we would want to implement. We propose adding a new interface which will provide:

- A way to put CIM Operations (getClass, etc.) back into the Object Manager
- Additional specific operations required by the provider -

#### Operation Context

Introduce OperationContext which communicates context information to operation methods and allows implementation specific context information to be passed to providers.
OperationContext encapsulates
Locale information
User credentials
Implementation TBD

    CIMInstance MyProvider::getInstance(..., const OperationContext & context, ...)
    {
        // ...
        // get locale from operation context
        // ...
        // get user credentials from operation context
        // ...
        return(CIMInstance(instance));
    }

### Boolean Parameters

Operations currently use multiple arguments to represent additional information (Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, etc.) Replace optional request parameters with a 32 bit unsigned integer flags parameter.

    struct OperationFlag
    {
        const static Uint32 localOnly = 0x00000001;
        const static Uint32 includeQualifiers = 0x00000002;
        const static Uint32 includeClassOrigin = 0x00000004;
        const static Uint32 deepInheritance = 0x00000008;
    };
    The following is an example of the use of the compacted binary parameter.

    CIMInstance MyProvider::getInstance(..., const Uint32 flags, ...)
    {
        // . . .
        Boolean localOnly = false;
    	    CIMInstance instance;
        if(flags & OperationFlag::localOnly)
        {  // get only local properties
    	// . . .
        }
    	return(CIMInstance(instance));
    }

### Simplify Object Identity Parameters

Operations currently use two arguments to identify objects.

1. const String& namespace, String& className for class oriented operations (e.g., getClass() and enumerateInstances()).
2. const String& namespace, const CIMReference& instance in instance oriented operations (e.g., getInstance and enumInstances()).

Use CIMReference which encapsulates namespace, class name, and key bindings (for instance references) and isolates operation methods from changes in object identification (such as the addition of namespace type).

    CIMInstance MyProvider::getInstance(const CIMReference & ref, …)
    {
        // get the namespace path (e.g., "root" or "root//sample"
        String namespacePath = ref.getNamespace();

        // get the class name
        String className = ref.getModel().getClassName();

        // get the instance keys
        Array<KeyBinding> keySet = ref.getKeyBindings();

    	if(keySet().getSize() == 0)
    	{
          	    // throw exception
    	}
    	CIMInstance instance;

    	// ...

    	return(CIMInstance(instance));
    }
    Actually, this largely exists today. We are supplying the CIMReference including the namespacepath component normally
    and the remainder of the CIMReference is part of the defined paths today. However, it requires changing the type for
    the paths throughout the model Thus

    virtual CIMClass getClass(
    	const String& nameSpace,
    	const String& className,
    	Boolean localOnly = true,
    	Boolean includeQualifiers = true,
    	Boolean includeClassOrigin = false,
    	const Array<String>& propertyList = EmptyStringArray());

would become

    virtual CIMClass getClass(
    	const CIMReference& className,
    	Boolean localOnly = true,
    	Boolean includeQualifiers = true,
    	Boolean includeClassOrigin = false,
    	const Array<String>& propertyList = EmptyStringArray());

To accomplish this:

1. All provider operations would change to drop the nameSpace parameter.
2. Those classes that provide className as a string would change to provide it and the namespace as CIMReference (this is the following class operations.
   - getClass
   - deleteClass
   - enumerateClassNames
   - enumerateClasses
   At the same time, it is not certain that we need the class interfaces for the provider. We have no plans to implement a class provider at this point because we have not seen the requirement.
3. Most instance operations remaine the same except that the namespace parameter would be removed. Thus, getInstance which today is:

           virtual CIMInstance getInstance(
       	    const String& nameSpace,
       	    const CIMReference& instanceName,
       	    Boolean localOnly = true,
       	    Boolean includeQualifiers = false,
       	    Boolean includeClassOrigin = false,
       	    const Array<String>& propertyList = EmptyStringArray());

   Becomes:

           virtual CIMInstance getInstance(

       	    const CIMReference& instanceName,
       	    Boolean localOnly = true,
       	    Boolean includeQualifiers = false,
       	    Boolean includeClassOrigin = false,
       	    const Array<String>& propertyList = EmptyStringArray());

   The following instance functions can be modified this way:
   - getInstance
   - deleteInstance
   - enumerateInstances
   - getProperty
   - setProperty
   - invokeMethod
4. The qualifier functions probably do not need to be implemented in any case. It is not clear that we need class qualifier modification tools in the provider.
5. The functions that will be different are those operations tha move entire clases or instances as part of the operation. This includes
   - createClass
   - createInstance
   - modifyClass
   - modifyInstance
   Today, for example, the modifyInstance is as follows:

       	virtual void modifyInstance(
       	    const String& nameSpace,
       	    CIMInstance& modifiedInstance);

   Could become:

           TBD

6. Association operation - These functions represent minimal change since they use CIMReference today. For example:

       virtual Array<CIMReference> referenceNames(
       	const String& nameSpace,
       	const CIMReference& objectName,
       	const String& resultClass = String::EMPTY,
       	const String& role = String::EMPTY);

   Would be modified simply be modified by removing the nameSpace parameter.
7. Exec Query - The execQuery is a special case since the parameter set for this is unique.

           virtual Array<CIMInstance> execQuery(
       	    const String& queryLanguage,
       	    const String& query) ;

   There is no reason to change this functional interface.

### Subdivide Provider Interface

Today the provider interface consists of all of the possible operations gathered together. It has been requested that we break this down into multiple interfaces that represent the major catagory of provider

1. Instance Provider
2. Property Provider
3. Method Provider
4. Association Provider
5. Indication Provider

Generally the provider writers feel that they would prefer these simpler interfaces. The proposal made by IBM is that the operations be broken up as follows:

1. Instance Provider - All Instance operations
2. Property Provider - Get and Set Properyt
3. Method Provider - Invoke method
4. Association provider - The association and reference operations
5. Indication Provider - TBD

This implies that a single provider that does all of the above then must set up interfaces for all of the different provider types.

Today, the current interface has one provider type with all of the operations built in. In effect, we view this as our interpretation of the instance provider. It provides for instances and those other entities such as properties, etc. We can provide either type of interface or both (we are preparing a separate proposal on a solution to maintaining multiple provider interfaces.).

### Terminate Provider Operations

Requirement: We need a way to quies providers - to tell them to stop what they are doing. This is probably not very important in the case of simple responding providers. They simply respond to requests and await the next request. However, providers that do their own monitoring, that establish and manage separate threads (and in the future remote providers) should be shut down systematically as part of the shutdown of the CIMOM environment. Thus, an additional provider interface is needed that can issue a terminate command.

This one is simple. The method name is:

        Terminate();

It will be issued by the Object Manager to all active providers in the process of Object Manager shutdown, possibly operator command, etc.. Note that in the future when providers are visible through the CIM_Services objects, they could be stopped through methods attached to the provider CIM_Service objects. This means that ALL providers must implement this interface just as they must implement the `Initialize()` interface today. Normally the requirement on the provider would be to stop any continuous operations that are in process and then return a response. At this point we have not proposed any special requirements such as timers for shutdown,etc.

Our proposed behavior is that the provider not return completion on this request until it has terminated operations and is prepared to be shutdonwn.

QUESTION: Is this a problem?.

### Indication Interface

We will discuss this as part of another document on indication implementation.

---END OF _DOCUMENT---