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 final String tcaVESCEFResponseJsonFileLocation = "data/json/facade/tca_ves_cef_response.json";
38 public void testTCAPolicyJsonConversions() throws Exception {
40 final TCAVESResponse vesCEFMessageResponse =
41 assertJsonConversions(tcaVESCEFResponseJsonFileLocation, TCAVESResponse.class);
43 assertThat("VES CEF Message Response AAI generics VNF Id must match",
44 vesCEFMessageResponse.getAai().getGenericVNFId(), is("vpp-test(?)"));
46 assertThat("VES CEF Message target type must be parsed correctly as VNF",
47 vesCEFMessageResponse.getTargetType(), is("VNF"));
49 assertThat("VES closed Loop Name must be CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8",
50 vesCEFMessageResponse.getClosedLoopControlName(),
51 is("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8"));
53 assertThat("version must be 1.0.2", vesCEFMessageResponse.getVersion(), is("1.0.2"));
55 assertThat("closedLoopAlarmStart must be 1478189220547",
56 vesCEFMessageResponse.getClosedLoopAlarmStart(), is(1478189220547L));
57 assertThat("closedLoopEventClient must be tca.instance00001",
58 vesCEFMessageResponse.getClosedLoopEventClient(), is("tca.instance00001"));
59 assertThat("target_type must be VNF", vesCEFMessageResponse.getTargetType(), is("VNF"));
60 assertThat("target must be VNF", vesCEFMessageResponse.getTarget(), is("generic-vnf.vnf-id"));
61 assertThat("aai generic vnf id must be vpp-test(?)", vesCEFMessageResponse.getAai().getGenericVNFId(),
63 assertThat("from must be DCAE", vesCEFMessageResponse.getFrom(), is("DCAE"));
64 assertThat("policyScope must be resource=vFirewall;type=configuration",
65 vesCEFMessageResponse.getPolicyScope(), is("resource=vFirewall;type=configuration"));
67 assertThat("policyName must be configuration.dcae.microservice.tca.xml",
68 vesCEFMessageResponse.getPolicyName(), is("configuration.dcae.microservice.tca.xml"));
70 assertThat("policyVersion must be v0.0.1",
71 vesCEFMessageResponse.getPolicyVersion(), is("v0.0.1"));
73 assertThat("closedLoopEventStatus is ONSET",
74 vesCEFMessageResponse.getClosedLoopEventStatus(), is("ONSET"));