@itentialopensource/adapter-infoblox_universal_ddi 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +19 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +211 -0
  6. package/CALLS.md +923 -0
  7. package/CODE_OF_CONDUCT.md +43 -0
  8. package/CONTRIBUTING.md +13 -0
  9. package/ENHANCE.md +69 -0
  10. package/LICENSE +201 -0
  11. package/PROPERTIES.md +661 -0
  12. package/README.md +344 -0
  13. package/SUMMARY.md +9 -0
  14. package/SYSTEMINFO.md +16 -0
  15. package/TAB1.md +10 -0
  16. package/TAB2.md +314 -0
  17. package/TROUBLESHOOT.md +56 -0
  18. package/UTILITIES.md +473 -0
  19. package/adapter.js +13131 -0
  20. package/adapterBase.js +1488 -0
  21. package/entities/.generic/action.json +214 -0
  22. package/entities/.generic/schema.json +28 -0
  23. package/entities/.system/action.json +50 -0
  24. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  25. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  26. package/entities/.system/schema.json +19 -0
  27. package/entities/.system/schemaTokenReq.json +53 -0
  28. package/entities/.system/schemaTokenResp.json +53 -0
  29. package/entities/Address/action.json +106 -0
  30. package/entities/Address/schema.json +122 -0
  31. package/entities/AddressBlock/action.json +270 -0
  32. package/entities/AddressBlock/schema.json +163 -0
  33. package/entities/Asm/action.json +66 -0
  34. package/entities/Asm/schema.json +43 -0
  35. package/entities/ConfigProfile/action.json +126 -0
  36. package/entities/ConfigProfile/schema.json +90 -0
  37. package/entities/DhcpHost/action.json +87 -0
  38. package/entities/DhcpHost/schema.json +110 -0
  39. package/entities/DhcpUniversalService/action.json +46 -0
  40. package/entities/DhcpUniversalService/schema.json +20 -0
  41. package/entities/DnsUsage/action.json +46 -0
  42. package/entities/DnsUsage/schema.json +86 -0
  43. package/entities/Filter/action.json +25 -0
  44. package/entities/Filter/schema.json +107 -0
  45. package/entities/FixedAddress/action.json +106 -0
  46. package/entities/FixedAddress/schema.json +111 -0
  47. package/entities/Global/action.json +86 -0
  48. package/entities/Global/schema.json +33 -0
  49. package/entities/HaGroup/action.json +106 -0
  50. package/entities/HaGroup/schema.json +122 -0
  51. package/entities/HardwareFilter/action.json +106 -0
  52. package/entities/HardwareFilter/schema.json +111 -0
  53. package/entities/IpSpace/action.json +167 -0
  54. package/entities/IpSpace/schema.json +136 -0
  55. package/entities/IpamHost/action.json +106 -0
  56. package/entities/IpamHost/schema.json +111 -0
  57. package/entities/LeasesCommand/action.json +24 -0
  58. package/entities/LeasesCommand/schema.json +19 -0
  59. package/entities/MacAddressItem/action.json +146 -0
  60. package/entities/MacAddressItem/schema.json +91 -0
  61. package/entities/OptionCode/action.json +106 -0
  62. package/entities/OptionCode/schema.json +89 -0
  63. package/entities/OptionFilter/action.json +106 -0
  64. package/entities/OptionFilter/schema.json +111 -0
  65. package/entities/OptionGroup/action.json +106 -0
  66. package/entities/OptionGroup/schema.json +111 -0
  67. package/entities/OptionSpace/action.json +106 -0
  68. package/entities/OptionSpace/schema.json +111 -0
  69. package/entities/Range/action.json +147 -0
  70. package/entities/Range/schema.json +113 -0
  71. package/entities/Server/action.json +106 -0
  72. package/entities/Server/schema.json +111 -0
  73. package/entities/Service/action.json +46 -0
  74. package/entities/Service/schema.json +108 -0
  75. package/entities/Subnet/action.json +188 -0
  76. package/entities/Subnet/schema.json +137 -0
  77. package/error.json +190 -0
  78. package/metadata.json +61 -0
  79. package/package.json +75 -0
  80. package/pronghorn.json +8232 -0
  81. package/propertiesDecorators.json +18 -0
  82. package/propertiesSchema.json +1727 -0
  83. package/report/adapterInfo.json +10 -0
  84. package/report/auto-adapter-openapi.json +6163 -0
  85. package/report/creationReport.json +1150 -0
  86. package/report/universal_ddi_v1.json +10288 -0
  87. package/sampleProperties.json +260 -0
  88. package/test/integration/adapterTestBasicGet.js +117 -0
  89. package/test/integration/adapterTestConnectivity.js +117 -0
  90. package/test/integration/adapterTestIntegration.js +3484 -0
  91. package/test/unit/adapterBaseTestUnit.js +1628 -0
  92. package/test/unit/adapterTestUnit.js +4871 -0
  93. package/utils/adapterInfo.js +156 -0
  94. package/utils/argParser.js +44 -0
  95. package/utils/checkMigrate.js +102 -0
  96. package/utils/entitiesToDB.js +190 -0
  97. package/utils/findPath.js +74 -0
  98. package/utils/logger.js +26 -0
  99. package/utils/methodDocumentor.js +273 -0
  100. package/utils/modify.js +153 -0
  101. package/utils/mongoDbConnection.js +79 -0
  102. package/utils/mongoUtils.js +162 -0
  103. package/utils/pre-commit.sh +32 -0
  104. package/utils/removeHooks.js +20 -0
  105. package/utils/setup.js +33 -0
  106. package/utils/taskMover.js +308 -0
  107. package/utils/tbScript.js +103 -0
  108. package/utils/tbUtils.js +347 -0
  109. package/utils/testRunner.js +298 -0
  110. package/utils/troubleshootingAdapter.js +177 -0
  111. package/utils/updateAdapterConfig.js +158 -0
