This article covers the steps / syntax for inserting relationship on a notification object with EDAA.
For example:ICS_Notification::NOTIFICATION_Router_dummy-router_Down
and want to update OccurredOn to link to device Router::dummy-router
.
SMARTS 10.1.X
TCSA 2.X
To update the OccurredOn relationship, a POST request needs to be sent. This means that user would have to supply the relationship link with an XML/JSON payload to go along with the POST.
Following is the bit of code is what makes up the URL that would set the OccurredOn:
$resultXML="RESULT.XML";
$occurredOn = "/instances/ICS_Notification::" . $notifName . "/relationships/OccurredOn?pretty=true";
$actionURL=$EDAA . $SAM . $occurredOn;
print " * actionURL: " . $actionURL . "\n";
So the URL would be:
http://<IPAddress>:Port/smarts-edaa/msa/$SAMserverName/instances/ICS_Notification::NOTIFICATION-this-is-a-notification/relationships/OccurredOn?pretty=true
Steps to create the Payload message:
XML format of the payload:
$message="";
$message= $message . "\<\?xml version=\"1.0\" encoding=\"UTF-8\"\?\>\n";
#Example - $message= $message . "\<link href=\"/smarts-edaa/msa/INCHARGE-SA-PRES/instances/Router::dummy-router\"/\>";
$message= $message . "\<link href=\"/smarts-edaa/msa/INCHARGE-SA-PRES/instances/";
$message= $message . $class . "::" . $instance . "\"/\>\n";
JSON format of the payload:
$message = "{
"rel": "http://schemas.emc.com/msa/sam-presentation/2.0/ICS_Notification/relationship/OccurredOn"",
"href": "/smarts-edaa/msa/INCHARGE-SA-PRES/instances/Router::dummy-router"
}";
The JSON format needs to be added one more key in the body of the POST request i.e. "rel". The value of rel is should be in the below format:schemas URI + relationship
(the user wishes to update.)
Then, to send the payload onto the POST message.
$userAgent = LWP::UserAgent->new;
If payload used is in XML format:
$response = $userAgent->request(POST $actionURL,Content_Type => "application/xml",Content => $message);
If payload used is in JSON format:
$response = $userAgent->request(POST $actionURL,Content_Type => "application/json",Content => $message);
If you are using curl, you need to have an XML file that goes along with the POST you are sending to the server.