X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Fmodel%2Fdescriptors%2FVirtualDeploymentUnit.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2Fmodel%2Fdescriptors%2FVirtualDeploymentUnit.js;h=b808452a2f7dbbd99d765818ab43d4b7c7b6429e;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/libraries/model/descriptors/VirtualDeploymentUnit.js b/skyquake/plugins/composer/src/src/libraries/model/descriptors/VirtualDeploymentUnit.js new file mode 100644 index 000000000..b808452a2 --- /dev/null +++ b/skyquake/plugins/composer/src/src/libraries/model/descriptors/VirtualDeploymentUnit.js @@ -0,0 +1,114 @@ +/* + * + * Copyright 2016 RIFT.IO Inc + * + * 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. + * + */ +/** + * Created by onvelocity on 11/23/15. + */ + +'use strict'; + +import DescriptorModel from '../DescriptorModel' +import DescriptorModelFactory from '../DescriptorModelFactory' + +export default class VirtualDeploymentUnit extends DescriptorModel { + + static get type() { + return 'vdu'; + } + + static get className() { + return 'VirtualDeploymentUnit'; + } + + constructor(model, parent) { + super(model, parent); + this.type = 'vdu'; + this.uiState['qualified-type'] = 'vnfd.vdu'; + this.className = 'VirtualDeploymentUnit'; + } + + get key() { + return this.parent.key + '/' + super.key; + } + + get connectionPoint() { + const list = this.model['internal-connection-point'] || (this.model['internal-connection-point'] = []); + return list.map(d => DescriptorModelFactory.newVirtualDeploymentUnitInternalConnectionPoint(d, this)); + } + + set connectionPoint(obj) { + return this.updateModelList('internal-connection-point', obj, DescriptorModelFactory.VirtualDeploymentUnitInternalConnectionPoint); + } + + //get internalConnectionPoint() { + // //https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces + // const vduc = this; + // if (this.model && this.model['internal-interface']) { + // const icpMap = this.model['internal-connection-point'].reduce((r, d) => { + // r[d.id] = d; + // return r; + // }, {}); + // return this.model['internal-interface'].reduce((result, internalIfc) => { + // const id = internalIfc['vdu-internal-connection-point-ref']; + // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : ''; + // if (icpMap[id]) { + // const icp = Object.assign({}, icpMap[id], { + // key: keyPrefix + id, + // name: internalIfc.name, + // 'virtual-interface': internalIfc['virtual-interface'] + // }); + // result.push(icp); + // } + // return result; + // }, []); + // } + // return []; + //} + + removeInternalConnectionPoint(icp) { + this.parent.removeAnyConnectionsForConnector(icp); + return this.removeModelListItem('connectionPoint', icp); + } + + //get externalConnectionPoint() { + // // https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces + // //const vduc = this; + // //if (vduc.model && vduc.model['external-interface']) { + // // return vduc.model['external-interface'].reduce((result, externalIfc) => { + // // const id = externalIfc['vnfd-connection-point-ref']; + // // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : ''; + // // result.push({id: id, key: keyPrefix + id}); + // // return result; + // // }, []); + // //} + // return []; + //} + // + get connectors() { + return this.connectionPoint; + } + + //get connection() { + // return this.externalConnectionPoint; + //} + + remove() { + return this.parent.removeVirtualDeploymentUnit(this); + } + +} +