2 * STANDARD_RIFT_IO_COPYRIGHT
5 * Created by onvelocity on 11/23/15.
10 import DescriptorModel from '../DescriptorModel'
11 import DescriptorModelFactory from '../DescriptorModelFactory'
13 export default class VirtualDeploymentUnit extends DescriptorModel {
19 static get className() {
20 return 'VirtualDeploymentUnit';
23 constructor(model, parent) {
26 this.uiState['qualified-type'] = 'vnfd.vdu';
27 this.className = 'VirtualDeploymentUnit';
31 return this.parent.key + '/' + super.key;
34 get connectionPoint() {
35 const list = this.model['internal-connection-point'] || (this.model['internal-connection-point'] = []);
36 return list.map(d => DescriptorModelFactory.newVirtualDeploymentUnitInternalConnectionPoint(d, this));
39 set connectionPoint(obj) {
40 return this.updateModelList('internal-connection-point', obj, DescriptorModelFactory.VirtualDeploymentUnitInternalConnectionPoint);
43 //get internalConnectionPoint() {
44 // //https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
46 // if (this.model && this.model['internal-interface']) {
47 // const icpMap = this.model['internal-connection-point'].reduce((r, d) => {
51 // return this.model['internal-interface'].reduce((result, internalIfc) => {
52 // const id = internalIfc['vdu-internal-connection-point-ref'];
53 // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
55 // const icp = Object.assign({}, icpMap[id], {
56 // key: keyPrefix + id,
57 // name: internalIfc.name,
58 // 'virtual-interface': internalIfc['virtual-interface']
68 removeInternalConnectionPoint(icp) {
69 this.parent.removeAnyConnectionsForConnector(icp);
70 return this.removeModelListItem('connectionPoint', icp);
73 //get externalConnectionPoint() {
74 // // https://trello.com/c/ZOyKQd3z/122-hide-lines-representing-interface-connection-point-references-both-internal-and-external-interfaces
75 // //const vduc = this;
76 // //if (vduc.model && vduc.model['external-interface']) {
77 // // return vduc.model['external-interface'].reduce((result, externalIfc) => {
78 // // const id = externalIfc['vnfd-connection-point-ref'];
79 // // const keyPrefix = vduc.parent ? vduc.parent.key + '/' : '';
80 // // result.push({id: id, key: keyPrefix + id});
88 return this.connectionPoint;
92 // return this.externalConnectionPoint;
96 return this.parent.removeVirtualDeploymentUnit(this);