2 * STANDARD_RIFT_IO_COPYRIGHT
5 * Created by onvelocity on 11/23/15.
10 import Position from '../../graph/Position'
11 import DescriptorModel from '../DescriptorModel'
12 import RspConnectionPointRef from './RspConnectionPointRef'
13 import VnfdConnectionPointRef from './VnfdConnectionPointRef'
14 import DescriptorModelFactory from '../DescriptorModelFactory'
17 * A VirtualNetworkFunctionConnectionPoint is always a child of a VNFD. We use it to build VnfdConnectionPointRef instances. So convenience
18 * methods are add to access the fields needed to do that.
20 export default class ConnectionPoint extends DescriptorModel {
23 return 'connection-point';
26 static get className() {
27 return 'VirtualNetworkFunctionConnectionPoint';
30 static get qualifiedType() {
31 return 'vnfd.' + ConnectionPoint.type;
34 constructor(model, parent) {
36 this.type = ConnectionPoint.type;
37 this.uiState['qualified-type'] = ConnectionPoint.qualifiedType;
38 this.className = 'VirtualNetworkFunctionConnectionPoint';
39 this.location = 'bottom-left';
40 this.position = new Position(parent.position.value());
41 this.position.top = parent.position.bottom;
42 this.position.width = 14;
43 this.position.height = 14;
47 return this.model.name;
51 return this.parent.key + '/' + this.model.name;
55 return this.model.name;
59 return this.parent.vnfdIndex;
63 return this.parent.vnfdId;
67 return this.uiState.cpNumber;
71 this.uiState.cpNumber = n;
75 * Convenience method to generate a VnfdConnectionPointRef instance from any given VirtualNetworkFunctionConnectionPoint.
77 * @returns {RspConnectionPointRef}
79 toRspConnectionPointRef() {
80 const ref = new RspConnectionPointRef({});
81 ref.vnfdId = this.vnfdId;
82 ref.vnfdIndex = this.vnfdIndex;
83 ref.vnfdConnectionPointName = this.name;
84 ref.cpNumber = this.cpNumber;
88 toVnfdConnectionPointRef() {
89 const ref = new VnfdConnectionPointRef({});
90 ref.vnfdId = this.vnfdId;
91 ref.vnfdIndex = this.vnfdIndex;
92 ref.vnfdConnectionPointName = this.name;
93 ref.cpNumber = this.cpNumber;
98 return (DescriptorModelFactory.isVirtualLink(obj) || DescriptorModelFactory.isConnectionPoint(obj)) && obj.parent !== this.parent;
102 return this.parent.removeConnectionPoint(this);