summaryrefslogtreecommitdiffstats
path: root/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java
blob: f565c694af3c6d795eb3806f1b9006226591b63e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
/*
 * ============LICENSE_START=======================================================
 * ves-agent
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import evel_javalibrary.att.com.*;
import evel_javalibrary.att.com.AgentMain.EVEL_ERR_CODES;
import evel_javalibrary.att.com.EvelFault.EVEL_SEVERITIES;
import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES;
import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES;
import evel_javalibrary.att.com.EvelHeader.PRIORITIES;
import evel_javalibrary.att.com.EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS;
import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_CPU_USE;
import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_MEM_USE;
import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_LATENCY_BUCKET;
import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_DISK_USE;
import evel_javalibrary.att.com.EvelScalingMeasurement.MEASUREMENT_VNIC_PERFORMANCE;
import evel_javalibrary.att.com.EvelStateChange.EVEL_ENTITY_STATE;
import evel_javalibrary.att.com.EvelThresholdCross.EVEL_ALERT_TYPE;
import evel_javalibrary.att.com.EvelThresholdCross.EVEL_EVENT_ACTION;


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.apache.log4j.BasicConfigurator;

import java.io.*;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;


@PrepareForTest({AgentMain.class})
@RunWith(PowerMockRunner.class)
public class TestJunit {

   private AgentMain  mymainmock = null;
   private EvelHeader header = null;

   //private static final Logger LOG = LoggerFactory.getLogger(TestJunit.class);
   private static final Logger LOG = Logger.getLogger(TestJunit.class.getName());

    @Before
    public void setupClass() {
        BasicConfigurator.configure();
        mymainmock = mock(AgentMain.class);

        // PowerMockito does bytecode magic to mock static methods and use final classes
        PowerMockito.mockStatic(AgentMain.class);

        //evel init
         try {
          mymainmock.evel_initialize( "http://127.0.0.1", 30000, "/vendor_event_listener", "/example_vnf", null, null,null, "pill", "will", Level.DEBUG);
         } catch ( Exception e )
         {
           e.printStackTrace();
         }
    }


   @Test
   public void testHeartbeat() {

              header  = EvelHeader.evel_new_heartbeat("Hearbeat_vAFX","vmname_ip");
              header.evel_nfnamingcode_set("vVNF");
              header.evel_nfcnamingcode_set("vVNF");
              when(mymainmock.evel_post_event(header)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(header);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }


   @Test
   public void testFault() {

              EvelFault flt  = new EvelFault("Fault_vVNF", "vmname_ip",
            		  "NIC error", "Hardware failed",
                  EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
                  EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
                  EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
                  EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
              flt.evel_fault_addl_info_add("nichw", "fail");
              flt.evel_fault_addl_info_add("nicsw", "fail");
              flt.evel_fault_category_set("intftype");
              flt.evel_fault_interface_set("eth0");
              flt.evel_fault_type_set("vmintf");
              when(mymainmock.evel_post_event(flt)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(flt);
              LOG.info("Returned "+ret);
              assertTrue( ret );

   }

   @Test
   public void testBatch() {
              EvelBatch be = new EvelBatch();
              EvelFault flt2  = new EvelFault("Fault_vVNF", "vmname_ip",
            		  "NIC error", "Hardware failed",
                  EvelHeader.PRIORITIES.EVEL_PRIORITY_HIGH,
                  EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
                  EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
                  EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
              flt2.evel_fault_addl_info_add("nichw", "fail");
              flt2.evel_fault_addl_info_add("nicsw", "fail");
              be.addEvent(flt2);
              
              EvelFault flt3  = new EvelFault("Fault_vVNF", "vmname_ip2",
            		  "NIC error", "Hardware failed",
                  EvelHeader.PRIORITIES.EVEL_PRIORITY_NORMAL,
                  EVEL_SEVERITIES.EVEL_SEVERITY_MAJOR,
                  EVEL_SOURCE_TYPES.EVEL_SOURCE_CARD,
                  EVEL_VF_STATUSES.EVEL_VF_STATUS_ACTIVE);
              flt3.evel_fault_type_set("Interface fault");
              flt3.evel_fault_category_set("Failed category");
              flt3.evel_fault_interface_set("An Interface Card");
              flt3.evel_fault_addl_info_add("nichw", "fail");
              flt3.evel_fault_addl_info_add("nicsw", "fail");
              be.addEvent(flt3);
 

              EvelStateChange stc  = new EvelStateChange("StateChange_vVNF", "vmname_ip",
            		      EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_IN_SERVICE,
                          EVEL_ENTITY_STATE.EVEL_ENTITY_STATE_OUT_OF_SERVICE,"bgp");
              stc.evel_statechange_addl_info_add("bgpa", "fail");
              stc.evel_statechange_addl_info_add("bgpb", "fail");
              //AgentMain.evel_post_event(stc);

              be.addEvent(stc);
              when(mymainmock.evel_post_event(be)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(be);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }

   @Test
   public void testMeasurement() {
              EvelScalingMeasurement sm  = new EvelScalingMeasurement(10.0,"Measurements_vVNF", "vmname_ip");
              sm.evel_measurement_type_set("dummy");
              sm.evel_measurement_addl_info_add("meas1","value1");
              sm.evel_measurement_addl_info_add("meas2","value2");
              sm.evel_measurement_concurrent_sessions_set(3);
              sm.evel_measurement_config_entities_set(3);
              sm.evel_measurement_myerrors_set(10,20,30,40);
              sm.evel_measurement_mean_req_lat_set(123.0);
              sm.evel_measurement_request_rate_set(12);
              MEASUREMENT_CPU_USE my1 = sm.evel_measurement_new_cpu_use_add("cpu1", 100.0);
              my1.idle.SetValue(20.0);
              my1.sys.SetValue(21.0);
              MEASUREMENT_CPU_USE my2 = sm.evel_measurement_new_cpu_use_add("cpu2", 10.0);
              my2.steal.SetValue(34.0);
              my2.user.SetValue(32.0);
              sm.evel_measurement_custom_measurement_add("group1","name1","val1");
              sm.evel_measurement_custom_measurement_add("group1","name2","val2");
              sm.evel_measurement_custom_measurement_add("group2","name1","val1");
              sm.evel_measurement_custom_measurement_add("group2","name2","val2");
              sm.evel_measurement_cpu_use_idle_set(my1,0.5);
              sm.evel_measurement_cpu_use_interrupt_set(my1,0.5);
              sm.evel_measurement_cpu_use_nice_set(my1,0.5);
              sm.evel_measurement_cpu_use_softirq_set(my1,0.5);
              sm.evel_measurement_cpu_use_steal_set(my1,0.5);
              sm.evel_measurement_cpu_use_system_set(my1,0.5);
              sm.evel_measurement_cpu_use_usageuser_set(my1,0.5);

              MEASUREMENT_MEM_USE mym1 = sm.evel_measurement_new_mem_use_add("mem1", "vm1",123456.0);
              sm.evel_measurement_mem_use_memcache_set(mym1, 456.);
	      sm.evel_measurement_mem_use_memconfig_set(mym1, 456.);
	      sm.evel_measurement_mem_use_memfree_set(mym1, 456.);
	      sm.evel_measurement_mem_use_slab_reclaimed_set(mym1, 456.);
	      sm.evel_measurement_mem_use_slab_unreclaimable_set(mym1, 456.);
	      sm.evel_measurement_mem_use_usedup_set(mym1, 456.);

              MEASUREMENT_DISK_USE dsk = sm.evel_measurement_new_disk_use_add("disk1");
	      sm.evel_measurement_disk_use_iotimeavg_set(dsk, 1.0); 
	      sm.evel_measurement_disk_use_iotimelast_set(dsk, 1.0); 
	      sm.evel_measurement_disk_use_iotimemax_set(dsk, 100.0); 
	      sm.evel_measurement_disk_use_mergereadavg_set(dsk, 67.);
	      sm.evel_measurement_disk_use_mergereadlast_set(dsk, 67.);
	      sm.evel_measurement_disk_use_mergereadmax_set(dsk, 678.);
	      sm.evel_measurement_disk_use_mergereadmin_set(dsk, 678.);
	      sm.evel_measurement_disk_use_mergewritelast_set(dsk,456.);
	      sm.evel_measurement_disk_use_mergewritemax_set(dsk,678.);
	      sm.evel_measurement_disk_use_mergewritemin_set(dsk,67.);
	      sm.evel_measurement_disk_use_octetsreadavg_set(dsk,65.);
	      sm.evel_measurement_disk_use_octetsreadlast_set(dsk,78.);
	      sm.evel_measurement_disk_use_octetsreadmax_set(dsk,56.);
	      sm.evel_measurement_disk_use_octetsreadmin_set(dsk,345.);
	      sm.evel_measurement_disk_use_octetswriteavg_set(dsk,34.);
	      sm.evel_measurement_disk_use_octetswritelast_set(dsk,676.);
	      sm.evel_measurement_disk_use_octetswritemax_set(dsk, 56.);
	      sm.evel_measurement_disk_use_octetswritemin_set(dsk,678.);
	      sm.evel_measurement_disk_use_opsreadavg_set(dsk,67.);
	      sm.evel_measurement_disk_use_opsreadlast_set(dsk,33.);
	      sm.evel_measurement_disk_use_opsreadmax_set(dsk,678.);
	      sm.evel_measurement_disk_use_opsreadmin_set(dsk,23.);
	      sm.evel_measurement_disk_use_opswriteavg_set(dsk,23.);
	      sm.evel_measurement_disk_use_opswritelast_set(dsk,23.);
	      sm.evel_measurement_disk_use_opswritemax_set(dsk,23.);
	      sm.evel_measurement_disk_use_opswritemin_set(dsk,23.);

	      sm.evel_measurement_disk_use_pendingopsavg_set(dsk,23.);
	      sm.evel_measurement_disk_use_pendingopslast_set(dsk,23.);
	      sm.evel_measurement_disk_use_pendingopsmax_set(dsk,23.);
	      sm.evel_measurement_disk_use_pendingopsmin_set(dsk,23.);

	      sm.evel_measurement_disk_use_timereadavg_set(dsk,45.);
	      sm.evel_measurement_disk_use_timereadlast_set(dsk,45.);
	      sm.evel_measurement_disk_use_timereadmax_set(dsk,45.);
	      sm.evel_measurement_disk_use_timereadmin_set(dsk,45.);

	      sm.evel_measurement_disk_use_timewriteavg_set(dsk,45.);
	      sm.evel_measurement_disk_use_timewritelast_set(dsk,45.);
	      sm.evel_measurement_disk_use_timewritemax_set(dsk,45.);
	      sm.evel_measurement_disk_use_timewritemin_set(dsk,45.);


              MEASUREMENT_VNIC_PERFORMANCE vnic_p = sm.evel_measurement_new_vnic_performance("vnic1","true");
              vnic_p.recvd_bcast_packets_acc.SetValue(2400000.0);
              vnic_p.recvd_mcast_packets_delta.SetValue(5677888.0);
              vnic_p.recvd_mcast_packets_acc.SetValue(5677888.0);
              vnic_p.tx_ucast_packets_acc.SetValue(547856576.0);
              vnic_p.tx_ucast_packets_delta.SetValue(540000.0);
              sm.evel_meas_vnic_performance_add(vnic_p);
              sm.evel_measurement_fsys_use_add("fs1",40000.0, 5678.0, 5432.0,45.0,67.0,78.0);
              sm.evel_measurement_feature_use_add("latefeature",40);
              sm.evel_measurement_codec_use_add("codec",41);

              MEASUREMENT_LATENCY_BUCKET myb = sm.evel_new_meas_latency_bucket(10);
              sm.evel_meas_latency_bucket_high_end_set(myb,1000.);
              sm.evel_meas_latency_bucket_low_end_set(myb,1.);
              sm.evel_meas_latency_bucket_add(myb);
              sm.evel_measurement_latency_add(1.,10.,20);

              sm.evel_measurement_vnic_performance_add("vnic","vals", 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.);

              when(mymainmock.evel_post_event(sm)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(sm);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              
   @Test
   public void testSyslog() {
              EvelSyslog sysl = new EvelSyslog("Syslog_vVNF", "vmname_ip",
            		                    EvelFault.EVEL_SOURCE_TYPES.EVEL_SOURCE_ROUTER,
            		                   "Router failed","JUNIPER");
              sysl.evel_syslog_proc_id_set(456);
              sysl.evel_syslog_proc_set("routed");
              sysl.evel_syslog_type_set("named");
              sysl.evel_syslog_addl_filter_set("syslfilter");
              sysl.evel_syslog_event_source_host_set("vm2474");
              sysl.evel_syslog_facility_set(EvelSyslog.EVEL_SYSLOG_FACILITIES.EVEL_SYSLOG_FACILITY_LOCAL7);
              sysl.evel_syslog_severity_set("Warning");
              sysl.evel_syslog_version_set(10);
              sysl.evel_syslog_s_data_set("hello");
              sysl.evel_syslog_sdid_set("hello");
              sysl.evel_syslog_severity_set("critical");
              
              when(mymainmock.evel_post_event(sysl)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(sysl);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              
   @Test
   public void testHtbtField() {
              EvelHeartbeatField hfld = new EvelHeartbeatField(123,"HeartbeatField_vVNF", "vmname_ip");
              hfld.evel_hrtbt_interval_set(23);
              hfld.evel_hrtbt_field_addl_info_add("bgpb", "fail");
              hfld.evel_hrtbt_interval_set(100);
              
              when(mymainmock.evel_post_event(hfld)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(hfld);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }


   @Test
   public void testEvelMobileFlow() {
              EvelMobileFlow mf1 = new EvelMobileFlow("hello","there");
              EvelMobileFlow.MOBILE_GTP_PER_FLOW_METRICS gtp = mf1.new MOBILE_GTP_PER_FLOW_METRICS(12.0, 13.0, 1,2,3,4,5,6,7,new Date(), "mflow", 8,9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26);
              mf1.gtp_per_flow_metrics = gtp;

              EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_12", "MF_12345", "flowdir", gtp, "iptyp", 
		"ipv4", "ipendp", 100, "endpou",1234);
              mf.evel_mobile_flow_addl_field_add("bgpb", "fail");
              mf.evel_mobile_flow_type_set("named");
              mf.evel_mobile_flow_app_type_set("named");

              when(mymainmock.evel_post_event(mf)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(mf);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }


   @Test
   public void testSipSignaling() {
              
              EvelSipSignaling sip = new EvelSipSignaling("SipSignaling_vVNF", "vmname_ip","aricent","corlator","127.0.0.1","5647","10.1.1.124","5678");
              sip.evel_signaling_type_set("BVOIP");
              sip.evel_signaling_local_ip_address_set("1.2.3.4");
              sip.evel_signaling_local_port_set("446");
              sip.evel_signaling_remote_ip_address_set("1.2.3.4");
              sip.evel_signaling_remote_port_set("1446");
              sip.evel_signaling_vnfmodule_name_set("sipmc");
              sip.evel_signaling_vnfname_set("SIPVM");
              sip.evel_signaling_compressed_sip_set("comprsip");
              sip.evel_signaling_summary_sip_set("summsip");
              sip.evel_signaling_correlator_set("corl");
              sip.evel_signaling_addl_info_add("bgpb", "fail");

              when(mymainmock.evel_post_event(sip)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(sip);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              
   @Test
   public void testVoiceQuality() {
              EvelVoiceQuality vq = new EvelVoiceQuality("VoiceQuality_vVNF", "vmname_ip",
            		  "calleeSideCodc",
      			    "callerSideCodc", "corlator",
    			    "midCllRtcp", "juniper");
              vq.evel_voice_quality_end_metrics_set("adjname", "Caller", 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 15.1, 160.12, 170, 180, 190);
              vq.evel_voice_quality_addl_info_add("bgpb", "fail");
              vq.evel_voice_quality_callee_codec_set("codec1");
              vq.evel_voice_quality_caller_codec_set("codec1");
              vq.evel_voice_quality_correlator_set("codec1");
              vq.evel_voice_quality_rtcp_data_set("codec1");
              vq.evel_voice_quality_vnfmodule_name_set("mod1");
              vq.evel_voice_quality_vnfname_set("mod1");
              vq.evel_voice_quality_phone_number_set("1234-567-8910");
              vq.evel_voice_quality_end_metrics_set("name","descr", 1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12,13.,14.,15.,16.,17.,18.,19.);
              
              when(mymainmock.evel_post_event(vq)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(vq);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              
   @Test
   public void testEvelOther() {
              EvelOther ev = new EvelOther("MyCustomEvent_vVNF", "vmname_ip");
              ev.evel_other_field_add("a1", "b1");
              ev.evel_other_field_add("a1", "b2");
              
              ev.evel_other_field_add_namedarray("a1", "b1", "c1");
              ev.evel_other_field_add_namedarray("a1", "b2", "c2");
              ev.evel_other_field_add_namedarray("a2", "b1", "c1");
              ev.evel_other_field_add_namedarray("a2", "b1", "c1");
              
              when(mymainmock.evel_post_event(ev)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(ev);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              
   @Test
   public void testThresholdCross() {
      		String dateStart = "01/14/2012 09:29:58";
      		String dateStop = "01/15/2012 10:31:48";

      		//HH converts hour in 24 hours format (0-23), day calculation
      		SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");

      		Date d1 = null;
      		Date d2 = null;

      		try {
      			d1 = format.parse(dateStart);
      			d2 = format.parse(dateStop);
      		}catch (Exception e) {
    			e.printStackTrace();
    		}
              
              
              EvelThresholdCross tca = new EvelThresholdCross("ThresholdCross_vVNF", "vmname_ip",
              "CRIT",
              "mcast Limit reached",
              "mcastRxPackets",
              "1250000000",
              EvelThresholdCross.EVEL_EVENT_ACTION.EVEL_EVENT_ACTION_SET,
              "Mcast Rx breached", 
              EvelThresholdCross.EVEL_ALERT_TYPE.EVEL_ELEMENT_ANOMALY,
              d1, 
              EvelThresholdCross.EVEL_SEVERITIES.EVEL_SEVERITY_CRITICAL,
              d2);
              tca.evel_threshold_cross_interfacename_set("ns345");
              tca.evel_thresholdcross_addl_info_add("n1", "v1");
              tca.evel_thresholdcross_addl_info_add("n2", "v2");
              tca.evel_thresholdcross_alertid_add("alert1");
              tca.evel_thresholdcross_alertid_add("alert2");
              tca.evel_threshold_cross_possible_rootcause_set("ns345");
              tca.evel_threshold_cross_networkservice_set("ns345");
              tca.evel_threshold_cross_interfacename_set("eth0");
              tca.evel_threshold_cross_data_elementtype_set("alert2");
              tca.evel_threshold_cross_data_collector_set("alert2");
              tca.evel_threshold_cross_alertvalue_set("value");
              
              when(mymainmock.evel_post_event(tca)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(tca);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }
              

   @Test
   public void testMobileFlow() {
      		String dateStart = "01/14/2012 09:29:58";
      		Date d1 = null;
      		SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
      		try {
      			d1 = format.parse(dateStart);
      		}catch (Exception e) {
    			e.printStackTrace();
    		}
              EvelMobileFlow mf = new EvelMobileFlow("MobileFlow_vVNF", "vmname_ip",
            		  "In",
                      null,
                      "GTP",
                       "v2.3",
                      "1.2.3.4",
                      345556,
                      "5.6.7.8",
                      334344);
              MOBILE_GTP_PER_FLOW_METRICS mygtp = mf.new MOBILE_GTP_PER_FLOW_METRICS(
                      1.01,
                      2.02,
                      3,
                      4,
                      5,
                      6,
                      7,
                      8,
                      9,
                      d1,
                      "ACTIVE",
                      10,
                      11,
                      12,
                      13,
                      14,
                      15,
                      16,
                      17,
                      18,
                      19,
                      20,
                      21,
                      22,
                      23,
                      24,
                      25,
                      26,
                      27,
                      28);
              mf.gtp_per_flow_metrics = mygtp;
              
              when(mymainmock.evel_post_event(mf)).thenReturn(true);
              boolean ret = mymainmock.evel_post_event(mf);
              LOG.info("Returned "+ret);
              assertTrue( ret );
   }


}