@itentialopensource/adapter-apic 0.12.2 → 0.14.0

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.
package/adapterBase.js CHANGED
@@ -1246,6 +1246,44 @@ class AdapterBase extends EventEmitterCl {
1246
1246
  return this.requestHandlerInst.iapGetDeviceCountAuth(callOptions, callback);
1247
1247
  }
1248
1248
 
1249
+ /**
1250
+ * @summary Parse and merge iapMetadata fields into reqObj
1251
+ *
1252
+ * @function parseIapMetadata
1253
+ * @param {Object} reqObj - the request object to merge metadata into
1254
+ * @param {Object} iapMetadata - the metadata object to parse and merge
1255
+ */
1256
+ parseIapMetadata(reqObj, iapMetadata) {
1257
+ const reqFields = ['payload', 'uriPathVars', 'uriQuery', 'uriOptions', 'addlHeaders', 'authData', 'callProperties', 'filter', 'priority', 'event'];
1258
+
1259
+ const result = { ...reqObj };
1260
+
1261
+ // Merge and add new iapMetadata fields in result
1262
+ Object.keys(iapMetadata).forEach((iapField) => {
1263
+ if (reqFields.includes(iapField) && iapMetadata[iapField]) {
1264
+ if (Array.isArray(result[iapField]) && Array.isArray(iapMetadata[iapField])) {
1265
+ result[iapField] = result[iapField].concat(iapMetadata[iapField]); // Merge arrays
1266
+ } else if (
1267
+ result[iapField]
1268
+ && iapMetadata[iapField]
1269
+ && typeof result[iapField] === 'object'
1270
+ && typeof iapMetadata[iapField] === 'object'
1271
+ && !Array.isArray(result[iapField])
1272
+ && !Array.isArray(iapMetadata[iapField])
1273
+ ) {
1274
+ result[iapField] = { ...result[iapField], ...iapMetadata[iapField] }; // Merge objects
1275
+ } else {
1276
+ // Otherwise, add new iapMetadata fields to result
1277
+ result[iapField] = iapMetadata[iapField];
1278
+ }
1279
+ }
1280
+ });
1281
+ // Add iapMetadata to result for further work
1282
+ result.iapMetadata = iapMetadata;
1283
+
1284
+ return result;
1285
+ }
1286
+
1249
1287
  /* ********************************************** */
1250
1288
  /* */
1251
1289
  /* EXPOSES GENERIC HANDLER */
