f08d28213134239d26e3dc36e3f3e6c877dfc6a3
[sdc.git] / openecomp-ui / test-utils / factories / softwareProduct / SoftwareProductComponentsNetworkFactories.js
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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
13  * or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 import {Factory} from 'rosie';
17 import randomstring from 'randomstring';
18 import IdMixin from 'test-utils/factories/mixins/IdMixin.js';
19
20 export const VSPComponentsNicFactory = new Factory()
21         .attrs({
22                 name: () => randomstring.generate(),
23                 description: () => randomstring.generate(),
24                 networkId: 'network',
25         })
26         .attr('networkName', ['name'], name => `n${name}`);
27
28 export const VSPComponentsNicWithIdFactory = new Factory()
29         .extend(VSPComponentsNicFactory)
30         .extend(IdMixin);
31
32 export const VSPComponentsNetworkFactory = new Factory()
33         .attrs({
34                 nicEditor: {},
35                 nicList: []
36         });
37
38 export const VSPComponentsNetworkQDataFactory = new Factory()
39         .attrs({
40                 protocols: {
41                         protocolWithHighestTrafficProfile: 'UDP',
42                         protocols: ['UDP']
43                 },
44                 ipConfiguration: {
45                         ipv4Required: true
46                 }
47         });
48
49 export const VSPComponentsNetworkDataMapFactory = new Factory()
50         .attrs({
51                 'protocols/protocolWithHighestTrafficProfile' : 'UDP',
52                 'protocols/protocols' : ['UDP'],
53                 'ipConfiguration/ipv4Required' : true
54         });
55
56 export const VSPComponentsNicFactoryGenericFieldInfo = new Factory()
57         .attrs({
58                 'description' : {
59                         isValid: true,
60                                 errorText: '',
61                                 validations: []
62                 },
63                 'name' : {
64                         isValid: true,
65                                 errorText: '',
66                                 validations: []
67                 }
68         });
69
70 export const VSPComponentsNicFactoryQGenericFieldInfo = new Factory()
71         .attrs({
72                         'protocols/protocols': {
73                                 isValid: true,
74                                 errorText: '',
75                                 'enum': [
76                                         {
77                                                 'enum': 'TCP',
78                                                 title: 'TCP'
79                                         },
80                                         {
81                                                 'enum': 'UDP',
82                                                 title: 'UDP'
83                                         },
84                                         {
85                                                 'enum': 'SCTP',
86                                                 title: 'SCTP'
87                                         },
88                                         {
89                                                 'enum': 'IPsec',
90                                                 title: 'IPsec'
91                                         }
92                                 ],
93                                 items: {
94                                         type: 'string',
95                                         'enum': [
96                                                 '',
97                                                 'TCP',
98                                                 'UDP',
99                                                 'SCTP',
100                                                 'IPsec'
101                                         ],
102                                         'default': ''
103                                 },
104                                 minItems: 1,
105                                 validations: []
106                         },
107                         'protocols/protocolWithHighestTrafficProfile': {
108                                 isValid: true,
109                                 errorText: '',
110                                 validations: []
111                         },
112                         'ipConfiguration/ipv4Required': {
113                                 isValid: true,
114                                 errorText: '',
115                                 type: 'boolean',
116                                 'default': true,
117                                 validations: []
118                         },
119                         'ipConfiguration/ipv6Required': {
120                                 isValid: true,
121                                 errorText: '',
122                                 type: 'boolean',
123                                 'default': false,
124                                 validations: []
125                         },
126                         'network/networkDescription': {
127                                 isValid: true,
128                                 errorText: '',
129                                 type: 'string',
130                                 validations: [
131                                         {
132                                                 type: 'pattern',
133                                                 data: '[A-Za-z]+'
134                                         },
135                                         {
136                                                 type: 'maxLength',
137                                                 data: 300
138                                         }
139                                 ]
140                         },
141                         'sizing/describeQualityOfService': {
142                                 isValid: true,
143                                 errorText: '',
144                                 type: 'string',
145                                 validations: []
146                         },
147                         'sizing/inflowTrafficPerSecond/packets/peak': {
148                                 isValid: true,
149                                 errorText: '',
150                                 type: 'number',
151                                 validations: []
152                         },
153                         'sizing/inflowTrafficPerSecond/packets/avg': {
154                                 isValid: true,
155                                 errorText: '',
156                                 type: 'number',
157                                 validations: []
158                         },
159                         'sizing/inflowTrafficPerSecond/bytes/peak': {
160                                 isValid: true,
161                                 errorText: '',
162                                 type: 'number',
163                                 validations: []
164                         },
165                         'sizing/inflowTrafficPerSecond/bytes/avg': {
166                                 isValid: true,
167                                 errorText: '',
168                                 type: 'number',
169                                 validations: []
170                         },
171                         'sizing/outflowTrafficPerSecond/packets/peak': {
172                                 isValid: true,
173                                 errorText: '',
174                                 type: 'number',
175                                 validations: []
176                         },
177                         'sizing/outflowTrafficPerSecond/packets/avg': {
178                                 isValid: true,
179                                 errorText: '',
180                                 type: 'number',
181                                 validations: []
182                         },
183                         'sizing/outflowTrafficPerSecond/bytes/peak': {
184                                 isValid: true,
185                                 errorText: '',
186                                 type: 'number',
187                                 validations: []
188                         },
189                         'sizing/outflowTrafficPerSecond/bytes/avg': {
190                                 isValid: true,
191                                 errorText: '',
192                                 type: 'number',
193                                 validations: []
194                         },
195                         'sizing/flowLength/packets/peak': {
196                                 isValid: true,
197                                 errorText: '',
198                                 type: 'number',
199                                 validations: []
200                         },
201                         'sizing/flowLength/packets/avg': {
202                                 isValid: true,
203                                 errorText: '',
204                                 type: 'number',
205                                 validations: []
206                         },
207                         'sizing/flowLength/bytes/peak': {
208                                 isValid: true,
209                                 errorText: '',
210                                 type: 'number',
211                                 validations: []
212                         },
213                         'sizing/flowLength/bytes/avg': {
214                                 isValid: true,
215                                 errorText: '',
216                                 type: 'number',
217                                 validations: []
218                         },
219                         'sizing/acceptableJitter/mean': {
220                                 isValid: true,
221                                 errorText: '',
222                                 type: 'number',
223                                 validations: []
224                         },
225                         'sizing/acceptableJitter/max': {
226                                 isValid: true,
227                                 errorText: '',
228                                 type: 'number',
229                                 validations: []
230                         },
231                         'sizing/acceptableJitter/variable': {
232                                 isValid: true,
233                                 errorText: '',
234                                 type: 'number',
235                                 validations: []
236                         },
237                         'sizing/acceptablePacketLoss': {
238                                 isValid: true,
239                                 errorText: '',
240                                 type: 'number',
241                                 validations: [
242                                         {
243                                                 type: 'minimum',
244                                                 data: 0
245                                         },
246                                         {
247                                                 type: 'maximum',
248                                                 data: 100
249                                         }
250                                 ]
251                         }
252         });
253
254 export const VSPComponentsVersionControllerFactory = new Factory()
255         .attrs({
256                 version: { id: '1.1', label: '1.1'},
257                 viewableVersions: [{id: '1.0', label: '1.0'}, {id: '1.1', label: '1.1'}, {id: '1.2', label: '1.2'}],
258                 status: 'locked',
259                 isCheckedOut: true
260         });