2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 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===========================================
21 package org.openecomp.dcae.apod.analytics.model.facade.tca;
23 import org.junit.Test;
24 import org.openecomp.dcae.apod.analytics.model.BaseAnalyticsModelUnitTest;
26 import static org.hamcrest.CoreMatchers.is;
27 import static org.junit.Assert.assertThat;
30 * @author Rajiv Singla . Creation Date: 12/16/2016.
32 public class TCAVESResponseTest extends BaseAnalyticsModelUnitTest {
34 private static final String TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION = "data/json/facade/tca_ves_cef_response.json";
37 public void testTCAPolicyJsonConversions() throws Exception {
39 final TCAVESResponse vesCEFMessageResponse =
40 assertJsonConversions(TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION, TCAVESResponse.class);
42 assertThat("VES CEF Message Response AAI generics VNF Id must match",
43 vesCEFMessageResponse.getAai().getGenericVNFId(), is("vpp-test(?)"));
45 assertThat("VES CEF Message target type must be parsed correctly as VNF",
46 vesCEFMessageResponse.getTargetType(), is("VNF"));
48 assertThat("VES closed Loop Name must be CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8",
49 vesCEFMessageResponse.getClosedLoopControlName(),
50 is("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8"));
52 assertThat("version must be 1.0.2", vesCEFMessageResponse.getVersion(), is("1.0.2"));
54 assertThat("closedLoopAlarmStart must be 1478189220547",
55 vesCEFMessageResponse.getClosedLoopAlarmStart(), is(1478189220547L));
56 assertThat("closedLoopEventClient must be tca.instance00001",
57 vesCEFMessageResponse.getClosedLoopEventClient(), is("tca.instance00001"));
58 assertThat("target_type must be VNF", vesCEFMessageResponse.getTargetType(), is("VNF"));
59 assertThat("target must be VNF", vesCEFMessageResponse.getTarget(), is("generic-vnf.vnf-id"));
60 assertThat("aai generic vnf id must be vpp-test(?)", vesCEFMessageResponse.getAai().getGenericVNFId(),
62 assertThat("from must be DCAE", vesCEFMessageResponse.getFrom(), is("DCAE"));
63 assertThat("policyScope must be resource=vFirewall;type=configuration",
64 vesCEFMessageResponse.getPolicyScope(), is("resource=vFirewall;type=configuration"));
66 assertThat("policyName must be configuration.dcae.microservice.tca.xml",
67 vesCEFMessageResponse.getPolicyName(), is("configuration.dcae.microservice.tca.xml"));
69 assertThat("policyVersion must be v0.0.1",
70 vesCEFMessageResponse.getPolicyVersion(), is("v0.0.1"));
72 assertThat("closedLoopEventStatus is ONSET",
73 vesCEFMessageResponse.getClosedLoopEventStatus(), is("ONSET"));