2 * Copyright 2016 RIFT.IO Inc
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * STANDARD_RIFT_IO_COPYRIGHT
21 * Created by onvelocity on 11/23/15.
26 import DescriptorModel from '../DescriptorModel'
27 import DescriptorModelFactory from '../DescriptorModelFactory'
29 export default class VirtualDeploymentUnit extends DescriptorModel {
35 static get className() {
36 return 'VirtualDeploymentUnit';
39 constructor(model, parent) {
42 this.uiState['qualified-type'] = 'vnfd.vdu';
43 this.className = 'VirtualDeploymentUnit';
47 return this.parent.key + '/' + super.key;
50 get connectionPoint() {
51 const list = this.model['internal-connection-point'] || (this.model['internal-connection-point'] = []);
52 return list.map(d => DescriptorModelFactory.newVirtualDeploymentUnitInternalConnectionPoint(d, this));
55 set connectionPoint(obj) {
56 return this.updateModelList('internal-connection-point', obj, DescriptorModelFactory.VirtualDeploymentUnitInternalConnectionPoint);
59 //get internalConnectionPoint() {
60 // //https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
62 // if (this.model && this.model['internal-interface']) {
63 // const icpMap = this.model['internal-connection-point'].reduce((r, d) => {
67 // return this.model['internal-interface'].reduce((result, internalIfc) => {
68 // const id = internalIfc['vdu-internal-connection-point-ref'];
69 // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
71 // const icp = Object.assign({}, icpMap[id], {
72 // key: keyPrefix + id,
73 // name: internalIfc.name,
74 // 'virtual-interface': internalIfc['virtual-interface']
84 removeInternalConnectionPoint(icp) {
85 this.parent.removeAnyConnectionsForConnector(icp);
86 return this.removeModelListItem('connectionPoint', icp);
89 //get externalConnectionPoint() {
90 // // https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
91 // //const vduc = this;
92 // //if (vduc.model && vduc.model['external-interface']) {
93 // // return vduc.model['external-interface'].reduce((result, externalIfc) => {
94 // // const id = externalIfc['vnfd-connection-point-ref'];
95 // // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
96 // // result.push({id: id, key: keyPrefix + id});
104 return this.connectionPoint;
108 // return this.externalConnectionPoint;
112 return this.parent.removeVirtualDeploymentUnit(this);