2 * Copyright (c) 2017 highstreet technologies GmbH and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 define(['app/onapSo/onapSo.module',
10 'app/onapSo/onapSo.services'],
11 function (onapSoApp) {
13 onapSoApp.register.controller('onapSoCtrl', ['uiGridConstants', '$uibModal', '$scope', '$rootScope', '$window', '$timeout', '$onapSo', '$mwtnLog',
14 function (uiGridConstants, $uibModal, $scope, $rootScope, $window, $timeout, $onapSo, $mwtnLog) {
16 var COMPONENT = 'onapSoCtrl';
17 $mwtnLog.info({ component: COMPONENT, message: 'onapSoCtrl started!' });
19 $rootScope.section_logo = 'src/app/onapSo/images/onapSo.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif'
21 $scope.highlightFilteredHeader = $onapSo.highlightFilteredHeader;
24 pnfName: { id: 'pnfName', labelId: 'PNF_NAME', value: 'New-PNF' },
25 pnfId: { id: 'pnfId', labelId: 'PNF_IDENTIFIER', value: 'New-PNF network unique identifier' },
26 equipType: { id: 'equipType', labelId: 'PNF_EQUIPMENT_TYPE', value: 'Fancy equipment type' },
27 equipModel: { id: 'equipModel', labelId: 'PNF_EQUIPMENT_MODEL', value: 'Best in class' },
28 equipVendor: { id: 'equipVendor', labelId: 'PNF_EQUIPMENT_VENDOR', value: 'ONAP SDN-R Community' },
29 ipaddressV4Oam: { id: 'ipaddressV4Oam', labelId: 'PNF_IPv4ADDRESS', value: '10.10.10.10' },
30 inMaintenance: { id: 'inMaintenance', labelId: 'PNF_MAINTENANCE_MODE', value: false },
31 resourceVersion: { id: 'resourceVersion', labelId: 'PNF_RESOURCE_VERSION', value: '' }
34 $scope.createPnfInAai = function () {
37 "pnf-name": $scope.pnf.pnfName.value,
38 "pnf-id": $scope.pnf.pnfId.value,
39 "equip-type": $scope.pnf.equipType.value,
40 "equip-model": $scope.pnf.equipModel.value,
41 "equip-vendor": $scope.pnf.equipVendor.value,
42 "ipaddress-v4-oam": $scope.pnf.ipaddressV4Oam.value,
43 "in-maint": $scope.pnf.inMaintenance.value
46 $onapSo.createPnf(data).then(function (response) {
47 console.info('successfully created: ', data['pnf-name']);
48 $onapSo.getPnf(data).then(function (success) {
49 // console.info('success', JSON.stringify(success.data));
50 $scope.pnf.resourceVersion.value = success.data['resource-version'];
52 console.log('error1', JSON.stringify(error.data));
56 console.log('error2', JSON.stringify(error.data));
61 $scope.deletePnfInAai = function () {
63 "pnf-name": $scope.pnf.pnfName.value,
65 $onapSo.getPnf(data).then(function (success) {
66 console.info('success', JSON.stringify(success.data));
67 $scope.pnf.resourceVersion.value = success.data['resource-version'];
68 data['resource-version'] = success.data['resource-version'];
69 $onapSo.deletePnf(data).then(function (success) {
70 console.info('success', JSON.stringify(success));
71 $scope.pnf.resourceVersion.value = success.data['resource-version'];
73 console.log('error', JSON.stringify(error.data));
77 console.log('error', JSON.stringify(error.data));