3 app.config(function($logProvider) {
4 // Optionally set to "false" to disable debug logging.
5 $logProvider.debugEnabled(true);
8 var testViewEditController = function(COMPONENT, DataService, PropertyService,
9 UtilityService, $scope, $timeout, $cookieStore, $log) {
11 $scope.popup = new Object();
12 $scope.isTestMode = false;
14 $scope.init = function(properties) {
17 * These 2 statements should be included in non-test code.
20 .setMsoMaxPollingIntervalMsec(properties.msoMaxPollingIntervalMsec);
21 PropertyService.setMsoMaxPolls(properties.msoMaxPolls);
24 * Common parameters that shows an example of how the view edit screen
25 * is expected to pass some common service instance values to the
29 DataService.setSubscriberName("Mobility");
30 DataService.setGlobalCustomerId("CUSTID12345")
31 DataService.setServiceType("Mobility Type 1");
32 DataService.setServiceInstanceName("Example Service Instance Name");
33 DataService.setServiceName("Mobility Service 1");
34 DataService.setServiceInstanceId("mmsc-test-service-instance");
35 DataService.setServiceUuid("XXXX-YYYY-ZZZZ");
36 DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME");
39 * "setTestMode" is only used for testing.
46 $scope.autoStartTest = function() {
48 * Optionally comment in / out one of these method calls (or add a
49 * similar entry) to auto-invoke an entry as soon as the page is
53 // $scope.showServiceDetails();
54 // $scope.showVnfDetails();
55 // $scope.createService();
56 // $scope.deleteService();
57 // $scope.createNetwork();
58 // $scope.createVnf();
59 // $scope.createVfModule();
60 // $scope.deleteVnf();
61 // $scope.createVfModule();
66 * This block of code is only used for testing.
70 * The first 3 functions override default values set in the server
73 * 1) The URL for the MSO controller is set to either the "real" controller
74 * or the test version depending on the "Use test MSO controller" checkbox.
76 * 2) SDC and AAI are set to use test controller versions.
78 * 3) Maximum polling and timeout values are set to lower values to lessen
79 * the time required to run tests.
83 var TEST_MODE_COOKIE = "isTestModeEnabled";
85 var defaultMsoBaseUrl = PropertyService.getMsoBaseUrl();
87 var setTestMode = function() {
88 setTestMsoMode($cookieStore.get(TEST_MODE_COOKIE));
89 PropertyService.setAaiBaseUrl("testaai");
90 PropertyService.setAsdcBaseUrl("testasdc");
91 PropertyService.setMsoMaxPollingIntervalMsec(1000);
92 PropertyService.setMsoMaxPolls(7);
93 PropertyService.setServerResponseTimeoutMsec(10000);
96 $scope.testMsoModeChanged = function() {
97 setTestMsoMode($scope.isTestMsoMode);
100 var setTestMsoMode = function(isEnabled) {
101 $scope.isTestMsoMode = isEnabled;
102 $cookieStore.put(TEST_MODE_COOKIE, isEnabled);
104 PropertyService.setMsoBaseUrl("testmso");
106 PropertyService.setMsoBaseUrl(defaultMsoBaseUrl);
110 var callbackFunction = function(response) {
111 $scope.callbackResults = "";
113 $scope.callbackStyle = {
114 "background-color" : color
117 * This 1/2 delay was only added to visually highlight the status
118 * change. Probably not needed in the real application code.
120 $timeout(function() {
121 $scope.callbackResults = UtilityService.getCurrentTime()
122 + " isSuccessful: " + response.isSuccessful;
123 if (response.isSuccessful) {
128 $scope.callbackStyle = {
129 "background-color" : color
135 * End of block of test-specific code
141 $scope.createService = function() {
143 DataService.setModelId("91238134091820938018230918230989");
145 $scope.$broadcast("createComponent", {
146 componentId : COMPONENT.SERVICE,
147 callbackFunction : callbackFunction
151 $scope.createVnf = function() {
153 DataService.setModelId("91238134091820938018230918230989");
154 DataService.setModelInstanceName("VNF_MODEL_INSTANCE_NAME");
156 DataService.setCloudRegionTenantList(exampleCloudRegionTenantList)
157 DataService.setServiceIdList(exampleServiceIdList);
159 // Data used to create MSO "relatedInstanceList" object
161 DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
163 $scope.$broadcast("createComponent", {
164 componentId : COMPONENT.VNF,
165 callbackFunction : callbackFunction
169 $scope.createVfModule = function() {
171 .setInventoryItem(exampleAaiResult["inventory-response-items"][0]);
173 DataService.setModelId("91238134091820938018230918230989");
174 DataService.setModelInstanceName("VF_MODULE_MODEL_INSTANCE_NAME");
176 DataService.setLcpRegion("Region2");
177 DataService.setTenant("Tenant2");
178 // Data used to create MSO "relatedInstanceList" object
180 DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
182 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
183 DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
185 DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
187 .setAvailableVolumeGroupList(exampleAvailableVolumeGroupList);
188 DataService.setModelInfo(COMPONENT.VOLUME_GROUP,
189 exampleVolumeGroupModelInfo);
191 $scope.$broadcast("createComponent", {
192 componentId : COMPONENT.VF_MODULE,
193 callbackFunction : callbackFunction
197 $scope.createVolumeGroup = function() {
199 DataService.setModelId("91238134091820938018230918230989");
200 DataService.setModelInstanceName("VOLUME_GROUP_MODEL_INSTANCE_NAME");
201 DataService.setLcpRegion("Region1");
202 DataService.setTenant("Tenant1");
203 // Data used to create MSO "relatedInstanceList" object
205 DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
207 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
208 DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
210 $scope.$broadcast("createComponent", {
211 componentId : COMPONENT.VOLUME_GROUP,
212 callbackFunction : callbackFunction
216 $scope.createNetwork = function() {
218 DataService.setModelId("91238134091820938018230918230989");
219 DataService.setModelInstanceName("NETWORK_MODEL_INSTANCE_NAME");
221 DataService.setCloudRegionTenantList(exampleCloudRegionTenantList)
222 DataService.setServiceIdList(exampleServiceIdList);
224 // Data used to create MSO "relatedInstanceList" object
226 DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
228 $scope.$broadcast("createComponent", {
229 componentId : COMPONENT.NETWORK,
230 callbackFunction : callbackFunction
237 $scope.deleteService = function() {
239 DataService.setInventoryItem(exampleServiceItem);
241 DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
243 $scope.$broadcast("deleteComponent", {
244 componentId : COMPONENT.SERVICE,
245 callbackFunction : callbackFunction
249 $scope.deleteVnf = function() {
252 .setInventoryItem(exampleAaiResult["inventory-response-items"]["inventory-response-item"][0]);
254 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
255 DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
256 DataService.setLcpRegion("Region3");
257 DataService.setTenant("Tenant3");
259 $scope.$broadcast("deleteComponent", {
260 componentId : COMPONENT.VNF,
261 callbackFunction : callbackFunction
265 $scope.deleteVfModule = function() {
267 DataService.setInventoryItem(exampleVfModuleItem);
269 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
271 DataService.setVfModuleInstanceId("VF_MODULE_INSTANCE_ID_12345");
272 DataService.setModelInfo(COMPONENT.VF_MODULE, exampleVfModuleModelInfo);
273 DataService.setLcpRegion("Region4");
274 DataService.setTenant("Tenant4");
276 $scope.$broadcast("deleteComponent", {
277 componentId : COMPONENT.VF_MODULE,
278 callbackFunction : callbackFunction
282 $scope.deleteVolumeGroup = function() {
284 DataService.setInventoryItem(exampleVolumeGroupItem);
286 DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
287 DataService.setModelInfo(COMPONENT.VOLUME_GROUP,
288 exampleVolumeGroupModelInfo);
289 DataService.setLcpRegion("Region3");
290 DataService.setTenant("Tenant3");
293 $scope.$broadcast("deleteComponent", {
294 componentId : COMPONENT.VOLUME_GROUP,
295 callbackFunction : callbackFunction
299 $scope.deleteNetwork = function() {
301 DataService.setInventoryItem(exampleNetworkItem);
303 DataService.setNetworkInstanceId("NETWORK_INSTANCE_ID_12345");
304 DataService.setModelInfo(COMPONENT.NETWORK, exampleNetworkModelInfo);
305 DataService.setLcpRegion("Region5");
306 DataService.setTenant("Tenant5");
308 $scope.$broadcast("deleteComponent", {
309 componentId : COMPONENT.NETWORK,
310 callbackFunction : callbackFunction
315 * Show Details functions
317 $scope.showServiceDetails = function() {
319 DataService.setInventoryItem(exampleServiceItem);
321 $scope.$broadcast("showComponentDetails", {
322 componentId : COMPONENT.SERVICE,
323 callbackFunction : callbackFunction
327 $scope.showVnfDetails = function() {
329 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
331 .setInventoryItem(exampleAaiResult["inventory-response-items"]["inventory-response-item"][0]);
333 $scope.$broadcast("showComponentDetails", {
334 componentId : COMPONENT.VNF,
335 callbackFunction : callbackFunction
339 $scope.showVfModuleDetails = function() {
341 DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
342 DataService.setVfModuleInstanceId("VF_MODULE_INSTANCE_ID_12345");
343 DataService.setInventoryItem(exampleVfModuleItem);
345 $scope.$broadcast("showComponentDetails", {
346 componentId : COMPONENT.VF_MODULE,
347 callbackFunction : callbackFunction
351 $scope.showVolumeGroupDetails = function() {
353 DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
354 DataService.setInventoryItem(exampleVolumeGroupItem);
356 $scope.$broadcast("showComponentDetails", {
357 componentId : COMPONENT.VOLUME_GROUP,
358 callbackFunction : callbackFunction
362 $scope.showNetworkDetails = function() {
364 DataService.setNetworkInstanceId("NETWORK_INSTANCE_ID_12345");
365 DataService.setInventoryItem(exampleNetworkItem);
367 $scope.$broadcast("showComponentDetails", {
368 componentId : COMPONENT.NETWORK,
369 callbackFunction : callbackFunction
374 app.controller("testViewEditController", [ "COMPONENT", "DataService",
375 "PropertyService", "UtilityService", "$scope", "$timeout",
376 "$cookieStore", "$log", testViewEditController ]);