diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-ui/fixture | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/fixture')
-rw-r--r-- | openecomp-ui/fixture/data/entitlementPools.json | 36 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/featureGroup.json | 59 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/featureGroups.json | 28 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/licenseAgreementList.json | 33 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/licenseKeyGroups.json | 20 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/licenseModels.json | 16 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/softwareProduct.json | 96 | ||||
-rw-r--r-- | openecomp-ui/fixture/data/softwareProductList.json | 34 | ||||
-rw-r--r-- | openecomp-ui/fixture/express.js | 231 | ||||
-rw-r--r-- | openecomp-ui/fixture/fixture.js | 93 | ||||
-rw-r--r-- | openecomp-ui/fixture/middleware.js | 24 |
11 files changed, 0 insertions, 670 deletions
diff --git a/openecomp-ui/fixture/data/entitlementPools.json b/openecomp-ui/fixture/data/entitlementPools.json deleted file mode 100644 index 22750cbb6d..0000000000 --- a/openecomp-ui/fixture/data/entitlementPools.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "results":[ - { - "name": "ep1", - "description": "string", - "thresholdValue": 75, - "thresholdUnits": "%", - "entitlementMetric": {"choice": "User", "other":""}, - "increments": "string", - "aggregationFunction": {"choice": "Average", "other": ""}, - "operationalScope": {"choices": ["VM"], "other": ""}, - "time": {"choice": "Hour", "other": ""}, - "sku": "DEF2-385A-4521-AAAA", - "id": "1", - "referencingFeatureGroups": ["1","2"], - "partNumber": "51529" - }, - { - "name": "ep2", - "description": "string", - "thresholdValue": 99, - "thresholdUnits": "%", - "entitlementMetric": {"choice": "User", "other":""}, - "increments": "string", - "aggregationFunction": {"choice": "Average", "other": ""}, - "operationalScope": {"choices": ["Other"], "other": "blabla"}, - "time": {"choice": "Hour", "other": ""}, - "sku": "DEF2-385A-4521-AAAA", - "id": "2", - "refCount": 0, - "partNumber": "51529", - "referencingFeatureGroups": [] - } - ] -} - diff --git a/openecomp-ui/fixture/data/featureGroup.json b/openecomp-ui/fixture/data/featureGroup.json deleted file mode 100644 index 278baecb36..0000000000 --- a/openecomp-ui/fixture/data/featureGroup.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "fssss", - "description": "gdfgdfgdsfg", - "id": "1", - "licenseKeyGroupsIds": [ - "1,2" - ], - "entitlementPoolsIds": [ - "1,2" - ], - "licenseKeyGroups": [ - { - "name": "ls1", - "description": "string", - "type": "string", - "operationalScope": "string", - "id": "1", - "refCount": 0 - }, - { - "name": "ls2", - "description": "string", - "type": "string", - "operationalScope": "string", - "id": "1", - "refCount": 0 - } - ], - "entitlementPools": [ - { - "name": "ep1", - "description": "string", - "thresholdValue": 0, - "thresholdUnits": "string", - "entitlementMetric": "string", - "increments": "string", - "aggregationFunction": "string", - "operationalScope": "string", - "time": "string", - "sku": "string", - "id": "string", - "refCount": 0 - }, - { - "name": "ep2", - "description": "string", - "thresholdValue": 0, - "thresholdUnits": "string", - "entitlementMetric": "string", - "increments": "string", - "aggregationFunction": "string", - "operationalScope": "string", - "time": "string", - "sku": "string", - "id": "string", - "refCount": 0 - } - ] -} diff --git a/openecomp-ui/fixture/data/featureGroups.json b/openecomp-ui/fixture/data/featureGroups.json deleted file mode 100644 index eea4967ca8..0000000000 --- a/openecomp-ui/fixture/data/featureGroups.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "results": [ - { - "name": "fs1", - "id": "0", - "description": "fs1-description", - "licenseKeyGroupsIds": [ - "1" - ], - "entitlementPoolsIds": [ - "1" - ], - "referencingLicenseAgreements": ["1","2"] - }, - { - "name": "fs2", - "id": "1", - "description": "fs2-description", - "licenseKeyGroupsIds": [ - "2" - ], - "entitlementPoolsIds": [ - "2" - ], - "referencingLicenseAgreements": [] - } - ] -} diff --git a/openecomp-ui/fixture/data/licenseAgreementList.json b/openecomp-ui/fixture/data/licenseAgreementList.json deleted file mode 100644 index b113295fcb..0000000000 --- a/openecomp-ui/fixture/data/licenseAgreementList.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "results": [ - { - "name": "name0", - "description": "description0", - "licenseTerm": {"choice": "Other", "other": "blabla"}, - "requirementsAndConstrains": "requirementsAndConstrains0", - "featureGroupsIds": [], - "id": "0" - }, - { - "name": "name1", - "description": "description1", - "licenseTerm": {"choice": "Fixed_Term", "other": ""}, - "requirementsAndConstrains": "requirementsAndConstrains1", - "featureGroupsIds": [ - "1" - ], - "id": "1" - }, - { - "name": "name2", - "description": "description2", - "licenseTerm": {"choice": "Unlimited", "other": ""}, - "requirementsAndConstrains": "requirementsAndConstrains2", - "featureGroupsIds": [ - "2" - ], - "id": "2" - } - ], - "listCount": 3 -} diff --git a/openecomp-ui/fixture/data/licenseKeyGroups.json b/openecomp-ui/fixture/data/licenseKeyGroups.json deleted file mode 100644 index 74050ab033..0000000000 --- a/openecomp-ui/fixture/data/licenseKeyGroups.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "results":[ - { - "name": "lsk1", - "description": "string", - "type": "Unique", - "operationalScope": {"choices": ["Network_Wide","VM"], "other": ""}, - "id": "1", - "referencingFeatureGroups":["1","2"] - }, - { - "name": "lsk2", - "description": "string", - "type": "One_Time", - "operationalScope": {"choices": ["Other"], "other": "blabla"}, - "id": "2", - "referencingFeatureGroups": 0 - } - ] -} diff --git a/openecomp-ui/fixture/data/licenseModels.json b/openecomp-ui/fixture/data/licenseModels.json deleted file mode 100644 index 5239c4fafc..0000000000 --- a/openecomp-ui/fixture/data/licenseModels.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "results":[ - { - "vendorName": "Omer Corp.", - "description": "", - "iconRef": "string", - "id": "1" - }, - { - "vendorName": "Robotricks", - "description": "Optimus Prime", - "iconRef": "string", - "id": "2" - } - ] -} diff --git a/openecomp-ui/fixture/data/softwareProduct.json b/openecomp-ui/fixture/data/softwareProduct.json deleted file mode 100644 index 5b60587614..0000000000 --- a/openecomp-ui/fixture/data/softwareProduct.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "VSP5", - "version": "0.1", - "id": "4730033D16C64E3CA556AB0AC4478218", - "description": "A software model for Fortigate. Nam hendrerit sollicitudin semper. Aenean consectetur nisi sit amet ante sodales consectetur. Nullam rutrum massa in pellentesque ' +elementum. Aliquam efficitur tellus lacus, eget iaculis justo iaculis eu. ", - "categoryId": "category", - "vendorId": "1", - "checkinStatus": "CHECK_OUT", - "licensingData": "test data", - "validationData": { - "logicalStructure": [ - { - "type": "PPD", - "catalogInstances": [ - { - "name": "PPD1", - "artifacts": [ - { - "name": "chopstick.py" - }, - { - "name": "bread.py" - } - ] - } - ] - } - ], - "importStructure": { - "HEAT": [ - { - "fileName": "sushi.yml", - "env": "soy.env", - "nested": [ - { - "fileName": "salmon.yml", - "env": "skin.env", - "artifacts": [ - { - "name": "rice.py", - "status": "OK" - }, - { - "name": "tuna.py", - "status": "Missing" - } - ] - } - ], - "artifacts": [ - { - "name": "chopstick.py", - "status": "OK" - }, - { - "name": "bread.py", - "status": "Missing" - } - ], - "volume": [ - { - "fileName": "fishtank.yml", - "env": "middletown.env" - } - ], - "network": [ - { - "fileName": "fishnet.yml", - "env": "ship.env" - } - ] - } - ], - "volume": [ - { - "fileName": "vol1.yml", - "env": "e1.env" - }, - { - "fileName": "vol2.yml", - "env": "e2.env" - } - ], - "network": [ - { - "fileName": "net1.yml", - "env": "env1.env" - }, - { - "fileName": "net2.yml", - "env": "env2.env" - } - ] - } - } -} diff --git a/openecomp-ui/fixture/data/softwareProductList.json b/openecomp-ui/fixture/data/softwareProductList.json deleted file mode 100644 index 4554abc95f..0000000000 --- a/openecomp-ui/fixture/data/softwareProductList.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "results": [ - { - "name": "Software Product 1", - "version": "1.0", - "id": "1", - "category": "Category1", - "subCategory": "Sub Category1", - "vendor": "1", - "status": "string", - "checkinStatus": "string" - }, - { - "name": "Software Product 2", - "version": "1.0", - "id": "2", - "category": "Category2", - "subCategory": "Sub Category2", - "vendor": "2", - "status": "string", - "checkinStatus": "string" - }, - { - "name": "Software Product 3", - "version": "1.0", - "id": "3", - "category": "Category3", - "subCategory": "Sub Category3", - "vendor": "3", - "status": "string", - "checkinStatus": "string" - } - ] -} diff --git a/openecomp-ui/fixture/express.js b/openecomp-ui/fixture/express.js deleted file mode 100644 index ed8bf956f9..0000000000 --- a/openecomp-ui/fixture/express.js +++ /dev/null @@ -1,231 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -var args = process.argv.slice(2); - -function defineRoutes(router) { - - //LICENSE-MODELS - router.get('/v1.0/vendor-license-models', licenseModelsList); - - //FEATURE-GROUP - router.get('/v1.0/vendor-license-models/:licenseModelId/feature-groups', featureGroupList); - router.get('/v1.0/vendor-license-models/:licenseModelId/feature-groups/:featureGroupId', featureGroup); - router.post('/v1.0/vendor-license-models/:licenseModelId/feature-groups', addFeatureGroup); - router.delete('/v1.0/vendor-license-models/:licenseModelId/feature-groups/:featureGroupId', deletefeatureGroup); - router.put('/v1.0/vendor-license-models/:licenseModelId/feature-groups/:featureGroupId', updatefeatureGroup); - - - - //LICENSE-AGREEMENT - router.get('/v1.0/vendor-license-models/:licenseModelId/license-agreements', licenseAgreementList); - router.post('/v1.0/vendor-license-models/:licenseModelId/license-agreements/', addLicenseAgreement); - router.delete('/v1.0/vendor-license-models/:licenseModelId/license-agreements/:licenseAgreementId', deleteLicenseAgreement); - router.put('/v1.0/vendor-license-models/:licenseModelId/license-agreements/:licenseAgreementId', updateLicenseAgreement); - - //ENTITLEMENT POOLS - router.get('/v1.0/vendor-license-models/:licenseModelId/entitlement-pools', entitlementPoolsList); - router.post('/v1.0/vendor-license-models/:licenseModelId/entitlement-pools', addEntitlementPool); - router.put('/v1.0/vendor-license-models/:licenseModelId/entitlement-pools/:entitlementPoolId', updateEntitlementPool); - router.delete('/v1.0/vendor-license-models/:licenseModelId/entitlement-pools/:entitlementPoolId', deleteEntitlementPool); - - //LICENSE KEY GROUPS - router.get('/v1.0/vendor-license-models/:licenseModelId/license-key-groups', licenseKeyGroupsList); - router.post('/v1.0/vendor-license-models/:licenseModelId/license-key-groups', addLicenseKeyGroup); - router.delete('/v1.0/vendor-license-models/:licenseModelId/license-key-groups/:licenseKeyGroupId', deleteLicenseKeyGroup); - router.put('/v1.0/vendor-license-models/:licenseModelId/license-key-groups/:licenseKeyGroupId', updateLicenseKeyGroup); - - //VENDOR SOFTWARE PRODUCT - - router.post('/v1.0/vendor-software-products/:vspId/upload', softwareProductUpload); - router.get('/v1.0/vendor-software-products/:vspId', getSoftwareProduct); - router.get('/v1.0/vendor-software-products', softwareProductList); - - router.put('/v1.0/vendor-software-products/:vspId/processes/:prcId', putSoftwareProductProcess); - router.post('/v1.0/vendor-software-products/:vspId/processes', postSoftwareProductProcess); -} - - -function licenseModelsList(req, res) { - res.json(require('./data/licenseModels')); -} - -function featureGroupList(req, res) { - res.json(require('./data/featureGroups')); -} - -function featureGroup(req, res) { - res.json(require('./data/featureGroup')); -} - -function deletefeatureGroup(req, res) { - res.json({ - returnCode: 'OK' - }); -} - - -function updatefeatureGroup(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -function addFeatureGroup(req,res) { - var id = Math.floor(Math.random() * (100 - 1) + 1).toString(); - res.json({ - returnCode: 'OK', - value: id - }) -} - -/** ENTITLEMENT POOLS **/ -function entitlementPoolsList(req, res) { - res.json(require('./data/entitlementPools')); -} - -function updateEntitlementPool(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -function addEntitlementPool(req,res) { - var id = Math.floor(Math.random() * (100 - 1) + 1).toString(); - res.json({ - returnCode: 'OK', - value: id - }) -} - -function deleteEntitlementPool(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -/** LICENSE KEY GROUPS */ - -function licenseKeyGroupsList(req, res) { - res.json(require('./data/licenseKeyGroups')); -} - -function addLicenseKeyGroup(req,res) { - var id = Math.floor(Math.random() * (100 - 1) + 1).toString(); - res.json({ - returnCode: 'OK', - value: id - }) -} - -function deleteLicenseKeyGroup(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -function updateLicenseKeyGroup(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -function licenseAgreementList(req, res) { - res.json(require('./data/licenseAgreementList')); -} - - -function addLicenseAgreement(req,res) { - var id = Math.floor(Math.random() * (100 - 1) + 1).toString(); - res.json({ - returnCode: 'OK', - value: id - }) -} -function deleteLicenseAgreement(req, res) { - res.json({ - returnCode: 'OK' - }); -} -function updateLicenseAgreement(req, res) { - res.json({ - returnCode: 'OK' - }); -} - -/** VENDOR SOFTWARE PRODUCT */ - -function softwareProductUpload(req, res) { - res.json({ - status: 'SUCCESS' - }); -} - -function getSoftwareProduct(req, res) { - res.json(require('./data/softwareProduct')); -} - - -function putSoftwareProductProcess(req, res) { - res.json({ - status: 'SUCCESS' - }); -} - -function postSoftwareProductProcess(req, res) { - var id = Math.floor(Math.random() * (100 - 1) + 1).toString(); - res.json({ - returnCode: 'OK', - value: id - }); -} - - - - -function createFixtureServer(port) { - var express = require('express'); - var app = express(); - var bodyParser = require('body-parser'); - app.use(bodyParser.urlencoded({extended: true})); - app.use(bodyParser.json()); - - var router = express.Router(); - - defineRoutes(router); - - app.use('/api', router); - app.use('/onboarding-api', router); - app.use('/sdc1/feProxy/onboarding-api', router); - - app.listen(port); - - console.log('Fixture server is up. port->', port); - //console.log(router.stack); - return app; -} - -/** SOFTWARE PRODUCT LIST **/ -function softwareProductList(req, res) { - res.json(require('./data/softwareProductList')); -} - - -createFixtureServer(args[0]); diff --git a/openecomp-ui/fixture/fixture.js b/openecomp-ui/fixture/fixture.js deleted file mode 100644 index 7e5b263c5c..0000000000 --- a/openecomp-ui/fixture/fixture.js +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -'use strict'; - -const PORT = 4000; - -function startFixtureServer() { - return require('child_process').fork('fixture/express', [PORT]); -} - -function buildProxyMiddleware() { - return require('./middleware')(PORT); -} - -function getProxyData(fixtureServerOptions, req, res, next) { - if (!fixtureServerOptions.serverProcess) { - fixtureServerOptions.serverProcess = startFixtureServer(); - } - - return fixtureServerOptions.proxy(req, res, next); -} - -function wrapFixture(fixtureServerOptions, req, res, next) { - if (fixtureServerOptions.proxy) { - return getProxyData(fixtureServerOptions, req, res, next); - } else { - next(); - } -} - - -module.exports = function fixture(options) { - - let proxy; - if(options.enabled) { - proxy = buildProxyMiddleware(); - } - - let fixtureServerOptions = { - proxy, - serverProcess: null - }; - - (function startWatch() { - var nodeWatch = require('node-watch'); - - nodeWatch(['fixture/data', 'fixture/express.js'], function () { - if (fixtureServerOptions.proxy && fixtureServerOptions.serverProcess) { - fixtureServerOptions.serverProcess.kill(); - fixtureServerOptions.serverProcess = startFixtureServer(); - } - }); - - nodeWatch(['devConfig.json'], function () { - let devConfigDefaults = require('../devConfig.defaults'); - require('fs').readFile('devConfig.json', (err, data) => { - if (err) throw err; - const config = Object.assign({}, devConfigDefaults, JSON.parse(data)); - if (config.useFixture) { - fixtureServerOptions.proxy = proxy || buildProxyMiddleware(); - } - else { - fixtureServerOptions.proxy = null; - if (fixtureServerOptions.serverProcess) { - fixtureServerOptions.serverProcess.kill(); - fixtureServerOptions.serverProcess = null; - } - } - }); - }); - - })(); - - return (req, res, next) => wrapFixture(fixtureServerOptions, req, res, next); -}; diff --git a/openecomp-ui/fixture/middleware.js b/openecomp-ui/fixture/middleware.js deleted file mode 100644 index 915bb81cab..0000000000 --- a/openecomp-ui/fixture/middleware.js +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -module.exports = function createProxyMiddleware(port) { - var proxy = require('http-proxy-middleware'); - return proxy(['/api', '/onboarding-api'], {target: 'http://localhost:' + port}); -}; |