Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrissmith-mcafee/1780d2e5093eb3896581d4742c7a0795 to your computer and use it in GitHub Desktop.
Save chrissmith-mcafee/1780d2e5093eb3896581d4742c7a0795 to your computer and use it in GitHub Desktop.
This Node-RED flow invokes and displays the results of a `system.find` remote command via the ePO DXL service.
[
{
"id": "c73cd652.3f9f08",
"type": "tab",
"label": "ePO System Find Example",
"disabled": false,
"info": "This sample invokes and displays the results of a `system.find` remote command\r\nvia the ePO DXL service. The results of the find command are displayed on the\r\nNode-RED `debug` tab.\r\n\r\n### Prerequisites\r\n\r\n* The samples configuration step has been completed (see\r\n [Client Configuration](https://opendxl.github.io/node-red-contrib-dxl/jsdoc/tutorial-configuration.html)).\r\n* A ePO DXL service is running and available on the DXL fabric. If version 5.0\r\n or later of the DXL ePO extensions are installed on your ePO server, an ePO\r\n DXL service should already be running on the fabric. If you are using an\r\n earlier version of the DXL ePO extensions, you can use the\r\n [ePO DXL Python Service](https://github.com/opendxl/opendxl-epo-service-python).\r\n* The DXL client associated with the `Find systems in ePO` node is\r\n authorized to invoke the ePO DXL service, and the user that is connecting to\r\n the ePO server (within the ePO DXL service) has permission to execute the\r\n `system.find` remote command (see\r\n [Client Authorization](https://opendxl.github.io/opendxl-epo-client-python/pydoc/authorization.html)).\r\n\r\n### Setup\r\n\r\n* If more than one ePO service is available on the DXL fabric that the DXL\r\n client is connecting to, edit the `Find systems in ePO` node and set the\r\n `ePO Id` property to that of the ePO service through which the remote command\r\n should be performed. By default, the `ePO Id` property is empty, in which case\r\n the client attempts to dynamically determine the id of the ePO service to\r\n communicate with.\r\n* Edit the `Specify search text` node and modify the `Payload` property with\r\n the search text to use for the system find command. For example:\r\n\r\n ```\r\n broker\r\n ```\r\n\r\n* To deploy the flow, press the `Deploy` button in the upper-right corner of the\r\n screen. If Node-RED is able to properly connect to the DXL fabric, a green dot\r\n with the word `connected` should appear under the `Find systems in ePO` node.\r\n\r\n### Running\r\n\r\nTo exercise the flow, double-click the button on the left side of the\r\n`Specify search text` node.\r\n\r\n### Output\r\n\r\nThe following output should appear in the Node-RED `debug` tab:\r\n\r\n```\r\n? [ object ]\r\n```\r\n\r\nAfter clicking on the right arrow button to expand the contents of the object,\r\noutput similar to the following should appear:\r\n\r\n```\r\n? array[1]\r\n ? 0: object\r\n EPOComputerProperties.ParentID: 2\r\n EPOComputerProperties.ComputerName\": \"mysystem\",\r\n EPOComputerProperties.Description\": null,\r\n...\r\n```\r\n\r\n### Details\r\n\r\nThe flow exercises the nodes below.\r\n\r\n#### Specify search text\r\n\r\nThis is an `inject` input node which starts the flow. This node injects a new\r\nmessage with a `payload` property which specifies the search text to use for the\r\nsystem find command.\r\n\r\n#### Set searchText request parameter\r\n\r\nThis is a `change` node which copies the value from the `payload` property on\r\nthe message to the `searchText` property. The `Find systems in ePO` node uses the `searchText` property when constructing\r\nthe parameters for the `system.find` remote command. \r\n\r\n#### Find systems in ePO\r\n\r\nThis is an `epo system find` node. This node connects to the DXL fabric and\r\nsends a DXL `Request` message to the ePO service. The message specifies the\r\ntarget remote command as `system.find`.\r\n\r\nThe request message also includes the `msg.searchText` property set by the\r\n`Set searchText request parameter` node.\r\n \r\nThe `Return` property is set to \"a parsed JSON object\" and the `Format` property\r\nis set to \"JSON\" to indicate that the payload for the response should be\r\nadded to the output message as a JavaScript object decoded from JSON.\r\n\r\n#### Output result\r\n\r\nThis is a `debug` output node. This node outputs the `payload` set on\r\nthe message by the `Find systems in ePO` node. The output should include\r\nthe response received from the DXL fabric for the `system.find` command."
},
{
"id": "1b9edb70.07a2d5",
"type": "inject",
"z": "c73cd652.3f9f08",
"name": "Specify search text",
"topic": "",
"payload": "<specify-search-text>",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 130,
"y": 100,
"wires": [
[
"cd9123b6.2492f"
]
]
},
{
"id": "af069888.ffe238",
"type": "debug",
"z": "c73cd652.3f9f08",
"name": "Debug: Output systems",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 530,
"y": 300,
"wires": []
},
{
"id": "1b3a4932.b46f37",
"type": "dxl-epo-system-find",
"z": "c73cd652.3f9f08",
"name": "",
"client": "31714476.e2a4ec",
"searchNameOnly": "",
"epoUniqueId": "",
"returnType": "obj",
"x": 280,
"y": 300,
"wires": [
[
"af069888.ffe238"
]
]
},
{
"id": "cd9123b6.2492f",
"type": "change",
"z": "c73cd652.3f9f08",
"name": "Set searchText request parameter",
"rules": [
{
"t": "set",
"p": "searchText",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "searchNameOnly",
"pt": "msg",
"to": "false",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 260,
"y": 200,
"wires": [
[
"1b3a4932.b46f37"
]
]
},
{
"id": "70002f7e.8a701",
"type": "comment",
"z": "c73cd652.3f9f08",
"name": "Supply the system search text to use in the 'Set search text' node",
"info": "",
"x": 250,
"y": 40,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment