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/24d34baa0921c3f45f0489b919f74b6d to your computer and use it in GitHub Desktop.
Save chrissmith-mcafee/24d34baa0921c3f45f0489b919f74b6d to your computer and use it in GitHub Desktop.
This Node-RED flow invokes and displays the results of a `system.clearTag` remote command via the ePO DXL service.
[
{
"id": "1723c736.e448e9",
"type": "tab",
"label": "ePO System Clear Tag Example",
"disabled": false,
"info": "This sample invokes and displays the results of a `system.clearTag` remote\r\ncommand via the ePO DXL service. The results of the clear command are displayed\r\non the Node-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 `Clear system tag from 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.clearTag` 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 `Clear system tag from 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 systems to clear tag from` node and modify the `Payload`\r\n property with the name(s) of the system(s) to clear the tag from. System names\r\n should be separated by commas. For example:\r\n\r\n ```\r\n system1,system2\r\n ```\r\n\r\n* Edit the `Clear system tag from ePO` node and modify the `Tag name` property\r\n with the name of the tag to clear. For example:\r\n\r\n ```\r\n mytag1\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 `Clear system tag from ePO`\r\n 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 systems to clear tag from` node.\r\n\r\n### Output\r\n\r\nThe number of systems that the tag was cleared from should appear in the\r\nNode-RED `debug` tab. For example:\r\n\r\n```\r\n2\r\n```\r\n\r\n### Details\r\n\r\nThe flow exercises the nodes below.\r\n\r\n#### Specify systems to clear tag from\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 name(s) of the system(s)\r\nto clear the tag from.\r\n\r\n#### Set names request parameter\r\n\r\nThis is a `change` node which copies the value from the `payload` property on\r\nthe message to the `names` property. The `Clear system tag from ePO` node uses the `names` property\r\nwhen constructing the parameters for the `system.clearTag` remote command. \r\n\r\n#### Apply system tag in ePO\r\n\r\nThis is an `epo system clear tag` 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.clearTag`.\r\n\r\nThe request message also includes the `msg.names` property set by the\r\n`Set names request parameter` node and the `tagName` set in the\r\n`Tag name` property.\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 `Clear system tag from ePO` node. The output should include\r\nthe response received from the DXL fabric for the `system.clearTag` command."
},
{
"id": "bd18c65a.273748",
"type": "inject",
"z": "1723c736.e448e9",
"name": "Specify systems to clear tag from",
"topic": "",
"payload": "<specify-systems-to-clear-tag-from>",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 170,
"y": 100,
"wires": [
[
"684fc5a6.d1373c"
]
]
},
{
"id": "a8237152.66ba2",
"type": "debug",
"z": "1723c736.e448e9",
"name": "Debug: Output result",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 580,
"y": 300,
"wires": []
},
{
"id": "5c2cef1a.30518",
"type": "dxl-epo-system-clear-tag",
"z": "1723c736.e448e9",
"name": "",
"tagName": "<specify-tag-to-clear>",
"client": "2ed0ce07.039942",
"returnType": "obj",
"x": 320,
"y": 300,
"wires": [
[
"a8237152.66ba2"
]
]
},
{
"id": "684fc5a6.d1373c",
"type": "change",
"z": "1723c736.e448e9",
"name": "Set names request parameter",
"rules": [
{
"t": "set",
"p": "names",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 250,
"y": 200,
"wires": [
[
"5c2cef1a.30518"
]
]
},
{
"id": "1b8a001f.ba618",
"type": "comment",
"z": "1723c736.e448e9",
"name": "Supply the list of systems to untag in the 'Set search text' node ",
"info": "",
"x": 240,
"y": 40,
"wires": []
},
{
"id": "6fa0ef7f.f3a96",
"type": "comment",
"z": "1723c736.e448e9",
"name": "Supply the tag name in the 'Clear system tag from ePO' node ",
"info": "",
"x": 400,
"y": 360,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment