RIFT-14134, RIFT-14548: RO CRU and Instantiate Data Centers
[osm/UI.git] / skyquake / plugins / launchpad / src / instantiate / instantiateStore.js
1 /*
2 *
3 * Copyright 2016 RIFT.IO Inc
4 *
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
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 *
17 */
18 import NetworkServiceActions from './launchNetworkServiceActions.js';
19 import NetworkServiceSource from './launchNetworkServiceSource.js';
20 import GUID from 'utils/guid.js';
21 import AppHeaderActions from 'widgets/header/headerActions.js';
22 import Alt from '../alt';
23 import _ from 'lodash';
24
25
26 class LaunchNetworkServiceStore {
27 constructor() {
28 this.nsd = [];
29 this.nsdDict = {};
30 this.vnfd = [];
31 this.pnfd = [];
32 this.vld = [];
33 this.name = "";
34 this.ipProfiles = [];
35 this.dnsServers = [];
36 this.sshKeysList = [];
37 this.sshKeysRef = [];
38 this.sla_parameters = [];
39 this.selectedNSDid;
40 this.selectedNSD = {};
41 this.selectedCloudAccount = {};
42 this.dataCenters = [];
43 this.cloudAccounts = [];
44 this.isLoading = false;
45 this.hasConfigureNSD = false;
46 this['input-parameters'] = [];
47 this.displayPlacementGroups = false;
48 this.ro = {};
49 this.bindActions(NetworkServiceActions);
50 this.nsdConfiguration = {
51 name:'',
52 selectedCloudAccount: {},
53 dataCenterID: null
54 };
55 /*Collection of vnf state containting cloud account and datacenter info.
56 keyed off vnfd-id-ref
57 */
58 this.vnfdCloudAccounts = {};
59 this.usersList = [];
60 this.configAgentAccounts = [];
61
62 this.isPreviewing = false;
63 this.isOpenMano = false;
64 this.registerAsync(NetworkServiceSource);
65 this.exportPublicMethods({
66 getMockData: getMockData.bind(this),
67 getMockSLA: getMockSLA.bind(this),
68 saveNetworkServiceRecord: this.saveNetworkServiceRecord,
69 nsFn: this.nsFn,
70 vnfFn: this.vnfFn,
71 updateInputParam: this.updateInputParam,
72 resetView: this.resetView,
73 nameUpdated: this.nameUpdated,
74 //nspg
75 descriptorSelected: this.descriptorSelected.bind(this),
76 deselectDescriptor: this.deselectDescriptor,
77 previewDescriptor: this.previewDescriptor,
78 vldFn: this.vldFn,
79 ipProfileFn: this.ipProfileFn,
80 dnsFn: this.dnsFn,
81 usersFn: this.usersFn,
82 sshFn: this.sshFn
83 });
84 }
85
86 //
87 resetView = () => {
88 console.log('reseting state');
89 this.setState({
90 name: '',
91 'input-parameter-xpath': null,
92 'ns-placement-groups': null,
93 'vnf-placement-groups':null,
94 vnfdCloudAccounts: {}
95 })
96 }
97
98
99 //Action Handlers
100 getCatalogSuccess(catalogs) {
101 let self = this;
102 let nsdDict = {};
103 let nsd = [];
104 let vnfd = [];
105 let pnfd = [];
106 catalogs.forEach(function(catalog) {
107 switch (catalog.type) {
108 case "nsd":
109 nsd.push(catalog);
110 try {
111 self.descriptorSelected(catalog.descriptors[0])
112 } catch (e) {
113 console.log('unable to select catalog')
114 }
115 break;
116 case "vnfd":
117 vnfd.push(catalog);
118 break;
119 case "pnfd":
120 pnfd.push(catalog);
121 break;
122 }
123 });
124 nsd[0].descriptors.map(function(n) {
125 nsdDict[n.id] = n;
126 })
127 this.setState({
128 nsd, vnfd, pnfd, nsdDict,
129
130 });
131 }
132 getLaunchCloudAccountSuccess(cloudAccounts) {
133 let newState = {};
134 newState.cloudAccounts = cloudAccounts || [];
135 if(cloudAccounts && cloudAccounts.length > 0) {
136 newState.selectedCloudAccount = cloudAccounts[0];
137 if (cloudAccounts[0]['account-type'] == 'openstack') {
138 newState.displayPlacementGroups = true;
139 } else {
140 newState.displayPlacementGroups = false;
141 }
142 } else {
143 newState.selectedCloudAccount = {};
144 }
145
146 this.setState(newState);
147 }
148 getConfigAgentSuccess(configAgentAccounts) {
149 this.setState({
150 configAgentAccounts: configAgentAccounts
151 })
152 }
153 getDataCentersSuccess(data) {
154 let dataCenters = data;
155
156 let newState = {
157 dataCenters: dataCenters || []
158 };
159 if (this.ro['account-type'] == 'openmano') {
160 newState.dataCenterID = dataCenters[this.ro.name][0].uuid
161 }
162 this.setState(newState)
163 }
164 getVDUSuccess(VNFD) {
165 this.setState({
166 sla_parameters: VNFD
167 })
168 }
169 launchNSRLoading() {
170 Alt.actions.global.showScreenLoader.defer();
171 this.setState({
172 isLoading: true
173 });
174 console.log('is Loading', this)
175 }
176 launchNSRSuccess(data) {
177 console.log('Launching Network Service')
178 let tokenizedHash = window.location.hash.split('/');
179 Alt.actions.global.hideScreenLoader.defer();
180 this.setState({
181 isLoading: false
182 });
183 return window.location.hash = 'launchpad/' + tokenizedHash[2];
184 }
185 launchNSRError(error) {
186 Alt.actions.global.showError.defer('Something went wrong while trying to instantiate. Check the error logs for more information');
187 Alt.actions.global.hideScreenLoader.defer();
188 this.setState({
189 isLoading: false
190 });
191 }
192 getInstantiateSshKeySuccess = (data) => {
193 this.setState({
194 sshKeysList: data,
195 sshKeysRef: []
196 })
197 }
198 getResourceOrchestratorSuccess = (data) => {
199 Alt.actions.global.hideScreenLoader.defer();
200 this.setState({
201 ro: data
202 })
203 }
204 getResourceOrchestratorError = (data) => {
205 console.log('getResourceOrchestrator Error: ', data)
206 }
207 //Form handlers
208 nameUpdated = (e) => {
209 this.setState({
210 name: e.target.value
211 })
212 }
213 deselectDescriptor = () => {
214 console.log('deselecting')
215 this.setState({
216 selectedNSDid: null,
217 selectedNSD: {},
218 isPreviewing: false
219 })
220 }
221 descriptorSelected = (data) => {
222 let NSD = data;
223 let VNFIDs = [];
224 this.resetView();
225 let newState = {
226 selectedNSDid: NSD.id,
227 vld: NSD && NSD.vld && NSD.vld.map(function(v) {
228 //Adding a type for UI state management
229 //This is deleted before launch
230 if(v['ip-profile-ref']) {
231 v.type = 'ip-profile-ref';
232 } else {
233 if(v['vim-network-name']) {
234 v.type = 'vim-network-name';
235 } else {
236 v.type = 'unknown';
237 }
238 }
239 return v;
240 }),
241 ipProfiles: NSD['ip-profiles']
242 };
243 newState.selectedNSD = data;
244 if (NSD['input-parameter-xpath']) {
245 newState.hasConfigureNSD = true;
246 newState['input-parameters'] = NSD['input-parameter-xpath'];
247 } else {
248 newState.hasConfigureNSD = false;
249 newState['input-parameters'] = null;
250 }
251 if(NSD['ns-placement-groups'] && NSD['ns-placement-groups'].length > 0 ) {
252 newState['ns-placement-groups'] = NSD['ns-placement-groups'];
253 }
254 if(NSD['vnf-placement-groups'] && NSD['vnf-placement-groups'].length > 0 ) {
255 newState['vnf-placement-groups'] = NSD['vnf-placement-groups'];
256 }
257 NSD["constituent-vnfd"].map((v) => {
258 VNFIDs.push(v["vnfd-id-ref"]);
259 })
260 this.getInstance().getVDU(VNFIDs);
261 this.setState(newState);
262 }
263 previewDescriptor = (data) => {
264 let self = this;
265 return function(e) {
266 self.setState({
267 isPreviewing: true,
268 selectedNSD: data
269 })
270 }
271 }
272 updateInputParam = (i, value) => {
273 let ip = this['input-parameters'];
274 ip[i].value = value;
275 this.setState({
276 'input-parameters': ip
277 });
278 }
279 nsFn = () => {
280 let self = this;
281 return {
282 updateSelectedCloudAccount: (cloudAccount) => {
283 let nsd = self.nsd[0];
284 var newState = {
285 selectedCloudAccount: cloudAccount
286 };
287 if (cloudAccount['account-type'] == 'openstack') {
288 newState.displayPlacementGroups = true;
289 } else {
290 newState.displayPlacementGroups = false;
291 }
292 self.setState(newState);
293 },
294 updateSelectedDataCenter: (dataCenter) => {
295 self.setState({
296 dataCenterID: dataCenter.target.value
297 });
298 },
299 placementGroupUpdate: (i, k, value) => {
300 let pg = self['ns-placement-groups'];
301 pg[i][k] = value;
302 self.setState({
303 'ns-placement-groups': pg
304 })
305 },
306 hostAggregateUpdate: (pgi, hai, k, value) => {
307 let pg = self['ns-placement-groups'];
308 let ha = pg[pgi]['host-aggregate'][hai];
309 ha[k] = value;
310 self.setState({
311 'ns-placement-groups': pg
312 })
313 },
314 addHostAggregate: (pgi) => {
315 let pg = self['ns-placement-groups'];
316 let ha = pg[pgi]['host-aggregate'];
317 ha.push({});
318 self.setState({
319 'ns-placement-groups': pg
320 })
321 },
322 removeHostAggregate: (pgi, hai) => {
323 let pg = self['ns-placement-groups'];
324 let ha = pg[pgi]['host-aggregate'];
325 ha.splice(hai, 1);
326 self.setState({
327 'ns-placement-groups': pg
328 })
329 },
330 getNSDByID: (id) => {
331
332 }
333 }
334 }
335 vnfFn = () => {
336 let self = this;
337 return {
338 placementGroupUpdate: (i, k, value) => {
339 let pg = self['vnf-placement-groups'];
340 pg[i][k] = value;
341 self.setState({
342 'vnf-placement-groups': pg
343 })
344 },
345 hostAggregateUpdate: (pgi, hai, k, value) => {
346 let pg = self['vnf-placement-groups'];
347 let ha = pg[pgi]['host-aggregate'][hai];
348 ha[k] = value;
349 self.setState({
350 'vnf-placement-groups': pg
351 })
352 },
353 addHostAggregate: (pgi) => {
354 let pg = self['vnf-placement-groups'];
355 let ha = pg[pgi]['host-aggregate'];
356 ha.push({});
357 self.setState({
358 'vnf-placement-groups': pg
359 })
360 },
361 removeHostAggregate: (pgi, hai) => {
362 let pg = self['vnf-placement-groups'];
363 let ha = pg[pgi]['host-aggregate'];
364 ha.splice(hai, 1);
365 self.setState({
366 'vnf-placement-groups': pg
367 })
368 },
369 updateSelectedCloudAccount: (id, cloudAccount) => {
370 let vnfCA = self.vnfdCloudAccounts;
371 if(cloudAccount) {
372 if(!vnfCA.hasOwnProperty(id)) {
373 vnfCA[id] = {};
374 }
375 vnfCA[id].account = cloudAccount;
376
377 if (cloudAccount['account-type'] == 'openmano' && this.dataCenters && self.dataCenters[cloudAccount['name']]) {
378 let datacenter = self.dataCenters[cloudAccount['name']][0];
379 vnfCA[id].datacenter = datacenter.uuid;
380 } else {
381 if (vnfCA[id].datacenter) {
382 delete vnfCA[id].datacenter;
383 }
384 }
385 } else {
386 if(vnfCA.hasOwnProperty(id)) {
387 if(vnfCA[id].hasOwnProperty('config-agent-account')) {
388 delete vnfCA[id].account;
389 } else {
390 delete vnfCA[id];
391 }
392 }
393 }
394 self.setState({
395 vnfdCloudAccounts: vnfCA
396 });
397 },
398 updateSelectedConfigAgent: (id) => {
399 return function(e) {
400 let configAgentRef = JSON.parse(e.target.value);
401 let vnfCA = self.vnfdCloudAccounts;
402 if(configAgentRef) {
403 if(!vnfCA.hasOwnProperty(id)) {
404 vnfCA[id] = {};
405 }
406 vnfCA[id]['config-agent-account'] = configAgentRef;
407 } else {
408 if(vnfCA[id].hasOwnProperty('account')) {
409 delete vnfCA[id]['config-agent-account'];
410 } else {
411 delete vnfCA[id];
412 }
413 }
414 self.setState({
415 vnfdCloudAccounts: vnfCA
416 });
417 }
418 },
419 updateSelectedDataCenter: (id, dataCenter) => {
420 let vnfCA = self.vnfdCloudAccounts;
421 if (!vnfCA[id]) {
422 vnfCA[id] = {};
423 }
424 vnfCA[id].datacenter = dataCenter.target.value;
425 self.setState({
426 vnfdCloudAccounts: vnfCA
427 });
428 }
429 }
430 }
431 vldFn = () => {
432 let self = this;
433 return {
434 updateType: (i) => {
435 return function(e){
436 let type = e.target.value;
437 let vld = self.vld;
438 if (vld[i].hasOwnProperty('type')) {
439 delete vld[i][vld[i].type]
440 }
441 vld[i].type = type;
442 vld[i][type] = '';
443 if(type == 'ip-profile-ref') {
444 let IPProfile = self.ipProfiles;
445 vld[i][type] = IPProfile[0] && IPProfile[0].name;
446 delete vld[i]['vim-network-name'];
447 } else {
448 delete vld[i]['dns-server'];
449 }
450 if(type == 'unknown') {
451 delete vld[i]['ip-profile-ref'];
452 delete vld[i]['vim-network-name'];
453 }
454 self.setState({vld:vld});
455 }
456 },
457 updateValue: (i, type) => {
458 return function(e) {
459 // Select Option returns JSON values.
460 let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value;
461 let vld = self.vld;
462 vld[i][type] = value;
463 self.setState({vld:vld});
464 }
465 }
466 }
467 }
468 ipProfileFn = () => {
469 let self = this;
470 return {
471 updateProfile: (i, key) => {
472 return function(e) {
473 // Select Option returns JSON values.
474 let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value;
475 self.ipProfiles[i]['ip-profile-params'][key] = value;
476
477 self.setState({ipProfiles:self.ipProfiles});
478 }
479 },
480 updateVersion: (i) => {
481 return function(e) {
482 // Select Option returns JSON values.
483 let value = e.target.value;
484 self.ipProfiles[i]['ip-profile-params']['ip-version'] = value;
485 self.setState({ipProfiles:self.ipProfiles});
486 }
487 },
488 updateDNS: (i, dnsIndex) => {
489 return function(e) {
490 // Select Option returns JSON values.
491 let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value;
492 self.ipProfiles[i]['ip-profile-params']['dns-server'][dnsIndex] = value;
493 self.setState({ipProfiles:self.ipProfiles});
494 }
495 },
496 updateDHCP: (i, property) => {
497 return function(e) {
498 let value = e.target.value;
499 //If value is meant to be boolean, convert it
500 if(value == "true" || value == "false") {
501 value = JSON.parse(value);
502 }
503 if(!self.ipProfiles[i]['ip-profile-params'].hasOwnProperty('dhcp-params')) {
504 self.ipProfiles[i]['ip-profile-params']['dhcp-params'] = {
505 enabled: true,
506 'start-address': '',
507 count: ''
508 }
509 }
510 //Removing DCHP property on disable to allow instantiation
511 if(!value) {
512 delete self.ipProfiles[i]['ip-profile-params']['dhcp-params'];
513 } else {
514 self.ipProfiles[i]['ip-profile-params']['dhcp-params'][property] = value;
515 }
516 self.setState({ipProfiles:self.ipProfiles});
517 }
518 }
519 }
520 }
521 dnsFn = () => {
522 let self = this;
523 return {
524 addDNS: (i) => {
525 let self = this;
526 return function(e) {
527 if(self.ipProfiles[i]['ip-profile-params']['dns-server']) {
528 self.ipProfiles[i]['ip-profile-params']['dns-server'].unshift('')
529 } else {
530 self.ipProfiles[i]['ip-profile-params']['dns-server'] = [''];
531 }
532
533 self.setState({ipProfiles:self.ipProfiles});
534 }
535 },
536 removeDNS: (i, k) => {
537 let self = this;
538 return function(e) {
539 self.ipProfiles[i]['ip-profile-params']['dns-server'].splice(k, 1);
540 if(self.ipProfiles[i]['ip-profile-params']['dns-server'].length == 0) {
541 delete self.ipProfiles[i]['ip-profile-params']['dns-server'];
542 }
543 self.setState({ipProfiles:self.ipProfiles});
544 }
545 }
546 }
547 }
548 sshFn = () => {
549 let self = this;
550 return {
551 updateNewKeyRefSelection: (e) => {
552 self.setState({
553 newRefSelection: e.target.value
554 })
555 },
556 updateKeyRef: (refIndex, remove) => {
557 let self = this;
558 return function(e) {
559 let sshKeysRef = self.sshKeysRef;
560 if(!remove) {
561 // if(!e.target.value) {
562 // return Alt.actions.global.showError.defer('Please select a key pair');
563 // } else {
564 if(!isNaN(refIndex)){
565 sshKeysRef.splice(refIndex, 1);
566 sshKeysRef.push(e.target.value);
567 } else {
568 sshKeysRef.push(e.target.value);
569 }
570 // }
571 } else {
572 sshKeysRef.splice(refIndex, 1);
573 }
574 self.setState({
575 sshKeysRef: sshKeysRef,
576 newRefSelection: null
577 })
578 }
579 }
580 }
581 }
582 usersFn = () => {
583 let self = this;
584 return {
585 add: function() {
586 console.log('adding user')
587 let newUser = {
588 name: '',
589 gecos: '',
590 passwd: ''
591 }
592 let usersList = self.usersList;
593 usersList.push(newUser);
594 self.setState({
595 usersList: usersList
596 })
597 },
598 remove: function(i) {
599 return function() {
600 self.usersList.splice(i, 1);
601 self.setState({
602 usersList: self.usersList
603 })
604 }
605 },
606 update: function(i, key) {
607 return function(e) {
608 let value = e.target.value;
609 self.usersList[i][key] = value;
610 self.setState({
611 usersList: self.usersList
612 })
613 }
614 }
615 }
616 }
617 saveNetworkServiceRecord(name, launch) {
618 //input-parameter: [{uuid: < some_unique_name>, xpath: <same as you got from nsd>, value: <user_entered_value>}]
619 /*
620 'input-parameter-xpath':[{
621 'xpath': 'someXpath'
622 }],
623 */
624 let nsPg = null;
625 let vnfPg = null;
626 let guuid = GUID();
627
628 // Create a filtered NSD payload from the decorated one as RW.REST cannot handle extra parameters now
629 let nsdPayload = {};
630 nsdPayload = _.cloneDeep(_.find(this.state.nsd[0].descriptors, {id: this.state.selectedNSDid}));
631
632 if (nsdPayload != {}) {
633 nsdPayload['meta'] && delete nsdPayload['meta'];
634 nsdPayload['constituent-vnfd'] && nsdPayload['constituent-vnfd'].map((constituentVnfd) => {
635 constituentVnfd['vnf-name'] && delete constituentVnfd['vnf-name'];
636 constituentVnfd['name'] && delete constituentVnfd['name'];
637 });
638 nsdPayload['placement-groups'] && nsdPayload['placement-groups'].map((placementGroup) => {
639 placementGroup['member-vnfd'] && placementGroup['member-vnfd'].map((memberVnfd) => {
640 memberVnfd['name'] && delete memberVnfd['name'];
641 });
642 })
643 nsdPayload['ns-placement-groups'] && delete nsdPayload['ns-placement-groups'];
644 nsdPayload['vnf-placement-groups'] && delete nsdPayload['vnf-placement-groups'];
645 nsdPayload.vld = this.state.vld;
646 nsdPayload.vld && nsdPayload.vld.map(function(v){
647 delete v['unknown'];
648 delete v.type;
649 })
650 }
651 let vnfdCloudAccounts = this.state.vnfdCloudAccounts;
652 let payload = {
653 id: guuid,
654 "name": name,
655 "short-name": name,
656 "description": "a description for " + guuid,
657 "admin-status": launch ? "ENABLED" : "DISABLED",
658 "nsd": nsdPayload
659 }
660
661 if (this.state.ro['account-type'] == 'openmano') {
662 payload['om-datacenter'] = this.state.dataCenterID;
663 } else {
664 payload["cloud-account"] = this.state.selectedCloudAccount.name;
665 }
666 if (this.state.hasConfigureNSD) {
667 let ips = this.state['input-parameters'];
668 let ipsToSend = ips.filter(function(ip) {
669 if (ip.value && ip.value != "") {
670 ip.uuid = GUID();
671 delete ip.name;
672 return true;
673 }
674 return false;
675 });
676 if (ipsToSend.length > 0) {
677 payload['input-parameter'] = ipsToSend;
678 }
679 }
680 // These placement groups need to be refactored. Too much boilerplate.
681 if (this.state.displayPlacementGroups) {
682 nsPg = this.state['ns-placement-groups'];
683 vnfPg = this.state['vnf-placement-groups'];
684 if(nsPg && (nsPg.length > 0)) {
685 payload['nsd-placement-group-maps'] = nsPg.map(function(n, i) {
686 if(n['availability-zone'] || n['server-group'] || (n['host-aggregate'].length > 0)) {
687 var obj = {
688 'cloud-type': 'openstack'
689 };
690 if(n['host-aggregate'].length > 0) {
691 obj['host-aggregate'] = n['host-aggregate'].map(function(h, j) {
692 return {
693 'metadata-key': h.key,
694 'metadata-value': h.value
695 }
696 })
697 }
698 if(n['availability-zone'] && (n['availability-zone'] != '')) {
699 obj['availability-zone'] = {name: n['availability-zone']};
700 }
701 if(n['server-group'] && (n['server-group'] != '')) {
702 obj['server-group'] = {name: n['server-group']};
703 }
704 obj['placement-group-ref'] = n.name;
705 return obj;
706 }
707 }).filter(function(o){
708 if(o) {
709 return true;
710 } else {
711 return false;
712 }
713 });
714 };
715 if(vnfPg && (vnfPg.length > 0)) {
716 payload['vnfd-placement-group-maps'] = vnfPg.map(function(n, i) {
717 if(n['availability-zone'] || n['server-group'] || (n['host-aggregate'].length > 0)) {
718 var obj = {
719 'cloud-type': 'openstack'
720 };
721 if(n['host-aggregate'].length > 0) {
722 obj['host-aggregate'] = n['host-aggregate'].map(function(h, j) {
723 return {
724 'metadata-key': h.key,
725 'metadata-value': h.value
726 }
727 })
728 }
729 if(n['server-group'] && (n['server-group'] != '')) {
730 obj['server-group'] = {name: n['server-group']};
731 }
732 if(n['availability-zone'] && (n['availability-zone'] != '')) {
733 obj['availability-zone'] = {name: n['availability-zone']};
734 }
735 obj['placement-group-ref'] = n.name;
736 obj['vnfd-id-ref'] = n['vnfd-id-ref'];
737 return obj;
738 }
739 }).filter(function(o){
740 if(o) {
741 return true;
742 } else {
743 return false;
744 }
745 });
746 }
747 }
748 //Construct VNF cloud accounts
749 payload['vnf-cloud-account-map'] = [];
750 for(let k in vnfdCloudAccounts) {
751 let vnf = {};
752 vnf['member-vnf-index-ref'] = k;
753 if(vnfdCloudAccounts[k].hasOwnProperty('account') && (vnfdCloudAccounts[k]['account'] && vnfdCloudAccounts[k]['account'].name)) {
754 vnf['cloud-account'] = vnfdCloudAccounts[k].account.name;
755 }
756 if(vnfdCloudAccounts[k].hasOwnProperty('config-agent-account') && vnfdCloudAccounts[k]['config-agent-account']) {
757 vnf['config-agent-account'] = vnfdCloudAccounts[k]['config-agent-account'];
758 }
759 if(vnfdCloudAccounts[k].hasOwnProperty('datacenter')) {
760 vnf['om-datacenter'] = vnfdCloudAccounts[k].datacenter;
761 }
762 payload['vnf-cloud-account-map'].push(vnf);
763 }
764 //Add SSH-Keys
765 payload['ssh-authorized-key'] = this.state.sshKeysRef.map(function(k) {
766 return {'key-pair-ref': JSON.parse(k).name};
767 });
768 //Add Users
769 payload['user'] = this.state.usersList;
770 this.launchNSR({
771 'nsr': [payload]
772 });
773 }
774 }
775
776
777
778 function getMockSLA(id) {
779 console.log('Getting mock SLA Data for id: ' + id);
780 this.setState({
781 sla_parameters: slaData
782 });
783 }
784
785 function getMockData() {
786 console.log('Getting mock Descriptor Data');
787 this.setState({
788 nsd: data.nsd,
789 vnfd: data.vnfd,
790 pnfd: data.pnfd
791 });
792 }
793 // export default Alt.createStore(LaunchNetworkServiceStore);
794 export default LaunchNetworkServiceStore;