@@ -0,0 +1,25 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllApplicationProfiles",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/fvAp.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllApplicationProfiles",
12
+ "enum": [
13
+ "getAllApplicationProfiles"
14
+ ],
15
+ "external_name": "ph_request_type"
16
+ }
17
+ },
18
+ "definitions": {}
19
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllBridgeDomains",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/fvBD.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "createDHCPRelayPolicy",
26
+ "protocol": "REST",
27
+ "method": "POST",
28
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}/relayp-{pathv2}.json?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "requestDatatype": "JSON",
34
+ "responseDatatype": "JSON",
35
+ "headers": {},
36
+ "responseObjects": [
37
+ {
38
+ "type": "default",
39
+ "key": "",
40
+ "mockFile": ""
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "name": "associateDHCPRelayToBD",
46
+ "protocol": "REST",
47
+ "method": "POST",
48
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}/BD-{pathv2}.json?{query}",
49
+ "requestSchema": "schema.json",
50
+ "responseSchema": "schema.json",
51
+ "timeout": 0,
52
+ "sendEmpty": false,
53
+ "requestDatatype": "JSON",
54
+ "responseDatatype": "JSON",
55
+ "headers": {},
56
+ "responseObjects": [
57
+ {
58
+ "type": "default",
59
+ "key": "",
60
+ "mockFile": ""
61
+ }
62
+ ]
63
+ }
64
+ ]
65
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllBridgeDomains",
12
+ "enum": [
13
+ "getAllBridgeDomains",
14
+ "createDHCPRelayPolicy",
15
+ "associateDHCPRelayToBD"
16
+ ],
17
+ "external_name": "ph_request_type"
18
+ }
19
+ },
20
+ "definitions": {}
21
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllEPGs",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/fvAEPg.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "getEPGsInTenant",
26
+ "protocol": "REST",
27
+ "method": "GET",
28
+ "entitypath": "{base_path}/{version}/node/class/fvAEPg.json?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "sendGetBody": false,
34
+ "requestDatatype": "JSON",
35
+ "responseDatatype": "JSON",
36
+ "headers": {},
37
+ "responseObjects": [
38
+ {
39
+ "type": "default",
40
+ "key": "",
41
+ "mockFile": ""
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "createEPGWithVMM",
47
+ "protocol": "REST",
48
+ "method": "POST",
49
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}/ap-{pathv2}.json?{query}",
50
+ "requestSchema": "schema.json",
51
+ "responseSchema": "schema.json",
52
+ "timeout": 0,
53
+ "sendEmpty": false,
54
+ "requestDatatype": "JSON",
55
+ "responseDatatype": "JSON",
56
+ "headers": {},
57
+ "responseObjects": [
58
+ {
59
+ "type": "default",
60
+ "key": "",
61
+ "mockFile": ""
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "name": "associateEPGWithVMM",
67
+ "protocol": "REST",
68
+ "method": "POST",
69
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}/ap-{pathv2}/epg-{pathv3}.json?{query}",
70
+ "requestSchema": "schema.json",
71
+ "responseSchema": "schema.json",
72
+ "timeout": 0,
73
+ "sendEmpty": false,
74
+ "requestDatatype": "JSON",
75
+ "responseDatatype": "JSON",
76
+ "headers": {},
77
+ "responseObjects": [
78
+ {
79
+ "type": "default",
80
+ "key": "",
81
+ "mockFile": ""
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllEPGs",
12
+ "enum": [
13
+ "getAllEPGs",
14
+ "getEPGsInTenant",
15
+ "createEPGWithVMM",
16
+ "associateEPGWithVMM"
17
+ ],
18
+ "external_name": "ph_request_type"
19
+ },
20
+ "queryTargetFilter": {
21
+ "type": "string",
22
+ "description": "",
23
+ "parse": false,
24
+ "encode": false,
25
+ "encrypt": {
26
+ "type": "AES",
27
+ "key": ""
28
+ },
29
+ "external_name": "query-target-filter"
30
+ }
31
+ },
32
+ "definitions": {}
33
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllTenants",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/fvTenant.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "getTenant",
26
+ "protocol": "REST",
27
+ "method": "GET",
28
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}.json?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "sendGetBody": false,
34
+ "requestDatatype": "JSON",
35
+ "responseDatatype": "JSON",
36
+ "headers": {},
37
+ "responseObjects": [
38
+ {
39
+ "type": "default",
40
+ "key": "",
41
+ "mockFile": ""
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "getTenantWithFullSubtree",
47
+ "protocol": "REST",
48
+ "method": "GET",
49
+ "entitypath": "{base_path}/{version}/mo/uni/tn-{pathv1}.json?{query}",
50
+ "requestSchema": "schema.json",
51
+ "responseSchema": "schema.json",
52
+ "timeout": 0,
53
+ "sendEmpty": false,
54
+ "sendGetBody": false,
55
+ "requestDatatype": "JSON",
56
+ "responseDatatype": "JSON",
57
+ "headers": {},
58
+ "responseObjects": [
59
+ {
60
+ "type": "default",
61
+ "key": "",
62
+ "mockFile": ""
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "name": "createTenantOrEnvironment",
68
+ "protocol": "REST",
69
+ "method": "POST",
70
+ "entitypath": "{base_path}/{version}/mo/uni.json?{query}",
71
+ "requestSchema": "schema.json",
72
+ "responseSchema": "schema.json",
73
+ "timeout": 0,
74
+ "sendEmpty": false,
75
+ "requestDatatype": "JSON",
76
+ "responseDatatype": "JSON",
77
+ "headers": {},
78
+ "responseObjects": [
79
+ {
80
+ "type": "default",
81
+ "key": "",
82
+ "mockFile": ""
83
+ }
84
+ ]
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllTenants",
12
+ "enum": [
13
+ "getAllTenants",
14
+ "getTenant",
15
+ "getTenantWithFullSubtree",
16
+ "createTenantOrEnvironment"
17
+ ],
18
+ "external_name": "ph_request_type"
19
+ }
20
+ },
21
+ "definitions": {}
22
+ }
@@ -0,0 +1,147 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllVLANPools",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/fvnsVlanInstP.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "createDynamicVLANPool",
26
+ "protocol": "REST",
27
+ "method": "POST",
28
+ "entitypath": "{base_path}/{version}/mo/uni/infra/vlanns-[{pathv1}]-dynamic.json?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "requestDatatype": "JSON",
34
+ "responseDatatype": "JSON",
35
+ "headers": {},
36
+ "responseObjects": [
37
+ {
38
+ "type": "default",
39
+ "key": "",
40
+ "mockFile": ""
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "name": "getVLANPoolDetails",
46
+ "protocol": "REST",
47
+ "method": "GET",
48
+ "entitypath": "{base_path}/{version}/mo/uni/infra/vlanns-[{pathv1}]-dynamic.json?{query}",
49
+ "requestSchema": "schema.json",
50
+ "responseSchema": "schema.json",
51
+ "timeout": 0,
52
+ "sendEmpty": false,
53
+ "sendGetBody": false,
54
+ "requestDatatype": "JSON",
55
+ "responseDatatype": "JSON",
56
+ "headers": {},
57
+ "responseObjects": [
58
+ {
59
+ "type": "default",
60
+ "key": "",
61
+ "mockFile": ""
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "name": "createStaticVLANPool",
67
+ "protocol": "REST",
68
+ "method": "POST",
69
+ "entitypath": "{base_path}/{version}/mo/uni/infra/vlanns-[{pathv1}]-static.json?{query}",
70
+ "requestSchema": "schema.json",
71
+ "responseSchema": "schema.json",
72
+ "timeout": 0,
73
+ "sendEmpty": false,
74
+ "requestDatatype": "JSON",
75
+ "responseDatatype": "JSON",
76
+ "headers": {},
77
+ "responseObjects": [
78
+ {
79
+ "type": "default",
80
+ "key": "",
81
+ "mockFile": ""
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "name": "associateVLANPoolWithVMM",
87
+ "protocol": "REST",
88
+ "method": "POST",
89
+ "entitypath": "{base_path}/{version}/mo/uni/vmmp-VMware/dom-{pathv1}.json?{query}",
90
+ "requestSchema": "schema.json",
91
+ "responseSchema": "schema.json",
92
+ "timeout": 0,
93
+ "sendEmpty": false,
94
+ "requestDatatype": "JSON",
95
+ "responseDatatype": "JSON",
96
+ "headers": {},
97
+ "responseObjects": [
98
+ {
99
+ "type": "default",
100
+ "key": "",
101
+ "mockFile": ""
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "name": "getVMMDomainVLANPoolAssociation",
107
+ "protocol": "REST",
108
+ "method": "GET",
109
+ "entitypath": "{base_path}/{version}/mo/uni/vmmp-VMware/dom-{pathv1}.json?{query}",
110
+ "requestSchema": "schema.json",
111
+ "responseSchema": "schema.json",
112
+ "timeout": 0,
113
+ "sendEmpty": false,
114
+ "sendGetBody": false,
115
+ "requestDatatype": "JSON",
116
+ "responseDatatype": "JSON",
117
+ "headers": {},
118
+ "responseObjects": [
119
+ {
120
+ "type": "default",
121
+ "key": "",
122
+ "mockFile": ""
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "name": "addVLANRangeToPool",
128
+ "protocol": "REST",
129
+ "method": "POST",
130
+ "entitypath": "{base_path}/{version}/mo/uni/infra/vlanns-[{pathv1}]-dynamic/from-[vlan-{pathv2}]-to-[vlan-{pathv3}].json?{query}",
131
+ "requestSchema": "schema.json",
132
+ "responseSchema": "schema.json",
133
+ "timeout": 0,
134
+ "sendEmpty": false,
135
+ "requestDatatype": "JSON",
136
+ "responseDatatype": "JSON",
137
+ "headers": {},
138
+ "responseObjects": [
139
+ {
140
+ "type": "default",
141
+ "key": "",
142
+ "mockFile": ""
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllVLANPools",
12
+ "enum": [
13
+ "getAllVLANPools",
14
+ "createDynamicVLANPool",
15
+ "getVLANPoolDetails",
16
+ "createStaticVLANPool",
17
+ "associateVLANPoolWithVMM",
18
+ "getVMMDomainVLANPoolAssociation",
19
+ "addVLANRangeToPool"
20
+ ],
21
+ "external_name": "ph_request_type"
22
+ }
23
+ },
24
+ "definitions": {}
25
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "getAllVMMDomains",
5
+ "protocol": "REST",
6
+ "method": "GET",
7
+ "entitypath": "{base_path}/{version}/class/vmmDomP.json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "sendGetBody": false,
13
+ "requestDatatype": "JSON",
14
+ "responseDatatype": "JSON",
15
+ "headers": {},
16
+ "responseObjects": [
17
+ {
18
+ "type": "default",
19
+ "key": "",
20
+ "mockFile": ""
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "name": "getVMwareVMMDomains",
26
+ "protocol": "REST",
27
+ "method": "GET",
28
+ "entitypath": "{base_path}/{version}/node/class/vmmDomP.json?{query}",
29
+ "requestSchema": "schema.json",
30
+ "responseSchema": "schema.json",
31
+ "timeout": 0,
32
+ "sendEmpty": false,
33
+ "sendGetBody": false,
34
+ "requestDatatype": "JSON",
35
+ "responseDatatype": "JSON",
36
+ "headers": {},
37
+ "responseObjects": [
38
+ {
39
+ "type": "default",
40
+ "key": "",
41
+ "mockFile": ""
42
+ }
43
+ ]
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": true,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "getAllVMMDomains",
12
+ "enum": [
13
+ "getAllVMMDomains",
14
+ "getVMwareVMMDomains"
15
+ ],
16
+ "external_name": "ph_request_type"
17
+ },
18
+ "queryTargetFilter": {
19
+ "type": "string",
20
+ "description": "",
21
+ "parse": false,
22
+ "encode": false,
23
+ "encrypt": {
24
+ "type": "AES",
25
+ "key": ""
26
+ },
27
+ "external_name": "query-target-filter"
28
+ }
29
+ },
30
+ "definitions": {}
31
+ }