@itentialopensource/adapter-six_connect 0.6.1 → 0.7.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/CHANGELOG.md +8 -0
- package/adapter.js +55 -11
- package/entities/ipam/schema.json +7 -7
- package/package.json +1 -1
- package/pronghorn.json +128 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.7.0 [07-25-2022]
|
|
3
|
+
|
|
4
|
+
* Changes for smartAssign -- added smartAssignTags and smartAssignObject for requested changes
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/controller-orchestrator/adapter-six_connect!10
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
2
10
|
## 0.6.1 [06-04-2022]
|
|
3
11
|
|
|
4
12
|
* Add schema for query parameter changes in names
|
package/adapter.js
CHANGED
|
@@ -2104,12 +2104,63 @@ class SixConnect extends AdapterBaseCl {
|
|
|
2104
2104
|
* @summary Smart assign by using Resource ID
|
|
2105
2105
|
*
|
|
2106
2106
|
* @function smartAssign
|
|
2107
|
-
* @param {
|
|
2107
|
+
* @param {string} type - type for assignment
|
|
2108
|
+
* @param {number} rir - rir for assignment
|
|
2109
|
+
* @param {string} mask - mask for assignment
|
|
2110
|
+
* @param {string} resource_id - resource_id for assignment
|
|
2111
|
+
* @param {string} region_id - region_id for assignment
|
|
2108
2112
|
* @param {getCallback} callback - a callback function to return the result
|
|
2109
2113
|
*/
|
|
2110
2114
|
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2111
2115
|
smartAssign(type, rir, mask, resource_id, region_id, callback) {
|
|
2112
|
-
const
|
|
2116
|
+
const bodyVars = {
|
|
2117
|
+
type,
|
|
2118
|
+
rir,
|
|
2119
|
+
mask,
|
|
2120
|
+
resource_id,
|
|
2121
|
+
region_id,
|
|
2122
|
+
tags_mode: 'intersection'
|
|
2123
|
+
};
|
|
2124
|
+
this.smartAssignObject(bodyVars, callback);
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
/**
|
|
2128
|
+
* @summary Smart assign by using Resource ID with Tags
|
|
2129
|
+
*
|
|
2130
|
+
* @function smartAssignTags
|
|
2131
|
+
* @param {string} type - type for assignment
|
|
2132
|
+
* @param {number} rir - rir for assignment
|
|
2133
|
+
* @param {string} mask - mask for assignment
|
|
2134
|
+
* @param {string} resource_id - resource_id for assignment
|
|
2135
|
+
* @param {string} region_id - region_id for assignment
|
|
2136
|
+
* @param {array} tags - tags for assignment
|
|
2137
|
+
* @param {string} tags_mode - tags_mode for assignment
|
|
2138
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2139
|
+
*/
|
|
2140
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2141
|
+
smartAssignTags(type, rir, mask, resource_id, region_id, tags, tags_mode, callback) {
|
|
2142
|
+
const bodyVars = {
|
|
2143
|
+
type,
|
|
2144
|
+
rir,
|
|
2145
|
+
mask,
|
|
2146
|
+
resource_id,
|
|
2147
|
+
region_id,
|
|
2148
|
+
tags,
|
|
2149
|
+
tags_mode
|
|
2150
|
+
};
|
|
2151
|
+
this.smartAssignObject(bodyVars, callback);
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* @summary Smart assign by using Full Body
|
|
2156
|
+
*
|
|
2157
|
+
* @function smartAssignObject
|
|
2158
|
+
* @param {object} body - body param
|
|
2159
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2160
|
+
*/
|
|
2161
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2162
|
+
smartAssignObject(body, callback) {
|
|
2163
|
+
const meth = 'adapter-smartAssignObject';
|
|
2113
2164
|
const origin = `${this.id}-${meth}`;
|
|
2114
2165
|
log.trace(origin);
|
|
2115
2166
|
|
|
@@ -2124,14 +2175,7 @@ class SixConnect extends AdapterBaseCl {
|
|
|
2124
2175
|
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2125
2176
|
const queryParams = {};
|
|
2126
2177
|
const pathVars = [];
|
|
2127
|
-
const bodyVars =
|
|
2128
|
-
type,
|
|
2129
|
-
rir,
|
|
2130
|
-
mask,
|
|
2131
|
-
resource_id,
|
|
2132
|
-
region_id,
|
|
2133
|
-
tags_mode: 'intersection'
|
|
2134
|
-
};
|
|
2178
|
+
const bodyVars = body;
|
|
2135
2179
|
|
|
2136
2180
|
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
2137
2181
|
const reqObj = {
|
|
@@ -2151,7 +2195,7 @@ class SixConnect extends AdapterBaseCl {
|
|
|
2151
2195
|
return callback(null, irReturnError);
|
|
2152
2196
|
}
|
|
2153
2197
|
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2154
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['
|
|
2198
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['smartAssignObject'], null, null, null);
|
|
2155
2199
|
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2156
2200
|
return callback(null, errorObj);
|
|
2157
2201
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$id": "schema.json",
|
|
3
3
|
"type": "object",
|
|
4
4
|
"schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"translate":
|
|
5
|
+
"translate": true,
|
|
6
6
|
"dynamicfields": true,
|
|
7
7
|
"properties": {
|
|
8
8
|
"ph_request_type": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"external_name": "ph_request_type"
|
|
101
101
|
},
|
|
102
102
|
"lirId": {
|
|
103
|
-
"type": "string",
|
|
103
|
+
"type": ["string", "number"],
|
|
104
104
|
"description": "lir id",
|
|
105
105
|
"parse": false,
|
|
106
106
|
"encode": false,
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"external_name": "lir_id"
|
|
112
112
|
},
|
|
113
113
|
"regionId": {
|
|
114
|
-
"type": "string",
|
|
114
|
+
"type": ["string", "number"],
|
|
115
115
|
"description": "region id",
|
|
116
116
|
"parse": false,
|
|
117
117
|
"encode": false,
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"external_name": "region_id"
|
|
123
123
|
},
|
|
124
124
|
"resourceId": {
|
|
125
|
-
"type": "string",
|
|
125
|
+
"type": ["string", "number"],
|
|
126
126
|
"description": "resource id",
|
|
127
127
|
"parse": false,
|
|
128
128
|
"encode": false,
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"external_name": "resource_id"
|
|
134
134
|
},
|
|
135
135
|
"vlanId": {
|
|
136
|
-
"type": "string",
|
|
136
|
+
"type": ["string", "number"],
|
|
137
137
|
"description": "vlan id",
|
|
138
138
|
"parse": false,
|
|
139
139
|
"encode": false,
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"external_name": "vlan_id"
|
|
145
145
|
},
|
|
146
146
|
"ruleId": {
|
|
147
|
-
"type": "string",
|
|
147
|
+
"type": ["string", "number"],
|
|
148
148
|
"description": "rule id",
|
|
149
149
|
"parse": false,
|
|
150
150
|
"encode": false,
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"external_name": "rule_id"
|
|
156
156
|
},
|
|
157
157
|
"orgId": {
|
|
158
|
-
"type": "string",
|
|
158
|
+
"type": ["string", "number"],
|
|
159
159
|
"description": "org id",
|
|
160
160
|
"parse": false,
|
|
161
161
|
"encode": false,
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -1918,6 +1918,134 @@
|
|
|
1918
1918
|
},
|
|
1919
1919
|
"task": true
|
|
1920
1920
|
},
|
|
1921
|
+
{
|
|
1922
|
+
"name": "smartAssignTags",
|
|
1923
|
+
"summary": "Smart assign by using Resource ID",
|
|
1924
|
+
"description": "Smart assign by using Resource ID",
|
|
1925
|
+
"input": [
|
|
1926
|
+
{
|
|
1927
|
+
"name": "type",
|
|
1928
|
+
"type": "string",
|
|
1929
|
+
"info": "",
|
|
1930
|
+
"required": true,
|
|
1931
|
+
"schema": {
|
|
1932
|
+
"title": "type",
|
|
1933
|
+
"type": "string"
|
|
1934
|
+
}
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
"name": "rir",
|
|
1938
|
+
"type": "string",
|
|
1939
|
+
"info": "",
|
|
1940
|
+
"required": true,
|
|
1941
|
+
"schema": {
|
|
1942
|
+
"title": "rir",
|
|
1943
|
+
"type": "string"
|
|
1944
|
+
}
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"name": "mask",
|
|
1948
|
+
"type": "string",
|
|
1949
|
+
"info": "",
|
|
1950
|
+
"required": true,
|
|
1951
|
+
"schema": {
|
|
1952
|
+
"title": "mask",
|
|
1953
|
+
"type": "string"
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
"name": "resource_id",
|
|
1958
|
+
"type": "string",
|
|
1959
|
+
"info": "",
|
|
1960
|
+
"required": true,
|
|
1961
|
+
"schema": {
|
|
1962
|
+
"title": "resource_id",
|
|
1963
|
+
"type": "string"
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
"name": "region_id",
|
|
1968
|
+
"type": "string",
|
|
1969
|
+
"info": "",
|
|
1970
|
+
"required": true,
|
|
1971
|
+
"schema": {
|
|
1972
|
+
"title": "region_id",
|
|
1973
|
+
"type": "string"
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
{
|
|
1977
|
+
"name": "tags",
|
|
1978
|
+
"type": "array",
|
|
1979
|
+
"info": "",
|
|
1980
|
+
"required": true,
|
|
1981
|
+
"schema": {
|
|
1982
|
+
"title": "tags",
|
|
1983
|
+
"type": "array"
|
|
1984
|
+
}
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
"name": "tags_mode",
|
|
1988
|
+
"type": "string",
|
|
1989
|
+
"info": "",
|
|
1990
|
+
"required": true,
|
|
1991
|
+
"schema": {
|
|
1992
|
+
"title": "tags_mode",
|
|
1993
|
+
"type": "string"
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
],
|
|
1997
|
+
"output": {
|
|
1998
|
+
"name": "result",
|
|
1999
|
+
"type": "object",
|
|
2000
|
+
"description": "A JSON Object containing status, code and the result",
|
|
2001
|
+
"schema": {
|
|
2002
|
+
"title": "result",
|
|
2003
|
+
"type": "object"
|
|
2004
|
+
}
|
|
2005
|
+
},
|
|
2006
|
+
"roles": [
|
|
2007
|
+
"admin"
|
|
2008
|
+
],
|
|
2009
|
+
"route": {
|
|
2010
|
+
"verb": "POST",
|
|
2011
|
+
"path": "/smartAssignTags"
|
|
2012
|
+
},
|
|
2013
|
+
"task": true
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
"name": "smartAssignObject",
|
|
2017
|
+
"summary": "Smart assign by using Resource ID",
|
|
2018
|
+
"description": "Smart assign by using Resource ID",
|
|
2019
|
+
"input": [
|
|
2020
|
+
{
|
|
2021
|
+
"name": "body",
|
|
2022
|
+
"type": "object",
|
|
2023
|
+
"info": "",
|
|
2024
|
+
"required": true,
|
|
2025
|
+
"schema": {
|
|
2026
|
+
"title": "body",
|
|
2027
|
+
"type": "object"
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
],
|
|
2031
|
+
"output": {
|
|
2032
|
+
"name": "result",
|
|
2033
|
+
"type": "object",
|
|
2034
|
+
"description": "A JSON Object containing status, code and the result",
|
|
2035
|
+
"schema": {
|
|
2036
|
+
"title": "result",
|
|
2037
|
+
"type": "object"
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
"roles": [
|
|
2041
|
+
"admin"
|
|
2042
|
+
],
|
|
2043
|
+
"route": {
|
|
2044
|
+
"verb": "POST",
|
|
2045
|
+
"path": "/smartAssignObject"
|
|
2046
|
+
},
|
|
2047
|
+
"task": true
|
|
2048
|
+
},
|
|
1921
2049
|
{
|
|
1922
2050
|
"name": "deleteSwip1",
|
|
1923
2051
|
"summary": "Deassign by using Netblock CIDR",
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "0.6.1",
|
|
3
|
+
"configLines": 13436,
|
|
4
4
|
"scriptLines": 1707,
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
9
|
-
"wfTasks":
|
|
5
|
+
"codeLines": 18932,
|
|
6
|
+
"testLines": 11139,
|
|
7
|
+
"testCases": 524,
|
|
8
|
+
"totalCodeLines": 31778,
|
|
9
|
+
"wfTasks": 235
|
|
10
10
|
}
|
|
@@ -4655,5 +4655,29 @@ describe('[integration] Six_connect Adapter Test', () => {
|
|
|
4655
4655
|
}
|
|
4656
4656
|
}).timeout(attemptTimeout);
|
|
4657
4657
|
});
|
|
4658
|
+
|
|
4659
|
+
describe('#getNetblocks - errors', () => {
|
|
4660
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
4661
|
+
try {
|
|
4662
|
+
a.getNetblocks('fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
|
|
4663
|
+
try {
|
|
4664
|
+
if (stub) {
|
|
4665
|
+
log.error(data);
|
|
4666
|
+
} else {
|
|
4667
|
+
log.error(data);
|
|
4668
|
+
}
|
|
4669
|
+
|
|
4670
|
+
done();
|
|
4671
|
+
} catch (err) {
|
|
4672
|
+
log.error(`Test Failure: ${err}`);
|
|
4673
|
+
done(err);
|
|
4674
|
+
}
|
|
4675
|
+
});
|
|
4676
|
+
} catch (error) {
|
|
4677
|
+
log.error(`Adapter Exception: ${error}`);
|
|
4678
|
+
done(error);
|
|
4679
|
+
}
|
|
4680
|
+
}).timeout(attemptTimeout);
|
|
4681
|
+
});
|
|
4658
4682
|
});
|
|
4659
4683
|
});
|