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/4b82aaebb8b034f74e1457fdbd4042c4 to your computer and use it in GitHub Desktop.
Save chrissmith-mcafee/4b82aaebb8b034f74e1457fdbd4042c4 to your computer and use it in GitHub Desktop.
This Node-RED flow invokes and displays the results of a `system.applyTag` remote command via the ePO DXL service.
[
{
"id": "3cab471f.fbdca8",
"type": "tab",
"label": "ePO System Apply Tag Example",
"disabled": false,
"info": "This sample invokes and displays the results of a `system.applyTag` remote\r\ncommand via the ePO DXL service. The results of the apply 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 `Apply system tag 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.applyTag` 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 `Apply system tag 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 systems to tag` node and modify the `Payload` property with\r\n the name(s) of the system(s) to apply the tag to. System names should be\r\n separated by commas. For example:\r\n\r\n ```\r\n system1,system2\r\n ```\r\n\r\n* Edit the `Apply system tag in ePO` node and modify the `Tag name` property\r\n with the name of the tag to apply. 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 `Apply system tag in 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 tag` node.\r\n\r\n### Output\r\n\r\nThe number of systems that the tag was applied to should appear in the Node-RED\r\n`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 tag\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 apply the tag to.\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 `Apply system tag in ePO` node uses the `names` property when\r\nconstructing the parameters for the `system.applyTag` remote command. \r\n\r\n#### Apply system tag in ePO\r\n\r\nThis is an `epo system apply 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.applyTag`.\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 `Apply system tag in ePO` node. The output should include\r\nthe response received from the DXL fabric for the `system.applyTag` command."
},
{
"id": "dfbc08fd.29a308",
"type": "inject",
"z": "3cab471f.fbdca8",
"name": "Specify systems to tag",
"topic": "",
"payload": "<specify-systems-to-tag>",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 140,
"y": 40,
"wires": [
[
"35c99ba3.eb1b44"
]
]
},
{
"id": "eebb5fc1.e8327",
"type": "debug",
"z": "3cab471f.fbdca8",
"name": "Debug: Output result",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 560,
"y": 220,
"wires": []
},
{
"id": "d0651085.b90f3",
"type": "dxl-epo-system-apply-tag",
"z": "3cab471f.fbdca8",
"name": "",
"tagName": "<specify-tag-to-apply>",
"client": "2ed0ce07.039942",
"epoUniqueId": "",
"returnType": "obj",
"x": 290,
"y": 220,
"wires": [
[
"eebb5fc1.e8327"
]
]
},
{
"id": "35c99ba3.eb1b44",
"type": "change",
"z": "3cab471f.fbdca8",
"name": "Set names request parameter",
"rules": [
{
"t": "set",
"p": "names",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 230,
"y": 120,
"wires": [
[
"d0651085.b90f3"
]
]
},
{
"id": "91c0d2cd.6c4a1",
"type": "comment",
"z": "3cab471f.fbdca8",
"name": "Supply the list of systems to tag in the 'Set search text' node ",
"info": "",
"x": 540,
"y": 40,
"wires": []
},
{
"id": "5ccd91fd.367b5",
"type": "comment",
"z": "3cab471f.fbdca8",
"name": "Supply the tag name in the 'Apply system tag in ePO' node ",
"info": "",
"x": 370,
"y": 280,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment