aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegateTest.java117
-rw-r--r--src/test/java/org/onap/clamp/clds/client/HolmesPolicyDelegateTest.java183
-rw-r--r--src/test/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegateTest.java104
-rw-r--r--src/test/java/org/onap/clamp/clds/client/ModelDeleteDelegateTest.java63
-rw-r--r--src/test/java/org/onap/clamp/clds/client/OperationalPolicyDelegateTest.java125
-rw-r--r--src/test/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegateTest.java108
-rw-r--r--src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java13
-rw-r--r--src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java7
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java14
-rw-r--r--src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java24
-rw-r--r--src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java8
-rw-r--r--src/test/java/org/onap/clamp/flow/FlowLogOperationTestItCase.java41
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java30
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java244
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java11
-rw-r--r--src/test/resources/application.properties433
-rw-r--r--src/test/resources/clds/blueprint-with-microservice-chain.yaml6
-rw-r--r--src/test/resources/clds/clds-parse-exception.json1
-rw-r--r--src/test/resources/clds/single-microservice-fragment-valid.yaml2
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json25
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json48
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/tca.yaml2
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml160
-rw-r--r--src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml240
-rw-r--r--src/test/resources/example/sdc/expected-result/policy-data.yaml1033
-rwxr-xr-xsrc/test/resources/example/sdc/service-Vloadbalancerms-csar.csarbin110734 -> 0 bytes
-rw-r--r--src/test/resources/example/sdc/service_Vloadbalancerms_csar.csarbin0 -> 115690 bytes
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py12
-rw-r--r--src/test/resources/tosca/guard1-policy-payload.json14
-rw-r--r--src/test/resources/tosca/guard2-policy-payload.json14
-rw-r--r--src/test/resources/tosca/model-properties.json123
-rw-r--r--src/test/resources/tosca/operational-policy-no-guard-properties.json2
-rw-r--r--src/test/resources/tosca/operational-policy-payload-legacy.yaml39
-rw-r--r--src/test/resources/tosca/operational-policy-payload.json2
-rw-r--r--src/test/resources/tosca/operational-policy-payload.yaml25
-rw-r--r--src/test/resources/tosca/operational-policy-properties.json28
36 files changed, 2734 insertions, 567 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegateTest.java
new file mode 100644
index 00000000..2ff8166b
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/GuardPolicyDeleteDelegateTest.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.exception.ModelBpmnException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GuardPolicyDeleteDelegateTest {
+
+ private static final String MODEL_BPMN_KEY = "modelBpmnProp";
+ private static final String MODEL_PROP_KEY = "modelProp";
+ private static final String TEST_KEY = "isTest";
+ private static final String EVENT_ACTION_KEY = "eventAction";
+
+ private static final String POLICY_ID_FROM_JSON = "{policy:[{id:Policy_7,from:''}]}";
+ private static final String TCA_ID_FROM_JSON = "{tca:[{id:'',from:''}]}";
+ private static final String ID_JSON = "{Policy_7:{r:["
+ + "{name:pid,value:pid334},"
+ + "{name:timeout,value:50},"
+ + "{name:policyType,value:pt},"
+ + "{policyConfigurations:[["
+ + "{name:_id,value:ret345},"
+ + "{name:recipe,value:make},"
+ + "{name:maxRetries,value:5},"
+ + "{name:retryTimeLimit,value:100},"
+ + "{name:enableGuardPolicy,value:on}]]}]}}";
+ private static final String NOT_JSON = "not json";
+ private static final String EVENT_ACTION_VALUE = "action";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private PolicyClient policyClient;
+
+ @InjectMocks
+ private GuardPolicyDeleteDelegate guardPolicyDeleteDelegate;
+
+ @Test
+ public void shouldExecuteSuccessfully() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(POLICY_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(EVENT_ACTION_KEY))).thenReturn(EVENT_ACTION_VALUE);
+
+ // when
+ guardPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient).deleteGuard(any());
+ }
+
+ @Test
+ public void shouldExecutePolicyNotFound() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(TCA_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(EVENT_ACTION_KEY))).thenReturn(EVENT_ACTION_VALUE);
+
+ // when
+ guardPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient, never()).deleteGuard(any());
+ }
+
+ @Test(expected = ModelBpmnException.class)
+ public void shouldThrowModelBpmnException() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(NOT_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ guardPolicyDeleteDelegate.execute(exchange);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void shouldThrowNullPointerException() {
+ // when
+ guardPolicyDeleteDelegate.execute(exchange);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDelegateTest.java
new file mode 100644
index 00000000..1d3f1ce6
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDelegateTest.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import java.io.IOException;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.exception.ModelBpmnException;
+import org.onap.clamp.clds.model.CldsModel;
+import org.onap.clamp.clds.model.properties.Holmes;
+import org.onap.clamp.clds.model.properties.ModelProperties;
+import org.onap.clamp.clds.util.JsonUtils;
+
+@RunWith(MockitoJUnitRunner.class)
+public class HolmesPolicyDelegateTest {
+
+ private static final String ID_JSON = "{\"id\":{\"r\":[{},{\"serviceConfigurations\":"
+ + "[[\"x\",\"+\",\"2\",\"y\"]]}]}}";
+ private static final String METRICS_JSON = "{\"metricsPerEventName\":[{\"thresholds\":[]}]}";
+ private static final String CONTENT_JSON = "{\"content\":{}}";
+ private static final String NULL_JSON = "{}";
+ private static final String HOLMES_ID_FROM_JSON = "{\"holmes\":[{\"id\":\"id\",\"from\":\"\"}]}";
+ private static final String TCA_ID_FROM_JSON = "{\"tca\":[{\"id\":\"\",\"from\":\"\"}]}";
+ private static final String CORRELATION_LOGIC_JSON = "{\"name\":\"correlationalLogic\"}";
+ private static final String NOT_JSON = "not json";
+ private static final String MODEL_BPMN_KEY = "modelBpmnProp";
+ private static final String MODEL_PROP_KEY = "modelProp";
+ private static final String MODEL_NAME_KEY = "modelName";
+ private static final String TEST_KEY = "isTest";
+ private static final String USERID_KEY = "userid";
+ private static final String TCA_TEMPLATE_KEY = "tca.template";
+ private static final String TCA_POLICY_TEMPLATE_KEY = "tca.policy.template";
+ private static final String TCA_THRESHOLDS_TEMPLATE_KEY = "tca.thresholds.template";
+ private static final String HOLMES_POLICY_RESPONSE_MESSAGE_KEY = "holmesPolicyResponseMessage";
+ private static final String RESPONSE_MESSAGE_VALUE = "responseMessage";
+ private static final String MODEL_NAME_VALUE = "model.name";
+ private static final String CONTROL_NAME_VALUE = "control.name";
+ private static final String USERID_VALUE = "user";
+ private static final String CLDS_MODEL_ID = "id";
+ private static final String CLDS_MODEL_PROP_TEXT = "propText";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private PolicyClient policyClient;
+
+ @Mock
+ private ClampProperties clampProperties;
+
+ @Mock
+ private CldsDao cldsDao;
+
+ @InjectMocks
+ private HolmesPolicyDelegate holmesPolicyDelegateTest;
+
+ @Test
+ public void shouldExecuteSuccessfully() throws IOException {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(HOLMES_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(MODEL_NAME_KEY))).thenReturn(MODEL_NAME_VALUE);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(USERID_KEY))).thenReturn(USERID_VALUE);
+
+ JsonElement jsonTemplateA = mock(JsonElement.class);
+ when(clampProperties.getJsonTemplate(eq(TCA_TEMPLATE_KEY), anyString())).thenReturn(jsonTemplateA);
+ when(jsonTemplateA.getAsJsonObject()).thenReturn(getJsonObject(METRICS_JSON));
+
+ JsonElement jsonTemplateB = mock(JsonElement.class);
+ when(clampProperties.getJsonTemplate(eq(TCA_POLICY_TEMPLATE_KEY), anyString())).thenReturn(jsonTemplateB);
+ when(jsonTemplateB.getAsJsonObject()).thenReturn(getJsonObject(CONTENT_JSON));
+
+ JsonElement jsonTemplateC = mock(JsonElement.class);
+ when(clampProperties.getJsonTemplate(eq(TCA_THRESHOLDS_TEMPLATE_KEY), anyString())).thenReturn(jsonTemplateC);
+ when(jsonTemplateC.getAsJsonObject()).thenReturn(getJsonObject(NULL_JSON));
+
+ when(policyClient.sendBasePolicyInOther(anyString(), anyString(), any(), anyString()))
+ .thenReturn(RESPONSE_MESSAGE_VALUE);
+
+ CldsModel cldsModel = new CldsModel();
+ cldsModel.setId(CLDS_MODEL_ID);
+ cldsModel.setPropText(CLDS_MODEL_PROP_TEXT);
+ when(cldsDao.getModelTemplate(eq(MODEL_NAME_VALUE))).thenReturn(cldsModel);
+
+ // when
+ holmesPolicyDelegateTest.execute(exchange);
+
+ // then
+ verify(exchange).setProperty(eq(HOLMES_POLICY_RESPONSE_MESSAGE_KEY), eq(RESPONSE_MESSAGE_VALUE.getBytes()));
+ verify(cldsDao).setModel(eq(cldsModel), eq(USERID_VALUE));
+ }
+
+ @Test
+ public void shouldExecuteHolmesNotFound() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(TCA_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ holmesPolicyDelegateTest.execute(exchange);
+
+ // then
+ verify(policyClient, never()).sendBasePolicyInOther(anyString(), anyString(), any(), anyString());
+ verify(exchange, never()).setProperty(eq(HOLMES_POLICY_RESPONSE_MESSAGE_KEY), any());
+ verify(cldsDao, never()).setModel(any(), anyString());
+ }
+
+ @Test(expected = ModelBpmnException.class)
+ public void shouldThrowModelBpmnException() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(NOT_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ holmesPolicyDelegateTest.execute(exchange);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void shouldThrowNullPointerException() {
+ // when
+ holmesPolicyDelegateTest.execute(exchange);
+ }
+
+ @Test
+ public void shouldDoFormatHolmesConfigBodySuccessfully() {
+ // given
+ ModelProperties prop = new ModelProperties(null, CONTROL_NAME_VALUE, null, false,
+ HOLMES_ID_FROM_JSON, "{\"id\":" + CORRELATION_LOGIC_JSON + "}");
+ Holmes holmes = prop.getType(Holmes.class);
+
+ // when
+ String result = HolmesPolicyDelegate.formatHolmesConfigBody(prop, holmes);
+
+ // then
+ assertEquals(CONTROL_NAME_VALUE + "$$$" + CORRELATION_LOGIC_JSON, result);
+ }
+
+ private static JsonObject getJsonObject(String jsonText) {
+ return JsonUtils.GSON.fromJson(jsonText, JsonObject.class);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegateTest.java
new file mode 100644
index 00000000..ccebbfbe
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegateTest.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.exception.ModelBpmnException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class HolmesPolicyDeleteDelegateTest {
+
+ private static final String MODEL_BPMN_KEY = "modelBpmnProp";
+ private static final String MODEL_PROP_KEY = "modelProp";
+ private static final String TEST_KEY = "isTest";
+
+ private static final String HOLMES_ID_FROM_JSON = "{\"holmes\":[{\"id\":\"\",\"from\":\"\"}]}";
+ private static final String TCA_ID_FROM_JSON = "{\"tca\":[{\"id\":\"\",\"from\":\"\"}]}";
+ private static final String ID_JSON = "{\"id\":\"\"}";
+ private static final String NOT_JSON = "not json";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private PolicyClient policyClient;
+
+ @InjectMocks
+ private HolmesPolicyDeleteDelegate holmesPolicyDeleteDelegate;
+
+ @Test
+ public void shouldExecuteSuccessfully() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(HOLMES_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ holmesPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient).deleteBasePolicy(any());
+ }
+
+ @Test
+ public void shouldExecuteHolmesNotFound() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(TCA_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ holmesPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient, never()).deleteBasePolicy(any());
+ }
+
+ @Test(expected = ModelBpmnException.class)
+ public void shouldThrowModelBpmnException() {
+ // given
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(NOT_JSON);
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+
+ // when
+ holmesPolicyDeleteDelegate.execute(exchange);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void shouldThrowNullPointerException() {
+ // when
+ holmesPolicyDeleteDelegate.execute(exchange);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/client/ModelDeleteDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/ModelDeleteDelegateTest.java
new file mode 100644
index 00000000..06b94225
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/ModelDeleteDelegateTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.dao.CldsDao;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ModelDeleteDelegateTest {
+
+ private static final String NAME_KEY = "modelName";
+ private static final String NAME_VALUE = "model.name";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private CldsDao cldsDao;
+
+ @InjectMocks
+ private ModelDeleteDelegate modelDeleteDelegate;
+
+ @Test
+ public void shouldExecuteSuccessfully() {
+ // given
+ when(exchange.getProperty(eq(NAME_KEY))).thenReturn(NAME_VALUE);
+
+ // when
+ modelDeleteDelegate.execute(exchange);
+
+ // then
+ verify(cldsDao).deleteModel(eq(NAME_VALUE));
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDelegateTest.java
new file mode 100644
index 00000000..75be799b
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDelegateTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.config.ClampProperties;
+import org.onap.clamp.clds.exception.ModelBpmnException;
+import org.onap.policy.controlloop.policy.builder.BuilderException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OperationalPolicyDelegateTest {
+
+ private static final String TEST_KEY = "isTest";
+ private static final String MODEL_BPMN_KEY = "modelBpmnProp";
+ private static final String MODEL_PROP_KEY = "modelProp";
+ private static final String RECIPE_TOPIC_KEY = "op.recipeTopic";
+ private static final String MESSAGE_KEY = "operationalPolicyResponseMessage";
+ private static final String SERVICE_NAME = "service.name";
+ private static final String POLICY_ID_FROM_JSON = "{policy:[{id:Oper12,from:''}]}";
+ private static final String ID_WITH_CHAIN_JSON = "{Oper12:{ab:["
+ + "{name:timeout,value:500},"
+ + "{policyConfigurations:["
+ + "[{name:maxRetries,value:5},"
+ + "{name:retryTimeLimit,value:1000},"
+ + "{name:recipe,value:go},"
+ + "{name:targetResourceId,"
+ + "value:resid234}]]}]},"
+ + "global:[{name:service,value:" + SERVICE_NAME + "}]}";
+ private static final String SIMPLE_JSON = "{}";
+ private static final String NOT_JSON = "not json";
+ private static final String MESSAGE_VALUE = "message";
+ private static final String RECIPE_TOPIC_VALUE = "recipe.topic";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private PolicyClient policyClient;
+
+ @Mock
+ private ClampProperties refProp;
+
+ @InjectMocks
+ private OperationalPolicyDelegate operationalPolicyDelegate;
+
+ @Test
+ public void shouldExecuteSuccessfully() throws BuilderException, UnsupportedEncodingException {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(true);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(POLICY_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_WITH_CHAIN_JSON);
+ when(policyClient.sendBrmsPolicy(any(), any(), any())).thenReturn(MESSAGE_VALUE);
+ when(refProp.getStringValue(eq(RECIPE_TOPIC_KEY), eq(SERVICE_NAME))).thenReturn(RECIPE_TOPIC_VALUE);
+
+ // when
+ operationalPolicyDelegate.execute(exchange);
+
+ // then
+ verify(exchange).setProperty(eq(MESSAGE_KEY), eq(MESSAGE_VALUE.getBytes()));
+ }
+
+ @Test
+ public void shouldExecutePolicyNotFound() throws BuilderException, UnsupportedEncodingException {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(SIMPLE_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(SIMPLE_JSON);
+
+ // when
+ operationalPolicyDelegate.execute(exchange);
+
+ // then
+ verify(policyClient, never()).sendBrmsPolicy(any(), any(), any());
+ }
+
+ @Test(expected = ModelBpmnException.class)
+ public void shouldThrowModelBpmnException() throws BuilderException, UnsupportedEncodingException {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(true);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(NOT_JSON);
+
+ // when
+ operationalPolicyDelegate.execute(exchange);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void shouldThrowNullPointerException() throws BuilderException, UnsupportedEncodingException {
+ // when
+ operationalPolicyDelegate.execute(exchange);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegateTest.java b/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegateTest.java
new file mode 100644
index 00000000..9d87e7e9
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegateTest.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.client;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.camel.Exchange;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.clamp.clds.client.req.policy.PolicyClient;
+import org.onap.clamp.clds.exception.ModelBpmnException;
+import org.onap.clamp.clds.model.properties.ModelProperties;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OperationalPolicyDeleteDelegateTest {
+
+ private static final String TEST_KEY = "isTest";
+ private static final String MODEL_BPMN_KEY = "modelBpmnProp";
+ private static final String MODEL_PROP_KEY = "modelProp";
+ private static final String EVENT_ACTION_KEY = "eventAction";
+ private static final String POLICY_ID_FROM_JSON = "{policy:[{id:Poli2,from:''}]}";
+ private static final String ID_WITH_CHAIN_JSON = "{Poli2:{ab:c,xy:z}}";
+ private static final String ID_NO_CHAIN_JSON = "{Poli2:{}}";
+ private static final String EVENT_ACTION_VALUE = "still";
+ private static final String NOT_JSON = "23e";
+
+ @Mock
+ private Exchange exchange;
+
+ @Mock
+ private PolicyClient policyClient;
+
+ @InjectMocks
+ private OperationalPolicyDeleteDelegate operationalPolicyDeleteDelegate;
+
+ @Test
+ public void shouldExecuteSuccessfully() {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(POLICY_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_WITH_CHAIN_JSON);
+ when(exchange.getProperty(eq(EVENT_ACTION_KEY))).thenReturn(EVENT_ACTION_VALUE);
+
+ // when
+ operationalPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient, times(2)).deleteBrms(any(ModelProperties.class));
+ }
+
+ @Test
+ public void shouldExecuteTcaNotFound() {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(true);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(POLICY_ID_FROM_JSON);
+ when(exchange.getProperty(eq(MODEL_PROP_KEY))).thenReturn(ID_NO_CHAIN_JSON);
+
+ // when
+ operationalPolicyDeleteDelegate.execute(exchange);
+
+ // then
+ verify(policyClient, never()).deleteBrms(any(ModelProperties.class));
+ }
+
+ @Test(expected = ModelBpmnException.class)
+ public void shouldThrowModelBpmnException() {
+ // given
+ when(exchange.getProperty(eq(TEST_KEY))).thenReturn(false);
+ when(exchange.getProperty(eq(MODEL_BPMN_KEY))).thenReturn(NOT_JSON);
+
+ // when
+ operationalPolicyDeleteDelegate.execute(exchange);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void shouldThrowNullPointerException() {
+ // when
+ operationalPolicyDeleteDelegate.execute(exchange);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
index a32a6035..549c9132 100644
--- a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
+++ b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -25,10 +27,11 @@
package org.onap.clamp.clds.config;
import static org.assertj.core.api.Assertions.assertThat;
-
import org.junit.Test;
+import org.onap.clamp.clds.exception.CldsUsersException;
import org.onap.clamp.clds.service.CldsUser;
+
public class CldsUserJsonDecoderTest {
private String user1 = "admin1";
@@ -92,4 +95,12 @@ public class CldsUserJsonDecoderTest {
assertThat(user.getPassword()).isEqualTo(password);
assertThat(user.getPermissionsString()).isEqualTo(incompletePermissionsArray);
}
+
+ @Test(expected = CldsUsersException.class)
+ public void shouldThrowCldsUsersException() {
+ //when
+ CldsUserJsonDecoder
+ .decodeJson(this.getClass().getResourceAsStream("/clds/clds-parse-exception.json"));
+ }
+
}
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
index 36d4eb82..e1b963cc 100644
--- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java
@@ -179,10 +179,9 @@ public class CsarInstallerItCase {
ResourceFileUtil.getResourceAsStream("example/sdc/blueprint-dcae/prop-text-for-tca-2.json"),
StandardCharsets.UTF_8), cldsModel2.getPropText(), true);
CldsModel cldsModel3 = verifyClosedLoopModelLoadedInDb(csar, "tca_3.yaml");
- JSONAssert.assertEquals(
- IOUtils.toString(ResourceFileUtil.getResourceAsStream("example/sdc/blueprint-dcae/prop-text-for-tca.json"),
- StandardCharsets.UTF_8),
- cldsModel3.getPropText(), true);
+ JSONAssert.assertEquals(IOUtils.toString(
+ ResourceFileUtil.getResourceAsStream("example/sdc/blueprint-dcae/prop-text-for-tca-3.json"),
+ StandardCharsets.UTF_8), cldsModel3.getPropText(), true);
}
private CldsModel verifyClosedLoopModelLoadedInDb(CsarHandler csar, String artifactName)
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
index 211bb390..dec63977 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
@@ -142,18 +142,18 @@ public class BlueprintParserTest {
public void getNodeRepresentationFromCompleteYaml() {
final JsonObject jsonObject = jsonObjectBlueprintValid;
- MicroService expected = new MicroService(SECOND_APPP, MODEL_TYPE1, FIRST_APPP, "", SECOND_APPP);
+ MicroService expected = new MicroService(SECOND_APPP, MODEL_TYPE1, FIRST_APPP, "");
Entry<String, JsonElement> entry = jsonObject.entrySet().iterator().next();
- MicroService actual = new BlueprintParser().getNodeRepresentation(entry);
+ MicroService actual = new BlueprintParser().getNodeRepresentation(entry, jsonObject, null);
Assert.assertEquals(expected, actual);
}
@Test
public void getMicroServicesFromBlueprintTest() {
- MicroService thirdApp = new MicroService(THIRD_APPP, MODEL_TYPE3, "", "", THIRD_APPP);
- MicroService firstApp = new MicroService(FIRST_APPP, MODEL_TYPE1, THIRD_APPP, "", FIRST_APPP);
- MicroService secondApp = new MicroService(SECOND_APPP, MODEL_TYPE2, FIRST_APPP, "", SECOND_APPP);
+ MicroService thirdApp = new MicroService(THIRD_APPP, MODEL_TYPE3, "", "");
+ MicroService firstApp = new MicroService(FIRST_APPP, MODEL_TYPE1, THIRD_APPP, "");
+ MicroService secondApp = new MicroService(SECOND_APPP, MODEL_TYPE2, FIRST_APPP, "");
Set<MicroService> expected = new HashSet<>(Arrays.asList(firstApp, secondApp, thirdApp));
Set<MicroService> actual = new BlueprintParser().getMicroServices(microServiceTheWholeBlueprintValid);
@@ -164,7 +164,7 @@ public class BlueprintParserTest {
@Test
public void fallBackToOneMicroServiceTCATest() {
MicroService tcaMS = new MicroService(BlueprintParser.TCA, "onap.policies.monitoring.cdap.tca.hi.lo.app", "",
- "", "");
+ "");
List<MicroService> expected = Collections.singletonList(tcaMS);
List<MicroService> actual = new BlueprintParser().fallbackToOneMicroService(microServiceBlueprintOldStyleTCA);
@@ -175,7 +175,7 @@ public class BlueprintParserTest {
@Test
public void fallBackToOneMicroServiceHolmesTest() {
MicroService holmesMS = new MicroService(BlueprintParser.HOLMES, "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "", "", "");
+ "", "");
List<MicroService> expected = Collections.singletonList(holmesMS);
List<MicroService> actual = new BlueprintParser()
diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
index 1eb66ead..4b41ee81 100644
--- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
+++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/ChainGeneratorTest.java
@@ -38,10 +38,10 @@ public class ChainGeneratorTest {
@Test
public void getChainOfMicroServicesTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "", "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "", "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", THIRD_APPP, "", "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", THIRD_APPP, "");
List<MicroService> expectedList = Arrays.asList(ms1, ms2, ms3, ms4);
Set<MicroService> inputSet = new HashSet<>(expectedList);
@@ -52,10 +52,10 @@ public class ChainGeneratorTest {
@Test
public void getChainOfMicroServicesTwiceNoInputTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", "", "", "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "", "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "", "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", "", "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", SECOND_APPP, "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "");
Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
@@ -64,10 +64,10 @@ public class ChainGeneratorTest {
@Test
public void getChainOfMicroServicesBranchingTest() {
- MicroService ms1 = new MicroService(FIRST_APPP, "", "", "", "");
- MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "", "");
- MicroService ms3 = new MicroService(THIRD_APPP, "", FIRST_APPP, "", "");
- MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "", "");
+ MicroService ms1 = new MicroService(FIRST_APPP, "", "", "");
+ MicroService ms2 = new MicroService(SECOND_APPP, "", FIRST_APPP, "");
+ MicroService ms3 = new MicroService(THIRD_APPP, "", FIRST_APPP, "");
+ MicroService ms4 = new MicroService(FOURTH_APPP, "", FIRST_APPP, "");
Set<MicroService> inputSet = new HashSet<>(Arrays.asList(ms1, ms2, ms3, ms4));
List<MicroService> actualList = new ChainGenerator().getChainOfMicroServices(inputSet);
diff --git a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
index 5eb664fe..ff6e1b5d 100644
--- a/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
+++ b/src/test/java/org/onap/clamp/clds/util/drawing/ClampGraphBuilderTest.java
@@ -56,8 +56,8 @@ public class ClampGraphBuilderTest {
@Test
public void clampGraphBuilderCompleteChainTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id", "");
- MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id", "");
+ MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id");
+ MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id");
String policy = "OperationalPolicy";
List<MicroService> microServices = Arrays.asList(ms1, ms2);
@@ -76,8 +76,8 @@ public class ClampGraphBuilderTest {
@Test(expected = InvalidStateException.class)
public void clampGraphBuilderNoPolicyGivenTest() {
String collector = "VES";
- MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id", "");
- MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id", "");
+ MicroService ms1 = new MicroService("ms1", "", "", "ms1_jpa_id");
+ MicroService ms2 = new MicroService("ms2", "", "", "ms2_jpa_id");
ClampGraphBuilder clampGraphBuilder = new ClampGraphBuilder(mockPainter);
clampGraphBuilder.collector(collector).addMicroService(ms1).addMicroService(ms2).build();
diff --git a/src/test/java/org/onap/clamp/flow/FlowLogOperationTestItCase.java b/src/test/java/org/onap/clamp/flow/FlowLogOperationTestItCase.java
new file mode 100644
index 00000000..1abeb104
--- /dev/null
+++ b/src/test/java/org/onap/clamp/flow/FlowLogOperationTestItCase.java
@@ -0,0 +1,41 @@
+package org.onap.clamp.flow;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.clamp.clds.util.LoggingUtils;
+import org.onap.clamp.clds.util.ONAPLogConstants;
+import org.onap.clamp.flow.log.FlowLogOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.util.ReflectionTestUtils;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+
+public class FlowLogOperationTestItCase {
+
+ @Autowired
+ CamelContext camelContext;
+
+ @Test
+ public void testStratLog() {
+ //given
+ FlowLogOperation flowLogOperation = new FlowLogOperation();
+ Exchange exchange = new DefaultExchange(camelContext);
+ LoggingUtils loggingUtils = mock(LoggingUtils.class);
+ ReflectionTestUtils.setField(flowLogOperation, "util", loggingUtils);
+
+ //when
+ Mockito.when(loggingUtils.getProperties(ONAPLogConstants.MDCs.REQUEST_ID)).thenReturn("MockRequestId");
+ Mockito.when(loggingUtils.getProperties(ONAPLogConstants.MDCs.INVOCATION_ID)).thenReturn("MockInvocationId");
+ Mockito.when(loggingUtils.getProperties(ONAPLogConstants.MDCs.PARTNER_NAME)).thenReturn("MockPartnerName");
+ flowLogOperation.startLog(exchange, "serviceName");
+
+ //then
+ assertThat(exchange.getProperty(ONAPLogConstants.Headers.REQUEST_ID)).isEqualTo("MockRequestId");
+ assertThat(exchange.getProperty(ONAPLogConstants.Headers.INVOCATION_ID)).isEqualTo("MockInvocationId");
+ assertThat(exchange.getProperty(ONAPLogConstants.Headers.PARTNER_NAME)).isEqualTo("MockPartnerName");
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index 26e8de20..ed912831 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -51,7 +51,9 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerExceptio
import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
+import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
@@ -59,6 +61,7 @@ import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -70,7 +73,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller-new")
public class CsarInstallerItCase {
- private static final String CSAR_ARTIFACT_NAME = "example/sdc/service-Vloadbalancerms-csar.csar";
+ private static final String CSAR_ARTIFACT_NAME = "example/sdc/service_Vloadbalancerms_csar.csar";
private static final String INVARIANT_SERVICE_UUID = "4cc5b45a-1f63-4194-8100-cd8e14248c92";
private static final String INVARIANT_RESOURCE1_UUID = "07e266fc-49ab-4cd7-8378-ca4676f1b9ec";
private static final String INVARIANT_RESOURCE2_UUID = "023a3f0d-1161-45ff-b4cf-8918a8ccf3ad";
@@ -138,8 +141,7 @@ public class CsarInstallerItCase {
// set
SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
String path = Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME).getFile();
- ISdcCsarHelper sdcHelper = factory
- .getSdcCsarHelper(path);
+ ISdcCsarHelper sdcHelper = factory.getSdcCsarHelper(path);
Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(sdcHelper);
// Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper);
@@ -159,11 +161,11 @@ public class CsarInstallerItCase {
Mockito.when(notificationData.getServiceArtifacts()).thenReturn(serviceArtifactsList);
CsarHandler csarHandler = new CsarHandler(notificationData, "", "");
- csarHandler.setFilePath(Thread.currentThread().getContextClassLoader()
- .getResource(CSAR_ARTIFACT_NAME).getFile());
+ csarHandler
+ .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME).getFile());
Optional<String> testyaml = csarHandler.getPolicyModelYaml();
- Assert.assertEquals(testyaml, Optional.ofNullable(ResourceFileUtil
- .getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
+ Assert.assertEquals(testyaml,
+ Optional.ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
}
@Test
@@ -179,6 +181,7 @@ public class CsarInstallerItCase {
@Test
@Transactional
+ @Rollback(value = false)
public void testInstallTheCsarTca() throws SdcArtifactInstallerException, SdcToscaParserException,
CsarHandlerException, IOException, JSONException, InterruptedException, PolicyModelException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
@@ -203,6 +206,19 @@ public class CsarInstallerItCase {
assertThat(loop.getOperationalPolicies()).hasSize(1);
assertThat(loop.getModelPropertiesJson().get("serviceDetails")).isNotNull();
assertThat(loop.getModelPropertiesJson().get("resourceDetails")).isNotNull();
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"),
+ JsonUtils.GSON.toJson(loop.getModelPropertiesJson()), true);
+ assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty();
+
+ loop = loopsRepo
+ .findById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca_3.yaml"))
+ .get();
+ assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty();
+
+ loop = loopsRepo
+ .findById(Loop.generateLoopName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE2, "tca_2.yaml"))
+ .get();
+ assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty();
}
@Test(expected = SdcArtifactInstallerException.class)
diff --git a/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java
new file mode 100644
index 00000000..a2c97e0c
--- /dev/null
+++ b/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Nokia 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.loop;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+
+import java.io.IOException;
+import java.util.HashSet;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.json.simple.parser.ParseException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.clamp.clds.Application;
+import org.onap.clamp.loop.LoopOperation.TempLoopState;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+import org.onap.clamp.policy.operational.OperationalPolicy;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = Application.class)
+public class LoopOperationTestItCase {
+
+ private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
+ @Autowired
+ LoopService loopService;
+
+ private Loop createTestLoop() {
+ String yaml = "imports:\n" + " - \"http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\"\n"
+ + "node_templates:\n" + " docker_service_host:\n" + " type: dcae.nodes.SelectedDockerHost";
+
+ Loop loopTest = new Loop("ControlLoopTest", yaml, "<xml></xml>");
+ loopTest.setGlobalPropertiesJson(
+ new Gson().fromJson("{\"dcaeDeployParameters\":" + "{\"policy_id\": \"name\"}}", JsonObject.class));
+ loopTest.setLastComputedState(LoopState.DESIGN);
+ loopTest.setDcaeDeploymentId("123456789");
+ loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
+ loopTest.setDcaeBlueprintId("UUID-blueprint");
+
+ MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", "",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", true,
+ gson.fromJson("{\"configtype\":\"json\"}", JsonObject.class), new HashSet<>());
+ microServicePolicy.setProperties(new Gson().fromJson("{\"param1\":\"value1\"}", JsonObject.class));
+
+ loopTest.addMicroServicePolicy(microServicePolicy);
+ return loopTest;
+ }
+
+ @Test
+ public void testAnalysePolicyResponse() {
+ LoopOperation loopOp = new LoopOperation(loopService);
+ String status1 = loopOp.analysePolicyResponse(200);
+ String status2 = loopOp.analysePolicyResponse(404);
+ String status3 = loopOp.analysePolicyResponse(500);
+ String status4 = loopOp.analysePolicyResponse(503);
+
+ // then
+ assertThat(status1).isEqualTo("SUBMITTED");
+ assertThat(status2).isEqualTo("NOT_SUBMITTED");
+ assertThat(status3).isEqualTo("IN_ERROR");
+ assertThat(status4).isEqualTo("IN_ERROR");
+ }
+
+ @Test
+ public void testGetOperationalPolicyName() {
+ LoopOperation loopOp = new LoopOperation(loopService);
+ Loop loop = this.createTestLoop();
+ String opName1 = loopOp.getOperationalPolicyName(loop);
+ assertThat(opName1).isNull();
+
+ OperationalPolicy opPolicy1 = new OperationalPolicy("OperationalPolicyTest1", null,
+ gson.fromJson("{\"type\":\"Operational\"}", JsonObject.class));
+ loop.addOperationalPolicy(opPolicy1);
+ String opName2 = loopOp.getOperationalPolicyName(loop);
+ assertThat(opName2).isEqualTo("OperationalPolicyTest1");
+ }
+
+ @Test
+ public void testAnalyseDcaeResponse() throws ParseException {
+ LoopOperation loopOp = new LoopOperation(loopService);
+ String dcaeStatus1 = loopOp.analyseDcaeResponse(null, null);
+ assertThat(dcaeStatus1).isEqualTo("NOT_DEPLOYED");
+
+ String dcaeStatus2 = loopOp.analyseDcaeResponse(null, 500);
+ assertThat(dcaeStatus2).isEqualTo("IN_ERROR");
+
+ String dcaeStatus3 = loopOp.analyseDcaeResponse(null, 404);
+ assertThat(dcaeStatus3).isEqualTo("NOT_DEPLOYED");
+
+ Exchange camelExchange = Mockito.mock(Exchange.class);
+ Message mockMessage = Mockito.mock(Message.class);
+ Mockito.when(camelExchange.getIn()).thenReturn(mockMessage);
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"install\",\"status\":\"succeeded\"}");
+ String dcaeStatus4 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus4).isEqualTo("DEPLOYED");
+
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"install\",\"status\":\"processing\"}");
+ String dcaeStatus5 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus5).isEqualTo("PROCESSING");
+
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"install\",\"status\":\"failed\"}");
+ String dcaeStatus6 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus6).isEqualTo("IN_ERROR");
+
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"succeeded\"}");
+ String dcaeStatus7 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus7).isEqualTo("NOT_DEPLOYED");
+
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"processing\"}");
+ String dcaeStatus8 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus8).isEqualTo("PROCESSING");
+
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"failed\"}");
+ String dcaeStatus9 = loopOp.analyseDcaeResponse(camelExchange, 200);
+ assertThat(dcaeStatus9).isEqualTo("IN_ERROR");
+ }
+
+ @Test
+ public void testUpdateLoopStatus() {
+ LoopOperation loopOp = new LoopOperation(loopService);
+ Loop loop = this.createTestLoop();
+ loopService.saveOrUpdateLoop(loop);
+ LoopState newState1 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.DEPLOYED);
+ LoopState dbState1 = loopService.getLoop(loop.getName()).getLastComputedState();
+ assertThat(newState1).isEqualTo(LoopState.DEPLOYED);
+ assertThat(dbState1).isEqualTo(LoopState.DEPLOYED);
+
+ LoopState newState2 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.NOT_DEPLOYED);
+ LoopState dbState2 = loopService.getLoop(loop.getName()).getLastComputedState();
+ assertThat(newState2).isEqualTo(LoopState.SUBMITTED);
+ assertThat(dbState2).isEqualTo(LoopState.SUBMITTED);
+
+ LoopState newState3 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.PROCESSING);
+ assertThat(newState3).isEqualTo(LoopState.WAITING);
+
+ LoopState newState4 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.IN_ERROR);
+ assertThat(newState4).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState5 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.DEPLOYED);
+ assertThat(newState5).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState6 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.PROCESSING);
+ assertThat(newState6).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState7 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.NOT_DEPLOYED);
+ assertThat(newState7).isEqualTo(LoopState.DESIGN);
+
+ LoopState newState8 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.DEPLOYED);
+ assertThat(newState8).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState9 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.NOT_DEPLOYED);
+ assertThat(newState9).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState10 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.PROCESSING);
+ assertThat(newState10).isEqualTo(LoopState.IN_ERROR);
+
+ LoopState newState11 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.IN_ERROR);
+ assertThat(newState11).isEqualTo(LoopState.IN_ERROR);
+ }
+
+ @Test
+ public void testUpdateLoopInfo() throws ParseException {
+ Loop loop = this.createTestLoop();
+ loopService.saveOrUpdateLoop(loop);
+
+ Exchange camelExchange = Mockito.mock(Exchange.class);
+ Message mockMessage = Mockito.mock(Message.class);
+ Mockito.when(camelExchange.getIn()).thenReturn(mockMessage);
+ Mockito.when(mockMessage.getBody(String.class))
+ .thenReturn("{\"links\":{\"status\":\"http://testhost/dcae-operationstatus\",\"test2\":\"test2\"}}");
+
+ LoopOperation loopOp = new LoopOperation(loopService);
+ loopOp.updateLoopInfo(camelExchange, loop, "testNewId");
+
+ Loop newLoop = loopService.getLoop(loop.getName());
+ String newDeployId = newLoop.getDcaeDeploymentId();
+ String newDeploymentStatusUrl = newLoop.getDcaeDeploymentStatusUrl();
+
+ assertThat(newDeployId).isEqualTo("testNewId");
+ assertThat(newDeploymentStatusUrl).isEqualTo("http4://testhost/dcae-operationstatus");
+ }
+
+ @Test
+ public void testGetDeploymentId() {
+ Loop loop = this.createTestLoop();
+ LoopOperation loopOp = new LoopOperation(loopService);
+ String deploymentId1 = loopOp.getDeploymentId(loop);
+ assertThat(deploymentId1).isEqualTo("123456789");
+
+ loop.setDcaeDeploymentId(null);
+ String deploymentId2 = loopOp.getDeploymentId(loop);
+ assertThat(deploymentId2).startsWith("CLAMP_");
+
+ loop.setDcaeDeploymentId("");
+ String deploymentId3 = loopOp.getDeploymentId(loop);
+ assertThat(deploymentId3).startsWith("CLAMP_");
+ assertThat(deploymentId3).isNotEqualTo(deploymentId2);
+ }
+
+ @Test
+ public void testGetDeployPayload() throws IOException {
+ Loop loop = this.createTestLoop();
+ LoopOperation loopOp = new LoopOperation(loopService);
+ String deploymentPayload = loopOp.getDeployPayload(loop);
+
+ String expectedPayload = "{\"serviceTypeId\":\"UUID-blueprint\",\"inputs\":{\"policy_id\":\"name\"}}";
+ assertThat(deploymentPayload).isEqualTo(expectedPayload);
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index b12ca89f..8972e511 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -33,6 +33,7 @@ import java.util.Map;
import org.junit.Test;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -43,13 +44,23 @@ public class OperationalPolicyPayloadTest {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig);
+
assertThat(policy.createPolicyPayloadYaml())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
+
assertThat(policy.createPolicyPayload())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.json"));
}
@Test
+ public void testLegacyOperationalPolicyPayloadConstruction() throws IOException {
+ JsonObject jsonConfig = new GsonBuilder().create().fromJson(
+ ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+ assertThat(LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(jsonConfig.get("operational_policy")))
+ .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
+ }
+
+ @Test
public void testGuardPolicyEmptyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-no-guard-properties.json"),
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index ecc40331..7b29e179 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -1,109 +1,109 @@
-###
-# ============LICENSE_START=======================================================
-# ONAP CLAMP
-# ================================================================================
-# Copyright (C) 2017-2018 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============================================
-# ===================================================================
-#
-###
-
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-
-### Set the port for HTTP or HTTPS protocol (Controlled by Spring framework, only one at a time).
-### (See below for the parameter 'server.http.port' if you want to have both enabled)
-### To have only HTTP, keep the lines server.ssl.* commented
-### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location
-server.port=${clamp.it.tests.http}
-### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
-#server.ssl.key-store=file:/tmp/mykey.jks
-#server.ssl.key-store-password=pass
-#server.ssl.key-password=pass
-
-### In order to be user friendly when HTTPS is enabled,
-### you can add another HTTP port that will be automatically redirected to HTTPS
-### by enabling this parameter (server.http.port) and set it to another port (80 or 8080, 8090, etc ...)
-#server.http-to-https-redirection.port=8090
-
-### HTTP Example:
-###--------------
-### server.port=8080
-
-### HTTPS Example:
-### --------------
-### server.port=8443
-### server.ssl.key-store=file:/tmp/mykey.jks
-### server.ssl.key-store-password=mypass
-### server.ssl.key-password=mypass
-
-### HTTP (Redirected to HTTPS) and HTTPS Example:
-### --------------------------------------------
-### server.port=8443 <-- The HTTPS port
-### server.ssl.key-store=file:/tmp/mykey.jks
-### server.ssl.key-store-password=mypass
-### server.ssl.key-password=mypass
-### server.http-to-https-redirection.port=8090 <-- The HTTP port
-
-server.servlet.context-path=/
-#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-default-user
-spring.http.converters.preferred-json-mapper=gson
-
-#The max number of active threads in this pool
-server.tomcat.max-threads=200
-#The minimum number of threads always kept alive
-server.tomcat.min-Spare-Threads=25
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
-server.tomcat.max-idle-time=60000
-
-#Servlet context parameters
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
-
-camel.springboot.consumer-template-cache-size=1000
-camel.springboot.producer-template-cache-size=1000
-# JMX enabled to have Camel Swagger runtime working
-camel.springboot.jmx-enabled=true
-camel.defaultthreadpool.poolsize=10
-camel.defaultthreadpool.maxpoolsize=20
-camel.defaultthreadpool.maxqueuesize=1000
-camel.defaultthreadpool.keepaliveTime=60
-camel.defaultthreadpool.rejectpolicy=CallerRuns
-#camel.springboot.xmlRoutes = false
-camel.springboot.xmlRoutes=classpath:/clds/camel/routes/*.xml
-camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml
-#camel.springboot.typeConversion = false
-
-#clds datasource connection details
-spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
-spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306,localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
-spring.datasource.cldsdb.username=clds
-spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
-spring.datasource.cldsdb.validationQuery=SELECT 1
-spring.datasource.cldsdb.validationQueryTimeout=20000
-spring.datasource.cldsdb.validationInterval=30000
-spring.datasource.cldsdb.testWhileIdle = true
-spring.datasource.cldsdb.minIdle = 0
-spring.datasource.cldsdb.initialSize=0
-# Automatically test whether a connection provided is good or not
-spring.datasource.cldsdb.testOnBorrow=true
-spring.datasource.cldsdb.ignoreExceptionOnPreLoad=true
-
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2017-2018 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============================================
+# ===================================================================
+#
+###
+
+info.build.artifact=@project.artifactId@
+info.build.name=@project.name@
+info.build.description=@project.description@
+info.build.version=@project.version@
+
+### Set the port for HTTP or HTTPS protocol (Controlled by Spring framework, only one at a time).
+### (See below for the parameter 'server.http.port' if you want to have both enabled)
+### To have only HTTP, keep the lines server.ssl.* commented
+### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location
+server.port=${clamp.it.tests.http}
+### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
+#server.ssl.key-store=file:/tmp/mykey.jks
+#server.ssl.key-store-password=pass
+#server.ssl.key-password=pass
+
+### In order to be user friendly when HTTPS is enabled,
+### you can add another HTTP port that will be automatically redirected to HTTPS
+### by enabling this parameter (server.http.port) and set it to another port (80 or 8080, 8090, etc ...)
+#server.http-to-https-redirection.port=8090
+
+### HTTP Example:
+###--------------
+### server.port=8080
+
+### HTTPS Example:
+### --------------
+### server.port=8443
+### server.ssl.key-store=file:/tmp/mykey.jks
+### server.ssl.key-store-password=mypass
+### server.ssl.key-password=mypass
+
+### HTTP (Redirected to HTTPS) and HTTPS Example:
+### --------------------------------------------
+### server.port=8443 <-- The HTTPS port
+### server.ssl.key-store=file:/tmp/mykey.jks
+### server.ssl.key-store-password=mypass
+### server.ssl.key-password=mypass
+### server.http-to-https-redirection.port=8090 <-- The HTTP port
+
+server.servlet.context-path=/
+#Modified engine-rest applicationpath
+spring.profiles.active=clamp-default,clamp-default-user
+spring.http.converters.preferred-json-mapper=gson
+
+#The max number of active threads in this pool
+server.tomcat.max-threads=200
+#The minimum number of threads always kept alive
+server.tomcat.min-Spare-Threads=25
+#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
+server.tomcat.max-idle-time=60000
+
+#Servlet context parameters
+server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
+
+camel.springboot.consumer-template-cache-size=1000
+camel.springboot.producer-template-cache-size=1000
+# JMX enabled to have Camel Swagger runtime working
+camel.springboot.jmx-enabled=true
+camel.defaultthreadpool.poolsize=10
+camel.defaultthreadpool.maxpoolsize=20
+camel.defaultthreadpool.maxqueuesize=1000
+camel.defaultthreadpool.keepaliveTime=60
+camel.defaultthreadpool.rejectpolicy=CallerRuns
+#camel.springboot.xmlRoutes = false
+camel.springboot.xmlRoutes=classpath:/clds/camel/routes/*.xml
+camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml
+#camel.springboot.typeConversion = false
+
+#clds datasource connection details
+spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
+spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:3306,localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3
+spring.datasource.cldsdb.username=clds
+spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
+spring.datasource.cldsdb.validationQuery=SELECT 1
+spring.datasource.cldsdb.validationQueryTimeout=20000
+spring.datasource.cldsdb.validationInterval=30000
+spring.datasource.cldsdb.testWhileIdle = true
+spring.datasource.cldsdb.minIdle = 0
+spring.datasource.cldsdb.initialSize=0
+# Automatically test whether a connection provided is good or not
+spring.datasource.cldsdb.testOnBorrow=true
+spring.datasource.cldsdb.ignoreExceptionOnPreLoad=true
+
spring.jpa.properties.javax.persistence.schema-generation.database.action=drop-and-create
#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata
#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
@@ -118,112 +118,117 @@ spring.jpa.properties.hibernate.use-new-id-generator-mappings=true
# Whether to enable logging of SQL statements.
spring.jpa.show-sql=true
-#Async Executor default Parameters
-async.core.pool.size=10
-async.max.pool.size=20
-async.queue.capacity=500
-
-#For EELF logback file
-#com.att.eelf.logging.path=
-clamp.config.logback.filename=logback-default.xml
-#The log folder that will be used in logback.xml file
-clamp.config.log.path=log
-clamp.config.files.systemProperties=classpath:/system.properties
-clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
-clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
-clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
-
-# Properties for Clamp
-# DCAE request build properties
-#
-clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
-clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
-#
-#
-# Configuration Settings for Policy Engine Components
-clamp.config.policy.api.url=http4://localhost:${docker.http-cache.port.host}
-clamp.config.policy.api.userName=healthcheck
-clamp.config.policy.api.password=zb!XztG34
-clamp.config.policy.pap.url=http4://localhost:${docker.http-cache.port.host}
-clamp.config.policy.pap.userName=healthcheck
-clamp.config.policy.pap.password=zb!XztG34
-
-clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
-clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
-clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123
-clamp.config.policy.notificationType=websocket
-clamp.config.policy.notificationUebServers=localhost
-clamp.config.policy.notificationTopic=
-clamp.config.policy.clientId=python
-# base64 encoding
-clamp.config.policy.clientKey=dGVzdA==
-#DEVL for development
-#TEST for Test environments
-#PROD for prod environments
-clamp.config.policy.policyEnvironment=DEVL
-# General Policy request properties
-#
-clamp.config.policy.onap.name=DCAE
-clamp.config.policy.pdp.group=default
-clamp.config.policy.ms.type=MicroService
-clamp.config.policy.ms.policyNamePrefix=Config_MS_
-clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
-clamp.config.policy.base.policyNamePrefix=Config_
-clamp.config.policy.op.type=BRMS_Param
-
-clamp.config.import.tosca.model=false
-clamp.config.tosca.policyTypes=tca
-clamp.config.tosca.filePath=/tmp/tosca-models
-
-# TCA MicroService Policy request build properties
-#
-clamp.config.tca.policyid.prefix=DCAE.Config_
-clamp.config.tca.policy.template=classpath:/clds/templates/tca-policy-template.json
-clamp.config.tca.template=classpath:/clds/templates/tca-template.json
-clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-template.json
-
-#
-#
-# Operational Policy request build properties
-#
-clamp.config.op.policyDescription=from clds
-# default
-clamp.config.op.templateName=ClosedLoopControlName
-clamp.config.op.operationTopic=APPC-CL
-clamp.config.op.notificationTopic=POLICY-CL-MGT
-clamp.config.op.controller=amsterdam
-clamp.config.op.policy.appc=APPC
-#
-# Sdc service properties
-#
-clamp.config.sdc.csarFolder = ${project.build.directory}/sdc-tests
-clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
-#
-clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
-#
-# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
-clamp.config.action.test.override=false
-# if action.insert.test.event is true, then insert event even if the action is set to test
-clamp.config.action.insert.test.event=false
-clamp.config.clds.service.cache.invalidate.after.seconds=120
-
-#DCAE Inventory Url Properties
-clamp.config.dcae.inventory.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.dcae.intentory.retry.interval=100
-clamp.config.dcae.intentory.retry.limit=1
-
-#DCAE Dispatcher Url Properties
-clamp.config.dcae.dispatcher.url=http://localhost:${docker.http-cache.port.host}
-clamp.config.dcae.dispatcher.retry.interval=100
-clamp.config.dcae.dispatcher.retry.limit=1
-
-#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
-clamp.config.security.permission.type.cl=permission-type-cl
-clamp.config.security.permission.type.cl.manage=permission-type-cl-manage
-clamp.config.security.permission.type.cl.event=permission-type-cl-event
-clamp.config.security.permission.type.filter.vf=permission-type-filter-vf
-clamp.config.security.permission.type.template=permission-type-template
-clamp.config.security.permission.type.tosca=permission-type-tosca
-#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
-clamp.config.security.permission.instance=dev
+#Async Executor default Parameters
+async.core.pool.size=10
+async.max.pool.size=20
+async.queue.capacity=500
+
+#For EELF logback file
+#com.att.eelf.logging.path=
+clamp.config.logback.filename=logback-default.xml
+#The log folder that will be used in logback.xml file
+clamp.config.log.path=log
+clamp.config.files.systemProperties=classpath:/system.properties
+clamp.config.files.cldsUsers=classpath:/clds/clds-users.json
+clamp.config.files.globalProperties=classpath:/clds/templates/globalProperties.json
+clamp.config.files.sdcController=classpath:/clds/sdc-controllers-config.json
+
+# Properties for Clamp
+# DCAE request build properties
+#
+clamp.config.dcae.template=classpath:/clds/templates/dcae-template.json
+clamp.config.dcae.deployment.template=classpath:/clds/templates/dcae-deployment-template.json
+#
+#
+# Configuration Settings for Policy Engine Components
+clamp.config.policy.api.url=http4://localhost:${docker.http-cache.port.host}
+clamp.config.policy.api.userName=healthcheck
+clamp.config.policy.api.password=zb!XztG34
+clamp.config.policy.pap.url=http4://localhost:${docker.http-cache.port.host}
+clamp.config.policy.pap.userName=healthcheck
+clamp.config.policy.pap.password=zb!XztG34
+
+clamp.config.policy.pdpUrl1=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
+clamp.config.policy.pdpUrl2=http://localhost:${docker.http-cache.port.host}/pdp/ , testpdp, alpha123
+clamp.config.policy.papUrl=http://localhost:${docker.http-cache.port.host}/pap/ , testpap, alpha123
+clamp.config.policy.notificationType=websocket
+clamp.config.policy.notificationUebServers=localhost
+clamp.config.policy.notificationTopic=
+clamp.config.policy.clientId=python
+# base64 encoding
+clamp.config.policy.clientKey=dGVzdA==
+#DEVL for development
+#TEST for Test environments
+#PROD for prod environments
+clamp.config.policy.policyEnvironment=DEVL
+# General Policy request properties
+#
+clamp.config.policy.onap.name=DCAE
+clamp.config.policy.pdp.group=default
+clamp.config.policy.ms.type=MicroService
+clamp.config.policy.ms.policyNamePrefix=Config_MS_
+clamp.config.policy.op.policyNamePrefix=Config_BRMS_Param_
+clamp.config.policy.base.policyNamePrefix=Config_
+clamp.config.policy.op.type=BRMS_Param
+
+clamp.config.import.tosca.model=false
+clamp.config.tosca.policyTypes=tca
+clamp.config.tosca.filePath=/tmp/tosca-models
+
+# TCA MicroService Policy request build properties
+#
+clamp.config.tca.policyid.prefix=DCAE.Config_
+clamp.config.tca.policy.template=classpath:/clds/templates/tca-policy-template.json
+clamp.config.tca.template=classpath:/clds/templates/tca-template.json
+clamp.config.tca.thresholds.template=classpath:/clds/templates/tca-thresholds-template.json
+
+#
+#
+# Operational Policy request build properties
+#
+clamp.config.op.policyDescription=from clds
+# default
+clamp.config.op.templateName=ClosedLoopControlName
+clamp.config.op.operationTopic=APPC-CL
+clamp.config.op.notificationTopic=POLICY-CL-MGT
+clamp.config.op.controller=amsterdam
+clamp.config.op.policy.appc=APPC
+#
+# Sdc service properties
+#
+clamp.config.sdc.csarFolder = ${project.build.directory}/sdc-tests
+clamp.config.sdc.blueprint.parser.mapping = classpath:/clds/blueprint-parser-mapping.json
+#
+clamp.config.ui.location.default=classpath:/clds/templates/ui-location-default.json
+#
+# if action.test.override is true, then any action will be marked as test=true (even if incoming action request had test=false); otherwise, test flag will be unchanged on the action request
+clamp.config.action.test.override=false
+# if action.insert.test.event is true, then insert event even if the action is set to test
+clamp.config.action.insert.test.event=false
+clamp.config.clds.service.cache.invalidate.after.seconds=120
+
+#DCAE Inventory Url Properties
+clamp.config.dcae.inventory.url=http://localhost:${docker.http-cache.port.host}
+clamp.config.dcae.intentory.retry.interval=100
+clamp.config.dcae.intentory.retry.limit=1
+
+#DCAE Dispatcher Url Properties
+clamp.config.dcae.dispatcher.url=http://localhost:${docker.http-cache.port.host}
+clamp.config.dcae.dispatcher.retry.interval=100
+clamp.config.dcae.dispatcher.retry.limit=1
+
+#DCAE Deployment Url Properties
+clamp.config.dcae.deployment.url=http4://localhost:${docker.http-cache.port.host}
+clamp.config.dcae.deployment.userName=test
+clamp.config.dcae.deployment.password=test
+
+#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
+clamp.config.security.permission.type.cl=permission-type-cl
+clamp.config.security.permission.type.cl.manage=permission-type-cl-manage
+clamp.config.security.permission.type.cl.event=permission-type-cl-event
+clamp.config.security.permission.type.filter.vf=permission-type-filter-vf
+clamp.config.security.permission.type.template=permission-type-template
+clamp.config.security.permission.type.tosca=permission-type-tosca
+#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
+clamp.config.security.permission.instance=dev
clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal \ No newline at end of file
diff --git a/src/test/resources/clds/blueprint-with-microservice-chain.yaml b/src/test/resources/clds/blueprint-with-microservice-chain.yaml
index 4a7e5d7a..fa2d7205 100644
--- a/src/test/resources/clds/blueprint-with-microservice-chain.yaml
+++ b/src/test/resources/clds/blueprint-with-microservice-chain.yaml
@@ -31,7 +31,7 @@ node_templates:
service_component_name_override: second_app
image: { get_input: second_app_docker_image }
policy_id:
- policy_type_id: type2
+ policy_model_id: "type2"
interfaces:
cloudify.interfaces.lifecycle:
start:
@@ -56,7 +56,7 @@ node_templates:
image: { get_input: first_app_docker_image }
container_port: 6565
policy_id:
- policy_type_id: type1
+ policy_model_id: "type1"
interfaces:
cloudify.interfaces.lifecycle:
start:
@@ -81,7 +81,7 @@ node_templates:
image: { get_input: third_app_docker_image }
container_port: 443
policy_id:
- policy_type_id: type3
+ policy_model_id: "type3"
interfaces:
cloudify.interfaces.lifecycle:
start:
diff --git a/src/test/resources/clds/clds-parse-exception.json b/src/test/resources/clds/clds-parse-exception.json
new file mode 100644
index 00000000..1c06a394
--- /dev/null
+++ b/src/test/resources/clds/clds-parse-exception.json
@@ -0,0 +1 @@
+This is not json \ No newline at end of file
diff --git a/src/test/resources/clds/single-microservice-fragment-valid.yaml b/src/test/resources/clds/single-microservice-fragment-valid.yaml
index 269ee506..2c168071 100644
--- a/src/test/resources/clds/single-microservice-fragment-valid.yaml
+++ b/src/test/resources/clds/single-microservice-fragment-valid.yaml
@@ -6,7 +6,7 @@ second_app:
image: { get_input: second_app_docker_image }
name: second_app
policy_id:
- policy_type_id: type1
+ policy_model_id: "type1"
interfaces:
cloudify.interfaces.lifecycle:
start:
diff --git a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json
index 41ca2de2..d7a54162 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json
+++ b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-2.json
@@ -27,23 +27,22 @@
{
"name": "deployParameters",
"value": {
- "dh_override": "component_dockerhost",
- "dh_location_id": "zone1",
- "aaiEnrichmentHost": "none",
- "aaiEnrichmentPort": 8443,
- "enableAAIEnrichment": false,
- "dmaap_host": "dmaap.onap-message-router",
- "dmaap_port": 3904,
+ "aaiEnrichmentHost": "aai.onap.svc.cluster.local",
+ "aaiEnrichmentPort": "8443",
+ "enableAAIEnrichment": true,
+ "dmaap_host": "message-router.onap",
+ "dmaap_port": "3904",
"enableRedisCaching": false,
- "redisHosts": "",
- "tag_version": "nexus3.onap.org:10001/onap//onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0",
- "consul_host": "consul-server.onap-consul",
+ "redisHosts": "dcae-redis.onap.svc.cluster.local:6379",
+ "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1",
+ "consul_host": "consul-server.onap",
"consul_port": "8500",
- "cbs_host": "config-binding-service.dcae",
+ "cbs_host": "config-binding-servicel",
"cbs_port": "10000",
- "external_port": "32010",
+ "external_port": "32012",
+ "policy_model_id": "onap.policies.monitoring.cdap.tca.hi.lo.app",
"policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT"
}
}
]
-}
+} \ No newline at end of file
diff --git a/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json
new file mode 100644
index 00000000..012c46e9
--- /dev/null
+++ b/src/test/resources/example/sdc/blueprint-dcae/prop-text-for-tca-3.json
@@ -0,0 +1,48 @@
+{
+ "global": [
+ {
+ "name": "service",
+ "value": [
+ "4cc5b45a-1f63-4194-8100-cd8e14248c92"
+ ]
+ },
+ {
+ "name": "vf",
+ "value": [
+ "07e266fc-49ab-4cd7-8378-ca4676f1b9ec"
+ ]
+ },
+ {
+ "name": "actionSet",
+ "value": [
+ "vnfRecipe"
+ ]
+ },
+ {
+ "name": "location",
+ "value": [
+ "DC1"
+ ]
+ },
+ {
+ "name": "deployParameters",
+ "value": {
+ "aaiEnrichmentHost": "aai.onap.svc.cluster.local",
+ "aaiEnrichmentPort": "8443",
+ "enableAAIEnrichment": true,
+ "dmaap_host": "message-router.onap.svc.cluster.local",
+ "dmaap_port": "3904",
+ "enableRedisCaching": false,
+ "redisHosts": "dcae-redis.onap.svc.cluster.local:6379",
+ "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest",
+ "consul_host": "consul-server.onap.svc.cluster.local",
+ "consul_port": "8500",
+ "cbs_host": "config-binding-service.dcae.svc.cluster.local",
+ "cbs_port": "10000",
+ "external_port": "32012",
+ "policy_id": "AUTO_GENERATED_POLICY_ID_AT_SUBMIT",
+ "policy_model_id": "onap.policies.monitoring.cdap.tca.hi.lo.app"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
index edaa0be2..0cb9cdb6 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca.yaml
@@ -17,7 +17,7 @@ node_templates:
properties:
policy_id:
get_input: policy_id
- policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app
+ policy_model_id: "onap.policies.monitoring.cdap.tca.hi.lo.app"
cdap_host_host:
type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure
properties:
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
index c834b1b9..00ebfe7f 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca_2.yaml
@@ -1,76 +1,92 @@
+#
+# ============LICENSE_START====================================================
+# =============================================================================
+# Copyright (c) 2019 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======================================================
+
tosca_definitions_version: cloudify_dsl_1_3
-imports:
- - "http://www.getcloudify.org/spec/cloudify/3.4/types.yaml"
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dockerplugin/3.2.0/dockerplugin_types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/relationshipplugin/1.0.0/relationshipplugin_types.yaml
- - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
+description: >
+ This blueprint deploys/manages the TCA module as a Docker container
+
+imports:
+ - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+ - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml
+# - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
+ - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/clamppolicyplugin/1.0.0/clamppolicyplugin_types.yaml
inputs:
- dh_override:
- type: string
- default: "component_dockerhost"
- dh_location_id:
- type: string
- default: "zone1"
aaiEnrichmentHost:
type: string
- default: "none"
+ default: "aai.onap.svc.cluster.local"
aaiEnrichmentPort:
- type: string
- default: 8443
+ type: string
+ default: "8443"
enableAAIEnrichment:
type: string
- default: false
+ default: true
dmaap_host:
type: string
- default: dmaap.onap-message-router
+ default: message-router.onap
dmaap_port:
type: string
- default: 3904
+ default: "3904"
enableRedisCaching:
type: string
- default: false
+ default: false
redisHosts:
- type: string
+ type: string
+ default: dcae-redis.onap.svc.cluster.local:6379
tag_version:
type: string
- default: "nexus3.onap.org:10001/onap//onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0"
+ default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.1"
consul_host:
type: string
- default: consul-server.onap-consul
+ default: consul-server.onap
consul_port:
type: string
default: "8500"
cbs_host:
type: string
- default: "config-binding-service.dcae"
+ default: "config-binding-servicel"
cbs_port:
type: string
default: "10000"
policy_id:
type: string
- default: "none"
+ default: "onap.restart.tca"
external_port:
type: string
- description: "Port for CDAPgui to be exposed"
- default: "32010"
-
+ description: Kubernetes node port on which CDAPgui is exposed
+ default: "32012"
+ policy_model_id:
+ type: string
+ default: "onap.policies.monitoring.cdap.tca.hi.lo.app"
node_templates:
- docker_service_host:
- properties:
- docker_host_override:
- get_input: dh_override
- location_id:
- get_input: dh_location_id
- type: dcae.nodes.SelectedDockerHost
- tca_docker:
+ tca_k8s:
+ type: dcae.nodes.ContainerizedServiceComponent
relationships:
- - type: dcae.relationships.component_contained_in
- target: docker_service_host
- - target: tca_policy
- type: cloudify.relationships.depends_on
- type: dcae.nodes.DockerContainerForComponentsUsingDmaap
+ - target: tca_policy
+ type: cloudify.relationships.depends_on
properties:
+ service_component_type: 'dcaegen2-analytics-tca'
+ application_config: {}
+ docker_config: {}
+ image:
+ get_input: tag_version
+ log_info:
+ log_directory: "/opt/app/TCAnalytics/logs"
application_config:
app_config:
appDescription: DCAE Analytics Threshold Crossing Alert Application
@@ -84,87 +100,75 @@ node_templates:
tcaVESMessageStatusTableTTLSeconds: '86400'
thresholdCalculatorFlowletInstances: '2'
app_preferences:
- aaiEnrichmentHost:
+ aaiEnrichmentHost:
get_input: aaiEnrichmentHost
aaiEnrichmentIgnoreSSLCertificateErrors: 'true'
aaiEnrichmentPortNumber: '8443'
aaiEnrichmentProtocol: https
- aaiEnrichmentUserName: DCAE
- aaiEnrichmentUserPassword: DCAE
+ aaiEnrichmentUserName: dcae@dcae.onap.org
+ aaiEnrichmentUserPassword: demo123456!
aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query
aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf
- enableAAIEnrichment:
+ enableAAIEnrichment:
get_input: enableAAIEnrichment
- enableRedisCaching:
+ enableRedisCaching:
get_input: enableRedisCaching
- redisHosts:
+ redisHosts:
get_input: redisHosts
enableAlertCEFFormat: 'false'
publisherContentType: application/json
- publisherHostName:
+ publisherHostName:
get_input: dmaap_host
- publisherHostPort:
- get_input: dmaap_port
+ publisherHostPort:
+ get_input: dmaap_port
publisherMaxBatchSize: '1'
publisherMaxRecoveryQueueSize: '100000'
publisherPollingInterval: '20000'
publisherProtocol: http
publisherTopicName: unauthenticated.DCAE_CL_OUTPUT
- subscriberConsumerGroup: OpenDCAE-c12
+ subscriberConsumerGroup: OpenDCAE-clamp
subscriberConsumerId: c12
subscriberContentType: application/json
- subscriberHostName:
+ subscriberHostName:
get_input: dmaap_host
subscriberHostPort:
- get_input: dmaap_port
+ get_input: dmaap_port
subscriberMessageLimit: '-1'
subscriberPollingInterval: '30000'
subscriberProtocol: http
subscriberTimeoutMS: '-1'
- subscriberTopicName: unauthenticated.SEC_MEASUREMENT_OUTPUT
- tca_policy_default: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta","thresholdValue":300,"direction":"LESS_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta","thresholdValue":700,"direction":"GREATER_OR_EQUAL","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]},{"eventName":"vLoadBalancer","controlLoopSchemaType":"VM","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta","thresholdValue":300,"direction":"GREATER_OR_EQUAL","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]},{"eventName":"Measurement_vGMUX","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":0,"direction":"EQUAL","severity":"MAJOR","closedLoopEventStatus":"ABATED"},{"closedLoopControlName":"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":0,"direction":"GREATER","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]}]}'
- service_component_type: dcaegen2-analytics_tca
- docker_config:
- healthcheck:
- endpoint: /healthcheck
- interval: 15s
- timeout: 1s
- type: http
- image:
- get_input: tag_version
+ subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT
+# tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta","thresholdValue":300,"direction":"LESS_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta","thresholdValue":700,"direction":"GREATER_OR_EQUAL","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]},{"eventName":"vLoadBalancer","controlLoopSchemaType":"VM","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta","thresholdValue":300,"direction":"GREATER_OR_EQUAL","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]},{"eventName":"Measurement_vGMUX","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_tca-hi-lo","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":0,"direction":"EQUAL","severity":"MAJOR","closedLoopEventStatus":"ABATED"},{"closedLoopControlName":"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":0,"direction":"GREATER","severity":"CRITICAL","closedLoopEventStatus":"ONSET"}]}]}'
+ service_component_type: dcaegen2-analytics_tca
interfaces:
cloudify.interfaces.lifecycle:
start:
inputs:
envs:
- DMAAPHOST:
+ DMAAPHOST:
{ get_input: dmaap_host }
DMAAPPORT:
{ get_input: dmaap_port }
DMAAPPUBTOPIC: "unauthenticated.DCAE_CL_OUTPUT"
- DMAAPSUBTOPIC: "unauthenticated.SEC_MEASUREMENT_OUTPUT"
- AAIHOST:
+ DMAAPSUBTOPIC: "unauthenticated.VES_MEASUREMENT_OUTPUT"
+ AAIHOST:
{ get_input: aaiEnrichmentHost }
- AAIPORT:
+ AAIPORT:
{ get_input: aaiEnrichmentPort }
- CONSUL_HOST:
+ CONSUL_HOST:
{ get_input: consul_host }
- CONSUL_PORT:
+ CONSUL_PORT:
{ get_input: consul_port }
- CBS_HOST:
+ CBS_HOST:
{ get_input: cbs_host }
- CBS_PORT:
+ CBS_PORT:
{ get_input: cbs_port }
- CONFIG_BINDING_SERVICE: "config_binding_service"
+ CONFIG_BINDING_SERVICE: "config_binding_service"
ports:
- - concat: ["11011:", { get_input: external_port }]
- stop:
- inputs:
- cleanup_image: true
+ - concat: ["11011:", { get_input: external_port }]
tca_policy:
- type: dcae.nodes.policy
+ type: clamp.nodes.policy
properties:
policy_id:
get_input: policy_id
- policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app
-
+ policy_model_id: "onap.policies.monitoring.cdap.tca.hi.lo.app"
diff --git a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
index edaa0be2..6fab504b 100644
--- a/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
+++ b/src/test/resources/example/sdc/blueprint-dcae/tca_3.yaml
@@ -1,105 +1,157 @@
tosca_definitions_version: cloudify_dsl_1_3
+
+description: >
+ This blueprint deploys/manages the TCA module as a Docker container
+
imports:
-- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
-- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/docker/2.2.0/node-type.yaml
-- https://onap.org:8443/repository/solutioning01-mte2-raw/type_files/relationship/1.0.0/node-type.yaml
-- http://onap.org:8081/repository/solutioning01-mte2-raw/type_files/dmaap/dmaap_mr.yaml
+ - http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+ - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/k8splugin/1.4.12/k8splugin_types.yaml
+ - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4/dcaepolicyplugin/2.3.0/dcaepolicyplugin_types.yaml
inputs:
- location_id:
+ aaiEnrichmentHost:
type: string
- service_id:
+ default: "aai.onap.svc.cluster.local"
+ aaiEnrichmentPort:
type: string
+ default: "8443"
+ enableAAIEnrichment:
+ type: string
+ default: true
+ dmaap_host:
+ type: string
+ default: message-router.onap.svc.cluster.local
+ dmaap_port:
+ type: string
+ default: "3904"
+ enableRedisCaching:
+ type: string
+ default: false
+ redisHosts:
+ type: string
+ default: dcae-redis.onap.svc.cluster.local:6379
+ tag_version:
+ type: string
+ default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0-STAGING-latest"
+ consul_host:
+ type: string
+ default: consul-server.onap.svc.cluster.local
+ consul_port:
+ type: string
+ default: "8500"
+ cbs_host:
+ type: string
+ default: "config-binding-service.dcae.svc.cluster.local"
+ cbs_port:
+ type: string
+ default: "10000"
policy_id:
type: string
+ default: "none"
+ external_port:
+ type: string
+ description: Kubernetes node port on which CDAPgui is exposed
+ default: "32012"
+ policy_model_id:
+ type: string
+ default: "onap.policies.monitoring.cdap.tca.hi.lo.app"
+
node_templates:
- policy_0:
- type: dcae.nodes.policy
- properties:
- policy_id:
- get_input: policy_id
- policy_type_id: onap.policies.monitoring.cdap.tca.hi.lo.app
- cdap_host_host:
- type: dcae.nodes.StreamingAnalytics.SelectedCDAPInfrastructure
- properties:
- location_id:
- get_input: location_id
- scn_override: cdap_broker.solutioning-central.dcae.onap.org
- interfaces:
- cloudify.interfaces.lifecycle: {
- }
- tca_tca:
- type: dcae.nodes.MicroService.cdap
- properties:
- app_config:
- appDescription: DCAE Analytics Threshold Crossing Alert Application
- appName: dcae-tca
- tcaSubscriberOutputStreamName: TCASubscriberOutputStream
- tcaVESAlertsTableName: TCAVESAlertsTable
- tcaVESAlertsTableTTLSeconds: '1728000'
- tcaVESMessageStatusTableName: TCAVESMessageStatusTable
- tcaVESMessageStatusTableTTLSeconds: '86400'
- thresholdCalculatorFlowletInstances: '2'
- app_preferences:
- publisherContentType: application/json
- publisherHostName: mrlocal-mtnjftle01.onap.org
- publisherHostPort: '3905'
- publisherMaxBatchSize: '10'
- publisherMaxRecoveryQueueSize: '100000'
- publisherPollingInterval: '20000'
- publisherProtocol: https
- publisherTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESPub
- publisherUserName: test@tca.af.dcae.onap.org
- publisherUserPassword: password
- subscriberConsumerGroup: OpenDCAE-c12
- subscriberConsumerId: c12
- subscriberContentType: application/json
- subscriberHostName: mrlocal-mtnjftle01.onap.org
- subscriberHostPort: '3905'
- subscriberMessageLimit: '-1'
- subscriberPollingInterval: '20000'
- subscriberProtocol: https
- subscriberTimeoutMS: '-1'
- subscriberTopicName: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub
- subscriberUserName: test@tca.af.dcae.onap.org
- subscriberUserPassword: password
- tca_policy: null
- artifact_name: dcae-analytics-tca
- artifact_version: 1.0.0
- connections:
- streams_publishes: [
- ]
- streams_subscribes: [
- ]
- jar_url: http://somejar
- location_id:
- get_input: location_id
- namespace: cdap_tca_hi_lo
- programs:
- - program_id: TCAVESCollectorFlow
- program_type: flows
- - program_id: TCADMaaPMRSubscriberWorker
- program_type: workers
- - program_id: TCADMaaPMRPublisherWorker
- program_type: workers
- service_component_type: cdap_app_tca
- service_id:
- get_input: service_id
- streamname: TCASubscriberOutputStream
+ tca_k8s:
+ type: dcae.nodes.ContainerizedServiceComponent
relationships:
- - target: topic0
- type: dcae.relationships.subscribe_to_events
- - target: topic1
- type: dcae.relationships.publish_events
- - target: cdap_host_host
- type: dcae.relationships.component_contained_in
- - target: policy_0
- type: dcae.relationships.depends_on
- topic0:
- type: dcae.nodes.Topic
+ - target: tca_policy
+ type: cloudify.relationships.depends_on
properties:
- topic_name: ''
- topic1:
- type: dcae.nodes.Topic
+ service_component_type: 'dcaegen2-analytics-tca'
+ application_config: {}
+ docker_config: {}
+ image:
+ get_input: tag_version
+ log_info:
+ log_directory: "/opt/app/TCAnalytics/logs"
+ application_config:
+ app_config:
+ appDescription: DCAE Analytics Threshold Crossing Alert Application
+ appName: dcae-tca
+ tcaAlertsAbatementTableName: TCAAlertsAbatementTable
+ tcaAlertsAbatementTableTTLSeconds: '1728000'
+ tcaSubscriberOutputStreamName: TCASubscriberOutputStream
+ tcaVESAlertsTableName: TCAVESAlertsTable
+ tcaVESAlertsTableTTLSeconds: '1728000'
+ tcaVESMessageStatusTableName: TCAVESMessageStatusTable
+ tcaVESMessageStatusTableTTLSeconds: '86400'
+ thresholdCalculatorFlowletInstances: '2'
+ app_preferences:
+ aaiEnrichmentHost:
+ get_input: aaiEnrichmentHost
+ aaiEnrichmentIgnoreSSLCertificateErrors: 'true'
+ aaiEnrichmentPortNumber: '8443'
+ aaiEnrichmentProtocol: https
+ aaiEnrichmentUserName: dcae@dcae.onap.org
+ aaiEnrichmentUserPassword: demo123456!
+ aaiVMEnrichmentAPIPath: /aai/v11/search/nodes-query
+ aaiVNFEnrichmentAPIPath: /aai/v11/network/generic-vnfs/generic-vnf
+ enableAAIEnrichment:
+ get_input: enableAAIEnrichment
+ enableRedisCaching:
+ get_input: enableRedisCaching
+ redisHosts:
+ get_input: redisHosts
+ enableAlertCEFFormat: 'false'
+ publisherContentType: application/json
+ publisherHostName:
+ get_input: dmaap_host
+ publisherHostPort:
+ get_input: dmaap_port
+ publisherMaxBatchSize: '1'
+ publisherMaxRecoveryQueueSize: '100000'
+ publisherPollingInterval: '20000'
+ publisherProtocol: http
+ publisherTopicName: unauthenticated.DCAE_CL_OUTPUT
+ subscriberConsumerGroup: OpenDCAE-c12
+ subscriberConsumerId: c12
+ subscriberContentType: application/json
+ subscriberHostName:
+ get_input: dmaap_host
+ subscriberHostPort:
+ get_input: dmaap_port
+ subscriberMessageLimit: '-1'
+ subscriberPollingInterval: '30000'
+ subscriberProtocol: http
+ subscriberTimeoutMS: '-1'
+ subscriberTopicName: unauthenticated.VES_MEASUREMENT_OUTPUT
+ tca_policy: ''
+ service_component_type: dcaegen2-analytics_tca
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ envs:
+ DMAAPHOST:
+ { get_input: dmaap_host }
+ DMAAPPORT:
+ { get_input: dmaap_port }
+ DMAAPPUBTOPIC: "unauthenticated.DCAE_CL_OUTPUT"
+ DMAAPSUBTOPIC: "unauthenticated.VES_MEASUREMENT_OUTPUT"
+ AAIHOST:
+ { get_input: aaiEnrichmentHost }
+ AAIPORT:
+ { get_input: aaiEnrichmentPort }
+ CONSUL_HOST:
+ { get_input: consul_host }
+ CONSUL_PORT:
+ { get_input: consul_port }
+ CBS_HOST:
+ { get_input: cbs_host }
+ CBS_PORT:
+ { get_input: cbs_port }
+ CONFIG_BINDING_SERVICE: "config_binding_service"
+ ports:
+ - concat: ["11011:", { get_input: external_port }]
+ tca_policy:
+ type: dcae.nodes.policy
properties:
- topic_name: ''
-
+ policy_id:
+ get_input: policy_id
+ policy_model_id:
+ get_input: policy_model_id
diff --git a/src/test/resources/example/sdc/expected-result/policy-data.yaml b/src/test/resources/example/sdc/expected-result/policy-data.yaml
index 2d315311..3cf5e975 100644
--- a/src/test/resources/example/sdc/expected-result/policy-data.yaml
+++ b/src/test/resources/example/sdc/expected-result/policy-data.yaml
@@ -132,11 +132,11 @@ policy_types:
type: string
description: The name of the policy, that related to specific type, same as it is defined in the source.
required: false
- tosca.policies.Monitoring:
+ onap.policies.Monitoring:
derived_from: tosca.policies.Root
description: A base policy type for all policies that governs monitoring provisioning
onap.policies.monitoring.cdap.tca.hi.lo.app:
- derived_from: tosca.policies.Monitoring
+ derived_from: onap.policies.Monitoring
version: 1.0.0
properties:
tca_policy:
@@ -144,6 +144,316 @@ policy_types:
description: TCA Policy JSON
entry_schema:
type: onap.datatypes.monitoring.tca_policy
+ tosca.policies.nfv.InstantiationLevels:
+ derived_from: tosca.policies.Root
+ description: The InstantiationLevels type is a policy type representing all the instantiation levels of resources to be instantiated within a deployment flavour and including default instantiation level in term of the number of VNFC instances to be created as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ levels:
+ type: map
+ description: Describes the various levels of resources that can be used to instantiate the VNF using this flavour.
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.InstantiationLevel
+ default_level:
+ type: string
+ description: The default instantiation level for this flavour.
+ required: false
+ tosca.policies.nfv.VduInstantiationLevels:
+ derived_from: tosca.policies.Root
+ description: The VduInstantiationLevels type is a policy type representing all the instantiation levels of resources to be instantiated within a deployment flavour in term of the number of VNFC instances to be created from each vdu.Compute. as defined in ETSI GS NFV-IFA 011 [1]
+ properties:
+ levels:
+ type: map
+ description: Describes the Vdu.Compute levels of resources that can be used to instantiate the VNF using this flavour
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.VduLevel
+ targets:
+ - tosca.nodes.nfv.Vdu.Compute
+ tosca.policies.nfv.VirtualLinkInstantiationLevels:
+ derived_from: tosca.policies.Root
+ description: The VirtualLinkInstantiationLevels type is a policy type representing all the instantiation levels of virtual link resources to be instantiated within a deployment flavour as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ levels:
+ type: map
+ description: Describes the virtual link levels of resources that can be used to instantiate the VNF using this flavour.
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.VirtualLinkBitrateLevel
+ targets:
+ - tosca.nodes.nfv.VnfVirtualLink
+ tosca.policies.nfv.ScalingAspects:
+ derived_from: tosca.policies.Root
+ description: The ScalingAspects type is a policy type representing the scaling aspects used for horizontal scaling as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ aspects:
+ type: map
+ description: Describe maximum scale level for total number of scaling steps that can be applied to a particular aspect
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.ScalingAspect
+ tosca.policies.nfv.VduScalingAspectDeltas:
+ derived_from: tosca.policies.Root
+ description: The VduScalingAspectDeltas type is a policy type representing the Vdu.Compute detail of an aspect deltas used for horizontal scaling, as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ aspect:
+ type: string
+ description: Represents the scaling aspect to which this policy applies
+ required: true
+ deltas:
+ type: map
+ description: Describes the Vdu.Compute scaling deltas to be applied for every scaling steps of a particular aspect.
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.VduLevel
+ targets:
+ - tosca.nodes.nfv.Vdu.Compute
+ tosca.policies.nfv.VirtualLinkBitrateScalingAspectDeltas:
+ derived_from: tosca.policies.Root
+ description: The VirtualLinkBitrateScalingAspectDeltas type is a policy type representing the VnfVirtualLink detail of an aspect deltas used for horizontal scaling, as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ aspect:
+ type: string
+ description: Represents the scaling aspect to which this policy applies.
+ required: true
+ deltas:
+ type: map
+ description: Describes the VnfVirtualLink scaling deltas to be applied for every scaling steps of a particular aspect.
+ required: true
+ entry_schema:
+ type: tosca.datatypes.nfv.VirtualLinkBitrateLevel
+ targets:
+ - tosca.nodes.nfv.VnfVirtualLink
+ tosca.policies.nfv.VduInitialDelta:
+ derived_from: tosca.policies.Root
+ description: The VduInitialDelta type is a policy type representing the Vdu.Compute detail of an initial delta used for horizontal scaling, as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ initial_delta:
+ type: tosca.datatypes.nfv.VduLevel
+ description: Represents the initial minimum size of the VNF.
+ required: true
+ targets:
+ - tosca.nodes.nfv.Vdu.Compute
+ tosca.policies.nfv.VirtualLinkBitrateInitialDelta:
+ derived_from: tosca.policies.Root
+ description: The VirtualLinkBitrateInitialDelta type is a policy type representing the VnfVirtualLink detail of an initial deltas used for horizontal scaling, as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ initial_delta:
+ type: tosca.datatypes.nfv.VirtualLinkBitrateLevel
+ description: Represents the initial minimum size of the VNF.
+ required: true
+ targets:
+ - tosca.nodes.nfv.VnfVirtualLink
+ tosca.policies.nfv.SecurityGroupRule:
+ derived_from: tosca.policies.Root
+ description: The SecurityGroupRule type is a policy type specified the matching criteria for the ingress and/or egress traffic to/from visited connection points as defined in ETSI GS NFV-IFA 011 [1].
+ properties:
+ description:
+ type: string
+ description: Human readable description of the security group rule.
+ required: false
+ direction:
+ type: string
+ description: The direction in which the security group rule is applied. The direction of 'ingress' or 'egress' is specified against the associated CP. I.e., 'ingress' means the packets entering a CP, while 'egress' means the packets sent out of a CP.
+ required: false
+ constraints:
+ - valid_values:
+ - ingress
+ - egress
+ default: ingress
+ ether_type:
+ type: string
+ description: Indicates the protocol carried over the Ethernet layer.
+ required: false
+ constraints:
+ - valid_values:
+ - ipv4
+ - ipv6
+ default: ipv4
+ protocol:
+ type: string
+ description: Indicates the protocol carried over the IP layer. Permitted values include any protocol defined in the IANA protocol registry, e.g. TCP, UDP, ICMP, etc.
+ required: false
+ constraints:
+ - valid_values:
+ - hopopt
+ - icmp
+ - igmp
+ - ggp
+ - ipv4
+ - st
+ - tcp
+ - cbt
+ - egp
+ - igp
+ - bbn_rcc_mon
+ - nvp_ii
+ - pup
+ - argus
+ - emcon
+ - xnet
+ - chaos
+ - udp
+ - mux
+ - dcn_meas
+ - hmp
+ - prm
+ - xns_idp
+ - trunk_1
+ - trunk_2
+ - leaf_1
+ - leaf_2
+ - rdp
+ - irtp
+ - iso_tp4
+ - netblt
+ - mfe_nsp
+ - merit_inp
+ - dccp
+ - 3pc
+ - idpr
+ - xtp
+ - ddp
+ - idpr_cmtp
+ - tp++
+ - il
+ - ipv6
+ - sdrp
+ - ipv6_route
+ - ipv6_frag
+ - idrp
+ - rsvp
+ - gre
+ - dsr
+ - bna
+ - esp
+ - ah
+ - i_nlsp
+ - swipe
+ - narp
+ - mobile
+ - tlsp
+ - skip
+ - ipv6_icmp
+ - ipv6_no_nxt
+ - ipv6_opts
+ - cftp
+ - sat_expak
+ - kryptolan
+ - rvd
+ - ippc
+ - sat_mon
+ - visa
+ - ipcv
+ - cpnx
+ - cphb
+ - wsn
+ - pvp
+ - br_sat_mon
+ - sun_nd
+ - wb_mon
+ - wb_expak
+ - iso_ip
+ - vmtp
+ - secure_vmtp
+ - vines
+ - ttp
+ - iptm
+ - nsfnet_igp
+ - dgp
+ - tcf
+ - eigrp
+ - ospfigp
+ - sprite_rpc
+ - larp
+ - mtp
+ - ax.25
+ - ipip
+ - micp
+ - scc_sp
+ - etherip
+ - encap
+ - gmtp
+ - ifmp
+ - pnni
+ - pim
+ - aris
+ - scps
+ - qnx
+ - a/n
+ - ip_comp
+ - snp
+ - compaq_peer
+ - ipx_in_ip
+ - vrrp
+ - pgm
+ - l2tp
+ - ddx
+ - iatp
+ - stp
+ - srp
+ - uti
+ - smp
+ - sm
+ - ptp
+ - isis
+ - fire
+ - crtp
+ - crudp
+ - sscopmce
+ - iplt
+ - sps
+ - pipe
+ - sctp
+ - fc
+ - rsvp_e2e_ignore
+ - mobility
+ - udp_lite
+ - mpls_in_ip
+ - manet
+ - hip
+ - shim6
+ - wesp
+ - rohc
+ default: tcp
+ port_range_min:
+ type: integer
+ description: Indicates minimum port number in the range that is matched by the security group rule. If a value is provided at design-time, this value may be overridden at run-time based on other deployment requirements or constraints.
+ required: false
+ constraints:
+ - greater_or_equal: 0
+ - less_or_equal: 65535
+ default: 0
+ port_range_max:
+ type: integer
+ description: Indicates maximum port number in the range that is matched by the security group rule. If a value is provided at design-time, this value may be overridden at run-time based on other deployment requirements or constraints.
+ required: false
+ constraints:
+ - greater_or_equal: 0
+ - less_or_equal: 65535
+ default: 65535
+ targets:
+ - tosca.nodes.nfv.VduCp
+ - tosca.nodes.nfv.VnfExtCp
+ tosca.policies.nfv.SupportedVnfInterface:
+ derived_from: tosca.policies.Root
+ description: this policy type represents interfaces produced by a VNF, the details to access them and the applicable connection points to use to access these interfaces
+ properties:
+ interface_name:
+ type: string
+ description: Identifies an interface produced by the VNF.
+ required: true
+ constraints:
+ - valid_values:
+ - vnf_indicator
+ - vnf_configuration
+ details:
+ type: tosca.datatypes.nfv.InterfaceDetails
+ description: Provide additional data to access the interface endpoint
+ required: false
+ targets:
+ - tosca.nodes.nfv.VnfExtCp
+ - tosca.nodes.nfv.VduCp
data_types:
tosca.datatypes.Root:
description: The TOSCA root Data Type all other TOSCA base Data Types derive from
@@ -1381,119 +1691,159 @@ data_types:
type: string
description: The network role of the related network, sharing provider network.
required: false
+ tosca.datatypes.nfv.VnfcAdditionalConfigurableProperties:
+ derived_from: tosca.datatypes.Root
+ description: VnfcAdditionalConfigurableProperties type is an empty base type for deriving data types for describing additional configurable properties for a given VNFC.
+ properties:
+ description:
+ type: string
+ required: false
tosca.datatypes.nfv.VnfcConfigurableProperties:
derived_from: tosca.datatypes.Root
+ description: Defines the configurable properties of a VNFC
properties:
additional_vnfc_configurable_properties:
- type: map
- entry_schema:
- type: string
+ type: tosca.datatypes.nfv.VnfcAdditionalConfigurableProperties
+ description: Describes additional configuration for VNFC that can be modified using the ModifyVnfInfo operation
required: false
tosca.datatypes.nfv.RequestedAdditionalCapability:
derived_from: tosca.datatypes.Root
+ description: describes requested additional capability for a particular VDU
properties:
+ requested_additional_capability_name:
+ type: string
+ description: Identifies a requested additional capability for the VDU.
+ required: true
support_mandatory:
type: boolean
+ description: Indicates whether the requested additional capability is mandatory for successful operation.
required: true
min_requested_additional_capability_version:
type: string
+ description: Identifies the minimum version of the requested additional capability.
required: false
preferred_requested_additional_capability_version:
type: string
+ description: Identifies the preferred version of the requested additional capability.
required: false
- requested_additional_capability_name:
- type: string
- required: true
target_performance_parameters:
type: map
+ description: Identifies specific attributes, dependent on the requested additional capability type.
+ required: true
entry_schema:
type: string
- required: true
tosca.datatypes.nfv.VirtualMemory:
derived_from: tosca.datatypes.Root
+ description: supports the specification of requirements related to virtual memory of a virtual compute resource
properties:
virtual_mem_size:
type: scalar-unit.size
+ description: Amount of virtual memory.
required: true
virtual_mem_oversubscription_policy:
type: string
+ description: The memory core oversubscription policy in terms of virtual memory to physical memory on the platform.
required: false
- vdu_memory_requirements:
+ vdu_mem_requirements:
type: map
+ description: The hardware platform specific VDU memory requirements. A map of strings that contains a set of key-value pairs that describes hardware platform specific VDU memory requirements.
+ required: false
entry_schema:
type: string
- required: false
numa_enabled:
type: boolean
+ description: It specifies the memory allocation to be cognisant of the relevant process/core allocation.
required: false
+ default: false
tosca.datatypes.nfv.VirtualCpuPinning:
derived_from: tosca.datatypes.Root
+ description: Supports the specification of requirements related to the virtual CPU pinning configuration of a virtual compute resource
properties:
- cpu_pinning_policy:
+ virtual_cpu_pinning_policy:
type: string
+ description: 'Indicates the policy for CPU pinning. The policy can take values
+ of "static" or "dynamic". In case of "dynamic" the allocation of virtual
+ CPU cores to logical CPU cores is decided by the VIM. (e.g.: SMT (Simultaneous
+ Multi-Threading) requirements). In case of "static" the allocation is requested
+ to be according to the virtual_cpu_pinning_rule.'
+ required: false
constraints:
- valid_values:
- static
- dynamic
+ virtual_cpu_pinning_rule:
+ type: list
+ description: Provides the list of rules for allocating virtual CPU cores to logical CPU cores/threads
required: false
- cpu_pinning_map:
- type: map
entry_schema:
type: string
- required: false
tosca.datatypes.nfv.VirtualCpu:
derived_from: tosca.datatypes.Root
+ description: Supports the specification of requirements related to virtual CPU(s) of a virtual compute resource
properties:
cpu_architecture:
type: string
+ description: CPU architecture type. Examples are x86, ARM
required: false
num_virtual_cpu:
type: integer
+ description: Number of virtual CPUs
required: true
+ constraints:
+ - greater_than: 0
virtual_cpu_clock:
type: scalar-unit.frequency
+ description: Minimum virtual CPU clock rate
required: false
virtual_cpu_oversubscription_policy:
type: string
+ description: CPU core oversubscription policy e.g. the relation of virtual CPU cores to physical CPU cores/threads.
required: false
vdu_cpu_requirements:
type: map
+ description: The hardware platform specific VDU CPU requirements. A map of strings that contains a set of key-value pairs describing VDU CPU specific hardware platform requirements.
+ required: false
entry_schema:
type: string
- required: false
virtual_cpu_pinning:
type: tosca.datatypes.nfv.VirtualCpuPinning
+ description: The virtual CPU pinning configuration for the virtualised compute resource.
required: false
tosca.datatypes.nfv.LogicalNodeData:
derived_from: tosca.datatypes.Root
+ description: Describes compute, memory and I/O requirements associated with a particular VDU.
properties:
logical_node_requirements:
type: map
+ description: The logical node-level compute, memory and I/O requirements. A map of strings that contains a set of key-value pairs that describes hardware platform specific deployment requirements, including the number of CPU cores on this logical node, a memory configuration specific to a logical node or a requirement related to the association of an I/O device with the logical node.
+ required: false
entry_schema:
type: string
- required: false
tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements:
derived_from: tosca.datatypes.Root
+ description: Describes requirements on a virtual network interface
properties:
name:
type: string
+ description: Provides a human readable name for the requirement.
required: false
description:
type: string
+ description: Provides a human readable description of the requirement.
required: false
support_mandatory:
type: boolean
+ description: Indicates whether fulfilling the constraint is mandatory (TRUE) for successful operation or desirable (FALSE).
required: true
- requirement:
- type: string
- required: false
network_interface_requirements:
type: map
+ description: The network interface requirements. A map of strings that contain a set of key-value pairs that describes the hardware platform specific network interface deployment requirements.
+ required: true
entry_schema:
type: string
- required: true
nic_io_requirements:
type: tosca.datatypes.nfv.LogicalNodeData
+ description: references (couples) the CP with any logical node I/O requirements (for network devices) that may have been created. Linking these attributes is necessary so that so that I/O requirements that need to be articulated at the logical node level can be associated with the network interface requirements associated with the CP.
required: false
tosca.datatypes.nfv.injectFile:
derived_from: tosca.datatypes.Root
@@ -1506,24 +1856,27 @@ data_types:
required: true
tosca.datatypes.nfv.L2AddressData:
derived_from: tosca.datatypes.Root
+ description: Describes the information on the MAC addresses to be assigned to a connection point.
properties:
mac_address_assignment:
type: boolean
+ description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
- address:
- type: string
- required: false
tosca.datatypes.nfv.L3AddressData:
derived_from: tosca.datatypes.Root
+ description: Provides information about Layer 3 level addressing scheme and parameters applicable to a CP
properties:
ip_address_assignment:
type: boolean
+ description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
floating_ip_activated:
type: boolean
+ description: Specifies if the floating IP scheme is activated on the Connection Point or not
required: true
ip_address_type:
type: string
+ description: Defines address type. The address type should be aligned with the address type supported by the layer_protocols properties of the parent VnfExtCp
required: false
constraints:
- valid_values:
@@ -1531,49 +1884,62 @@ data_types:
- ipv6
number_of_ip_address:
type: integer
+ description: Minimum number of IP addresses to be assigned
required: false
+ constraints:
+ - greater_than: 0
fixed_ip_address:
type: list
entry_schema:
type: string
required: false
tosca.datatypes.nfv.AddressData:
+ derived_from: tosca.datatypes.Root
+ description: Describes information about the addressing scheme and parameters applicable to a CP
properties:
address_type:
+ type: string
+ description: Describes the type of the address to be assigned to a connection point. The content type shall be aligned with the address type supported by the layerProtocol property of the connection point
+ required: true
constraints:
- valid_values:
- mac_address
- ip_address
- type: string
- required: true
l2_address_data:
- required: false
type: tosca.datatypes.nfv.L2AddressData
- l3_address_data:
+ description: Provides the information on the MAC addresses to be assigned to a connection point.
required: false
+ l3_address_data:
type: tosca.datatypes.nfv.L3AddressData
+ description: Provides the information on the IP addresses to be assigned to a connection point
+ required: false
tosca.datatypes.nfv.ConnectivityType:
derived_from: tosca.datatypes.Root
+ description: describes additional connectivity information of a virtualLink
properties:
- layer_protocol:
- type: string
+ layer_protocols:
+ type: list
+ description: Identifies the protocol a virtualLink gives access to (ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire).The top layer protocol of the virtualLink protocol stack shall always be provided. The lower layer protocols may be included when there are specific requirements on these layers.
required: true
- constraints:
- - valid_values:
- - ethernet
- - mpls
- - odu2
- - ipv4
- - ipv6
- - pseudo_wire
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - ethernet
+ - mpls
+ - odu2
+ - ipv4
+ - ipv6
+ - pseudo-wire
flow_pattern:
type: string
+ description: Identifies the flow pattern of the connectivity
required: false
constraints:
- valid_values:
- - Line
- - Tree
- - Mesh
+ - line
+ - tree
+ - mesh
tosca.datatypes.nfv.VlFlavour:
derived_from: tosca.datatypes.Root
properties:
@@ -1640,108 +2006,223 @@ data_types:
required: false
tosca.datatypes.nfv.VduProfile:
derived_from: tosca.datatypes.Root
+ description: describes additional instantiation data for a given Vdu.Compute used in a specific deployment flavour.
properties:
min_number_of_instances:
type: integer
+ description: Minimum number of instances of the VNFC based on this Vdu.Compute that is permitted to exist for a particular VNF deployment flavour.
required: true
+ constraints:
+ - greater_or_equal: 0
max_number_of_instances:
type: integer
+ description: Maximum number of instances of the VNFC based on this Vdu.Compute that is permitted to exist for a particular VNF deployment flavour.
required: true
+ constraints:
+ - greater_or_equal: 0
watchdog:
type: string
required: true
vmBootUpTimeOut:
type: integer
required: false
- tosca.datatypes.nfv.LinkBitRateRequirements:
+ tosca.datatypes.nfv.LinkBitrateRequirements:
derived_from: tosca.datatypes.Root
+ description: describes the requirements in terms of bitrate for a virtual link
properties:
root:
type: integer
+ description: Specifies the throughput requirement in bits per second of the link (e.g. bitrate of E-Line, root bitrate of E-Tree, aggregate capacity of E-LAN).
required: true
+ constraints:
+ - greater_or_equal: 0
leaf:
type: integer
- required: true
+ description: Specifies the throughput requirement in bits per second of leaf connections to the link when applicable to the connectivity type (e.g. for E-Tree and E LAN branches).
+ required: false
+ constraints:
+ - greater_or_equal: 0
tosca.datatypes.nfv.Qos:
derived_from: tosca.datatypes.Root
+ description: describes QoS data for a given VL used in a VNF deployment flavour
properties:
latency:
- type: integer
+ type: scalar-unit.time
+ description: Specifies the maximum latency
required: true
+ constraints:
+ - greater_than: 0 s
packet_delay_variation:
- type: integer
+ type: scalar-unit.time
+ description: Specifies the maximum jitter
required: true
+ constraints:
+ - greater_or_equal: 0 s
packet_loss_ratio:
type: float
+ description: Specifies the maximum packet loss ratio
+ required: false
constraints:
- in_range:
- 0.0
- 1.0
- required: false
- tosca.datatypes.nfv.VlProfile:
+ tosca.datatypes.nfv.IpAllocationPool:
derived_from: tosca.datatypes.Root
+ description: Specifies a range of IP addresses
properties:
- max_bit_rate_requirements:
- type: tosca.datatypes.nfv.LinkBitRateRequirements
+ start_ip_address:
+ type: string
+ description: The IP address to be used as the first one in a pool of addresses derived from the cidr block full IP range
required: true
- min_bit_rate_requirements:
- type: tosca.datatypes.nfv.LinkBitRateRequirements
+ end_ip_address:
+ type: string
+ description: The IP address to be used as the last one in a pool of addresses derived from the cidr block full IP range
required: true
- qos:
- type: tosca.datatypes.nfv.Qos
- required: false
- initiationParameters:
- type: map
- entry_schema:
- type: string
+ tosca.datatypes.nfv.L2ProtocolData:
+ derived_from: tosca.datatypes.Root
+ description: describes L2 protocol data for a given virtual link used in a specific VNF deployment flavour.
+ properties:
+ name:
+ type: string
+ description: Identifies the network name associated with this L2 protocol.
required: false
- cidr:
+ network_type:
type: string
+ description: Specifies the network type for this L2 protocol.The value may be overridden at run-time.
required: false
- networkName:
+ constraints:
+ - valid_values:
+ - flat
+ - vlan
+ - vxlan
+ - gre
+ vlan_transparent:
+ type: boolean
+ description: Specifies whether to support VLAN transparency for this L2 protocol or not.
+ required: false
+ default: false
+ mtu:
+ type: integer
+ description: Specifies the maximum transmission unit (MTU) value for this L2 protocol.
+ required: false
+ constraints:
+ - greater_than: 0
+ segmentation_id:
+ type: integer
+ required: false
+ physical_network:
type: string
required: false
- startIp:
+ tosca.datatypes.nfv.L3ProtocolData:
+ derived_from: tosca.datatypes.Root
+ description: describes L3 protocol data for a given virtual link used in a specific VNF deployment flavour.
+ properties:
+ name:
type: string
+ description: Identifies the network name associated with this L3 protocol.
required: false
- endIp:
+ ip_version:
type: string
+ description: Specifies IP version of this L3 protocol.The value of the ip_version property shall be consistent with the value of the layer_protocol in the connectivity_type property of the virtual link node.
+ required: true
+ constraints:
+ - valid_values:
+ - ipv4
+ - ipv6
+ cidr:
+ type: string
+ description: Specifies the CIDR (Classless Inter-Domain Routing) of this L3 protocol. The value may be overridden at run-time.
+ required: true
+ ip_allocation_pools:
+ type: list
+ description: Specifies the allocation pools with start and end IP addresses for this L3 protocol. The value may be overridden at run-time.
required: false
- gatewayIp:
+ entry_schema:
+ type: tosca.datatypes.nfv.IpAllocationPool
+ gateway_ip:
type: string
+ description: Specifies the gateway IP address for this L3 protocol. The value may be overridden at run-time.
required: false
- segmentationId:
- type: integer
+ dhcp_enabled:
+ type: boolean
+ description: Indicates whether DHCP (Dynamic Host Configuration Protocol) is enabled or disabled for this L3 protocol. The value may be overridden at run-time.
required: false
- physicalNetwork:
+ ipv6_address_mode:
type: string
+ description: Specifies IPv6 address mode. May be present when the value of the ipVersion attribute is "ipv6" and shall be absent otherwise. The value may be overridden at run-time.
required: false
- networkType:
+ constraints:
+ - valid_values:
+ - slaac
+ - dhcpv6-stateful
+ - dhcpv6-stateless
+ tosca.datatypes.nfv.VirtualLinkProtocolData:
+ derived_from: tosca.datatypes.Root
+ description: describes one protocol layer and associated protocol data for a given virtual link used in a specific VNF deployment flavour
+ properties:
+ associated_layer_protocol:
type: string
- required: false
+ description: Identifies one of the protocols a virtualLink gives access to (ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire) as specified by the connectivity_type property.
+ required: true
constraints:
- valid_values:
- - VLAN
- - VXLAN
- dhcpEnabled:
- type: boolean
+ - ethernet
+ - mpls
+ - odu2
+ - ipv4
+ - ipv6
+ - pseudo-wire
+ l2_protocol_data:
+ type: tosca.datatypes.nfv.L2ProtocolData
+ description: Specifies the L2 protocol data for a virtual link. Shall be present when the associatedLayerProtocol attribute indicates a L2 protocol and shall be absent otherwise.
required: false
- vlanTransparent:
- type: boolean
+ l3_protocol_data:
+ type: tosca.datatypes.nfv.L3ProtocolData
+ description: Specifies the L3 protocol data for this virtual link. Shall be present when the associatedLayerProtocol attribute indicates a L3 protocol and shall be absent otherwise.
required: false
+ tosca.datatypes.nfv.VlProfile:
+ derived_from: tosca.datatypes.Root
+ description: Describes additional instantiation data for a given VL used in a specific VNF deployment flavour.
+ properties:
+ max_bitrate_requirements:
+ type: tosca.datatypes.nfv.LinkBitrateRequirements
+ description: Specifies the maximum bitrate requirements for a VL instantiated according to this profile.
+ required: true
+ min_bitrate_requirements:
+ type: tosca.datatypes.nfv.LinkBitrateRequirements
+ description: Specifies the minimum bitrate requirements for a VL instantiated according to this profile.
+ required: true
+ qos:
+ type: tosca.datatypes.nfv.Qos
+ description: Specifies the QoS requirements of a VL instantiated according to this profile.
+ required: false
+ virtual_link_protocol_data:
+ type: list
+ description: Specifies the protocol data for a virtual link.
+ required: false
+ entry_schema:
+ type: tosca.datatypes.nfv.VirtualLinkProtocolData
tosca.datatypes.nfv.VduLevel:
derived_from: tosca.datatypes.Root
+ description: Indicates for a given Vdu.Compute in a given level the number of instances to deploy
properties:
number_of_instances:
type: integer
+ description: Number of instances of VNFC based on this VDU to deploy for this level.
required: true
+ constraints:
+ - greater_or_equal: 0
tosca.datatypes.nfv.ScaleInfo:
derived_from: tosca.datatypes.Root
+ description: Indicates for a given scaleAspect the corresponding scaleLevel
properties:
- scaleLevel:
+ scale_level:
type: integer
+ description: The scale level for a particular aspect
required: true
- tosca.datatypes.nfv.ScaleAspect:
+ constraints:
+ - greater_or_equal: 0
+ tosca.datatypes.nfv.ScalingAspect:
derived_from: tosca.datatypes.Root
properties:
name:
@@ -1750,77 +2231,302 @@ data_types:
description:
type: string
required: true
- associated_group:
- type: string
- required: false
max_scale_level:
type: integer
required: true
+ constraints:
+ - greater_or_equal: 0
+ step_deltas:
+ type: list
+ required: false
+ entry_schema:
+ type: string
tosca.datatypes.nfv.InstantiationLevel:
derived_from: tosca.datatypes.Root
+ description: Describes the scale level for each aspect that corresponds to a given level of resources to be instantiated within a deployment flavour in term of the number VNFC instances
properties:
description:
type: string
+ description: Human readable description of the level
required: true
- vdu_levels:
- type: map
- required: true
- entry_schema:
- type: tosca.datatypes.nfv.VduLevel
scale_info:
type: map
+ description: Represents for each aspect the scale level that corresponds to this instantiation level. scale_info shall be present if the VNF supports scaling.
required: false
entry_schema:
type: tosca.datatypes.nfv.ScaleInfo
+ tosca.datatypes.nfv.VnfInstantiateOperationConfiguration:
+ derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the InstantiateVnf operation.
+ properties:
+ description:
+ type: string
+ required: false
tosca.datatypes.nfv.VnfScaleOperationConfiguration:
derived_from: tosca.datatypes.Root
+ description: Represents information that affect the invocation of the ScaleVnf operation
properties:
scaling_by_more_than_one_step_supported:
type: boolean
+ description: Signals whether passing a value larger than one in the numScalingSteps parameter of the ScaleVnf operation is supported by this VNF.
+ required: false
+ default: false
tosca.datatypes.nfv.VnfScaleToLevelOperationConfiguration:
derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the ScaleVnfToLevel operation
properties:
arbitrary_target_levels_supported:
type: boolean
+ description: Signals whether scaling according to the parameter "scaleInfo" is supported by this VNF
+ required: true
tosca.datatypes.nfv.VnfHealOperationConfiguration:
derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the HealVnf operation
properties:
causes:
type: list
+ description: Supported "cause" parameter values
+ required: false
entry_schema:
type: string
tosca.datatypes.nfv.VnfTerminateOperationConfiguration:
derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the TerminateVnf
properties:
min_graceful_termination_timeout:
- type: integer
+ type: scalar-unit.time
+ description: Minimum timeout value for graceful termination of a VNF instance
+ required: true
max_recommended_graceful_termination_timeout:
- type: integer
+ type: scalar-unit.time
+ description: Maximum recommended timeout value that can be needed to gracefully terminate a VNF instance of a particular type under certain conditions, such as maximum load condition. This is provided by VNF provider as information for the operator facilitating the selection of optimal timeout value. This value is not used as constraint
+ required: false
tosca.datatypes.nfv.VnfOperateOperationConfiguration:
derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the OperateVnf operation
properties:
- min_graceful_termination_timeout:
+ min_graceful_stop_timeout:
+ type: scalar-unit.time
+ description: Minimum timeout value for graceful stop of a VNF instance
+ required: true
+ max_recommended_graceful_stop_timeout:
+ type: scalar-unit.time
+ description: Maximum recommended timeout value that can be needed to gracefully stop a VNF instance of a particular type under certain conditions, such as maximum load condition. This is provided by VNF provider as information for the operator facilitating the selection of optimal timeout value. This value is not used as constraint
+ required: false
+ tosca.datatypes.nfv.VnfChangeFlavourOperationConfiguration:
+ derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the ChangeVnfFlavour operation
+ properties:
+ description:
+ type: string
+ required: false
+ tosca.datatypes.nfv.VnfProfile:
+ derived_from: tosca.datatypes.Root
+ description: describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF.
+ properties:
+ instantiation_level:
+ type: string
+ description: Identifier of the instantiation level of the VNF DF to be used for instantiation. If not present, the default instantiation level as declared in the VNFD shall be used.
+ required: false
+ min_number_of_instances:
type: integer
- max_recommended_graceful_termination_timeout:
+ description: Minimum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
+ required: true
+ constraints:
+ - greater_or_equal: 0
+ max_number_of_instances:
type: integer
+ description: Maximum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
+ required: true
+ constraints:
+ - greater_or_equal: 0
+ tosca.datatypes.nfv.UriAuthority:
+ derived_from: tosca.datatypes.Root
+ description: information that corresponds to the authority component of a URI as specified in IETF RFC 3986 [8]
+ properties:
+ user_info:
+ type: string
+ description: user_info field of the authority component of a URI
+ required: false
+ host:
+ type: string
+ description: host field of the authority component of a URI
+ required: false
+ port:
+ type: string
+ description: port field of the authority component of a URI
+ required: false
+ tosca.datatypes.nfv.UriComponents:
+ derived_from: tosca.datatypes.Root
+ description: information used to build a URI that complies with IETF RFC 3986 [8].
+ properties:
+ scheme:
+ type: string
+ description: scheme component of a URI.
+ required: true
+ authority:
+ type: tosca.datatypes.nfv.UriAuthority
+ description: Authority component of a URI
+ required: false
+ path:
+ type: string
+ description: path component of a URI.
+ required: false
+ query:
+ type: string
+ description: query component of a URI.
+ required: false
+ fragment:
+ type: string
+ description: fragment component of a URI.
+ required: false
+ tosca.datatypes.nfv.InterfaceDetails:
+ derived_from: tosca.datatypes.Root
+ description: information used to access an interface exposed by a VNF
+ properties:
+ uri_components:
+ type: tosca.datatypes.nfv.UriComponents
+ description: Provides components to build a Uniform Ressource Identifier (URI) where to access the interface end point.
+ required: false
+ interface_specific_data:
+ type: map
+ description: Provides additional details that are specific to the type of interface considered.
+ required: false
+ entry_schema:
+ type: string
+ tosca.datatypes.nfv.VirtualLinkMonitoringParameter:
+ derived_from: tosca.datatypes.Root
+ description: Represents information on virtualised resource related performance metrics applicable to the VNF.
+ properties:
+ name:
+ type: string
+ description: Human readable name of the monitoring parameter
+ required: true
+ performance_metric:
+ type: string
+ description: Identifies a performance metric derived from those defined in ETSI GS NFV-IFA 027.The packetOutgoingVirtualLink and packetIncomingVirtualLink metrics shall be obtained by aggregation the PacketOutgoing and PacketIncoming measurements defined in clause 7.1 of GS NFV-IFA 027 of all virtual link ports attached to the virtual link to which the metrics apply.
+ required: true
+ constraints:
+ - valid_values:
+ - packet_outgoing_virtual_link
+ - packet_incoming_virtual_link
+ collection_period:
+ type: scalar-unit.time
+ description: Describes the recommended periodicity at which to collect the performance information.
+ required: false
+ constraints:
+ - greater_than: 0 s
+ tosca.datatypes.nfv.VnfcMonitoringParameter:
+ derived_from: tosca.datatypes.Root
+ description: Represents information on virtualised resource related performance metrics applicable to the VNF.
+ properties:
+ name:
+ type: string
+ description: Human readable name of the monitoring parameter
+ required: true
+ performance_metric:
+ type: string
+ description: Identifies the performance metric, according to ETSI GS NFV-IFA 027.
+ required: true
+ constraints:
+ - valid_values:
+ - v_cpu_usage_mean_vnf
+ - v_cpu_usage_peak_vnf
+ - v_memory_usage_mean_vnf
+ - v_memory_usage_peak_vnf
+ - v_disk_usage_mean_vnf
+ - v_disk_usage_peak_vnf
+ - byte_incoming_vnf_int_cp
+ - byte_outgoing_vnf_int_cp
+ - packet_incoming_vnf_int_cp
+ - packet_outgoing_vnf_int_cp
+ collection_period:
+ type: scalar-unit.time
+ description: Describes the recommended periodicity at which to collect the performance information.
+ required: false
+ constraints:
+ - greater_than: 0 s
+ tosca.datatypes.nfv.VnfChangeExtConnectivityOperationConfiguration:
+ derived_from: tosca.datatypes.Root
+ description: represents information that affect the invocation of the ChangeExtVnfConnectivity operation
+ properties:
+ description:
+ type: string
+ required: false
+ tosca.datatypes.nfv.VnfMonitoringParameter:
+ derived_from: tosca.datatypes.Root
+ description: Represents information on virtualised resource related performance metrics applicable to the VNF.
+ properties:
+ name:
+ type: string
+ description: Human readable name of the monitoring parameter
+ required: true
+ performance_metric:
+ type: string
+ description: Identifies the performance metric, according to ETSI GS NFV-IFA 027.
+ required: true
+ constraints:
+ - valid_values:
+ - v_cpu_usage_mean_vnf
+ - v_cpu_usage_peak_vnf
+ - v_memory_usage_mean_vnf
+ - v_memory_usage_peak_vnf
+ - v_disk_usage_mean_vnf
+ - v_disk_usage_peak_vnf
+ - byte_incoming_vnf_ext_cp
+ - byte_outgoing_vnf_ext_cp
+ - packet_incoming_vnf_ext_cp
+ - packet_outgoing_vnf_ext_cp
+ collection_period:
+ type: scalar-unit.time
+ description: Describes the recommended periodicity at which to collect the performance information.
+ required: false
+ constraints:
+ - greater_than: 0 s
tosca.datatypes.nfv.VnfLcmOperationsConfiguration:
derived_from: tosca.datatypes.Root
+ description: Represents information to configure lifecycle management operations
properties:
+ instantiate:
+ type: tosca.datatypes.nfv.VnfInstantiateOperationConfiguration
+ description: Configuration parameters for the InstantiateVnf operation
+ required: false
scale:
type: tosca.datatypes.nfv.VnfScaleOperationConfiguration
+ description: Configuration parameters for the ScaleVnf operation
+ required: false
scale_to_level:
type: tosca.datatypes.nfv.VnfScaleToLevelOperationConfiguration
+ description: Configuration parameters for the ScaleVnfToLevel operation
+ required: false
+ change_flavour:
+ type: tosca.datatypes.nfv.VnfChangeFlavourOperationConfiguration
+ description: Configuration parameters for the changeVnfFlavourOpConfig operation
+ required: false
heal:
type: tosca.datatypes.nfv.VnfHealOperationConfiguration
+ description: Configuration parameters for the HealVnf operation
+ required: false
terminate:
type: tosca.datatypes.nfv.VnfTerminateOperationConfiguration
+ description: Configuration parameters for the TerminateVnf operation
+ required: false
operate:
type: tosca.datatypes.nfv.VnfOperateOperationConfiguration
+ description: Configuration parameters for the OperateVnf operation
+ required: false
+ change_ext_connectivity:
+ type: tosca.datatypes.nfv.VnfChangeExtConnectivityOperationConfiguration
+ description: Configuration parameters for the changeExtVnfConnectivityOpConfig operation
+ required: false
tosca.datatypes.nfv.CpProtocolData:
derived_from: tosca.datatypes.Root
+ description: Describes and associates the protocol layer that a CP uses together with other protocol and connection point information
properties:
- asscociated_layer_protocol:
+ associated_layer_protocol:
type: string
+ required: true
+ description: One of the values of the property layer_protocols of the CP
constraints:
- valid_values:
- ethernet
@@ -1829,40 +2535,185 @@ data_types:
- ipv4
- ipv6
- pseudo-wire
- required: true
address_data:
- type: tosca.datatypes.nfv.AddressData
+ type: list
+ description: Provides information on the addresses to be assigned to the CP
+ entry_schema:
+ type: tosca.datatypes.nfv.AddressData
+ required: false
+ tosca.datatypes.nfv.VnfAdditionalConfigurableProperties:
+ derived_from: tosca.datatypes.Root
+ description: is an empty base type for deriving data types for describing additional configurable properties for a given VNF
+ properties:
+ description:
+ type: string
required: false
tosca.datatypes.nfv.VnfConfigurableProperties:
derived_from: tosca.datatypes.Root
+ description: indicates configuration properties for a given VNF (e.g. related to auto scaling and auto healing).
properties:
is_autoscale_enabled:
type: boolean
+ description: It permits to enable (TRUE)/disable (FALSE) the auto-scaling functionality. If the properties is not present for configuring, then VNF property is not supported
required: false
is_autoheal_enabled:
type: boolean
+ description: It permits to enable (TRUE)/disable (FALSE) the auto-healing functionality. If the properties is not present for configuring, then VNF property is not supported
+ required: false
+ additional_configurable_properties:
+ description: It provides VNF specific configurable properties that can be modified using the ModifyVnfInfo operation
required: false
+ type: tosca.datatypes.nfv.VnfAdditionalConfigurableProperties
tosca.datatypes.nfv.VnfInfoModifiableAttributesExtensions:
derived_from: tosca.datatypes.Root
+ description: is an empty base type for deriving data types for describing VNF-specific extension
properties:
description:
type: string
required: false
tosca.datatypes.nfv.VnfInfoModifiableAttributesMetadata:
derived_from: tosca.datatypes.Root
+ description: is an empty base type for deriving data types for describing VNF-specific metadata
properties:
description:
type: string
required: false
tosca.datatypes.nfv.VnfInfoModifiableAttributes:
derived_from: tosca.datatypes.Root
+ description: Describes VNF-specific extension and metadata for a given VNF
properties:
extensions:
type: tosca.datatypes.nfv.VnfInfoModifiableAttributesExtensions
+ description: \"Extension\" properties of VnfInfo that are writeable
required: false
metadata:
type: tosca.datatypes.nfv.VnfInfoModifiableAttributesMetadata
+ description: \"Metadata\" properties of VnfInfo that are writeable
required: false
+ tosca.datatypes.nfv.VirtualLinkBitrateLevel:
+ derived_from: tosca.datatypes.Root
+ description: Describes bitrate requirements applicable to the virtual link instantiated from a particicular VnfVirtualLink
+ properties:
+ description:
+ type: string
+ required: false
+ bitrate_requirements:
+ type: tosca.datatypes.nfv.LinkBitrateRequirements
+ description: Virtual link bitrate requirements for an instantiation level or bitrate delta for a scaling step
+ required: true
+ tosca.datatypes.nfv.VnfOperationAdditionalParameters:
+ derived_from: tosca.datatypes.Root
+ description: Is an empty base type for deriving data type for describing VNF-specific parameters to be passed when invoking lifecycle management operations
+ properties:
+ description:
+ type: string
+ required: false
+ tosca.datatypes.nfv.VirtualFileStorageData:
+ derived_from: tosca.datatypes.Root
+ description: VirtualFileStorageData describes file storage requirements associated with compute resources in a particular VDU
+ properties:
+ size_of_storage:
+ type: scalar-unit.size
+ description: Size of virtualized storage resource
+ required: true
+ file_system_protocol:
+ type: string
+ description: The shared file system protocol (e.g. NFS, CIFS)
+ required: true
+ tosca.datatypes.nfv.VirtualObjectStorageData:
+ derived_from: tosca.datatypes.Root
+ description: VirtualObjectStorageData describes object storage requirements associated with compute resources in a particular VDU
+ properties:
+ max_size_of_storage:
+ type: scalar-unit.size
+ description: Maximum size of virtualized storage resource
+ required: false
+ tosca.datatypes.nfv.VirtualBlockStorageData:
+ derived_from: tosca.datatypes.Root
+ description: VirtualBlockStorageData describes block storage requirements associated with compute resources in a particular VDU, either as a local disk or as virtual attached storage
+ properties:
+ size_of_storage:
+ type: scalar-unit.size
+ description: Size of virtualised storage resource
+ required: true
+ vdu_storage_requirements:
+ type: map
+ description: The hardware platform specific storage requirements. A map of strings that contains a set of key-value pairs that represents the hardware platform specific storage deployment requirements.
+ required: false
+ entry_schema:
+ type: string
+ rdma_enabled:
+ type: boolean
+ description: Indicates if the storage support RDMA
+ required: false
+ default: false
+ tosca.datatypes.nfv.SwImageData:
+ derived_from: tosca.datatypes.Root
+ description: describes information related to a software image artifact
+ properties:
+ name:
+ type: string
+ description: Name of this software image
+ required: true
+ version:
+ type: string
+ description: Version of this software image
+ required: true
+ checksum:
+ type: string
+ description: Checksum of the software image file
+ required: true
+ container_format:
+ type: string
+ description: The container format describes the container file format in which software image is provided
+ required: true
+ constraints:
+ - valid_values:
+ - aki
+ - ami
+ - ari
+ - bare
+ - docker
+ - ova
+ - ovf
+ disk_format:
+ type: string
+ description: The disk format of a software image is the format of the underlying disk image
+ required: true
+ constraints:
+ - valid_values:
+ - aki
+ - ami
+ - ari
+ - iso
+ - qcow2
+ - raw
+ - vdi
+ - vhd
+ - vhdx
+ - vmdk
+ min_disk:
+ type: scalar-unit.size
+ description: The minimal disk size requirement for this software image
+ required: true
+ min_ram:
+ type: scalar-unit.size
+ description: The minimal RAM requirement for this software image
+ required: false
+ size:
+ type: scalar-unit.size
+ description: The size of this software image
+ required: true
+ operating_system:
+ type: string
+ description: Identifies the operating system used in the software image
+ required: false
+ supported_virtualisation_environments:
+ type: list
+ description: Identifies the virtualisation environments (e.g. hypervisor) compatible with this software image
+ required: false
+ entry_schema:
+ type: string
onap.datatypes.monitoring.metricsPerEventName:
derived_from: tosca.datatypes.Root
properties:
diff --git a/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar b/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar
deleted file mode 100755
index 727ef16b..00000000
--- a/src/test/resources/example/sdc/service-Vloadbalancerms-csar.csar
+++ /dev/null
Binary files differ
diff --git a/src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar b/src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar
new file mode 100644
index 00000000..3330dd1e
--- /dev/null
+++ b/src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar
Binary files differ
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
index f19aa0da..0db977bb 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -199,6 +199,18 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "GET":
+ print "self.path start with /policy/api/v1/policytypes/, generating response json..."
+ jsonGenerated = "{\"policyTypeId\": \"onap.policies.controlloop.operational\",\"policyTypeVersion\": \"1.0.0\",\"policyId\": \"OPERATIONAL_z711F_v1_0_ResourceInstanceName1_tca\"}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+
+ with open(cached_file_header, 'w') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w') as f:
+ f.write(jsonGenerated)
+ return True
else:
return False
diff --git a/src/test/resources/tosca/guard1-policy-payload.json b/src/test/resources/tosca/guard1-policy-payload.json
index bacf174f..b4e0809c 100644
--- a/src/test/resources/tosca/guard1-policy-payload.json
+++ b/src/test/resources/tosca/guard1-policy-payload.json
@@ -1,15 +1,15 @@
{
"policy-id": "guard1",
- "contents": {
+ "content": {
"recipe": "Rebuild",
"actor": "SO",
"clname": "testloop",
- "guardTargets": ".*",
- "minGuard": "3",
- "maxGuard": "7",
- "limitGuard": "",
- "timeUnitsGuard": "",
- "timeWindowGuard": "",
+ "targets": ".*",
+ "min": "3",
+ "max": "7",
+ "limit": "",
+ "timeUnits": "",
+ "timeWindow": "",
"guardActiveStart": "00:00:01-05:00",
"guardActiveEnd": "23:59:01-05:00"
}
diff --git a/src/test/resources/tosca/guard2-policy-payload.json b/src/test/resources/tosca/guard2-policy-payload.json
index 89f7ec89..29beb6b9 100644
--- a/src/test/resources/tosca/guard2-policy-payload.json
+++ b/src/test/resources/tosca/guard2-policy-payload.json
@@ -1,15 +1,15 @@
{
"policy-id": "guard2",
- "contents": {
+ "content": {
"recipe": "Migrate",
"actor": "SO",
"clname": "testloop",
- "guardTargets": ".*",
- "minGuard": "1",
- "maxGuard": "2",
- "limitGuard": "",
- "timeUnitsGuard": "",
- "timeWindowGuard": "",
+ "targets": ".*",
+ "min": "1",
+ "max": "2",
+ "limit": "",
+ "timeUnits": "",
+ "timeWindow": "",
"guardActiveStart": "00:00:01-05:00",
"guardActiveEnd": "23:59:01-05:00"
}
diff --git a/src/test/resources/tosca/model-properties.json b/src/test/resources/tosca/model-properties.json
new file mode 100644
index 00000000..9e7db8eb
--- /dev/null
+++ b/src/test/resources/tosca/model-properties.json
@@ -0,0 +1,123 @@
+{
+ "serviceDetails": {
+ "serviceType": "",
+ "namingPolicy": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "serviceEcompNaming": "true",
+ "serviceRole": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
+ "ecompGeneratedNaming": "true",
+ "category": "Network L4+",
+ "type": "Service",
+ "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
+ "instantiationType": "A-la-carte"
+ },
+ "resourceDetails": {
+ "CP": {
+
+ },
+ "VL": {
+
+ },
+ "VF": {
+ "vLoadBalancerMS 0": {
+ "resourceVendor": "Test",
+ "resourceVendorModelNumber": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
+ "subcategory": "Load Balancer",
+ "category": "Application L4+",
+ "type": "VF",
+ "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
+ "version": "1.0",
+ "resourceVendorRelease": "1.0",
+ "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
+ }
+ },
+ "CR": {
+
+ },
+ "VFC": {
+
+ },
+ "PNF": {
+
+ },
+ "Service": {
+
+ },
+ "CVFC": {
+
+ },
+ "Service Proxy": {
+
+ },
+ "Configuration": {
+
+ },
+ "AllottedResource": {
+
+ },
+ "VFModule": {
+ "Vloadbalancerms..vpkg..module-1": {
+ "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
+ "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vpkg",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vdns..module-3": {
+ "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
+ "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vdns",
+ "max_vf_module_instances": 50,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..base_template..module-0": {
+ "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
+ "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
+ "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "min_vf_module_instances": 1,
+ "vf_module_label": "base_template",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Base",
+ "isBase": true,
+ "initial_count": 1,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vlb..module-2": {
+ "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
+ "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vlb",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-no-guard-properties.json b/src/test/resources/tosca/operational-policy-no-guard-properties.json
index 30c04404..fdb1906a 100644
--- a/src/test/resources/tosca/operational-policy-no-guard-properties.json
+++ b/src/test/resources/tosca/operational-policy-no-guard-properties.json
@@ -22,7 +22,7 @@
"failure_guard": "",
"target": {
"type": "VM",
- "resourceId": "",
+ "resourceID": "",
"modelInvariantId": "",
"modelVersionId": "",
"modelName": "",
diff --git a/src/test/resources/tosca/operational-policy-payload-legacy.yaml b/src/test/resources/tosca/operational-policy-payload-legacy.yaml
new file mode 100644
index 00000000..41184c9c
--- /dev/null
+++ b/src/test/resources/tosca/operational-policy-payload-legacy.yaml
@@ -0,0 +1,39 @@
+controlLoop:
+ abatement: true
+ controlLoopName: control loop
+ timeout: 30
+ trigger_policy: new1
+ version: 2.0.0
+policies:
+- actor: SO
+ failure: new2
+ failure_exception: new2
+ failure_guard: new2
+ failure_retries: new2
+ failure_timeout: new2
+ id: new1
+ payload:
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ recipe: Rebuild
+ retry: 10
+ success: new2
+ target:
+ resourceTargetId: test
+ type: VFC
+ timeout: 20
+- actor: SDNC
+ failure: final_failure
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
+ failure_retries: final_failure_retries
+ failure_timeout: final_failure_timeout
+ id: new2
+ payload: ''
+ recipe: Migrate
+ retry: 30
+ success: final_success
+ target:
+ resourceTargetId: test
+ type: VFC
+ timeout: 40
diff --git a/src/test/resources/tosca/operational-policy-payload.json b/src/test/resources/tosca/operational-policy-payload.json
index 1017d0a2..5097654d 100644
--- a/src/test/resources/tosca/operational-policy-payload.json
+++ b/src/test/resources/tosca/operational-policy-payload.json
@@ -1,4 +1,4 @@
{
"policy-id": "testPolicy",
- "content": "tosca_definitions_version%3A+tosca_simple_yaml_1_0_0%0Atopology_template%3A%0A++policies%3A%0A++-+testPolicy%3A%0A++++++type%3A+onap.policies.controlloop.Operational%0A++++++version%3A+1.0.0%0A++++++metadata%3A+%7Bpolicy-id%3A+testPolicy%7D%0A++++++properties%3A%0A++++++++controlLoop%3A+%7BcontrolLoopName%3A+control+loop%2C+version%3A+2.0.0%2C+trigger_policy%3A+new1%2C%0A++++++++++timeout%3A+%2730%27%2C+abatement%3A+%27true%27%7D%0A++++++++policies%3A%0A++++++++-+id%3A+new1%0A++++++++++recipe%3A+Rebuild%0A++++++++++retry%3A+%2710%27%0A++++++++++timeout%3A+%2720%27%0A++++++++++actor%3A+SO%0A++++++++++payload%3A+test%0A++++++++++success%3A+new2%0A++++++++++failure%3A+new2%0A++++++++++failure_timeout%3A+new2%0A++++++++++failure_retries%3A+new2%0A++++++++++failure_exception%3A+new2%0A++++++++++failure_guard%3A+new2%0A++++++++++target%3A+%7Btype%3A+VFC%2C+resourceTargetId%3A+test%7D%0A++++++++-+id%3A+new2%0A++++++++++recipe%3A+Migrate%0A++++++++++retry%3A+%2730%27%0A++++++++++timeout%3A+%2740%27%0A++++++++++actor%3A+SDNC%0A++++++++++payload%3A+test%0A++++++++++target%3A+%7Btype%3A+VFC%2C+resourceTargetId%3A+test%7D%0A"
+ "content": "controlLoop%3A%0A++abatement%3A+true%0A++controlLoopName%3A+control+loop%0A++timeout%3A+30%0A++trigger_policy%3A+new1%0A++version%3A+2.0.0%0Apolicies%3A%0A-+actor%3A+SO%0A++failure%3A+new2%0A++failure_exception%3A+new2%0A++failure_guard%3A+new2%0A++failure_retries%3A+new2%0A++failure_timeout%3A+new2%0A++id%3A+new1%0A++payload%3A%0A++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B10%5D.value%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B15%5D.value%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B22%5D.value%22%7D%5D%27%0A++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++recipe%3A+Rebuild%0A++retry%3A+10%0A++success%3A+new2%0A++target%3A%0A++++resourceTargetId%3A+test%0A++++type%3A+VFC%0A++timeout%3A+20%0A-+actor%3A+SDNC%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+new2%0A++payload%3A+%27%27%0A++recipe%3A+Migrate%0A++retry%3A+30%0A++success%3A+final_success%0A++target%3A%0A++++resourceTargetId%3A+test%0A++++type%3A+VFC%0A++timeout%3A+40%0A"
} \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-payload.yaml b/src/test/resources/tosca/operational-policy-payload.yaml
index 68116b00..c3a6b5c2 100644
--- a/src/test/resources/tosca/operational-policy-payload.yaml
+++ b/src/test/resources/tosca/operational-policy-payload.yaml
@@ -4,28 +4,39 @@ topology_template:
- testPolicy:
type: onap.policies.controlloop.Operational
version: 1.0.0
- metadata: {policy-id: testPolicy}
+ metadata:
+ policy-id: testPolicy
properties:
- controlLoop: {controlLoopName: control loop, version: 2.0.0, trigger_policy: new1,
- timeout: '30', abatement: 'true'}
+ controlLoop:
+ controlLoopName: control loop
+ version: 2.0.0
+ trigger_policy: new1
+ timeout: '30'
+ abatement: 'true'
policies:
- id: new1
recipe: Rebuild
retry: '10'
timeout: '20'
actor: SO
- payload: test
+ payload:
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
success: new2
failure: new2
failure_timeout: new2
failure_retries: new2
failure_exception: new2
failure_guard: new2
- target: {type: VFC, resourceTargetId: test}
+ target:
+ type: VFC
+ resourceTargetId: test
- id: new2
recipe: Migrate
retry: '30'
timeout: '40'
actor: SDNC
- payload: test
- target: {type: VFC, resourceTargetId: test}
+ payload: ''
+ target:
+ type: VFC
+ resourceTargetId: test
diff --git a/src/test/resources/tosca/operational-policy-properties.json b/src/test/resources/tosca/operational-policy-properties.json
index 50361659..bfce6b33 100644
--- a/src/test/resources/tosca/operational-policy-properties.json
+++ b/src/test/resources/tosca/operational-policy-properties.json
@@ -4,12 +4,12 @@
"recipe": "Rebuild",
"actor": "SO",
"clname": "testloop",
- "guardTargets": ".*",
- "minGuard": "3",
- "maxGuard": "7",
- "limitGuard": "",
- "timeUnitsGuard": "",
- "timeWindowGuard": "",
+ "targets": ".*",
+ "min": "3",
+ "max": "7",
+ "limit": "",
+ "timeUnits": "",
+ "timeWindow": "",
"guardActiveStart": "00:00:01-05:00",
"guardActiveEnd": "23:59:01-05:00"
},
@@ -17,12 +17,12 @@
"recipe": "Migrate",
"actor": "SO",
"clname": "testloop",
- "guardTargets": ".*",
- "minGuard": "1",
- "maxGuard": "2",
- "limitGuard": "",
- "timeUnitsGuard": "",
- "timeWindowGuard": "",
+ "targets": ".*",
+ "min": "1",
+ "max": "2",
+ "limit": "",
+ "timeUnits": "",
+ "timeWindow": "",
"guardActiveStart": "00:00:01-05:00",
"guardActiveEnd": "23:59:01-05:00"
}
@@ -42,7 +42,7 @@
"retry": "10",
"timeout": "20",
"actor": "SO",
- "payload": "test",
+ "payload": "requestParameters: '{\"usePreload\":true,\"userParams\":[]}'\r\nconfigurationParameters: '[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[10].value\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[15].value\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[22].value\"}]'",
"success": "new2",
"failure": "new2",
"failure_timeout": "new2",
@@ -60,7 +60,7 @@
"retry": "30",
"timeout": "40",
"actor": "SDNC",
- "payload": "test",
+ "payload": "",
"target": {
"type": "VFC",
"resourceTargetId": "test"