2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
23 app.requires.push('ngRoute');
24 app.requires.push('ui.tree');
26 app.config(function($routeProvider) {
28 .when("/subviewedit", {
29 templateUrl : "app/vid/scripts/view-models/aaiSubViewEdit.htm",
30 controller : "aaiSubscriberSearchController"
33 .when("/subdetails", {
34 templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm",
35 controller : "aaiSubscriberController"
39 templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm",
40 controller : "aaiSubscriberSearchController"
44 app.config(function(treeConfig) {
45 treeConfig.defaultCollapsed = true; // collapse nodes by default
48 app.factory("user",function(){
52 app.controller("aaiSubscriberSearchController", [ "$scope", "$timeout", "$log", "UtilityService", "user", "PropertyService",
53 function($scope, $timeout, $log, UtilityService, user, PropertyService) {
56 $scope.responseTimeoutMsec = 10000;
57 $scope.msoMaxPollingIntervalMsec = 1000;
58 $scope.msoMaxPolls = 7;
60 $scope.init = function(properties) {
61 // takes a default value, retrieves the prop value from the file system and sets it
62 var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(1000);
63 PropertyService.setMsoMaxPollingIntervalMsec(msecs);
65 // takes a default value, retrieves the prop value from the file system and sets it
66 var polls = PropertyService.retrieveMsoMaxPolls(7);
67 PropertyService.setMsoMaxPolls(polls);
69 PropertyService.setServerResponseTimeoutMsec(10000);
71 // These two properties only added for testing
72 properties.msoDefaultBaseUrl = $scope.baseUrl;
73 properties.responseTimeoutMsec = $scope.responseTimeoutMsec;
75 UtilityService.setProperties(properties);
78 $scope.autoGetSubs = function() {
80 * Optionally comment in / out one of these method calls (or add a similar
81 * entry) to auto-invoke an entry when the test screen is redrawn.
84 $scope.getSubscribers();
85 // $scope.deleteServiceInstance();
86 // $scope.generateInvalidUrl405();
90 $scope.autoGetSubDetails = function() {
92 * Optionally comment in / out one of these method calls (or add a similar
93 * entry) to auto-invoke an entry when the test screen is redrawn.
96 $scope.getSubDetails();
97 // $scope.deleteServiceInstance();
98 // $scope.generateInvalidUrl405();
102 $scope.autoPopulateViewEdit = function() {
104 * Optionally comment in / out one of these method calls (or add a similar
105 * entry) to auto-invoke an entry when the test screen is redrawn.
107 $timeout(function() {
108 $scope.getComponentList();
109 // $scope.deleteServiceInstance();
110 // $scope.generateInvalidUrl405();
114 $scope.refreshSubs = function() {
116 * Optionally comment in / out one of these method calls (or add a similar
117 * entry) to auto-invoke an entry when the test screen is redrawn.
119 $timeout(function() {
120 $scope.refreshSubscribers();
121 // $scope.deleteServiceInstance();
122 // $scope.generateInvalidUrl405();
126 $scope.autoStartQueryTest = function() {
128 * Optionally comment in / out one of these method calls (or add a similar
129 * entry) to auto-invoke an entry when the test screen is redrawn.
131 $timeout(function() {
132 // $scope.queryServiceInstance();
136 $scope.queryServiceInstance = function() {
138 * Example of method call needed to query a service instance.
140 $scope.$broadcast("queryServiceInstance", {
141 serviceInstanceId: "bc305d54-75b4-431b-adb2-eb6b9e546014"
145 $scope.getSubscribers = function() {
147 * Example of method call needed to commit an instance creation request.
149 $scope.$broadcast("getSubs", {
150 url : "aai_get_subscribers",
151 requestDetails : createServiceRequestDetails
155 $scope.getSubDetails = function() {
157 * Example of method call needed to commit an instance creation request.
159 $scope.$broadcast("getSubDetails", {
160 url : "aai_sub_details",
161 requestDetails : createServiceRequestDetails
165 $scope.getComponentList = function() {
167 * Example of method call needed to commit an instance creation request.
169 $scope.$broadcast("getComponentList", {
170 url : "aai_sub_viewedit",
171 requestDetails : createServiceRequestDetails
176 $scope.refreshSubscribers = function() {
178 * Example of method call needed to commit an instance creation request.
180 $scope.$broadcast("getSubs", {
181 url : "aai_refresh_subscribers",
182 requestDetails : createServiceRequestDetails
186 $scope.deleteServiceInstance = function() {
188 * Example of method call needed to commit an instance deletion request.
190 $scope.$broadcast("deleteInstance", {
191 url : "mso_delete_svc_instance/bc305d54-75b4-431b-adb2-eb6b9e546014",
192 requestDetails : deleteServiceRequestDetails
196 $scope.createNetworkInstance = function() {
197 $scope.$broadcast("createInstance", {
198 url : "mso_create_nw_instance",
199 requestDetails : createNetworkRequestDetails
203 $scope.deleteNetworkInstance = function() {
204 $scope.$broadcast("deleteInstance", {
205 url : "mso_delete_nw_instance/bc305d54-75b4-431b-adb2-eb6b9e546014/networks/ff305d54-75b4-ff1b-fff1-eb6b9e5460ff",
206 requestDetails : deleteNetworkRequestDetails
210 $scope.generateError = function(testName) {
211 // Clone example request object
212 var request = JSON.parse(JSON.stringify(createServiceRequestDetails));
213 request.modelInfo.modelName = testName;
214 $scope.$broadcast("createInstance", {
215 url : "mso_create_svc_instance",
216 requestDetails : request
220 $scope.generateInvalidUrl404 = function() {
221 var properties = UtilityService.getProperties(properties);
222 properties.msoDefaultBaseUrl = "/INVALID_STRING/";
223 UtilityService.setProperties(properties);
224 $scope.$broadcast("refreshProperties");
226 $scope.$broadcast("createInstance", {
227 url : "mso_create_svc_instance",
228 requestDetails : createServiceRequestDetails
231 properties.msoDefaultBaseUrl = $scope.baseUrl;
232 UtilityService.setProperties(properties);
233 $scope.$broadcast("refreshProperties");
236 $scope.generateInvalidUrl405 = function() {
237 $scope.$broadcast("createInstance", {
238 url : "INVALID_STRING_mso_create_svc_instance",
239 requestDetails : createServiceRequestDetails
247 var subscriberInfo = {
248 globalSubscriberId : "C12345",
249 subscriberName : "General Electric Division 12"
252 var createServiceRequestDetails = {
254 modelType : "service",
255 modelId : "sn5256d1-5a33-55df-13ab-12abad84e764",
256 modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484a333",
257 modelName : "WanBonding",
260 subscriberInfo : subscriberInfo,
261 requestParameters : {
262 vpnId : "1a2b3c4d5e6f",
263 productName : "Trinity",
264 customerId : "icore9883749"
268 var deleteServiceRequestDetails = {
270 modelType : "service",
271 modelId : "sn5256d1-5a33-55df-13ab-12abad84e764",
272 modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484a333",
273 modelName : "WanBonding",
278 var createNetworkRequestDetails = {
280 modelType : "network",
281 modelId : "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
282 modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
283 modelName : "vIsbcOamNetwork",
289 instanceId : "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
291 modelType : "service",
292 modelId : "ff3514e3-5a33-55df-13ab-12abad84e7ff",
293 modelNameVersionId : "fe6985cd-ea33-3346-ac12-ab121484a3fe",
294 modelName : "Intercarrier Interconnect Session Border Controller",
301 instanceId : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
304 modelId : "ff5256d1-5a33-55df-13ab-12abad84e7ff",
305 modelNameVersionId : "fe6478e4-ea33-3346-ac12-ab121484a3fe",
313 instanceId : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
315 modelType : "vfModule",
316 modelId : "ff5256d1-5a33-55df-13ab-22abad84e7ff",
317 modelNameVersionId : "fe6478e4-ea33-3346-bc12-ab121484a3fe",
318 modelName : "vIsbcRtpExpansionModule",
323 subscriberInfo : subscriberInfo,
324 requestParameters : {
326 * FYI: quotes around field names are needed due to embedded "-"
329 "cidr-mask" : "255.255.255.000",
330 "gateway-address" : "10.10.125.1",
331 "dhcp-enabled" : "true"
335 var deleteNetworkRequestDetails = {
337 modelType : "network",
338 modelId : "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
339 modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
340 modelName : "vIsbcOamNetwork",
346 instanceId : "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
348 modelType : "service",
349 modelId : "ff3514e3-5a33-55df-13ab-12abad84e7ff",
350 modelNameVersionId : "fe6985cd-ea33-3346-ac12-ab121484a3fe",
351 modelName : "Intercarrier Interconnect Session Border Controller",
358 instanceId : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
361 modelId : "ff5256d1-5a33-55df-13ab-12abad84e7ff",
362 modelNameVersionId : "fe6478e4-ea33-3346-ac12-ab121484a3fe",
370 instanceId : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
372 modelType : "vfModule",
373 modelId : "ff5256d1-5a33-55df-13ab-22abad84e7ff",
374 modelNameVersionId : "fe6478e4-ea33-3346-bc12-ab121484a3fe",
375 modelName : "vIsbcRtpExpansionModule",
381 $scope.getSubscriberDet = function(selectedCustomer){
382 window.location.href = '#subdetails?selectedSubscriber=' + selectedCustomer;