package/.eslintignore ADDED
@@ -0,0 +1,5 @@
1
+ .nyc_output/*
2
+ backup/*
3
+ coverage/*
4
+ out/*
5
+ adapter_modifications/*
package/.eslintrc.js ADDED
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es6: true,
5
+ node: true
6
+ },
7
+ extends: 'airbnb-base',
8
+ plugins: [
9
+ 'json'
10
+ ],
11
+ parserOptions: {
12
+ ecmaVersion: 2020,
13
+ sourceType: 'module'
14
+ },
15
+ rules: {
16
+ 'max-len': 'warn',
17
+ 'comma-dangle': ['error', 'never']
18
+ }
19
+ };
package/.jshintrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "esversion": 6
3
+ }
package/AUTH.md ADDED
@@ -0,0 +1,39 @@
1
+ ## Authenticating Infoblox_universal_ddi Adapter
2
+
3
+ This document will go through the steps for authenticating the Infoblox_universal_ddi adapter with Basic Authentication. Properly configuring the properties for an adapter in Itential Platform is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
4
+
5
+ ### Basic Authentication
6
+ The Infoblox_universal_ddi adapter requires Basic Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
7
+
8
+ STEPS
9
+ 1. Ensure you have access to a Infoblox_universal_ddi server and that it is running
10
+ 2. Follow the steps in the README.md to import the adapter into Itential Platform if you have not already done so
11
+ 3. Use the properties below for the ```properties.authentication``` field
12
+ ```json
13
+ "authentication": {
14
+ "auth_method": "basic user_password",
15
+ "username": "<apikey>",
16
+ "password": "<secure api key>",
17
+ "token": "",
18
+ "token_timeout": 1800000,
19
+ "token_cache": "local",
20
+ "invalid_token_error": 401,
21
+ "auth_field": "header.headers.Authorization",
22
+ "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
23
+ "auth_logging": false,
24
+ "client_id": "",
25
+ "client_secret": "",
26
+ "grant_type": ""
27
+ }
28
+ ```
29
+ 4. Restart the adapter. If your properties were set correctly, the adapter should go online.
30
+
31
+ ### Troubleshooting
32
+ - Make sure you copied over the correct username and password.
33
+ - Turn on debug level logs for the adapter in Itential Platform Admin Essentials.
34
+ - Turn on auth_logging for the adapter in Itential Platform Admin Essentials (adapter properties).
35
+ - Investigate the logs - in particular:
36
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
37
+ - The FULL BODY log to make sure the payload is accurate.
38
+ - The CALL RETURN log to see what the other system is telling us.
39
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
package/BROKER.md ADDED
@@ -0,0 +1,211 @@
1
+ ## Integrating Infoblox_universal_ddi Adapter with Itential Platform Device Broker
2
+
3
+ This document will go through the steps for integrating the Infoblox_universal_ddi adapter with Itential Platform's Device Broker. Itential Platform Device Broker integration allows for easier interation into several of Itential Platform's applications (e.g. Configuration Manager). Properly configuring the properties for the adapter in Itential Platform is critical for getting the device broker integration to work. Their is additional information in the configuration section of the adapter readme. This document will go through each of the calls that are utilized by the Device Broker.
4
+
5
+ ### getDevicesFiltered
6
+ getDevicesFiltered(options, callback) → This call returns all of the devices within Infoblox_universal_ddi that match the provided filter.
7
+
8
+ #### input
9
+
10
+ options {object}: defines the options for the search. At current filter is the most important one. The filter can contain the device name (e.g. the options can be { filter: { name: [‘abc’, ‘def’] }}. The adapter currently filters by doing a contains on the name(s) provided in the array and not an exact match. So deviceabc will be returned when this filter is applied. In many adapters, other options (start, limit, sort and order) are not implemented.
11
+
12
+ #### output
13
+
14
+ An Object containing the total number of matching devices and a list containing an array of the details for each device. For example, { total: 2, list: [ { name: ‘abc’, ostype: ‘type’, port: 80, ipaddress: ‘10.10.10.10’ }, { name: ‘def’, ostype: ‘type2’, port: 443, ipaddress: ‘10.10.10.15’ }] }
15
+
16
+ The fields name and ostype are required by the broker and should be mapped through properties to data from the other system. In addition, ipaddress and port should also be mapped as it is utilized by some north bound Itential Platform applications (e.g. Config Manager). There are other fields that can be set as well but consider these the minimal fields.
17
+
18
+ Below is an example of how you may set up the properties for this call.
19
+
20
+ ```json
21
+ "getDevicesFiltered": [
22
+ {
23
+ "path": "/{org}/get/devices",
24
+ "method": "GET",
25
+ "pagination": {
26
+ "offsetVar": "",
27
+ "limitVar": "",
28
+ "incrementBy": "limit",
29
+ "requestLocation": "query"
30
+ },
31
+ "query": {},
32
+ "body": {},
33
+ "headers": {},
34
+ "handleFailure": "ignore",
35
+ "responseDataKey": "",
36
+ "requestFields": {
37
+ "org": "555"
38
+ },
39
+ "responseFields": {
40
+ "name": "{hostField}",
41
+ "ostype": "{osField}",
42
+ "ostypePrefix": "system-",
43
+ "ipaddress": "{attributes.ipaddr}",
44
+ "port": "443"
45
+ }
46
+ },
47
+ {
48
+ "path": "/{org}/get/devices",
49
+ "method": "GET",
50
+ "query": {},
51
+ "body": {},
52
+ "headers": {},
53
+ "handleFailure": "ignore",
54
+ "responseDataKey": "",
55
+ "requestFields": {
56
+ "org": "777"
57
+ },
58
+ "responseFields": {
59
+ "name": "{hostField}",
60
+ "ostype": "{osField}",
61
+ "ostypePrefix": "system-",
62
+ "ipaddress": "{attributes.ipaddr}",
63
+ "port": "443",
64
+ "myorg": "{orgField}"
65
+ }
66
+ }
67
+ ]
68
+ ```
69
+
70
+ Notice with the path, there is a variable in it ({org}). This variable must be provided in the data available to the call. For getDevicesFiltered this means the requestFields as a static value. In other calls, it may also come from the result of the getDevicesFiltered call.
71
+
72
+ Notice with the responseFields, it wants the Itential Platform data key as the key and where it is supposed to find the data in the response as the value. You can use nested fields in the response object using standard object notation. You can also add static data as shown in the port field. Finally, you can append data to the response from the requestInformation using its key (e.g. org). The ostypePrefix is a special field that allows you to add static data to the ostype to help define the system you are getting the device from.
73
+
74
+ Notice here that you can also have multiple calls that make up the results provided to the Device Broker. In this example we are making calls to two different organizations and returning the results from both.
75
+
76
+ ### isAlive
77
+ isAlive(deviceName, callback) → This call returns whether the device provided is operational.
78
+
79
+ input
80
+
81
+ deviceName {string}: the name of the device to get details of. The adapter will always call getDevicesFiltered first with this name in the filter in order to get any additional details it needs for this call (e.g. id).
82
+
83
+ output
84
+
85
+ A boolean value. This usually needs to be determined from a particular field in the data returned from the other system. This is where definind a status value and a status field is critical to properly configuring the call.
86
+
87
+ Below is an example of how you may set up the properties for this call.
88
+
89
+ ```json
90
+ "isAlive": [
91
+ {
92
+ "path": "/{org}/get/devices/{id}/status",
93
+ "method": "GET",
94
+ "query": {},
95
+ "body": {},
96
+ "headers": {},
97
+ "handleFailure": "ignore",
98
+ "statusValue": "online",
99
+ "responseDataKey": "",
100
+ "requestFields": {
101
+ "org": "{myorg}",
102
+ "id": "{name}"
103
+ },
104
+ "responseFields": {
105
+ "status": "{status}"
106
+ }
107
+ }
108
+ ]
109
+ ```
110
+
111
+ Notice with the requestFields, it will use the org and name that it got from the response of the getDevicesFiltered call to complete the path for the call.
112
+
113
+ Notice with the responseFields, it use the status field that came back and test to see if the value is online since that is what you defined as the statusValue. If it is it will return true otherwise it will return false.
114
+
115
+ You could have multiple calls here if needed but generally that will not be the case.
116
+
117
+ ### getConfig
118
+ getConfig(deviceName, format, callback) → This call returns the configuration for the device. This can be a simple call or a complex/multiple calls to get all of the “configuration” desirable.
119
+
120
+ input
121
+
122
+ deviceName {string}: the name of the device to get details of. The adapter will always call getDevicesFiltered first with this name in the filter in order to get any additional details it needs for this call (e.g. id).
123
+
124
+ format {string}: is an optional format you want provided back. Most adapters do not support formats by default and just return the “stringified” json object.
125
+
126
+ output
127
+
128
+ An object containing a response field which has the value of the stringified config (e.g. { response: ‘stringified configuration data’ }
129
+
130
+ Below is an example of how you may set up the properties for this call.
131
+
132
+ ```json
133
+ "getConfig": [
134
+ {
135
+ "path": "/{org}/get/devices/{id}/configPart1",
136
+ "method": "GET",
137
+ "query": {},
138
+ "body": {},
139
+ "headers": {},
140
+ "handleFailure": "ignore",
141
+ "responseDataKey": "",
142
+ "requestFields": {
143
+ "org": "{myorg}",
144
+ "id": "{name}"
145
+ }
146
+ "responseFields": {}
147
+ },
148
+ {
149
+ "path": "/{org}/get/devices/configPart2",
150
+ "method": "GET",
151
+ "query": {},
152
+ "body": {},
153
+ "headers": {},
154
+ "handleFailure": "ignore",
155
+ "responseDataKey": "",
156
+ "requestFields": {
157
+ "org": "{myorg}"
158
+ }
159
+ "responseFields": {}
160
+ }
161
+ ]
162
+ ```
163
+
164
+ The example above shows multiple calls. With the handleFailure property set to ignore, if one of the calls fails, the adapter will still send the response with that configuration missing. If you want it to fail set the handleFailure property to fail.
165
+
166
+ There is no limit on the number of calls you can make however understand that the adapter will make all of these calls prior to providing a response so there can be performance implications.
167
+
168
+ ### getDevice - may be deprecated
169
+ getDevice(deviceName, callback) → This call returns details of the device provided. In many systems the getDevicesFiltered only returns summary information and so we also want a more detailed call to get device details.
170
+
171
+ input
172
+
173
+ deviceName {string}: the name of the device to get details of. The adapter will always call getDevicesFiltered first with this name in the filter in order to get any additional details it needs for this call (e.g. id).
174
+
175
+ output
176
+
177
+ An Object containing the details of the device. The object should contain at least the same information that was provided in the getDevicesFiltered call (e.g. the fields name, ostype, port and ipaddress should be mapped in the adapter properties to data from the other system) and may contain many more details about the device.
178
+
179
+ Below is an example of how you may set up the properties for this call.
180
+
181
+ ```json
182
+ "getDevice": [
183
+ {
184
+ "path": "/{org}/get/device",
185
+ "method": "GET",
186
+ "query": {
187
+ "id": "{id}"
188
+ },
189
+ "body": {},
190
+ "headers": {},
191
+ "handleFailure": "ignore",
192
+ "responseDataKey": "",
193
+ "requestFields": {
194
+ "org": "{myorg}",
195
+ "id": "{name}"
196
+ },
197
+ "responseFields": {
198
+ "name": "{hostField}",
199
+ "ostype": "{osField}",
200
+ "ostypePrefix": "system-",
201
+ "ipaddress": "{attributes.ipaddr}",
202
+ "port": "443",
203
+ "myorg": "{orgField}"
204
+ }
205
+ }
206
+ ]
207
+ ```
208
+
209
+ In this example, we show a query parameter being used. Notice that the value is still provided via the requestFields and then like with the path, we use curly braces in the query to denote a variable. The body and header variables work in this same manner.
210
+
211
+ You could have multiple calls here if needed but generally that will not be the case.