aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
blob: 430074ea8cf6b380df111be96d8f0d6f47af8aef (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
/*-
 * ============LICENSE_START=======================================================
 *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
 *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
 * ================================================================================
 * 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.
 *
 * SPDX-License-Identifier: Apache-2.0
 * ============LICENSE_END=========================================================
 */

package org.onap.policy.apex.examples.aadm;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
import org.onap.policy.apex.context.parameters.ContextParameterConstants;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus;
import org.onap.policy.apex.examples.aadm.model.AadmDomainModelFactory;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;

// TODO: Auto-generated Javadoc
/**
 * This class tests AADM use case.
 *
 * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
 *
 */
public class AadmUseCaseTest {
    private static final XLogger logger = XLoggerFactory.getXLogger(AadmUseCaseTest.class);

    private SchemaParameters schemaParameters;
    private ContextParameters contextParameters;
    private EngineParameters engineParameters;

    /**
     * Test AADM use case setup.
     */
    @Before
    public void beforeTest() {
        schemaParameters = new SchemaParameters();

        schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
        schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());

        ParameterService.register(schemaParameters);

        contextParameters = new ContextParameters();

        contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
        contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
        contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
        contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);

        ParameterService.register(contextParameters);
        ParameterService.register(contextParameters.getDistributorParameters());
        ParameterService.register(contextParameters.getLockManagerParameters());
        ParameterService.register(contextParameters.getPersistorParameters());

        engineParameters = new EngineParameters();
        engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
        ParameterService.register(engineParameters);
    }

    /**
     * After test.
     */
    @After
    public void afterTest() {
        ParameterService.deregister(engineParameters);

        ParameterService.deregister(contextParameters.getDistributorParameters());
        ParameterService.deregister(contextParameters.getLockManagerParameters());
        ParameterService.deregister(contextParameters.getPersistorParameters());
        ParameterService.deregister(contextParameters);

        ParameterService.deregister(schemaParameters);
    }

    /**
     * Test aadm case.
     *
     * @throws ApexException the apex exception
     * @throws InterruptedException the interrupted exception
     * @throws IOException Signals that an I/O exception has occurred.
     */
    @Test
    public void testAadmCase() throws ApexException, InterruptedException, IOException {
        final AxPolicyModel apexPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel();
        assertNotNull(apexPolicyModel);
        final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1");

        final ApexEngineImpl apexEngine = (ApexEngineImpl) new ApexEngineFactory().createApexEngine(key);
        final TestApexActionListener listener = new TestApexActionListener("Test");
        apexEngine.addEventListener("listener", listener);
        apexEngine.updateModel(apexPolicyModel, false);
        apexEngine.start();

        final AxEvent axEvent = getTriggerEvent(apexPolicyModel);
        assertNotNull(axEvent);

        // getting number of connections send it to policy, expecting probe action
        logger.info("Sending too many connections trigger ");
        EnEvent event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 101);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("DoS", false);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");
        apexEngine.handleEvent(event);
        EnEvent result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        // no DOS_IN_eNodeB set so return probe action
        assertEquals("probe", result.get("ACTTASK"));
        assertTrue((boolean) result.get("TCP_ON"));
        assertTrue((boolean) result.get("PROBE_ON"));
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));

        final ContextAlbum eNodeBStatusAlbum = apexEngine.getInternalContext().get("ENodeBStatusAlbum");
        final ENodeBStatus eNodeBStatus = (ENodeBStatus) eNodeBStatusAlbum.get("123");
        eNodeBStatus.setDosCount(101);
        eNodeBStatusAlbum.put(eNodeBStatus.getENodeB(), eNodeBStatus);

        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 101);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 99.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 101);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 101.0);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("DoS", false);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        // DOS_IN_eNodeB set to be more than throughput so return act action
        assertEquals("act", result.get("ACTTASK"));
        // only one imsi was sent to process, so stop probe and tcp
        assertTrue(!(boolean) result.get("TCP_ON"));
        assertTrue(!(boolean) result.get("PROBE_ON"));
        assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));

        ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99);

        // getting number of connections send it to policy, expecting probe action
        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 99);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("DoS", false);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("probe", result.get("ACTTASK"));
        assertTrue((boolean) result.get("TCP_ON"));
        assertTrue((boolean) result.get("PROBE_ON"));
        assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());

        ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99);

        // tcp correlation return positive dos
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 101.0);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0);
        event.put("DoS", false);
        event.put("NUM_SUBSCRIBERS", 0);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SERVICE_REQUEST_COUNT", 0);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("UE_IP_ADDRESS", "");
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("act", result.get("ACTTASK"));
        assertTrue(!(boolean) result.get("TCP_ON"));
        assertTrue(!(boolean) result.get("PROBE_ON"));
        assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));

        ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(101);

        // user moving enodeB
        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 101);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0);
        event.put("DoS", false);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("act", result.get("ACTTASK"));
        assertTrue(!(boolean) result.get("TCP_ON"));
        assertTrue(!(boolean) result.get("PROBE_ON"));
        assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));

        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("ENODEB_ID", Long.valueOf(124));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 101);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("DoS", false);
        event.put("IMSI_IP", "");
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("probe", result.get("ACTTASK"));
        assertTrue((boolean) result.get("TCP_ON"));
        assertTrue((boolean) result.get("PROBE_ON"));
        assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        assertEquals(1, ((ENodeBStatus) eNodeBStatusAlbum.get("124")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));
        // End of user moving enodeB

        ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(101);

        // user becomes non anomalous
        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("IMSI_IP", "101.111.121.131");
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 101.0);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("NUM_SUBSCRIBERS", 101);
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("DoS", false);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("probe", result.get("ACTTASK"));
        assertTrue((boolean) result.get("TCP_ON"));
        assertTrue((boolean) result.get("PROBE_ON"));
        assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));

        logger.info("Sending too many connections trigger ");
        event = apexEngine.createEvent(axEvent.getKey());
        event.put("IMSI", Long.valueOf(123456));
        event.put("ENODEB_ID", Long.valueOf(123));
        event.put("SERVICE_REQUEST_COUNT", 99);
        event.put("UE_IP_ADDRESS", "101.111.121.131");
        event.put("ACTTASK", "");
        event.put("APPLICATION", "");
        event.put("ATTACH_COUNT", 0);
        event.put("AVG_SUBSCRIBER_ATTACH", 0D);
        event.put("AVG_SUBSCRIBER_SERVICE_REQUEST", 0.0);
        event.put("DoS", false);
        event.put("IMSI_IP", "");
        event.put("NUM_SUBSCRIBERS", 0);
        event.put("NW_IP", "");
        event.put("PROBE_ON", false);
        event.put("SGW_IP_ADDRESS", "");
        event.put("TCP_ON", false);
        event.put("TCP_UE_SIDE_AVG_THROUGHPUT", 0D);
        event.put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", 0L);
        event.put("http_host_class", "");
        event.put("protocol_group", "");

        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals("probe", result.get("ACTTASK"));
        assertTrue((boolean) result.get("TCP_ON"));
        assertTrue((boolean) result.get("PROBE_ON"));
        assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
        logger.info("Receiving action event with {} action", result.get("ACTTASK"));
        // End of user becomes non anomalous
        apexEngine.handleEvent(result);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent"));
        assertEquals("ServiceA", result.get("PROFILE"));
        assertTrue((boolean) result.get("BLACKLIST_ON"));

        event = apexEngine.createEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"));
        event.put("PERIODIC_EVENT_COUNT", (long) 100);
        event.put("PERIODIC_DELAY", (long) 1000);
        event.put("PERIODIC_FIRST_TIME", System.currentTimeMillis());
        event.put("PERIODIC_CURRENT_TIME", System.currentTimeMillis());
        event.put("PERIODIC_LAST_TIME", System.currentTimeMillis());
        apexEngine.handleEvent(event);
        result = listener.getResult();
        assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent"));
        assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
        assertEquals(0L, result.get("IMSI"));
        assertEquals("ServiceA", result.get("PROFILE"));
        assertFalse((boolean) result.get("BLACKLIST_ON"));

        apexEngine.stop();
    }

    /**
     * Test vpn cleardown.
     */
    @After
    public void testAadmCleardown() {
        // Not used
    }

    /**
     * Gets the trigger event.
     *
     * @param apexPolicyModel the apex policy model
     * @return the trigger event
     */
    private AxEvent getTriggerEvent(final AxPolicyModel apexPolicyModel) {
        for (final AxEvent axEvent : apexPolicyModel.getEvents().getEventMap().values()) {
            if (axEvent.getKey().getId().equals("AADMEvent:0.0.1")) {
                return axEvent;
            }
        }
        return null;
    }
}