summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/test')
-rw-r--r--POLICY-SDK-APP/src/test/java/org/openecomp/policy/admin/PolicyManagerServletTest.java155
-rw-r--r--POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/AdminTabControllerTest.java74
-rw-r--r--POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/CreateDcaeMicroServiceControllerTest.java647
-rw-r--r--POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PDPControllerTest.java98
-rw-r--r--POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PolicyControllerTest.java66
-rw-r--r--POLICY-SDK-APP/src/test/resources/Config_SampleTest1206.1.xml90
-rw-r--r--POLICY-SDK-APP/src/test/resources/logback.xml254
-rw-r--r--POLICY-SDK-APP/src/test/resources/policy_tosca_tca_v1707.yml65
-rw-r--r--POLICY-SDK-APP/src/test/resources/schedulerPolicies1707.xmi156
9 files changed, 1605 insertions, 0 deletions
diff --git a/POLICY-SDK-APP/src/test/java/org/openecomp/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/admin/PolicyManagerServletTest.java
new file mode 100644
index 000000000..773955d85
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/admin/PolicyManagerServletTest.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.admin;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.controller.PolicyController;
+import org.openecomp.policy.model.Roles;
+import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
+import org.openecomp.policy.rest.jpa.PolicyVersion;
+import org.openecomp.policy.rest.jpa.UserInfo;
+
+public class PolicyManagerServletTest extends Mockito{
+
+ private static Logger logger = FlexLogger.getLogger(PolicyManagerServletTest.class);
+
+ private static List<Object> rolesdata;
+ private static List<Object> policyData;
+ private static List<Object> policyEditorScopes;
+ private static List<Object> policyVersion;
+
+ @Before
+ public void setUp() throws Exception{
+ logger.info("setUp: Entering");
+ UserInfo userinfo = new UserInfo();
+ userinfo.setUserLoginId("Test");
+ userinfo.setUserName("Test");
+ //Roles Data
+ rolesdata = new ArrayList<>();
+ Roles roles = new Roles();
+ roles.setLoginId("Test");
+ roles.setRole("super-admin");
+ Roles roles1 = new Roles();
+ roles1.setLoginId("Test");
+ roles1.setRole("admin");
+ roles1.setScope("['com','Test']");
+ rolesdata.add(roles);
+ rolesdata.add(roles1);
+
+ //PolicyEntity Data
+ policyData = new ArrayList<>();
+ String policyContent = "";
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ policyContent = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml"));
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
+ }
+ PolicyEntity entity = new PolicyEntity();
+ entity.setPolicyName("Config_SampleTest.1.xml");
+ entity.setPolicyData(policyContent);
+ entity.setScope("com");
+ policyData.add(entity);
+
+ //PolicyEditorScopes data
+ policyEditorScopes = new ArrayList<>();
+ PolicyEditorScopes scopes = new PolicyEditorScopes();
+ scopes.setScopeName("com");
+ scopes.setUserCreatedBy(userinfo);
+ scopes.setUserModifiedBy(userinfo);
+ PolicyEditorScopes scopes1 = new PolicyEditorScopes();
+ scopes1.setScopeName("com\\Test");
+ scopes1.setUserCreatedBy(userinfo);
+ scopes1.setUserModifiedBy(userinfo);
+ policyEditorScopes.add(scopes);
+ policyEditorScopes.add(scopes1);
+
+ //PolicyVersion data
+ policyVersion = new ArrayList<>();
+ PolicyVersion policy = new PolicyVersion();
+ policy.setPolicyName("com\\Config_SampleTest1206");
+ policy.setActiveVersion(1);
+ policy.setHigherVersion(1);
+ policy.setCreatedBy("Test");
+ policy.setModifiedBy("Test");
+ policyVersion.add(policy);
+ }
+
+ @Test
+ public void testDescribePolicy(){
+ PolicyManagerServlet servlet = new PolicyManagerServlet();
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ HttpServletResponse response = mock(HttpServletResponse.class);
+ PolicyController controller = mock(PolicyController.class);
+
+ BufferedReader reader = new BufferedReader(new StringReader("{params: { mode: 'DESCRIBEPOLICYFILE', path: 'com.Config_SampleTest1206.1.xml'}}"));
+ try {
+ when(request.getReader()).thenReturn(reader);
+ when(controller.getDataByQuery("FROM PolicyEntity where policyName = 'Config_SampleTest1206.1.xml' and scope ='com'")).thenReturn(policyData);
+ servlet.setPolicyController(controller);
+ servlet.doPost(request, response);
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
+ }
+ }
+
+
+ @Test
+ public void testPolicyScopeList(){
+ PolicyManagerServlet servlet = new PolicyManagerServlet();
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ HttpServletResponse response = mock(HttpServletResponse.class);
+ PolicyController controller = mock(PolicyController.class);
+ List<String> list = new ArrayList<>();
+ list.add("{params: { mode: 'LIST', path: '/', onlyFolders: false}}");
+ list.add("{params: { mode: 'LIST', path: '/com', onlyFolders: false}}");
+ for(int i =0; i < list.size(); i++){
+ BufferedReader reader = new BufferedReader(new StringReader(list.get(i)));
+ try {
+ when(request.getReader()).thenReturn(reader);
+ when(controller.getRoles("Test")).thenReturn(rolesdata);
+ when(controller.getDataByQuery("from PolicyEditorScopes")).thenReturn(policyEditorScopes);
+ when(controller.getDataByQuery("from PolicyEditorScopes where SCOPENAME like 'com%'")).thenReturn(policyEditorScopes);
+ when(controller.getDataByQuery("from PolicyVersion where POLICY_NAME like 'com%'")).thenReturn(policyVersion);
+ servlet.setPolicyController(controller);
+ servlet.setTestUserId("Test");
+ servlet.doPost(request, response);
+ } catch (Exception e1) {
+ logger.error("Exception Occured"+e1);
+ }
+ }
+ }
+
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/AdminTabControllerTest.java b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/AdminTabControllerTest.java
new file mode 100644
index 000000000..43b8a6f25
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/AdminTabControllerTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controller;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.GlobalRoleSettings;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+public class AdminTabControllerTest {
+
+ private static Logger logger = FlexLogger.getLogger(AdminTabControllerTest.class);
+ private static CommonClassDao commonClassDao;
+
+ @Before
+ public void setUp() throws Exception {
+
+ logger.info("setUp: Entering");
+ commonClassDao = mock(CommonClassDao.class);
+ GlobalRoleSettings globalRole = new GlobalRoleSettings();
+ globalRole.setLockdown(true);
+ globalRole.setRole("super-admin");
+ List<Object> globalRoles = new ArrayList<>();
+ globalRoles.add(globalRole);
+ when(commonClassDao.getData(GlobalRoleSettings.class)).thenReturn(globalRoles);
+ }
+
+ @Test
+ public void testGetAdminRole(){
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ MockHttpServletResponse response = new MockHttpServletResponse();
+
+ AdminTabController admin = new AdminTabController();
+ AdminTabController.setCommonClassDao(commonClassDao);
+ admin.getAdminTabEntityData(request, response);
+
+ try {
+ assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("lockdowndata"));
+ } catch (UnsupportedEncodingException e) {
+ logger.error("Exception Occured"+e);
+ }
+ }
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/CreateDcaeMicroServiceControllerTest.java b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/CreateDcaeMicroServiceControllerTest.java
new file mode 100644
index 000000000..ca4f24949
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/CreateDcaeMicroServiceControllerTest.java
@@ -0,0 +1,647 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.controller;
+
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ReadListener;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.ConfigurationDataEntity;
+import org.openecomp.policy.rest.jpa.MicroServiceModels;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.fge.jackson.JsonLoader;
+
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
+
+/**
+ * The class <code>CreateDcaeMicroServiceControllerTest</code> contains tests
+ * for the class {@link <code>CreateDcaeMicroServiceController</code>}*
+ *
+ * All JUnits are designed to run in the local development environment
+ * where they have write privileges and can execute time-sensitive
+ * tasks.
+ *
+ *
+ *
+ */
+
+public class CreateDcaeMicroServiceControllerTest {
+
+ private static Logger logger = FlexLogger.getLogger(CreateDcaeMicroServiceControllerTest.class);
+ private static CommonClassDao commonClassDao;
+ private String jsonString = null;
+ private String configBodyString = null;
+ private HttpServletRequest request = null;
+
+ @Before
+ public void setUp() throws Exception {
+
+ logger.info("setUp: Entering");
+ commonClassDao = mock(CommonClassDao.class);
+ List<Object> microServiceModelsData = new ArrayList<Object>();
+ MicroServiceModels testData = new MicroServiceModels();
+ testData.setVersion("OpenEcomp-Junit");
+ microServiceModelsData.add(testData);
+
+ // mock the getDataById() call
+ when(commonClassDao.getDataById(MicroServiceModels.class, "modelName", "test")).thenReturn(microServiceModelsData);
+
+ jsonString = "{\"policyData\": {\"error\": \"\", \"inprocess\": false,\"model\": {\"name\": \"testingdata\", "
+ + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", "
+ + " \"version\": \"\",\"createdBy\": \"someone\", \"modifiedBy\": \"someone\", \"content\": \"\",\"recursive\": false},"
+ + " \"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\" },"
+ + " \"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\",\"policyName\": \"may1501\", "
+ + " \"policyDescription\": \"testing input\", \"ecompName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\",\"riskLevel\": \"2\","
+ + " \"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\",\"version\": \"1707.41.02\",\"ruleGridData\": [ [\"fileId\"]],\"ttlDate\": null}}, "
+ + " \"policyJSON\": {\"pmTableName\": \"test\", \"dmdTopic\": \"1\",\"fileId\": \"56\"} }";
+
+ configBodyString = "{\"service\":\"SniroPolicyEntityTest\",\"policyName\":\"someone\",\"description\":\"test\",\"templateVersion\":\"1607\",\"version\":\"HD\","
+ + "\"priority\":\"2\",\"content\":{\"lastPolled\":\"1\",\"boolen-test\":\"true\",\"created\":\"test\",\"retiredDate\":\"test\",\"scope\":\"SNIRO_PLACEMENT_VDHV\","
+ + "\"name\":\"test\",\"lastModified\":\"test\",\"state\":\"CREATED\",\"type\":\"CONFIG\",\"intent\":\"test\",\"target\":\"SNIRO\"}}";
+
+ request = mock(HttpServletRequest.class);
+ BufferedReader br = new BufferedReader(new StringReader(jsonString));
+ // mock the getReader() call
+ when(request.getReader()).thenReturn(br);
+
+ logger.info("setUp: exit");
+ }
+
+
+ /**
+ * Run the PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter,
+ * JsonNode) method test
+ */
+
+ @Test
+ public void testSetDataToPolicyRestAdapter() {
+
+ logger.debug("testSetDataToPolicyRestAdapter: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+ CreateDcaeMicroServiceController.setCommonClassDao(commonClassDao);
+
+ JsonNode root = null;
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ PolicyRestAdapter policyData = null;
+ try {
+ root = JsonLoader.fromString(jsonString);
+ policyData = (PolicyRestAdapter)mapper.readValue(root.get("policyData").get("policy").toString(), PolicyRestAdapter.class);
+ } catch (Exception e) {
+ logger.error("testSetDataToPolicyRestAdapter", e);
+ }
+
+ PolicyRestAdapter result = controller.setDataToPolicyRestAdapter(policyData, root);
+ assertTrue(result != null && result.getJsonBody() != null && !result.getJsonBody().isEmpty());
+
+ logger.debug("result.getJsonBody() : " + result.getJsonBody());
+ logger.debug("testSetDataToPolicyRestAdapter: exit");
+ }
+
+ /**
+ * Run the void stringBetweenDots(String, String) method test
+ */
+
+ @Test
+ public void testStringBetweenDots() {
+
+ logger.debug("testStringBetweenDots: enter");
+
+ //expect: uniqueKeys should contain a string value
+ CreateDcaeMicroServiceController controllerA = new CreateDcaeMicroServiceController();
+ String str = "testing\\.byCorrectWay\\.OfDATA";
+ String value = null;
+ assertEquals(1, controllerA.stringBetweenDots(str, value));
+
+ //expect: uniqueKeys should not contain a string value
+ str = "testing\byWrongtWay.\\OfDATA";
+ CreateDcaeMicroServiceController controllerB = new CreateDcaeMicroServiceController();
+ assertEquals(0, controllerB.stringBetweenDots(str, value));
+
+ logger.debug("testStringBetweenDots: exit");
+ }
+
+ /**
+ * Run the Map<String,String> load(String) method test
+ */
+
+ @Test
+ public void testLoad() {
+
+ logger.debug("testLoad: enter");
+
+ boolean isLocalTesting = true;
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+ String fileName = null;
+ Map<String,String> result = null;
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ fileName = new File(classLoader.getResource("policy_tosca_tca_v1707.yml").getFile()).getAbsolutePath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured while loading file"+e1);
+ }
+ if(isLocalTesting){
+ try {
+ result = controller.load(fileName);
+ } catch (IOException e) {
+ logger.error("testLoad", e);
+ result = null;
+ }
+
+ assertTrue(result != null && !result.isEmpty());
+ logger.debug("result : " + result);
+ }
+
+ logger.debug("testLoad: exit");
+ }
+
+ /**
+ * Run the void parseTosca(String) method test
+ */
+
+ @Test
+ public void testParseTosca() {
+
+ logger.debug("testParseTosca: enter");
+ boolean isLocalTesting = true;
+ String fileName = null;
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ fileName = new File(classLoader.getResource("policy_tosca_tca_v1707.yml").getFile()).getAbsolutePath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured while loading file"+e1);
+ }
+
+ CreateDcaeMicroServiceController contoller = new CreateDcaeMicroServiceController();
+ if(isLocalTesting){
+ try {
+ contoller.parseTosca(fileName);
+ }catch (Exception e) {
+ fail("parseTosca caused error: " + e);
+ }
+ }
+ logger.debug("testParseTosca: exit");
+ }
+
+ /**
+ * Run the ModelAndView getDCAEMSTemplateData(HttpServletRequest,
+ * HttpServletResponse) method test
+ */
+
+ @Test
+ public void testGetDCAEMSTemplateData() {
+
+ logger.debug("testGetDCAEMSTemplateData: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ String msModelJson = "{\"policyData\":\"DkatPolicyBody\"}";
+ try {
+
+ CreateDcaeMicroServiceController.setCommonClassDao(commonClassDao);
+
+ BufferedReader br = new BufferedReader(new StringReader(msModelJson));
+ // mock the getReader() call
+ when(request.getReader()).thenReturn(br);
+
+ List<Object> microServiceModelsData = new ArrayList<Object>();
+ MicroServiceModels testData = new MicroServiceModels();
+ testData.setVersion("1707.4.1.2-Junit");
+ microServiceModelsData.add(testData);
+ // mock the getDataById() call with the same MS model name
+ when(commonClassDao.getDataById(MicroServiceModels.class, "modelName", "DkatPolicyBody")).thenReturn(microServiceModelsData);
+
+ controller.getDCAEMSTemplateData(request, response);
+
+ assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("dcaeModelData"));
+
+ logger.debug("response: " + response.getContentAsString());
+
+ } catch (Exception e) {
+ logger.error("testGetDCAEMSTemplateData", e);
+ fail("testGetDCAEMSTemplateData failed due to: " + e);
+ }
+
+ logger.debug("testGetDCAEMSTemplateData: exit");
+ }
+
+ /**
+ * Run the ModelAndView getModelServiceVersionData(HttpServletRequest,
+ * HttpServletResponse) method test
+ */
+
+ @Test
+ public void testGetModelServiceVersionData() {
+
+ logger.debug("testGetModelServiceVersionData: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ String msModelJson = "{\"policyData\":\"DkatPolicyBody\"}";
+ try {
+
+ CreateDcaeMicroServiceController.setCommonClassDao(commonClassDao);
+
+ BufferedReader br = new BufferedReader(new StringReader(msModelJson));
+ // mock the getReader() call
+ when(request.getReader()).thenReturn(br);
+
+ List<Object> microServiceModelsData = new ArrayList<Object>();
+ MicroServiceModels testData = new MicroServiceModels();
+ testData.setVersion("1707.4.1.2-Junit");
+ microServiceModelsData.add(testData);
+
+ // mock the getDataById() call with the same MS model name
+ when(commonClassDao.getDataById(MicroServiceModels.class, "modelName", "DkatPolicyBody")).thenReturn(microServiceModelsData);
+ controller.getModelServiceVersionData(request, response);
+
+ assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("1707.4.1.2-Junit"));
+
+ logger.debug("response: " + response.getContentAsString());
+
+ } catch (Exception e) {
+ logger.error("testGetModelServiceVersionData", e);
+ fail("testGetModelServiceVersionData failed due to: " + e);
+ }
+
+ logger.debug("testGetModelServiceVersionData: exit");
+ }
+
+ /**
+ * Run the void getDCAEPriorityValuesData(HttpServletRequest,
+ * HttpServletResponse) method test
+ */
+
+ @Test
+ public void testGetDCAEPriorityValuesData() {
+
+ logger.debug("testGetDCAEPriorityValuesData: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ try{
+ controller.getDCAEPriorityValuesData(request, response);
+ assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("priorityDatas"));
+ logger.debug("response: " + response.getContentAsString());
+ } catch (Exception e) {
+ logger.error("testGetDCAEPriorityValuesData", e);
+ fail("testGetDCAEPriorityValuesData failed due to: " + e);
+ }
+
+ logger.debug("testGetDCAEPriorityValuesData: exit");
+ }
+
+ /**
+ * Run the void prePopulateDCAEMSPolicyData(PolicyRestAdapter,
+ * PolicyEntity) method test
+ */
+
+ @Test
+ public void testPrePopulateDCAEMSPolicyData() {
+
+ logger.debug("testPrePopulateDCAEMSPolicyData: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+
+ // populate an entity object for testing
+ PolicyEntity entity = new PolicyEntity();
+ ConfigurationDataEntity configData = new ConfigurationDataEntity();
+ configData.setConfigBody(configBodyString);
+ entity.setConfigurationData(configData);
+
+ JsonNode root = null;
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ PolicyRestAdapter restAdapter = null;
+
+ try {
+ root = JsonLoader.fromString(jsonString);
+ restAdapter = (PolicyRestAdapter)mapper.readValue(root.get("policyData").get("policy").toString(), PolicyRestAdapter.class);
+ PolicyType policyType = new PolicyType();
+ TargetType target = new TargetType();
+
+ // create guard attribute
+ AnyOfType anyOfType = new AnyOfType();
+ AllOfType alltype = new AllOfType();
+ MatchType matchType = new MatchType();
+ // set value
+ AttributeValueType attributeValue1 = new AttributeValueType();
+ attributeValue1.getContent().add("True");
+ matchType.setAttributeValue(attributeValue1);
+ // set Id
+ AttributeDesignatorType designator = new AttributeDesignatorType();
+ designator.setAttributeId("guard");
+ matchType.setAttributeDesignator(designator);
+ alltype.getMatch().add(matchType);
+
+ // add a dummy MatchType object since while (matchList.size()>1 ...)
+ MatchType matchDummy = new MatchType();
+ // set value
+ AttributeValueType dummyValue = new AttributeValueType();
+ dummyValue.getContent().add("dummy");
+ matchDummy.setAttributeValue(dummyValue);
+ // set Id
+ AttributeDesignatorType designatorDummy = new AttributeDesignatorType();
+ designatorDummy.setAttributeId("dummyId");
+ matchDummy.setAttributeDesignator(designatorDummy);
+
+ alltype.getMatch().add(matchDummy);
+ anyOfType.getAllOf().add(alltype);
+
+ target.getAnyOf().add(anyOfType);
+
+ // create RiskType attribute
+ AnyOfType anyRiskType = new AnyOfType();
+ AllOfType allRiskType = new AllOfType();
+ MatchType matchRiskType = new MatchType();
+ // set value
+ AttributeValueType riskTypeValue = new AttributeValueType();
+ riskTypeValue.getContent().add("test");
+ matchRiskType.setAttributeValue(riskTypeValue);
+ // set Id
+ AttributeDesignatorType designatorRiskType = new AttributeDesignatorType();
+ designatorRiskType.setAttributeId("RiskType");
+ matchRiskType.setAttributeDesignator(designatorRiskType);
+ allRiskType.getMatch().add(matchRiskType);
+
+ // add a dummy MatchType object since while (matchList.size()>1 ...)
+ MatchType matchDummy1 = new MatchType();
+ // set value
+ AttributeValueType dummy1Value = new AttributeValueType();
+ dummy1Value.getContent().add("dummy");
+ matchDummy1.setAttributeValue(dummy1Value);
+ // set Id
+ AttributeDesignatorType designatorDummy1 = new AttributeDesignatorType();
+ designatorDummy1.setAttributeId("dummyId");
+ matchDummy1.setAttributeDesignator(designatorDummy1);
+
+ allRiskType.getMatch().add(matchDummy1);
+
+ anyRiskType.getAllOf().add(allRiskType);
+
+ target.getAnyOf().add(anyRiskType);
+
+ // create RiskLevel attribute
+ AnyOfType anyRiskLevel = new AnyOfType();
+ AllOfType allRiskLevel = new AllOfType();
+ MatchType matchRiskLevel = new MatchType();
+ // set value
+ AttributeValueType riskLevel = new AttributeValueType();
+ riskLevel.getContent().add("3");
+ matchRiskLevel.setAttributeValue(riskLevel);
+ // set Id
+ AttributeDesignatorType designatorRiskLevel = new AttributeDesignatorType();
+ designatorRiskLevel.setAttributeId("RiskLevel");
+ matchRiskLevel.setAttributeDesignator(designatorRiskLevel);
+ allRiskLevel.getMatch().add(matchRiskLevel);
+
+ // add a dummy MatchType object since while (matchList.size()>1 ...)
+ MatchType matchDummy2 = new MatchType();
+ // set value
+ AttributeValueType dummy2Value = new AttributeValueType();
+ dummy2Value.getContent().add("dummy");
+ matchDummy2.setAttributeValue(dummy2Value);
+ // set Id
+ AttributeDesignatorType designatorDummy2 = new AttributeDesignatorType();
+ designatorDummy2.setAttributeId("dummyId");
+ matchDummy2.setAttributeDesignator(designatorDummy2);
+
+ allRiskLevel.getMatch().add(matchDummy2);
+
+ anyRiskLevel.getAllOf().add(allRiskLevel);
+ target.getAnyOf().add(anyRiskLevel);
+
+ policyType.setTarget(target);
+
+ restAdapter.setPolicyData(policyType);
+
+ controller.prePopulateDCAEMSPolicyData(restAdapter, entity);
+
+ logger.error("restAdapter.getRiskType() : " + restAdapter.getRiskType());
+ logger.error("restAdapter.getRiskLevel() : " + restAdapter.getRiskLevel());
+ logger.error("restAdapter.getGuard() : " + restAdapter.getGuard());
+
+ assertEquals("True", restAdapter.getGuard());
+ assertEquals("3", restAdapter.getRiskLevel());
+ assertEquals("test", restAdapter.getRiskType());
+
+ } catch (Exception e) {
+ logger.error("testPrePopulateDCAEMSPolicyData", e);
+ fail("testPrePopulateDCAEMSPolicyData failed due to: " + e);
+ }
+
+ logger.debug("testPrePopulateDCAEMSPolicyData: exit");
+
+ }
+
+ /**
+ * Run the Map<String,String> convert(String, String) method test
+ */
+
+ @Test
+ public void testConvert(){
+ logger.debug("testConvert: enter");
+
+ String str = "k1=v1,k2=v2,k3=v3";
+ String split = ",";
+ Map<String,String> result = CreateDcaeMicroServiceController.convert(str, split);
+ assertTrue(result != null && result.size() == 3);
+
+ logger.debug("testConvert: exit");
+ }
+
+ /**
+ * Run the Map<String,String> convertMap(Map<String,String>,
+ * Map<String,String>) method test
+ */
+
+ @Test
+ public void testConvertMap(){
+ logger.debug("testConvertMap: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+ Map<String,String> attributesMap = new HashMap<String, String>();
+ Map<String,String> attributesRefMap = new HashMap<String, String>();
+ Map<String,String> attributesListRefMap = controller.getAttributesListRefMap();
+ Map<String, LinkedList<String>> arrayTextList = controller.getArrayTextList();
+ LinkedList<String> list = new LinkedList<String>();
+
+ attributesMap.put("keyOne", "valueOne");
+ attributesMap.put("keyTwo", "valueTwo");
+ attributesMap.put("keyThree", "valueThree");
+
+ attributesRefMap.put("key4", "value4");
+ attributesRefMap.put("key5", "value5");
+ attributesRefMap.put("key6", "value6");
+
+ attributesListRefMap.put("key7", "value7");
+
+ list.add("l1");
+ list.add("l2");
+ arrayTextList.put("key8", list);
+
+ Map<String,String> result = controller.convertMap(attributesMap, attributesRefMap);
+
+ assertTrue(result != null && result.size() == 8);
+
+ assertTrue(arrayTextList.get("key8").toString().contains("[l1, l2]"));
+
+ logger.debug("testConvertMap: exit");
+ }
+
+ /**
+ * Run the void SetMSModelData(HttpServletRequest, HttpServletResponse)
+ * method test
+ */
+
+ //Ignore it for now due to Stream ended unexpectedly
+ //@Ignore
+ @Test
+ public void testSetMSModelData() {
+
+ logger.debug("testSetMSModelData: enter");
+
+ CreateDcaeMicroServiceController controller = new CreateDcaeMicroServiceController();
+
+ MockHttpServletResponse response = new MockHttpServletResponse();
+
+ HttpServletRequest request = createMock(HttpServletRequest.class);
+ expect(request.getContentType()).andReturn("multipart/form-data; boundary=----WebKitFormBoundaryWcRUaIbC8kXgjr3p");
+ expect(request.getMethod()).andReturn("post");
+ expect(request.getHeader("Content-length")).andReturn("7809");
+
+ expect(request.getContentLength()).andReturn(7809);
+
+ try {
+ // value of fileName needs to be matched to your local directory
+ String fileName = "";
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ fileName = new File(classLoader.getResource("schedulerPolicies1707.xmi").getFile()).getAbsolutePath();
+ } catch (Exception e1) {
+ logger.error("Exception Occured while loading file"+e1);
+ }
+ expect(request.getInputStream()).andReturn(new MockServletInputStream(fileName));
+ expect(request.getCharacterEncoding()).andReturn("UTF-8");
+ expect(request.getContentLength()).andReturn(1024);
+ replay(request);
+
+ controller.SetMSModelData(request, response);
+
+ } catch (Exception e) {
+ logger.error("testSetMSModelData" + e);
+ e.printStackTrace();
+ }
+
+ //assertTrue(false);
+
+ logger.debug("testSetMSModelData: exit");
+ }
+
+ /**
+ *
+ * @ Get File Stream
+ *
+ */
+ private class MockServletInputStream extends ServletInputStream {
+
+ InputStream fis = null;
+ public MockServletInputStream(String fileName) {
+ try {
+ fis = new FileInputStream(fileName);
+ } catch (Exception genExe) {
+ genExe.printStackTrace();
+ }
+ }
+ @Override
+ public int read() throws IOException {
+ if(fis.available() > 0) {
+ return fis.read();
+ }
+ return 0;
+ }
+
+ @Override
+ public int read(byte[] bytes, int len, int size) throws IOException {
+ if(fis.available() > 0) {
+ int length = fis.read(bytes, len, size);
+ return length;
+ }
+ return -1;
+ }
+ @Override
+ public boolean isFinished() {
+ return false;
+ }
+ @Override
+ public boolean isReady() {
+ return false;
+ }
+ @Override
+ public void setReadListener(ReadListener arg0) {
+
+ }
+ }
+
+} \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PDPControllerTest.java b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PDPControllerTest.java
new file mode 100644
index 000000000..a27ad4b57
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PDPControllerTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controller;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.model.Roles;
+import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPDPGroupStatus;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+
+
+public class PDPControllerTest extends Mockito{
+
+ private static Logger logger = FlexLogger.getLogger(PDPControllerTest.class);
+ private Set<EcompPDPGroup> groupsData;
+ private Set<StdPDPGroup> groups;
+ private static List<Object> rolesdata;
+
+ @Before
+ public void setUp() throws Exception{
+ logger.info("setUp: Entering");
+ rolesdata = new ArrayList<>();
+ Roles roles = new Roles();
+ roles.setLoginId("Test");
+ roles.setRole("super-admin");
+ Roles roles1 = new Roles();
+ roles1.setLoginId("Test");
+ roles1.setRole("admin");
+ roles1.setScope("['com','Test']");
+ rolesdata.add(roles);
+ rolesdata.add(roles1);
+
+ groups = new HashSet<>();
+ StdPDPGroup group = new StdPDPGroup();
+ group.setId("default");
+ group.setDefault(true);
+ group.setName("default");
+ group.setDescription("The default group where new PDP's are put.");
+ group.setStatus(new StdPDPGroupStatus());
+ groups.add(group);
+ groupsData = new HashSet<>();
+ for (EcompPDPGroup g : this.groups) {
+ groupsData.add(g);
+ }
+ }
+
+ @Test
+ public void testPDPGroupData(){
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ PolicyController controller = mock(PolicyController.class);
+ PDPController pdpController = new PDPController();
+ pdpController.setJunit(true);;
+ pdpController.setPolicyController(controller);
+ pdpController.setGroupsData(groupsData);
+ when(controller.getRoles("Test")).thenReturn(rolesdata);
+ pdpController.getPDPGroupEntityData(request, response);
+ try {
+ assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("data"));
+ } catch (UnsupportedEncodingException e) {
+ logger.error("Exception Occured"+e);
+ }
+ }
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PolicyControllerTest.java b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PolicyControllerTest.java
new file mode 100644
index 000000000..73f8d755a
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/openecomp/policy/controller/PolicyControllerTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.controller;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
+
+public class PolicyControllerTest {
+
+ private static Logger logger = FlexLogger.getLogger(PolicyControllerTest.class);
+ private static CommonClassDao commonClassDao;
+
+ @Before
+ public void setUp() throws Exception{
+ logger.info("setUp: Entering");
+ commonClassDao = mock(CommonClassDao.class);
+ List<Object> data = new ArrayList<>();
+ String policyData = "";
+ try {
+ ClassLoader classLoader = getClass().getClassLoader();
+ policyData = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml"));
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ PolicyEntity entity = new PolicyEntity();
+ entity.setPolicyName("Config_SampleTest.1.xml");
+ entity.setPolicyData(policyData);
+ entity.setScope("com");
+ data.add(entity);
+
+ when(commonClassDao.getDataByQuery("FROM PolicyEntity where policyName = 'Config_SampleTest1206.1.xml' and scope ='com'")).thenReturn(data);
+ }
+
+ @Test
+ public void dummy(){
+ System.out.println("Dummy");
+ }
+}
diff --git a/POLICY-SDK-APP/src/test/resources/Config_SampleTest1206.1.xml b/POLICY-SDK-APP/src/test/resources/Config_SampleTest1206.1.xml
new file mode 100644
index 000000000..5c32cd4f1
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/resources/Config_SampleTest1206.1.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
+ <Description>SampleTest1206@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy:</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleTest1206.1.xml</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ <AllOf>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">success</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ECOMPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PROD</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">True</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="org.openecomp.function.regex-match">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleTest1206</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Rule RuleId="urn:com:xacml:rule:id:7e46d503-af54-4ea5-a86c-9eb6dd1f4f43" Effect="Permit">
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <AdviceExpressions>
+ <AdviceExpression AdviceId="configID" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_SampleTest1206.1.txt</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_SampleTest1206.1.xml</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ECOMPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">success</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleTest1206</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PROD</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">True</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ </AdviceExpressions>
+ </Rule>
+</Policy>
diff --git a/POLICY-SDK-APP/src/test/resources/logback.xml b/POLICY-SDK-APP/src/test/resources/logback.xml
new file mode 100644
index 000000000..b119a4e3b
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/resources/logback.xml
@@ -0,0 +1,254 @@
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP-PAP-REST
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+ <!--<jmxConfigurator /> -->
+ <!-- directory path for all other type logs -->
+ <property name="logDir" value="logs" />
+
+ <!-- directory path for debugging type logs -->
+ <property name="debugDir" value="logs" />
+
+ <!-- specify the component name
+ <ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" -->
+ <property name="componentName" value="Policy"></property>
+ <property name="subComponentName" value="XACML-PAP-REST"></property>
+
+ <!-- log file names -->
+ <property name="errorLogName" value="error" />
+ <property name="metricsLogName" value="metrics" />
+ <property name="auditLogName" value="audit" />
+ <property name="debugLogName" value="debug" />
+
+
+ <!-- modified time stamp format -->
+
+ <!-- A U D I T
+ <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{ElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ -->
+ <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+
+
+
+ <!-- M E T R I C
+ <property name="defaultMetricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ -->
+ <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+
+
+
+
+ <!-- E R R O R
+ <property name="defaultErrorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDesciption}|%msg%n" />
+ -->
+ <property name="defaultErrorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{requestId}|%t|%X{serviceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDesciption}|%msg%n" />
+
+
+
+ <!-- D E B U G
+ <property name="debugLoggerPatternOld" value="%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|[%caller{3}]|%msg%n" />
+ <property name="debugLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" /> -->
+ -->
+ <property name="debugLoggerPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%X{RequestId}|%msg%n" />
+
+
+
+ <!-- D E F A U L T
+ <property name="defaultPatternOld" value="%d{MM/dd-HH:mm:ss.SSS}|%logger|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|%msg%n" />
+ <property name="defaultPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ -->
+ <property name="defaultPattern" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{server}|%X{clientIpAddress}|%c||%msg%n" />
+
+
+
+ <!-- P A T H
+ <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" />
+ <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" />
+
+ -->
+ <property name="logDirectory" value="${catalina.base}/${logDir}/${componentName}/${subComponentName}" />
+ <property name="debugLogDirectory" value="${catalina.base}/${debugDir}/${componentName}/${subComponentName}" />
+
+
+
+
+ <!-- Example evaluator filter applied against console appender -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- ============================================================================ -->
+ <!-- EELF Appenders -->
+ <!-- ============================================================================ -->
+
+ <!-- The EELFAppender is used to record events to the general application
+ log -->
+
+ <!-- EELF Audit Appender. This appender is used to record audit engine
+ related logging events. The audit logger and appender are specializations
+ of the EELF application root logger and appender. This can be used to segregate
+ Policy engine events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+
+ <appender name="EELFAudit"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${auditLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${auditLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultAuditPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFAudit" />
+ </appender>
+
+
+
+
+<appender name="EELFMetrics"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${metricsLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${metricsLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>${defaultMetricPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFMetrics"/>
+ </appender>
+
+
+
+
+ <appender name="EELFError"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/${errorLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/${errorLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>ERROR</level>
+ </filter>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${defaultErrorPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFError"/>
+ </appender>
+
+
+
+ <appender name="EELFDebug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${debugLogDirectory}/${debugLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${debugLogDirectory}/${debugLogName}.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${debugLoggerPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="EELFDebug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+
+ <!-- ============================================================================ -->
+ <!-- EELF loggers -->
+ <!-- ============================================================================ -->
+
+ <logger name="com.att.eelf.audit" level="info" additivity="false">
+ <appender-ref ref="asyncEELFAudit" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="asyncEELFMetrics" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="error" additivity="false">
+ <appender-ref ref="asyncEELFError" />
+ </logger>
+
+ <logger name="com.att.eelf.debug" level="info" additivity="false">
+ <appender-ref ref="asyncEELFDebug" />
+ </logger>
+
+
+
+ <root level="INFO">
+ <appender-ref ref="asyncEELFDebug" />
+ <appender-ref ref="asyncEELFError" />
+ </root>
+
+</configuration>
diff --git a/POLICY-SDK-APP/src/test/resources/policy_tosca_tca_v1707.yml b/POLICY-SDK-APP/src/test/resources/policy_tosca_tca_v1707.yml
new file mode 100644
index 000000000..0c30ceea0
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/resources/policy_tosca_tca_v1707.yml
@@ -0,0 +1,65 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+
+node_types:
+ # policy root node
+ policy.nodes.Root:
+ derived_from: tosca.nodes.Root
+ properties:
+ policyName:
+ type: string
+ required: true
+ policyVersion:
+ type: string
+ required: true
+ policyScope:
+ type: string
+ required: true
+ policyDescription:
+ type: string
+ required: false
+
+ # virtual policy node for string matcher
+ policy.nodes.tca:
+ derived_from: policy.nodes.Root
+ properties:
+ functionalRole:
+ type: string
+ required: true
+ default: "ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8"
+ policyName:
+ type: string
+ required: true
+ default: "configuration.dcae.microservice.tca.xml"
+ policyVersion:
+ type: string
+ required: true
+ default: "v0.0.1"
+ threshholds:
+ type: list
+ entry_schema:
+ - type:policy.data.Threshold
+
+data_types:
+ policy.data.Threshold:
+ derived_from: tosca.nodes.Root
+ properties:
+ closedLoopControlName:
+ type: string
+ required: true
+ version:
+ type: string
+ required: true
+ default: "1.0.2"
+ fieldPath:
+ type: string
+ required: true
+ thresholdValue:
+ type: integer
+ required: true
+ direction:
+ type: string
+ required: true
+ severity:
+ type: string
+ required: true
+
diff --git a/POLICY-SDK-APP/src/test/resources/schedulerPolicies1707.xmi b/POLICY-SDK-APP/src/test/resources/schedulerPolicies1707.xmi
new file mode 100644
index 000000000..22afa23a2
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/resources/schedulerPolicies1707.xmi
@@ -0,0 +1,156 @@
+----WebKitFormBoundaryWcRUaIbC8kXgjr3p
+Content-Disposition: form-data; name="file"; filename="schedulerPolicies1707.xmi"
+
+<?xml version="1.0" encoding="ASCII"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="scheduler" nsURI="org.ecomp.test.scheduler" nsPrefix="scheduler">
+ <eAnnotations source="http://www.eclipse.org/emf/2011/Xcore">
+ <details key="ecomp" value="http://ecomp.org.com"/>
+ <details key="policy" value="http://ecomp.org.com/policy"/>
+ </eAnnotations>
+ <eClassifiers xsi:type="ecore:EClass" name="TimeLimitAndVerticalTopology" eSuperTypes="//SniroPolicyMetaInfo">
+ <eAnnotations source="http://ecomp.org.com/policy">
+ <details key="policyTemplate" value="SNIRO-SCHEDULER"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" unique="false" eType="//TimeLimitNVerticalTopologyType">
+ <eAnnotations source="http://ecomp.org.com/policy">
+ <details key="matching" value="true"/>
+ </eAnnotations>
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" unique="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="nodeType" unique="false" upperBound="-1" eType="//EntityType">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="conflictScope" unique="false" eType="//ConflictScope">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="timeSchedule" eType="//TimeSchedule" containment="true" resolveProxies="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TimeSchedule">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="allowedPeriodicTime" upperBound="-1" eType="//AllowedPeriodicTime" containment="true" resolveProxies="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TimeRange">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="start_time" unique="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="end_time" unique="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AllowedPeriodicTime">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="day" unique="false" eType="//DayType">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="timeRange" upperBound="-1" eType="//TimeRange" containment="true" resolveProxies="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SniroPolicyMetaInfo">
+ <eAnnotations source="http://ecomp.org.com/policy">
+ <details key="policyTemplate" value="SNIRO"/>
+ </eAnnotations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="identity" unique="false">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="policyScope" eType="//Scope" containment="true" resolveProxies="false">
+ <eAnnotations source="http://ecomp.org.com/policy">
+ <details key="matching" value="true"/>
+ </eAnnotations>
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Scope">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceType" unique="false" upperBound="-1" eType="//ServiceType">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="entityType" unique="false" upperBound="-1" eType="//EntityType">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="aicZone" unique="false" upperBound="-1">
+ <eAnnotations source="http://ecomp.org.com">
+ <details key="type" value="configuration"/>
+ </eAnnotations>
+ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eStructuralFeatures>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="WorkflowType">
+ <eLiterals name="softwareDownload" value="1"/>
+ <eLiterals name="softwareUpgrade" value="2"/>
+ <eLiterals name="configurationChange" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ServiceType">
+ <eLiterals name="networkOnDemand" value="1"/>
+ <eLiterals name="changeManagement" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ConflictScope">
+ <eLiterals name="vnf" value="1"/>
+ <eLiterals name="vnf_pserver" value="2"/>
+ <eLiterals name="vnf_zone" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="EntityType">
+ <eLiterals name="vnf" value="1"/>
+ <eLiterals name="pServer" value="2"/>
+ <eLiterals name="vServer" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="DayType">
+ <eLiterals name="weekday" value="1"/>
+ <eLiterals name="weekend" value="2"/>
+ <eLiterals name="holiday" value="3"/>
+ <eLiterals name="mon" value="4"/>
+ <eLiterals name="tue" value="5"/>
+ <eLiterals name="wed" value="6"/>
+ <eLiterals name="thu" value="7"/>
+ <eLiterals name="fri" value="8"/>
+ <eLiterals name="sat" value="9"/>
+ <eLiterals name="sun" value="10"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="TimeLimitNVerticalTopologyType">
+ <eLiterals name="timeLimitAndVerticalTopology"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EDataType" name="UUID" instanceClassName="java.util.UUID"/>
+</ecore:EPackage>
+
+------WebKitFormBoundaryWcRUaIbC8kXgjr3p
+Content-Disposition: form-data; name="file"; filename="schedulerPolicies1707.xmi"
+Content-Type: application/octet-stream
+
+
+------WebKitFormBoundaryWcRUaIbC8kXgjr3p-- \ No newline at end of file