3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * Created by onvelocity on 11/23/15.
24 import DescriptorModel
from '../DescriptorModel'
25 import DescriptorModelFactory
from '../DescriptorModelFactory'
27 export default class VirtualDeploymentUnit
extends DescriptorModel
{
33 static get className() {
34 return 'VirtualDeploymentUnit';
37 constructor(model
, parent
) {
40 this.uiState
['qualified-type'] = 'vnfd.vdu';
41 this.className
= 'VirtualDeploymentUnit';
45 return this.parent
.key
+ '/' + super.key
;
48 get connectionPoint() {
49 const list
= this.model
['internal-connection-point'] || (this.model
['internal-connection-point'] = []);
50 return list
.map(d
=> DescriptorModelFactory
.newVirtualDeploymentUnitInternalConnectionPoint(d
, this));
53 set connectionPoint(obj
) {
54 return this.updateModelList('internal-connection-point', obj
, DescriptorModelFactory
.VirtualDeploymentUnitInternalConnectionPoint
);
57 //get internalConnectionPoint() {
58 // //https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
60 // if (this.model && this.model['internal-interface']) {
61 // const icpMap = this.model['internal-connection-point'].reduce((r, d) => {
65 // return this.model['internal-interface'].reduce((result, internalIfc) => {
66 // const id = internalIfc['vdu-internal-connection-point-ref'];
67 // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
69 // const icp = Object.assign({}, icpMap[id], {
70 // key: keyPrefix + id,
71 // name: internalIfc.name,
72 // 'virtual-interface': internalIfc['virtual-interface']
82 removeInternalConnectionPoint(icp
) {
83 this.parent
.removeAnyConnectionsForConnector(icp
);
84 return this.removeModelListItem('connectionPoint', icp
);
87 //get externalConnectionPoint() {
88 // // https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
89 // //const vduc = this;
90 // //if (vduc.model && vduc.model['external-interface']) {
91 // // return vduc.model['external-interface'].reduce((result, externalIfc) => {
92 // // const id = externalIfc['vnfd-connection-point-ref'];
93 // // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
94 // // result.push({id: id, key: keyPrefix + id});
102 return this.connectionPoint
;
106 // return this.externalConnectionPoint;
110 return this.parent
.removeVirtualDeploymentUnit(this);