Start a Conversation

Unsolved

This post is more than 5 years old

4579

February 21st, 2018 02:00

EDAA REST - Populate Notification OccurredOn relationship.....

Good morning,

I am attempting to use EDAA to create and update notifications using perl and json.

So far I have had some success.  I can create a notification (using the NotificationFactory), populate the basic fields, run a notify and a change.

The only problem I have is managing to POST to  the OccurredOn relationship.

I am getting the following error 4009 :

'MsaError - Msa Create Related Instance Operation Error. Source: ICS_Notification::NOTIFICATION-MyNotificationNameHere. Relationship: OccurredOn. Caused by: Cannot invoke method indexOf() on null object',

I am running a POST to this URL :

/instances/ICS_Notification::NOTIFICATION-MyNotificationNameHere/relationships/OccurredOn

This is the encoded payload :

{"link": { "-href": "/smarts-edaa/msa/edaa-oi-01/instances/Node::MyDevice-Edaa" }}

But however I play around with the payload ("-href", "href", "ref" and all kinds of combinations of the link itself) I still get the same error.

I know I am probably missing something obvious....

Full text of error :

$VAR1 = 'xmlns';

$VAR2 = 'http://www.w3.org/2005/Atom';

$VAR3 = 'entries';

$VAR4 = [

          {

            'xmlns$inst' => 'http://schemas.emc.com/vs-xml/namespace/Common/1.0',

            'content' => {

                           'Time' => '2018-02-21T09:47:45+00:00',

                           'ErrorMessage' => 'Msa Create Related Instance Operation Error. Source: ICS_Notification::NOTIFICATION-MyNotificationNameHere. Relationship: OccurredOn. Caused by: Cannot invoke method indexOf() on null object',

                           'RequestUri' => 'http://myServer.bob:8080/smarts-edaa/msa/edaa-oi-01/instances/ICS_Notification::NOTIFICATION-MyNotificationNameHere/relationships/OccurredOn',

                           'Code' => '4009',

                           'Type' => 'OPERATION_ERROR',

                           'vsc$displayName' => 'Msa Create Related Instance Operation Error. Source: ICS_Notification::NOTIFICATION-MyNotificationNameHere. Relationship: OccurredOn. Caused by: Cannot invoke method indexOf() on null object',

                           'CodeString' => 'msa.create.related.instance.operation.error',

                           'links' => [

                                        {

                                          'rel' => 'http://schemas.emc.com/msa/common/reln/type',

                                          'href' => 'http://myServer.bob:8080/smarts-edaa/msa/edaa-oi-01/types/MsaError'

                                        }

                                      ]

                         },

            'updated' => '2018-02-21T09:47:45+00:00',

            'id' => 'http://myServer.bob:8080/smarts-edaa/msa/edaa-oi-01/instances/MsaError::4009',

            'title' => 'MsaError - Msa Create Related Instance Operation Error. Source: ICS_Notification::NOTIFICATION-MyNotificationNameHere. Relationship: OccurredOn. Caused by: Cannot invoke method indexOf() on null object',

            'xmlns$vsc' => 'http://schemas.emc.com/vs-xml/namespace/Common/1.0',

            'links' => [

                         {

                           'rel' => 'http://schemas.emc.com/msa/common/reln/type',

                           'href' => 'http://myServer.bob:8080/smarts-edaa/msa/edaa-oi-01/types/MsaError'

                         }

                       ]

          }

        ];


Any help, gratefully received.....

Cheers

Tom Counter

54 Posts

February 21st, 2018 09:00

Tom,

Thank you for contacting the Smarts user forum.

I'll need to research your question and will provide an update to you on Friday.

Kind Regards,

Sean Popham

February 22nd, 2018 02:00

Sean,

Any light you could shed would be hugely helpful.

Many thanks,

Thomas Counter

NMS Engineer

February 23rd, 2018 07:00

Naturally, before you issue the notification POST, you did check that the class of object is actually present as "Node" in the topology (not Host or Switch or some other type), and the object name "MyDevice-Edaa" is really present in the topology of the SAM, right?

54 Posts

February 23rd, 2018 09:00

Tom,

We are still researching the issue.. I'll have an update later today or Monday morning.

Kind Regards,

Sean

February 26th, 2018 01:00

I have be shown a solution which does work using LWP::UserAgent rather than REST::Client.

I would be interested to find out what I was doing wrong for REST as I still cannot get it working, but the LWP solution is good enough.

It was definitely something with my code as I managed to get Curl working from the command line and now LWP from within my script.

The LWP solution is basically

$client = REST::Client->new(host => $host);

$userAgent = LWP::UserAgent->new;

my $xml = "";

my $restURL = $host.$notificationURL."/relationships/OccurredOn";
$response = $userAgent->request(POST $restURL,Content_Type => "application/xml",Content => $xml);

I am happy to stick with this for now as I does everything I need.

Many thanks for your help.

Cheers

Tom Counter

Exponential-E

54 Posts

February 28th, 2018 10:00

Tom,

I'm glad you were shown the solution. Please understand that this area of Smarts is something we are limited on.. I would like to know if you found the solution online.

Please let me know.

Kind Regards,

Sean

March 1st, 2018 00:00

Sean,

I posted to the Google groups forum and got a bite from Glenn Davis who provided me with a lump of perl code using LWP::UserAgent which replicates the curl commandline POST approach.

I still can’t get the REST::Client working for POST relationships, but the LWP module is working fine.

use LWP::UserAgent;

$userAgent = LWP::UserAgent->new;

my $xml = "";
$response = $userAgent->request(POST $restURL,Content_Type => "application/xml",Content => $xml);

I am happy for this to be closed as I have a workable solution.

Many thanks.

Thomas Counter

NMS Engineer

No Events found!

Top