diff options
Diffstat (limited to 'src')
18 files changed, 1617 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java new file mode 100644 index 00000000..343391eb --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -0,0 +1,321 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.client;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.stream.Collectors;
+
+import javax.net.ssl.HttpsURLConnection;
+
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.onap.clamp.clds.model.refprop.RefProp;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+/**
+ *
+ *
+ */
+public class DcaeDispatcherServices {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeDispatcherServices.class);
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+
+ @Autowired
+ private RefProp refProp;
+
+ /**
+ *
+ * @param deploymentId
+ * @return
+ * @throws Exception
+ */
+ public String deleteDeployment(String deploymentId) throws Exception {
+
+ String statusUrl = null;
+ InputStream in = null;
+ try {
+ String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId;
+ logger.info("Dcae Dispatcher url - " + url);
+ URL obj = new URL(url);
+ HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
+ conn.setRequestMethod("DELETE");
+ int responseCode = conn.getResponseCode();
+
+ boolean requestFailed = true;
+ logger.info("responseCode=" + responseCode);
+ if (responseCode == 200 || responseCode == 202) {
+ requestFailed = false;
+ }
+
+ InputStream inStream = conn.getErrorStream();
+ if (inStream == null) {
+ inStream = conn.getInputStream();
+ }
+
+ String responseStr = null;
+ if (inStream != null) {
+ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inStream));
+ String inputLine = null;
+ StringBuffer response = new StringBuffer();
+ while ((inputLine = bufferedReader.readLine()) != null) {
+ response.append(inputLine);
+ }
+ responseStr = response.toString();
+ }
+
+ if (responseStr != null) {
+ if (requestFailed) {
+ logger.error("requestFailed - responseStr=" + responseStr);
+ throw new Exception(responseStr);
+ }
+ }
+
+ logger.debug("response code " + responseCode);
+ in = conn.getInputStream();
+ logger.debug("res:" + responseStr);
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(responseStr);
+ JSONObject jsonObj = (JSONObject) obj0;
+ JSONObject linksObj = (JSONObject) jsonObj.get("links");
+ statusUrl = (String) linksObj.get("status");
+ logger.debug("Status URL: " + statusUrl);
+
+ } catch (Exception e) {
+ logger.error(e.getClass().getName() + " " + e.getMessage());
+ throw e;
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+
+ return statusUrl;
+
+ }
+
+ /**
+ *
+ * @param statusUrl
+ * @return
+ * @throws Exception
+ */
+ public String getOperationStatus(String statusUrl) throws Exception {
+
+ String opStatus = null;
+ InputStream in = null;
+ try {
+ URL obj = new URL(statusUrl);
+ HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
+ conn.setRequestMethod("GET");
+ int responseCode = conn.getResponseCode();
+ logger.debug("response code " + responseCode);
+ in = conn.getInputStream();
+ String res = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(res);
+ JSONObject jsonObj = (JSONObject) obj0;
+ String operationType = (String) jsonObj.get("operationType");
+ String status = (String) jsonObj.get("status");
+ logger.debug("Operation Type " + operationType);
+ logger.debug("Status " + status);
+ opStatus = status;
+
+ } catch (Exception e) {
+ logger.debug(e.getClass().getName() + " " + e.getMessage());
+ logger.debug(e.getMessage()
+ + " : got exception while retrieving status, trying again until we get 200 response code");
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+
+ return opStatus;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void getDeployments() throws Exception {
+ InputStream in = null;
+ try {
+ String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments";
+ logger.info("Dcae Dispatcher deployments url - " + url);
+ URL obj = new URL(url);
+ HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
+ conn.setRequestMethod("GET");
+ int responseCode = conn.getResponseCode();
+ logger.debug("response code " + responseCode);
+ in = conn.getInputStream();
+ String res = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
+ logger.debug("res:" + res);
+ } catch (Exception e) {
+ logger.error("Exception occurred during DCAE communication", e);
+ throw e;
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ }
+
+ /**
+ * Returns status URL for deployment operation
+ *
+ * @param deploymentId
+ * @param serviceTypeId
+ * @return
+ * @throws Exception
+ */
+ public String createNewDeployment(String deploymentId, String serviceTypeId) throws Exception {
+
+ String statusUrl = null;
+ InputStream inStream = null;
+ BufferedReader in = null;
+ try {
+ String apiBodyString = "{\"serviceTypeId\": \"" + serviceTypeId + "\"}";
+ logger.info("Dcae api Body String - " + apiBodyString);
+ String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId;
+ logger.info("Dcae Dispatcher Service url - " + url);
+ URL obj = new URL(url);
+ HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
+ conn.setRequestMethod("PUT");
+ conn.setRequestProperty("Content-Type", "application/json");
+ conn.setDoOutput(true);
+ try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
+ wr.writeBytes(apiBodyString);
+ wr.flush();
+ }
+
+ boolean requestFailed = true;
+ int responseCode = conn.getResponseCode();
+ logger.info("responseCode=" + responseCode);
+ if (responseCode == 200 || responseCode == 202) {
+ requestFailed = false;
+ }
+
+ inStream = conn.getErrorStream();
+ if (inStream == null) {
+ inStream = conn.getInputStream();
+ }
+
+ String responseStr = null;
+ if (inStream != null) {
+ in = new BufferedReader(new InputStreamReader(inStream));
+
+ String inputLine = null;
+
+ StringBuffer response = new StringBuffer();
+
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+
+ responseStr = response.toString();
+ }
+
+ if (responseStr != null) {
+ if (requestFailed) {
+ logger.error("requestFailed - responseStr=" + responseStr);
+ throw new Exception(responseStr);
+ }
+ }
+
+ logger.debug("response code " + responseCode);
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(responseStr);
+ JSONObject jsonObj = (JSONObject) obj0;
+ JSONObject linksObj = (JSONObject) jsonObj.get("links");
+ statusUrl = (String) linksObj.get("status");
+ logger.debug("Status URL: " + statusUrl);
+ } catch (Exception e) {
+ logger.error("Exception occurred during the DCAE communication", e);
+ throw e;
+ } finally {
+ if (inStream != null) {
+ inStream.close();
+ }
+ if (in != null) {
+ in.close();
+ }
+ }
+ return statusUrl;
+ }
+
+ /**
+ *
+ * @param deploymentId
+ * @param serviceTypeId
+ * @return
+ * @throws Exception
+ */
+ public String deleteExistingDeployment(String deploymentId, String serviceTypeId) throws Exception {
+
+ String statusUrl = null;
+ InputStream in = null;
+ try {
+ String apiBodyString = "{\"serviceTypeId\": \"" + serviceTypeId + "\"}";
+ logger.debug(apiBodyString);
+ String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId;
+ logger.info("Dcae Dispatcher deployments url - " + url);
+ URL obj = new URL(url);
+ HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();
+ conn.setRequestMethod("DELETE");
+ conn.setRequestProperty("Content-Type", "application/json");
+ conn.setDoOutput(true);
+ DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
+ wr.writeBytes(apiBodyString);
+ wr.flush();
+
+ int responseCode = conn.getResponseCode();
+ logger.debug("response code " + responseCode);
+ in = conn.getInputStream();
+ String res = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
+ logger.debug("res:" + res);
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(res);
+ JSONObject jsonObj = (JSONObject) obj0;
+ JSONObject linksObj = (JSONObject) jsonObj.get("links");
+ statusUrl = (String) linksObj.get("status");
+ logger.debug("Status URL: " + statusUrl);
+ } catch (Exception e) {
+ logger.error("Exception occurred during DCAE communication", e);
+ throw e;
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ return statusUrl;
+ }
+
+}
\ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java new file mode 100644 index 00000000..3dfe9fec --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -0,0 +1,181 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.client;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.List;
+
+import javax.ws.rs.BadRequestException;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.onap.clamp.clds.dao.CldsDao;
+import org.onap.clamp.clds.model.CldsEvent;
+import org.onap.clamp.clds.model.CldsModel;
+import org.onap.clamp.clds.model.DcaeEvent;
+import org.onap.clamp.clds.model.prop.Global;
+import org.onap.clamp.clds.model.prop.ModelProperties;
+import org.onap.clamp.clds.model.refprop.RefProp;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+public class DcaeInventoryServices {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+
+ @Autowired
+ private RefProp refProp;
+
+ @Autowired
+ private CldsDao cldsDao;
+
+ @Autowired
+ private SdcCatalogServices sdcCatalogServices;
+
+ public void setEventInventory(CldsModel cldsModel, String userId) throws Exception {
+ String artifactName = cldsModel.getControlName();
+ DcaeEvent dcaeEvent = new DcaeEvent();
+ String isDcaeInfoAvailable = null;
+ if (artifactName != null) {
+ artifactName = artifactName + ".yml";
+ }
+ try {
+ /*
+ * Below are the properties required for calling the dcae inventory
+ * url call
+ */
+ ModelProperties prop = new ModelProperties(cldsModel.getName(), cldsModel.getControlName(), null, false, "{}",
+ cldsModel.getPropText());
+ Global global = prop.getGlobal();
+ String invariantServiceUuid = global.getService();
+ List<String> resourceUuidList = global.getResourceVf();
+ String serviceUuid = sdcCatalogServices.getServiceUuidFromServiceInvariantId(invariantServiceUuid);
+ String resourceUuid = "";
+ if (resourceUuidList != null && resourceUuidList.size() > 0) {
+ resourceUuid = resourceUuidList.get(0).toString();
+ }
+ /* Invemtory service url is called in this method */
+ isDcaeInfoAvailable = getDcaeInformation(artifactName, serviceUuid, resourceUuid);
+
+ /* set dcae events */
+ dcaeEvent.setArtifactName(artifactName);
+ dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION);
+
+ } catch (JsonProcessingException e) {
+ // exception
+ logger.error("JsonProcessingException" + e);
+ } catch (IOException e) {
+
+ // exception
+ logger.error("IOException :" + e);
+ }
+ /* Null whether the DCAE has items lenght or not */
+ if (isDcaeInfoAvailable != null) {
+ /* Inserting Event in to DB */
+ logger.info(isDcaeInfoAvailable);
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(isDcaeInfoAvailable);
+ JSONObject jsonObj = (JSONObject) obj0;
+ String oldTypeId = cldsModel.getTypeId();
+ String newTypeId = "";
+ if (jsonObj.get("typeId") != null) {
+ newTypeId = jsonObj.get("typeId").toString();
+ cldsModel.setTypeId(jsonObj.get("typeId").toString());
+ }
+ // cldsModel.setTypeName(cldsModel.getControlName().toString()+".yml");
+ if (jsonObj.get("typeName") != null) {
+ cldsModel.setTypeName(jsonObj.get("typeName").toString());
+ }
+ if(oldTypeId == null || !oldTypeId.equalsIgnoreCase(newTypeId)){
+ CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userId, dcaeEvent.getCldsActionCd(),
+ CldsEvent.ACTION_STATE_RECEIVED, null);
+ }
+ cldsModel.save(cldsDao, userId);
+ } else {
+ logger.info(cldsModel.getName() + " Model is not present in Dcae Inventory Service.");
+ }
+ }
+
+ public String getDcaeInformation(String artifactName, String serviceUUID, String resourceUUID)
+ throws IOException, ParseException {
+ String queryString = "?sdcResourceId=" + resourceUUID + "&sdcServiceId=" + serviceUUID + "&typeName="
+ + artifactName;
+ String fullUrl = refProp.getStringValue("DCAE_INVENTORY_URL") + "/dcae-service-types" + queryString;
+ logger.info("Dcae Inventory Service full url - " + fullUrl);
+ String daceInventoryResponse = null;
+ URL inventoryUrl = new URL(fullUrl);
+
+ HttpURLConnection conn = (HttpURLConnection) inventoryUrl.openConnection();
+ conn.setRequestMethod("GET");
+ boolean requestFailed = true;
+ int responseCode = conn.getResponseCode();
+ if (responseCode == 200) {
+ requestFailed = false;
+ }
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String inputLine = null;
+ StringBuffer response = new StringBuffer();
+ String responseStr = null;
+ while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+ }
+ in.close();
+ responseStr = response.toString();
+ if (responseStr != null) {
+ if (requestFailed) {
+ logger.error("requestFailed - responseStr=" + response);
+ throw new BadRequestException(responseStr);
+ }
+ }
+ String jsonResponseString = response.toString();
+ JSONParser parser = new JSONParser();
+ Object obj0 = parser.parse(jsonResponseString);
+
+ JSONObject jsonObj = (JSONObject) obj0;
+
+ Long totalCount = (Long) jsonObj.get("totalCount");
+
+ int numServices = totalCount.intValue();
+ if (numServices == 0) {
+ daceInventoryResponse = null;
+ } else if (numServices > 0) {
+ JSONArray itemsArray = (JSONArray) jsonObj.get("items");
+ JSONObject dcaeServiceType0 = (JSONObject) itemsArray.get(0);
+ daceInventoryResponse = dcaeServiceType0.toString();
+ logger.info(daceInventoryResponse.toString());
+ }
+ return daceInventoryResponse;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsHealthCheck.java b/src/main/java/org/onap/clamp/clds/model/CldsHealthCheck.java new file mode 100644 index 00000000..9a5e5a53 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CldsHealthCheck.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +public class CldsHealthCheck { + + private String healthCheckComponent; + + public String getHealthCheckComponent() { + return healthCheckComponent; + } + + public void setHealthCheckComponent(String healthCheckComponent) { + this.healthCheckComponent = healthCheckComponent; + } + + private String healthCheckStatus; + private String description; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getHealthCheckStatus() { + return healthCheckStatus; + } + + public void setHealthCheckStatus(String healthCheckStatus) { + this.healthCheckStatus = healthCheckStatus; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsInfo.java b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java new file mode 100644 index 00000000..9dc0f870 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +public class CldsInfo { + + private String userName; + private String cldsVersion; + private boolean permissionReadCl; + private boolean permissionUpdateCl; + private boolean permissionReadTemplate; + private boolean permissionUpdateTemplate; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getCldsVersion() { + return cldsVersion; + } + + public void setCldsVersion(String cldsVersion) { + this.cldsVersion = cldsVersion; + } + + public boolean isPermissionReadCl() { + return permissionReadCl; + } + + public void setPermissionReadCl(boolean permissionReadCl) { + this.permissionReadCl = permissionReadCl; + } + + public boolean isPermissionUpdateCl() { + return permissionUpdateCl; + } + + public void setPermissionUpdateCl(boolean permissionUpdateCl) { + this.permissionUpdateCl = permissionUpdateCl; + } + + public boolean isPermissionReadTemplate() { + return permissionReadTemplate; + } + + public void setPermissionReadTemplate(boolean permissionReadTemplate) { + this.permissionReadTemplate = permissionReadTemplate; + } + + public boolean isPermissionUpdateTemplate() { + return permissionUpdateTemplate; + } + + public void setPermissionUpdateTemplate(boolean permissionUpdateTemplate) { + this.permissionUpdateTemplate = permissionUpdateTemplate; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/CldsVfKPIData.java b/src/main/java/org/onap/clamp/clds/model/CldsVfKPIData.java new file mode 100644 index 00000000..62e676f0 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CldsVfKPIData.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +import java.io.Serializable; + +public class CldsVfKPIData implements Serializable { + + private static final long serialVersionUID = 9067755871527776380L; + + private String nfNamingCode; + private String nfNamingValue; + + private String fieldPath; + private String fieldPathValue; + + private String thresholdName; + private String thresholdValue; + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getNfNamingValue() { + return nfNamingValue; + } + + public void setNfNamingValue(String nfNamingValue) { + this.nfNamingValue = nfNamingValue; + } + + public String getFieldPath() { + return fieldPath; + } + + public void setFieldPath(String fieldPath) { + this.fieldPath = fieldPath; + } + + public String getFieldPathValue() { + return fieldPathValue; + } + + public void setFieldPathValue(String fieldPathValue) { + this.fieldPathValue = fieldPathValue; + } + + public String getThresholdName() { + return thresholdName; + } + + public void setThresholdName(String thresholdName) { + this.thresholdName = thresholdName; + } + + public String getThresholdValue() { + return thresholdValue; + } + + public void setThresholdValue(String thresholdValue) { + this.thresholdValue = thresholdValue; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java b/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java new file mode 100644 index 00000000..6142e9e6 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model.prop; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.databind.JsonNode; + +/** + * Parse Policy json properties. + * + * Example json: + * {"Policy_1e33tn8":{"PolicyTest1":[{"name":"pname","value":"PolicyTest1"},{ + * "name":"pid","value":"1"},{"name":"timeout","value":"345"},{ + * "policyConfigurations":[[{"name":"recipe","value":["restart"]},{"name": + * "maxRetries","value":["3"]},{"name":"retryTimeLimit","value":["180"]},{"name" + * :"_id","value":["q2JmHD5"]},{"name":"parentPolicy","value":[""]}],[{"name": + * "recipe","value":["rebuild"]},{"name":"maxRetries","value":["3"]},{"name": + * "retryTimeLimit","value":["180"]},{"name":"_id","value":["0ZqHdrR"]},{"name": + * "parentPolicy","value":[""]}]]}],"PolicyTest2":[{"name":"pname","value": + * "PolicyTest2"},{"name":"pid","value":"2"},{"name":"timeout","value":"345"},{ + * "policyConfigurations":[[{"name":"recipe","value":["restart"]},{"name": + * "maxRetries","value":["3"]},{"name":"retryTimeLimit","value":["180"]},{"name" + * :"_id","value":["q2JmHD5"]},{"name":"parentPolicy","value":[""]}],[{"name": + * "recipe","value":["rebuild"]},{"name":"maxRetries","value":["3"]},{"name": + * "retryTimeLimit","value":["180"]},{"name":"_id","value":["0ZqHdrR"]},{"name": + * "parentPolicy","value":[""]}]]}]}} f + * + */ +public class PolicyChain { + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyChain.class); + protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + + private String policyId; + private Integer timeout; + private List<PolicyItem> policyItems; + + public PolicyChain(JsonNode node) { + + policyId = ModelElement.getValueByName(node, "pid"); + timeout = ModelElement.getIntValueByName(node, "timeout"); + + // process policy configurations + JsonNode policyNode = node.get(node.size() - 1).get("policyConfigurations"); + Iterator<JsonNode> itr = policyNode.elements(); + policyItems = new ArrayList<PolicyItem>(); + while (itr.hasNext()) { + policyItems.add(new PolicyItem(itr.next())); + } + } + + /** + * @return the policyId + */ + public String getPolicyId() { + return policyId; + } + + /** + * @return the timeout + */ + public Integer getTimeout() { + return timeout; + } + + /** + * @return the policyItems + */ + public List<PolicyItem> getPolicyItems() { + return policyItems; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java b/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java new file mode 100644 index 00000000..de98333a --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model.prop; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.fasterxml.jackson.databind.JsonNode; + +/** + * Parse Resource Group json properties. + * + * Example json: + * {"StringMatch_0aji7go":{"Group1":[{"name":"rgname","value":"1493749598520"},{ + * "name":"rgfriendlyname","value":"Group1"},{"name":"policyName","value": + * "Policy1"},{"name":"policyId","value":"1"},{"serviceConfigurations":[[{"name" + * :"aaiMatchingFields","value":["complex.city","vserver.vserver-name"]},{"name" + * :"aaiSendFields","value":["complex.city","vserver.vserver-name"]},{"name": + * "eventSeverity","value":["OK"]},{"name":"eventSourceType","value":[""]},{ + * "name":"timeWindow","value":["100"]},{"name":"ageLimit","value":["100"]},{ + * "name":"createClosedLoopEventId","value":["Initial"]},{"name": + * "outputEventName","value":["ONSET"]}]]}],"Group2":[{"name":"rgname","value": + * "1493749665149"},{"name":"rgfriendlyname","value":"Group2"},{"name": + * "policyName","value":"Policy2"},{"name":"policyId","value":"2"},{ + * "serviceConfigurations":[[{"name":"aaiMatchingFields","value":[ + * "cloud-region.identity-url","vserver.vserver-name"]},{"name":"aaiSendFields", + * "value":["cloud-region.identity-url","vserver.vserver-name"]},{"name": + * "eventSeverity","value":["NORMAL"]},{"name":"eventSourceType","value":[""]},{ + * "name":"timeWindow","value":["1000"]},{"name":"ageLimit","value":["1000"]},{ + * "name":"createClosedLoopEventId","value":["Initial"]},{"name": + * "outputEventName","value":["ONSET"]}],[{"name":"aaiMatchingFields","value":[ + * "generic-vnf.vnf-name","vserver.vserver-name"]},{"name":"aaiSendFields", + * "value":["generic-vnf.vnf-name","vserver.vserver-name"]},{"name": + * "eventSeverity","value":["CRITICAL"]},{"name":"eventSourceType","value":[""]} + * ,{"name":"timeWindow","value":["3000"]},{"name":"ageLimit","value":["3000"]}, + * {"name":"createClosedLoopEventId","value":["Initial"]},{"name": + * "outputEventName","value":["ABATED"]}]]}]}} + * + */ +public class ResourceGroup { + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourceGroup.class); + protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + + private String groupNumber; + private String policyId; + private List<ServiceConfiguration> serviceConfigurations; + + /** + * Parse String Match Resource Group given json node. + * + * @param modelBpmn + * @param modelJson + */ + public ResourceGroup(JsonNode node) { + + groupNumber = ModelElement.getValueByName(node, "rgname"); + policyId = ModelElement.getValueByName(node, "policyId"); + + // process Server_Configurations + JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations"); + Iterator<JsonNode> itr = serviceConfigurationsNode.elements(); + serviceConfigurations = new ArrayList<ServiceConfiguration>(); + while (itr.hasNext()) { + serviceConfigurations.add(new ServiceConfiguration(itr.next())); + } + } + + /** + * @return the groupNumber + */ + public String getGroupNumber() { + return groupNumber; + } + + /** + * @return the policyId + */ + public String getPolicyId() { + return policyId; + } + + /** + * @return the serviceConfigurations + */ + public List<ServiceConfiguration> getServiceConfigurations() { + return serviceConfigurations; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java new file mode 100644 index 00000000..c4740068 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java @@ -0,0 +1,124 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.util;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import org.jboss.logging.MDC;
+
+public class LoggingUtils {
+
+ /**
+ * Set request related logging variables in thread local data via MDC
+ *
+ * @param service
+ * Service Name of API (ex. "PUT template")
+ * @param partner
+ * Partner name (client or user invoking API)
+ */
+ public static void setRequestContext(String service, String partner) {
+ MDC.put("RequestId", "clds-" + UUID.randomUUID().toString());
+ MDC.put("ServiceName", service);
+ MDC.put("PartnerName", partner);
+ }
+
+ /**
+ * Set time related logging variables in thread local data via MDC
+ *
+ * @param beginTimeStamp
+ * Start time
+ * @param endTimeStamp
+ * End time
+ */
+ public static void setTimeContext(Date beginTimeStamp, Date endTimeStamp) {
+ String beginTime = "";
+ String endTime = "";
+ String elapsedTime = "";
+
+ if (beginTimeStamp != null && endTimeStamp != null) {
+ elapsedTime = String.valueOf(endTimeStamp.getTime() - beginTimeStamp.getTime());
+ beginTime = generateTimestampStr(beginTimeStamp);
+ endTime = generateTimestampStr(endTimeStamp);
+ }
+
+ MDC.put("BeginTimestamp", beginTime);
+ MDC.put("EndTimestamp", endTime);
+ MDC.put("ElapsedTime", elapsedTime);
+ }
+
+ /**
+ * Set response related logging variables in thread local data via MDC
+ *
+ * @param code
+ * Response code ("0" indicates success)
+ * @param description
+ * Response description
+ * @param className
+ * class name of invoking class
+ */
+ public static void setResponseContext(String code, String description, String className) {
+ MDC.put("ResponseCode", code);
+ MDC.put("StatusCode", code.equals("0") ? "COMPLETE" : "ERROR");
+ MDC.put("ResponseDescription", description != null ? description : "");
+ MDC.put("ClassName", className != null ? className : "");
+ }
+
+ /**
+ * Set target related logging variables in thread local data via MDC
+ *
+ * @param targetEntity
+ * Target entity (an external/sub component, for ex. "sdc")
+ * @param targetServiceName
+ * Target service name (name of API invoked on target)
+ */
+ public static void setTargetContext(String targetEntity, String targetServiceName) {
+ MDC.put("TargetEntity", targetEntity != null ? targetEntity : "");
+ MDC.put("TargetServiceName", targetServiceName != null ? targetServiceName : "");
+ }
+
+ /**
+ * Set error related logging variables in thread local data via MDC
+ *
+ * @param code
+ * Error code
+ * @param description
+ * Error description
+ */
+ public static void setErrorContext(String code, String description) {
+ MDC.put("ErrorCode", code);
+ MDC.put("ErrorDescription", description != null ? description : "");
+ }
+
+ private static String generateTimestampStr(Date timeStamp) {
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ df.setTimeZone(tz);
+ return df.format(timeStamp);
+ }
+
+}
diff --git a/src/main/resources/META-INF/resources/designer/images/Collectors.png b/src/main/resources/META-INF/resources/designer/images/Collectors.png Binary files differnew file mode 100644 index 00000000..8b3cc1ee --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/images/Collectors.png diff --git a/src/main/resources/META-INF/resources/designer/invalid_login.html b/src/main/resources/META-INF/resources/designer/invalid_login.html new file mode 100644 index 00000000..067452e6 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/invalid_login.html @@ -0,0 +1,45 @@ +<!-- + ============LICENSE_START======================================================= + ONAP CLAMP + ================================================================================ + 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============================================ + =================================================================== + ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> +<style> +.divRow { + margin-left: 5px; + font-size: 13px; + font-weight: normal; + margin-top:10px; +} +</style> + +<head> + <title>CLDS</title> +</head> +<div> + <div class="divRow"><b>Login Failed!</b></div> + <div class="divRow"><b>Please make sure your login and password are correct. + If you don't have the login credential, please contact CLAMP administrator.</b></div> + + <div class="divRow">To login again, please click <a href="/designer/index.html"/>Login</a></div> +</div> + + + + diff --git a/src/main/resources/META-INF/resources/designer/lib/angular-md5.js b/src/main/resources/META-INF/resources/designer/lib/angular-md5.js new file mode 100644 index 00000000..7896bb42 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/lib/angular-md5.js @@ -0,0 +1,208 @@ +/* + angular-md5 - v0.1.8 + 2015-11-17 +*/ + +/* commonjs package manager support (eg componentjs) */ +if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports) { + module.exports = "angular-md5"; +} +(function(angular) { + angular.module("angular-md5", [ "gdi2290.md5" ]); + angular.module("ngMd5", [ "gdi2290.md5" ]); + angular.module("gdi2290.md5", [ "gdi2290.gravatar-filter", "gdi2290.md5-service", "gdi2290.md5-filter" ]); + "use strict"; + angular.module("gdi2290.gravatar-filter", []).filter("gravatar", [ "md5", function(md5) { + var cache = {}; + return function(text, defaultText) { + if (!cache[text]) { + defaultText = defaultText ? md5.createHash(defaultText.toString().toLowerCase()) : ""; + cache[text] = text ? md5.createHash(text.toString().toLowerCase()) : defaultText; + } + return cache[text]; + }; + } ]); + "use strict"; + angular.module("gdi2290.md5-filter", []).filter("md5", [ "md5", function(md5) { + return function(text) { + return text ? md5.createHash(text.toString().toLowerCase()) : text; + }; + } ]); + "use strict"; + angular.module("gdi2290.md5-service", []).factory("md5", [ function() { + var md5 = { + createHash: function(str) { + if (null === str) { + return null; + } + var xl; + var rotateLeft = function(lValue, iShiftBits) { + return lValue << iShiftBits | lValue >>> 32 - iShiftBits; + }; + var addUnsigned = function(lX, lY) { + var lX4, lY4, lX8, lY8, lResult; + lX8 = lX & 2147483648; + lY8 = lY & 2147483648; + lX4 = lX & 1073741824; + lY4 = lY & 1073741824; + lResult = (lX & 1073741823) + (lY & 1073741823); + if (lX4 & lY4) { + return lResult ^ 2147483648 ^ lX8 ^ lY8; + } + if (lX4 | lY4) { + if (lResult & 1073741824) { + return lResult ^ 3221225472 ^ lX8 ^ lY8; + } else { + return lResult ^ 1073741824 ^ lX8 ^ lY8; + } + } else { + return lResult ^ lX8 ^ lY8; + } + }; + var _F = function(x, y, z) { + return x & y | ~x & z; + }; + var _G = function(x, y, z) { + return x & z | y & ~z; + }; + var _H = function(x, y, z) { + return x ^ y ^ z; + }; + var _I = function(x, y, z) { + return y ^ (x | ~z); + }; + var _FF = function(a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(_F(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); + }; + var _GG = function(a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(_G(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); + }; + var _HH = function(a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(_H(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); + }; + var _II = function(a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(_I(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); + }; + var convertToWordArray = function(str) { + var lWordCount; + var lMessageLength = str.length; + var lNumberOfWords_temp1 = lMessageLength + 8; + var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - lNumberOfWords_temp1 % 64) / 64; + var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16; + var lWordArray = new Array(lNumberOfWords - 1); + var lBytePosition = 0; + var lByteCount = 0; + while (lByteCount < lMessageLength) { + lWordCount = (lByteCount - lByteCount % 4) / 4; + lBytePosition = lByteCount % 4 * 8; + lWordArray[lWordCount] = lWordArray[lWordCount] | str.charCodeAt(lByteCount) << lBytePosition; + lByteCount++; + } + lWordCount = (lByteCount - lByteCount % 4) / 4; + lBytePosition = lByteCount % 4 * 8; + lWordArray[lWordCount] = lWordArray[lWordCount] | 128 << lBytePosition; + lWordArray[lNumberOfWords - 2] = lMessageLength << 3; + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; + return lWordArray; + }; + var wordToHex = function(lValue) { + var wordToHexValue = "", wordToHexValue_temp = "", lByte, lCount; + for (lCount = 0; lCount <= 3; lCount++) { + lByte = lValue >>> lCount * 8 & 255; + wordToHexValue_temp = "0" + lByte.toString(16); + wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length - 2, 2); + } + return wordToHexValue; + }; + var x = [], k, AA, BB, CC, DD, a, b, c, d, S11 = 7, S12 = 12, S13 = 17, S14 = 22, S21 = 5, S22 = 9, S23 = 14, S24 = 20, S31 = 4, S32 = 11, S33 = 16, S34 = 23, S41 = 6, S42 = 10, S43 = 15, S44 = 21; + x = convertToWordArray(str); + a = 1732584193; + b = 4023233417; + c = 2562383102; + d = 271733878; + xl = x.length; + for (k = 0; k < xl; k += 16) { + AA = a; + BB = b; + CC = c; + DD = d; + a = _FF(a, b, c, d, x[k + 0], S11, 3614090360); + d = _FF(d, a, b, c, x[k + 1], S12, 3905402710); + c = _FF(c, d, a, b, x[k + 2], S13, 606105819); + b = _FF(b, c, d, a, x[k + 3], S14, 3250441966); + a = _FF(a, b, c, d, x[k + 4], S11, 4118548399); + d = _FF(d, a, b, c, x[k + 5], S12, 1200080426); + c = _FF(c, d, a, b, x[k + 6], S13, 2821735955); + b = _FF(b, c, d, a, x[k + 7], S14, 4249261313); + a = _FF(a, b, c, d, x[k + 8], S11, 1770035416); + d = _FF(d, a, b, c, x[k + 9], S12, 2336552879); + c = _FF(c, d, a, b, x[k + 10], S13, 4294925233); + b = _FF(b, c, d, a, x[k + 11], S14, 2304563134); + a = _FF(a, b, c, d, x[k + 12], S11, 1804603682); + d = _FF(d, a, b, c, x[k + 13], S12, 4254626195); + c = _FF(c, d, a, b, x[k + 14], S13, 2792965006); + b = _FF(b, c, d, a, x[k + 15], S14, 1236535329); + a = _GG(a, b, c, d, x[k + 1], S21, 4129170786); + d = _GG(d, a, b, c, x[k + 6], S22, 3225465664); + c = _GG(c, d, a, b, x[k + 11], S23, 643717713); + b = _GG(b, c, d, a, x[k + 0], S24, 3921069994); + a = _GG(a, b, c, d, x[k + 5], S21, 3593408605); + d = _GG(d, a, b, c, x[k + 10], S22, 38016083); + c = _GG(c, d, a, b, x[k + 15], S23, 3634488961); + b = _GG(b, c, d, a, x[k + 4], S24, 3889429448); + a = _GG(a, b, c, d, x[k + 9], S21, 568446438); + d = _GG(d, a, b, c, x[k + 14], S22, 3275163606); + c = _GG(c, d, a, b, x[k + 3], S23, 4107603335); + b = _GG(b, c, d, a, x[k + 8], S24, 1163531501); + a = _GG(a, b, c, d, x[k + 13], S21, 2850285829); + d = _GG(d, a, b, c, x[k + 2], S22, 4243563512); + c = _GG(c, d, a, b, x[k + 7], S23, 1735328473); + b = _GG(b, c, d, a, x[k + 12], S24, 2368359562); + a = _HH(a, b, c, d, x[k + 5], S31, 4294588738); + d = _HH(d, a, b, c, x[k + 8], S32, 2272392833); + c = _HH(c, d, a, b, x[k + 11], S33, 1839030562); + b = _HH(b, c, d, a, x[k + 14], S34, 4259657740); + a = _HH(a, b, c, d, x[k + 1], S31, 2763975236); + d = _HH(d, a, b, c, x[k + 4], S32, 1272893353); + c = _HH(c, d, a, b, x[k + 7], S33, 4139469664); + b = _HH(b, c, d, a, x[k + 10], S34, 3200236656); + a = _HH(a, b, c, d, x[k + 13], S31, 681279174); + d = _HH(d, a, b, c, x[k + 0], S32, 3936430074); + c = _HH(c, d, a, b, x[k + 3], S33, 3572445317); + b = _HH(b, c, d, a, x[k + 6], S34, 76029189); + a = _HH(a, b, c, d, x[k + 9], S31, 3654602809); + d = _HH(d, a, b, c, x[k + 12], S32, 3873151461); + c = _HH(c, d, a, b, x[k + 15], S33, 530742520); + b = _HH(b, c, d, a, x[k + 2], S34, 3299628645); + a = _II(a, b, c, d, x[k + 0], S41, 4096336452); + d = _II(d, a, b, c, x[k + 7], S42, 1126891415); + c = _II(c, d, a, b, x[k + 14], S43, 2878612391); + b = _II(b, c, d, a, x[k + 5], S44, 4237533241); + a = _II(a, b, c, d, x[k + 12], S41, 1700485571); + d = _II(d, a, b, c, x[k + 3], S42, 2399980690); + c = _II(c, d, a, b, x[k + 10], S43, 4293915773); + b = _II(b, c, d, a, x[k + 1], S44, 2240044497); + a = _II(a, b, c, d, x[k + 8], S41, 1873313359); + d = _II(d, a, b, c, x[k + 15], S42, 4264355552); + c = _II(c, d, a, b, x[k + 6], S43, 2734768916); + b = _II(b, c, d, a, x[k + 13], S44, 1309151649); + a = _II(a, b, c, d, x[k + 4], S41, 4149444226); + d = _II(d, a, b, c, x[k + 11], S42, 3174756917); + c = _II(c, d, a, b, x[k + 2], S43, 718787259); + b = _II(b, c, d, a, x[k + 9], S44, 3951481745); + a = addUnsigned(a, AA); + b = addUnsigned(b, BB); + c = addUnsigned(c, CC); + d = addUnsigned(d, DD); + } + var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); + return temp.toLowerCase(); + } + }; + return md5; + } ]); +})(angular);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/logout.html b/src/main/resources/META-INF/resources/designer/logout.html new file mode 100644 index 00000000..fa1df329 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/logout.html @@ -0,0 +1,40 @@ +<!-- + ============LICENSE_START======================================================= + ONAP CLAMP + ================================================================================ + 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============================================ + =================================================================== + ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> +<style> +.divRow { + margin-left: 5px; + font-size: 13px; + font-weight: normal; + margin-top:10px; +} +</style> + +<head> + <title>CLDS</title> +</head> +<div ng-controller="AuthenticateCtrl" ng-init="logout()"> + <div id='main'> + <div class="divRow"><b>You have been Logged Out successfully!</b></div> + <div class="divRow">To login again, please click <a href="/designer/index.html"/>Login</a></div> + </div> +</div> diff --git a/src/main/resources/META-INF/resources/designer/menu_simplified.html b/src/main/resources/META-INF/resources/designer/menu_simplified.html new file mode 100644 index 00000000..0bee1601 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/menu_simplified.html @@ -0,0 +1,54 @@ +<!-- + ============LICENSE_START======================================================= + ONAP CLAMP + ================================================================================ + 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============================================ + =================================================================== + ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> + +<style> +.navbar-custom { + background-color: #229922; + color: #ffffff; + border-radius: 0; +} + +.logo { + font-family: 'Trebuchet MS', cursive; + font-size: 20px; + font-weight: 500; + text-align: center; +} +</style> + +<nav attribute-test="menu" class="navbar navbar-default navbar-fixed-top" role="navigation" + style="margin-left: 2px; margin-right: 2px;"> + + <div attribute-test="menuc" class="container-fluid"> + + <div class="col-md-4 col-lg-4"> + <img class="onap_logo" src="images/logo_onap_2017.png" height="50px" + width="234px" style="display: inline-block; float: left"> + <div class="navbar-brand logo" ng-href="" + style="display: inline-block; float: left"> + <b>Closed Loop Definition</b> + </div> + </div> + + </div> +</nav> diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/extra_user_info.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/extra_user_info.html new file mode 100644 index 00000000..7fc04316 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/extra_user_info.html @@ -0,0 +1,49 @@ +<!-- + ============LICENSE_START======================================================= + ONAP CLAMP + ================================================================================ + 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============================================ + =================================================================== + ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> + +<div attribute-test="extrauserinfo" id="configure-widgets"> + <div attribute-test="extrauserinfoh" class="modal-header"> + <button type="button" class="close" ng-click="close(false)" aria-hidden="true" style="margin-top: -3px">×</button> + <h4>User Info</h4> + </div> + <div attribute-test="extrauserinfot" class="modal-body" style="text-align:center;"> + <div> + <b style="font-size:14px;">Current User</b>: {{userInfo["userName"]}} + </div> + <div> + <b style="font-size:14px;">CLDS Version</b>: {{userInfo["cldsVersion"]}} + </div> + <br> + <div> + <b style="font-size:14px;">User Permissions:</b> + <div ng-if="userInfo['permissionReadTemplate']">Read Template</div> + <div ng-if="userInfo['permissionUpdateTemplate']">Edit Template</div> + <div ng-if="userInfo['permissionReadCl']">Read Model</div> + <div ng-if="userInfo['permissionUpdateCl']">Edit Model</div> + </div> + </div> + <div attribute-test="extrauserinfof" class="modal-footer"> + <!-- <button ng-click="Ok()" class="btn btn-primary">Save Changes</button> --> + <button ng-click="close(true)" class="btn btn-primary">Close</button> + </div> +</div>
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/please_wait.html b/src/main/resources/META-INF/resources/designer/please_wait.html new file mode 100644 index 00000000..8068e4cf --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/please_wait.html @@ -0,0 +1,28 @@ +<!-- + ============LICENSE_START======================================================= + ONAP CLAMP + ================================================================================ + 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============================================ + =================================================================== + ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> + + +<div attribute-test="pleasewait"> + <h1>Please Wait.....{{urlparam}}</h1> + +</div> diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoCtrl.js new file mode 100644 index 00000000..f269b413 --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoCtrl.js @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +app.controller('ExtraUserInfoCtrl', + ['$scope', '$rootScope', '$modalInstance','extraUserInfoService', '$location', 'dialogs', + function($scope, $rootScope, $modalInstance, extraUserInfoService, $location, dialogs) { + //console.log("///////////ExtraUserInfoCtrl"); + + extraUserInfoService.getUserInfo().then(function(pars){ + $scope.userInfo = pars; + }); + + $scope.close = function() { + $modalInstance.close("closed"); + }; + } +]);
\ No newline at end of file diff --git a/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoService.js b/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoService.js new file mode 100644 index 00000000..25dc37bd --- /dev/null +++ b/src/main/resources/META-INF/resources/designer/scripts/ExtraUserInfoService.js @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +app.service('extraUserInfoService', ['$http', '$q', function($http, $q){ + //console.log("///////////extraUserInfoService"); + + this.getUserInfo = function(){ + var def = $q.defer(); + + var svcUrl = "/restservices/clds/v1/clds/cldsInfo"; + + $http.get(svcUrl) + .success(function(data){ + def.resolve(data); + }) + .error(function(data){ + def.reject("Retrieving User Info unsuccessful"); + }); + + return def.promise; + }; +}]);
\ No newline at end of file diff --git a/src/main/resources/policyLogger.properties b/src/main/resources/policyLogger.properties new file mode 100644 index 00000000..2f1358bd --- /dev/null +++ b/src/main/resources/policyLogger.properties @@ -0,0 +1,47 @@ +### +# ============LICENSE_START======================================================= +# ONAP CLAMP +# ================================================================================ +# 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============================================ +# =================================================================== +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +### + +################################### Set concurrentHashMap and timer info ####################### +#Timer initial delay and the delay between in milliseconds before task is to be execute. +timer.delay.time=1000 +#Timer scheduleAtFixedRate period - time in milliseconds between successive task executions. +check.interval= 30000 +#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds. +event.expired.time=86400 +#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed +#to remove all expired records from this concurrentHashMap. +concurrentHashMap.limit=5000 +#Size of the concurrentHashMap - when its size drops to this point, stop the Timer +stop.check.point=2500 +################################### Set logging format ############################################# +# set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println +logger.type=EELF +#################################### Set level for EELF or SYSTEMOUT logging ################################## +# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all +debugLogger.level=INFO +# Set level for metrics file. Set OFF to disable; set ON to enable +metricsLogger.level=ON +# Set level for error file. Set OFF to disable; set ON to enable +error.level=ON +# Set level for audit file. Set OFF to disable; set ON to enable +audit.level=ON
\ No newline at end of file |